aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
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
parentUpdate svn properties, minor formatting cleanup, fix a compiler warning. (diff)
downloadopensim-SC_OLD-5164fa24110b0197c2d18dc824351d384b1b8582.zip
opensim-SC_OLD-5164fa24110b0197c2d18dc824351d384b1b8582.tar.gz
opensim-SC_OLD-5164fa24110b0197c2d18dc824351d384b1b8582.tar.bz2
opensim-SC_OLD-5164fa24110b0197c2d18dc824351d384b1b8582.tar.xz
Mantis#2197. Thank you kindly, Tyre, for a patch that:
adds the new function osTeleportAgent().
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs14
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs30
-rw-r--r--OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs4
-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
8 files changed, 114 insertions, 4 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs b/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs
index 1b7cc48..cfc8e94 100644
--- a/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs
+++ b/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs
@@ -37,7 +37,7 @@ using rotation = OpenSim.Region.ScriptEngine.Common.LSL_Types.Quaternion;
37 37
38namespace OpenSim.Region.ScriptEngine.Common 38namespace OpenSim.Region.ScriptEngine.Common
39{ 39{
40 public class BuiltIn_Commands_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, IScript 40 public class BuiltIn_Commands_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, OSSL_BuilIn_Commands_Interface, IScript
41 { 41 {
42 // 42 //
43 // Included as base for any LSL-script that is compiled. 43 // Included as base for any LSL-script that is compiled.
@@ -1942,6 +1942,18 @@ namespace OpenSim.Region.ScriptEngine.Common
1942 m_LSL_Functions.osSetPrimFloatOnWater(floatYN); 1942 m_LSL_Functions.osSetPrimFloatOnWater(floatYN);
1943 } 1943 }
1944 1944
1945 // Teleport Functions
1946
1947 public void osTeleportAgent(string agent, string regionName, vector position, vector lookat)
1948 {
1949 m_LSL_Functions.osTeleportAgent(agent, regionName, position, lookat);
1950 }
1951
1952 public void osTeleportAgent(string agent, vector position, vector lookat)
1953 {
1954 m_LSL_Functions.osTeleportAgent(agent, position, lookat);
1955 }
1956
1945 // Animation Functions 1957 // Animation Functions
1946 1958
1947 public void osAvatarPlayAnimation(string avatar, string animation) 1959 public void osAvatarPlayAnimation(string avatar, string animation)
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index 39502b6..5d6cd37 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -88,7 +88,7 @@ namespace OpenSim.Region.ScriptEngine.Common
88 private float m_distanceFactor = 1.0f; 88 private float m_distanceFactor = 1.0f;
89 89
90 90
91 private void ScriptSleep(int delay) 91 protected void ScriptSleep(int delay)
92 { 92 {
93 delay = (int)((float)delay * m_delayFactor); 93 delay = (int)((float)delay * m_delayFactor);
94 if (delay == 0) 94 if (delay == 0)
diff --git a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs
index c6ded79..264a586 100644
--- a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs
@@ -32,7 +32,7 @@ using OpenSim.Framework.Console;
32using OpenSim.Region.Environment.Interfaces; 32using OpenSim.Region.Environment.Interfaces;
33using OpenSim.Region.Environment.Scenes; 33using OpenSim.Region.Environment.Scenes;
34using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; 34using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase;
35 35using TPFlags = OpenSim.Framework.Constants.TeleportFlags;
36//using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; 36//using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL;
37 37
38namespace OpenSim.Region.ScriptEngine.Common 38namespace OpenSim.Region.ScriptEngine.Common
@@ -436,6 +436,34 @@ namespace OpenSim.Region.ScriptEngine.Common
436 } 436 }
437 } 437 }
438 438
439 // Teleport functions
440 public void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
441 {
442 m_host.AddScriptLPS(1);
443 UUID agentId = new UUID();
444 if (UUID.TryParse(agent, out agentId))
445 {
446 ScenePresence presence = World.GetScenePresence(agentId);
447 if (presence != null)
448 {
449 // agent must be over owners land to avoid abuse
450 if (m_host.OwnerID == World.GetLandOwner(presence.AbsolutePosition.X, presence.AbsolutePosition.Y))
451 {
452 World.RequestTeleportLocation(presence.ControllingClient, regionName,
453 new Vector3((float)position.x, (float)position.y, (float)position.z),
454 new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation);
455 // ScriptSleep(5000);
456
457 }
458 }
459 }
460 }
461
462 public void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
463 {
464 osTeleportAgent(agent, World.RegionInfo.RegionName, position, lookat);
465 }
466
439 // Adam's super super custom animation functions 467 // Adam's super super custom animation functions
440 public void osAvatarPlayAnimation(string avatar, string animation) 468 public void osAvatarPlayAnimation(string avatar, string animation)
441 { 469 {
diff --git a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs
index 7daef7d..9c1587d 100644
--- a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs
+++ b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs
@@ -44,6 +44,10 @@ namespace OpenSim.Region.ScriptEngine.Common
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/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)