aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared
diff options
context:
space:
mode:
authorCharles Krinke2008-09-15 14:32:02 +0000
committerCharles Krinke2008-09-15 14:32:02 +0000
commit5164fa24110b0197c2d18dc824351d384b1b8582 (patch)
treec6180377754fb75e812a65bf0cb224e37e107273 /OpenSim/Region/ScriptEngine/Shared
parentUpdate svn properties, minor formatting cleanup, fix a compiler warning. (diff)
downloadopensim-SC-5164fa24110b0197c2d18dc824351d384b1b8582.zip
opensim-SC-5164fa24110b0197c2d18dc824351d384b1b8582.tar.gz
opensim-SC-5164fa24110b0197c2d18dc824351d384b1b8582.tar.bz2
opensim-SC-5164fa24110b0197c2d18dc824351d384b1b8582.tar.xz
Mantis#2197. Thank you kindly, Tyre, for a patch that:
adds the new function osTeleportAgent().
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs50
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs12
4 files changed, 67 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 00f843f..a5ff42d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -87,7 +87,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
87 AsyncCommands = (AsyncCommandManager)ScriptEngine.AsyncCommands; 87 AsyncCommands = (AsyncCommandManager)ScriptEngine.AsyncCommands;
88 } 88 }
89 89
90 private void ScriptSleep(int delay) 90 protected void ScriptSleep(int delay)
91 { 91 {
92 delay = (int)((float)delay * m_ScriptDelayFactor); 92 delay = (int)((float)delay * m_ScriptDelayFactor);
93 if (delay == 0) 93 if (delay == 0)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 5d69673..5293a26 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -36,6 +36,7 @@ using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
36using OpenSim.Region.ScriptEngine.Shared.ScriptBase; 36using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
37using OpenSim.Region.ScriptEngine.Interfaces; 37using OpenSim.Region.ScriptEngine.Interfaces;
38using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; 38using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
39using TPFlags = OpenSim.Framework.Constants.TeleportFlags;
39 40
40namespace OpenSim.Region.ScriptEngine.Shared.Api 41namespace OpenSim.Region.ScriptEngine.Shared.Api
41{ 42{
@@ -46,6 +47,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
46 internal SceneObjectPart m_host; 47 internal SceneObjectPart m_host;
47 internal uint m_localID; 48 internal uint m_localID;
48 internal UUID m_itemID; 49 internal UUID m_itemID;
50 internal AsyncCommandManager AsyncCommands = null;
51 internal float m_ScriptDelayFactor = 1.0f;
52 internal float m_ScriptDistanceFactor = 1.0f;
49 53
50 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) 54 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
51 { 55 {
@@ -53,6 +57,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
53 m_host = host; 57 m_host = host;
54 m_localID = localID; 58 m_localID = localID;
55 m_itemID = itemID; 59 m_itemID = itemID;
60
61 IConfigSource config = new IniConfigSource(Application.iniFilePath);
62 if (config.Configs["XEngine"] == null)
63 config.AddConfig("XEngine");
64
65 m_ScriptDelayFactor = config.Configs["XEngine"].
66 GetFloat("ScriptDelayFactor", 1.0f);
67 m_ScriptDistanceFactor = config.Configs["XEngine"].
68 GetFloat("ScriptDistanceLimitFactor", 1.0f);
69
70 AsyncCommands = (AsyncCommandManager)ScriptEngine.AsyncCommands;
56 } 71 }
57 72
58 // 73 //
@@ -69,6 +84,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
69 return lease; 84 return lease;
70 } 85 }
71 86
87 protected void ScriptSleep(int delay)
88 {
89 delay = (int)((float)delay * m_ScriptDelayFactor);
90 if (delay == 0)
91 return;
92 System.Threading.Thread.Sleep(delay);
93 }
94
72 // 95 //
73 // OpenSim functions 96 // OpenSim functions
74 // 97 //
@@ -312,6 +335,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
312 } 335 }
313 } 336 }
314 337
338 // Teleport functions
339 public void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
340 {
341 m_host.AddScriptLPS(1);
342 UUID agentId = new UUID();
343 if (UUID.TryParse(agent, out agentId))
344 {
345 ScenePresence presence = World.GetScenePresence(agentId);
346 if (presence != null)
347 {
348 // agent must be over owners land to avoid abuse
349 if (m_host.OwnerID == World.GetLandOwner(presence.AbsolutePosition.X, presence.AbsolutePosition.Y))
350 {
351 World.RequestTeleportLocation(presence.ControllingClient, regionName,
352 new Vector3((float)position.x, (float)position.y, (float)position.z),
353 new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation);
354 // ScriptSleep(5000);
355 }
356 }
357 }
358 }
359
360 public void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
361 {
362 osTeleportAgent(agent, World.RegionInfo.RegionName, position, lookat);
363 }
364
315 // Adam's super super custom animation functions 365 // Adam's super super custom animation functions
316 public void osAvatarPlayAnimation(string avatar, string animation) 366 public void osAvatarPlayAnimation(string avatar, string animation)
317 { 367 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 87b3ef4..d4bb8c3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -44,6 +44,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
44 void osSetParcelMediaURL(string url); 44 void osSetParcelMediaURL(string url);
45 void osSetPrimFloatOnWater(int floatYN); 45 void osSetPrimFloatOnWater(int floatYN);
46 46
47 // Teleport commands
48 void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
49 void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
50
47 // Animation commands 51 // Animation commands
48 void osAvatarPlayAnimation(string avatar, string animation); 52 void osAvatarPlayAnimation(string avatar, string animation);
49 void osAvatarStopAnimation(string avatar, string animation); 53 void osAvatarStopAnimation(string avatar, string animation);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 9d0c337..3a7c14e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -122,6 +122,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
122 m_OSSL_Functions.osSetPrimFloatOnWater(floatYN); 122 m_OSSL_Functions.osSetPrimFloatOnWater(floatYN);
123 } 123 }
124 124
125 // Teleport Functions
126
127 public void osTeleportAgent(string agent, string regionName, vector position, vector lookat)
128 {
129 m_OSSL_Functions.osTeleportAgent(agent, regionName, position, lookat);
130 }
131
132 public void osTeleportAgent(string agent, vector position, vector lookat)
133 {
134 m_OSSL_Functions.osTeleportAgent(agent, position, lookat);
135 }
136
125 // Animation Functions 137 // Animation Functions
126 138
127 public void osAvatarPlayAnimation(string avatar, string animation) 139 public void osAvatarPlayAnimation(string avatar, string animation)