diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 50 |
2 files changed, 51 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; | |||
36 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | 36 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; |
37 | using OpenSim.Region.ScriptEngine.Interfaces; | 37 | using OpenSim.Region.ScriptEngine.Interfaces; |
38 | using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; | 38 | using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; |
39 | using TPFlags = OpenSim.Framework.Constants.TeleportFlags; | ||
39 | 40 | ||
40 | namespace OpenSim.Region.ScriptEngine.Shared.Api | 41 | namespace 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 | { |