From 9fc72755ce137814d27edeb55e8c82c0124815ca Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Tue, 17 Jul 2007 23:14:19 +0000 Subject: * More LSL related fun --- .../Scenes/scripting/Engines/LSLEngine/LSLScript.cs | 4 +++- .../Scenes/scripting/Engines/LSLEngine/LSLScriptEngine.cs | 2 +- OpenSim/Region/Environment/Scenes/scripting/ScriptAPI.cs | 4 ++-- OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs | 7 ++++++- .../Environment/Scenes/scripting/ScriptInterpretedAPI.cs | 13 +++++++++++-- 5 files changed, 23 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLScript.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLScript.cs index 1d82cd2..4ee4d37 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLScript.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLScript.cs @@ -12,8 +12,10 @@ namespace OpenSim.Region.Scripting.LSL ScriptInfo scriptInfo; LSL.Engine lindenScriptEngine; - public LSLScript(string filename) + public LSLScript(string filename, libsecondlife.LLUUID taskObject) { + scriptInfo.CreateTaskAPI(taskObject); + lindenScriptEngine = new Engine(); lindenScriptEngine.Start(filename); } diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLScriptEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLScriptEngine.cs index 65f73dd..10706ad 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLScriptEngine.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLScriptEngine.cs @@ -16,7 +16,7 @@ namespace OpenSim.Region.Scripting public Dictionary compile(string filename) { - LSLScript script = new LSLScript(filename); + LSLScript script = new LSLScript(filename, libsecondlife.LLUUID.Zero); Dictionary returns = new Dictionary(); returns.Add(filename, script); diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptAPI.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptAPI.cs index b4f6a05..b3a804d 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/ScriptAPI.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptAPI.cs @@ -18,10 +18,10 @@ namespace OpenSim.Region.Scripting Scene scene; ScriptInterpretedAPI interpretedAPI; - public ScriptAPI(Scene world) + public ScriptAPI(Scene world, Key taskID) { scene = world; - interpretedAPI = new ScriptInterpretedAPI(); + interpretedAPI = new ScriptInterpretedAPI(world, taskID); } public Object CallMethod(String method, Object[] args) diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs index 4a6086c..35a6d9f 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs @@ -52,7 +52,12 @@ namespace OpenSim.Region.Scripting world = scene; events = world.EventManager; logger = MainLog.Instance; - api = new ScriptAPI(scene); + api = new ScriptAPI(world, libsecondlife.LLUUID.Zero); + } + + public void CreateTaskAPI(libsecondlife.LLUUID task) + { + api = new ScriptAPI(world, task); } } } diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedAPI.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedAPI.cs index 5153ed3..982cd65 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedAPI.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedAPI.cs @@ -51,7 +51,7 @@ namespace OpenSim.Region.Scripting /// The specific member being 'occupied' by the script public ScriptInterpretedAPI(Scene world, libsecondlife.LLUUID member) { - m_object = world; + m_scene = world; m_object = member; } @@ -76,7 +76,7 @@ namespace OpenSim.Region.Scripting int parcelID = 0; Vector myPosition = Task.Pos; - Land myParcel = World.LandManager.getLandObject(myPosition.X, myPosition.Y, myPosition.Z); + Land myParcel = World.LandManager.getLandObject(myPosition.X, myPosition.Y); OpenSim.Framework.Console.MainLog.Instance.Warn("Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)"); return; @@ -135,6 +135,15 @@ namespace OpenSim.Region.Scripting [Obsolete("Unimplemented")] public Key osAvatarOnSitTarget() { + //TODO: Follow this as Children is chanced to be of type entity to support ScenePresences + foreach (KeyValuePair Child in Task.Children) + { + if (Child.Value is ScenePresence) + { + return Child.Value.uuid; + } + } + return Key.Zero; } -- cgit v1.1