Mantis#2197. Thank you kindly, Tyre, for a patch that:
adds the new function osTeleportAgent().0.6.0-stable
parent
ab30c6dc62
commit
5164fa2411
|
@ -37,7 +37,7 @@ using rotation = OpenSim.Region.ScriptEngine.Common.LSL_Types.Quaternion;
|
|||
|
||||
namespace OpenSim.Region.ScriptEngine.Common
|
||||
{
|
||||
public class BuiltIn_Commands_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, IScript
|
||||
public class BuiltIn_Commands_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, OSSL_BuilIn_Commands_Interface, IScript
|
||||
{
|
||||
//
|
||||
// Included as base for any LSL-script that is compiled.
|
||||
|
@ -1942,6 +1942,18 @@ namespace OpenSim.Region.ScriptEngine.Common
|
|||
m_LSL_Functions.osSetPrimFloatOnWater(floatYN);
|
||||
}
|
||||
|
||||
// Teleport Functions
|
||||
|
||||
public void osTeleportAgent(string agent, string regionName, vector position, vector lookat)
|
||||
{
|
||||
m_LSL_Functions.osTeleportAgent(agent, regionName, position, lookat);
|
||||
}
|
||||
|
||||
public void osTeleportAgent(string agent, vector position, vector lookat)
|
||||
{
|
||||
m_LSL_Functions.osTeleportAgent(agent, position, lookat);
|
||||
}
|
||||
|
||||
// Animation Functions
|
||||
|
||||
public void osAvatarPlayAnimation(string avatar, string animation)
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace OpenSim.Region.ScriptEngine.Common
|
|||
private float m_distanceFactor = 1.0f;
|
||||
|
||||
|
||||
private void ScriptSleep(int delay)
|
||||
protected void ScriptSleep(int delay)
|
||||
{
|
||||
delay = (int)((float)delay * m_delayFactor);
|
||||
if (delay == 0)
|
||||
|
|
|
@ -32,7 +32,7 @@ using OpenSim.Framework.Console;
|
|||
using OpenSim.Region.Environment.Interfaces;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase;
|
||||
|
||||
using TPFlags = OpenSim.Framework.Constants.TeleportFlags;
|
||||
//using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.Common
|
||||
|
@ -436,6 +436,34 @@ namespace OpenSim.Region.ScriptEngine.Common
|
|||
}
|
||||
}
|
||||
|
||||
// Teleport functions
|
||||
public void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
UUID agentId = new UUID();
|
||||
if (UUID.TryParse(agent, out agentId))
|
||||
{
|
||||
ScenePresence presence = World.GetScenePresence(agentId);
|
||||
if (presence != null)
|
||||
{
|
||||
// agent must be over owners land to avoid abuse
|
||||
if (m_host.OwnerID == World.GetLandOwner(presence.AbsolutePosition.X, presence.AbsolutePosition.Y))
|
||||
{
|
||||
World.RequestTeleportLocation(presence.ControllingClient, regionName,
|
||||
new Vector3((float)position.x, (float)position.y, (float)position.z),
|
||||
new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation);
|
||||
// ScriptSleep(5000);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
|
||||
{
|
||||
osTeleportAgent(agent, World.RegionInfo.RegionName, position, lookat);
|
||||
}
|
||||
|
||||
// Adam's super super custom animation functions
|
||||
public void osAvatarPlayAnimation(string avatar, string animation)
|
||||
{
|
||||
|
|
|
@ -44,6 +44,10 @@ namespace OpenSim.Region.ScriptEngine.Common
|
|||
void osSetParcelMediaURL(string url);
|
||||
void osSetPrimFloatOnWater(int floatYN);
|
||||
|
||||
// Teleport commands
|
||||
void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
|
||||
void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
|
||||
|
||||
// Animation commands
|
||||
void osAvatarPlayAnimation(string avatar, string animation);
|
||||
void osAvatarStopAnimation(string avatar, string animation);
|
||||
|
|
|
@ -87,7 +87,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
AsyncCommands = (AsyncCommandManager)ScriptEngine.AsyncCommands;
|
||||
}
|
||||
|
||||
private void ScriptSleep(int delay)
|
||||
protected void ScriptSleep(int delay)
|
||||
{
|
||||
delay = (int)((float)delay * m_ScriptDelayFactor);
|
||||
if (delay == 0)
|
||||
|
|
|
@ -36,6 +36,7 @@ using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
|
|||
using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
|
||||
using OpenSim.Region.ScriptEngine.Interfaces;
|
||||
using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
|
||||
using TPFlags = OpenSim.Framework.Constants.TeleportFlags;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
|
@ -46,6 +47,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
internal SceneObjectPart m_host;
|
||||
internal uint m_localID;
|
||||
internal UUID m_itemID;
|
||||
internal AsyncCommandManager AsyncCommands = null;
|
||||
internal float m_ScriptDelayFactor = 1.0f;
|
||||
internal float m_ScriptDistanceFactor = 1.0f;
|
||||
|
||||
public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
|
||||
{
|
||||
|
@ -53,6 +57,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
m_host = host;
|
||||
m_localID = localID;
|
||||
m_itemID = itemID;
|
||||
|
||||
IConfigSource config = new IniConfigSource(Application.iniFilePath);
|
||||
if (config.Configs["XEngine"] == null)
|
||||
config.AddConfig("XEngine");
|
||||
|
||||
m_ScriptDelayFactor = config.Configs["XEngine"].
|
||||
GetFloat("ScriptDelayFactor", 1.0f);
|
||||
m_ScriptDistanceFactor = config.Configs["XEngine"].
|
||||
GetFloat("ScriptDistanceLimitFactor", 1.0f);
|
||||
|
||||
AsyncCommands = (AsyncCommandManager)ScriptEngine.AsyncCommands;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -69,6 +84,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
return lease;
|
||||
}
|
||||
|
||||
protected void ScriptSleep(int delay)
|
||||
{
|
||||
delay = (int)((float)delay * m_ScriptDelayFactor);
|
||||
if (delay == 0)
|
||||
return;
|
||||
System.Threading.Thread.Sleep(delay);
|
||||
}
|
||||
|
||||
//
|
||||
// OpenSim functions
|
||||
//
|
||||
|
@ -312,6 +335,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
}
|
||||
}
|
||||
|
||||
// Teleport functions
|
||||
public void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
UUID agentId = new UUID();
|
||||
if (UUID.TryParse(agent, out agentId))
|
||||
{
|
||||
ScenePresence presence = World.GetScenePresence(agentId);
|
||||
if (presence != null)
|
||||
{
|
||||
// agent must be over owners land to avoid abuse
|
||||
if (m_host.OwnerID == World.GetLandOwner(presence.AbsolutePosition.X, presence.AbsolutePosition.Y))
|
||||
{
|
||||
World.RequestTeleportLocation(presence.ControllingClient, regionName,
|
||||
new Vector3((float)position.x, (float)position.y, (float)position.z),
|
||||
new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation);
|
||||
// ScriptSleep(5000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
|
||||
{
|
||||
osTeleportAgent(agent, World.RegionInfo.RegionName, position, lookat);
|
||||
}
|
||||
|
||||
// Adam's super super custom animation functions
|
||||
public void osAvatarPlayAnimation(string avatar, string animation)
|
||||
{
|
||||
|
|
|
@ -44,6 +44,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
|||
void osSetParcelMediaURL(string url);
|
||||
void osSetPrimFloatOnWater(int floatYN);
|
||||
|
||||
// Teleport commands
|
||||
void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
|
||||
void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
|
||||
|
||||
// Animation commands
|
||||
void osAvatarPlayAnimation(string avatar, string animation);
|
||||
void osAvatarStopAnimation(string avatar, string animation);
|
||||
|
|
|
@ -122,6 +122,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
|||
m_OSSL_Functions.osSetPrimFloatOnWater(floatYN);
|
||||
}
|
||||
|
||||
// Teleport Functions
|
||||
|
||||
public void osTeleportAgent(string agent, string regionName, vector position, vector lookat)
|
||||
{
|
||||
m_OSSL_Functions.osTeleportAgent(agent, regionName, position, lookat);
|
||||
}
|
||||
|
||||
public void osTeleportAgent(string agent, vector position, vector lookat)
|
||||
{
|
||||
m_OSSL_Functions.osTeleportAgent(agent, position, lookat);
|
||||
}
|
||||
|
||||
// Animation Functions
|
||||
|
||||
public void osAvatarPlayAnimation(string avatar, string animation)
|
||||
|
|
Loading…
Reference in New Issue