From c084c54fb557ca6b35f22ec544fc42aa4ada8f21 Mon Sep 17 00:00:00 2001 From: Tedd Hansen Date: Sun, 30 Dec 2007 19:08:22 +0000 Subject: Added ScriptEngine.RemoteServer module --- OpenSim/Region/ScriptEngine/RemoteServer/Common.cs | 57 ++++++ .../ScriptEngine/RemoteServer/EventManager.cs | 226 +++++++++++++++++++++ .../RemoteServer/Properties/AssemblyInfo.cs | 38 ++++ .../ScriptEngine/RemoteServer/ScriptEngine.cs | 103 ++++++++++ 4 files changed, 424 insertions(+) create mode 100644 OpenSim/Region/ScriptEngine/RemoteServer/Common.cs create mode 100644 OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs create mode 100644 OpenSim/Region/ScriptEngine/RemoteServer/Properties/AssemblyInfo.cs create mode 100644 OpenSim/Region/ScriptEngine/RemoteServer/ScriptEngine.cs (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/RemoteServer/Common.cs b/OpenSim/Region/ScriptEngine/RemoteServer/Common.cs new file mode 100644 index 0000000..906c157 --- /dev/null +++ b/OpenSim/Region/ScriptEngine/RemoteServer/Common.cs @@ -0,0 +1,57 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +/* Original code: Tedd Hansen */ +namespace OpenSim.Region.ScriptEngine.RemoteServer +{ + public static class Common + { + public static bool debug = true; + public static ScriptEngine mySE; + + // This class just contains some static log stuff used for debugging. + + //public delegate void SendToDebugEventDelegate(string Message); + //public delegate void SendToLogEventDelegate(string Message); + //static public event SendToDebugEventDelegate SendToDebugEvent; + //static public event SendToLogEventDelegate SendToLogEvent; + + public static void SendToDebug(string Message) + { + //if (Debug == true) + mySE.Log.Verbose("ScriptEngine", "Debug: " + Message); + //SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); + } + + public static void SendToLog(string Message) + { + //if (Debug == true) + mySE.Log.Verbose("ScriptEngine", "LOG: " + Message); + //SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs b/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs new file mode 100644 index 0000000..b4ac615 --- /dev/null +++ b/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs @@ -0,0 +1,226 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +/* Original code: Tedd Hansen */ +using System; +using libsecondlife; +using OpenSim.Framework; + +namespace OpenSim.Region.ScriptEngine.RemoteServer +{ + /// + /// + [Serializable] + internal class EventManager + { + + System.Collections.Generic.Dictionary remoteScript = new System.Collections.Generic.Dictionary(); + + + private ScriptEngine myScriptEngine; + public EventManager(ScriptEngine _ScriptEngine) + { + myScriptEngine = _ScriptEngine; + + myScriptEngine.Log.Verbose("RemoteEngine", "Hooking up to server events"); + myScriptEngine.World.EventManager.OnObjectGrab += touch_start; + myScriptEngine.World.EventManager.OnRezScript += OnRezScript; + myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; + } + + public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) + { + remoteScript[localID].touch_start(localID, offsetPos, remoteClient); + } + + public void OnRezScript(uint localID, LLUUID itemID, string script) + { + remoteScript[localID].OnRezScript(localID, itemID, script); + } + + public void OnRemoveScript(uint localID, LLUUID itemID) + { + remoteScript[localID].OnRemoveScript(localID, itemID); + } + + public void state_exit(uint localID, LLUUID itemID) + { + remoteScript[localID].state_exit(localID, itemID); + } + + public void touch(uint localID, LLUUID itemID) + { + remoteScript[localID].touch(localID, itemID); + } + + public void touch_end(uint localID, LLUUID itemID) + { + remoteScript[localID].touch_end(localID, itemID); + } + + public void collision_start(uint localID, LLUUID itemID) + { + remoteScript[localID].collision_start(localID, itemID); + } + + public void collision(uint localID, LLUUID itemID) + { + remoteScript[localID].collision(localID, itemID); + } + + public void collision_end(uint localID, LLUUID itemID) + { + remoteScript[localID].collision_end(localID, itemID); + } + + public void land_collision_start(uint localID, LLUUID itemID) + { + remoteScript[localID].land_collision_start(localID, itemID); + } + + public void land_collision(uint localID, LLUUID itemID) + { + remoteScript[localID].land_collision(localID, itemID); + } + + public void land_collision_end(uint localID, LLUUID itemID) + { + remoteScript[localID].land_collision_end(localID, itemID); + } + + public void timer(uint localID, LLUUID itemID) + { + remoteScript[localID].timer(localID, itemID); + } + + public void listen(uint localID, LLUUID itemID) + { + remoteScript[localID].listen(localID, itemID); + } + + public void on_rez(uint localID, LLUUID itemID) + { + remoteScript[localID].on_rez(localID, itemID); + } + + public void sensor(uint localID, LLUUID itemID) + { + remoteScript[localID].sensor(localID, itemID); + } + + public void no_sensor(uint localID, LLUUID itemID) + { + remoteScript[localID].no_sensor(localID, itemID); + } + + public void control(uint localID, LLUUID itemID) + { + remoteScript[localID].control(localID, itemID); + } + + public void money(uint localID, LLUUID itemID) + { + remoteScript[localID].money(localID, itemID); + } + + public void email(uint localID, LLUUID itemID) + { + remoteScript[localID].email(localID, itemID); + } + + public void at_target(uint localID, LLUUID itemID) + { + remoteScript[localID].at_target(localID, itemID); + } + + public void not_at_target(uint localID, LLUUID itemID) + { + remoteScript[localID].not_at_target(localID, itemID); + } + + public void at_rot_target(uint localID, LLUUID itemID) + { + remoteScript[localID].at_rot_target(localID, itemID); + } + + public void not_at_rot_target(uint localID, LLUUID itemID) + { + remoteScript[localID].not_at_rot_target(localID, itemID); + } + + public void run_time_permissions(uint localID, LLUUID itemID) + { + remoteScript[localID].run_time_permissions(localID, itemID); + } + + public void changed(uint localID, LLUUID itemID) + { + remoteScript[localID].changed(localID, itemID); + } + + public void attach(uint localID, LLUUID itemID) + { + remoteScript[localID].attach(localID, itemID); + } + + public void dataserver(uint localID, LLUUID itemID) + { + remoteScript[localID].dataserver(localID, itemID); + } + + public void link_message(uint localID, LLUUID itemID) + { + remoteScript[localID].link_message(localID, itemID); + } + + public void moving_start(uint localID, LLUUID itemID) + { + remoteScript[localID].moving_start(localID, itemID); + } + + public void moving_end(uint localID, LLUUID itemID) + { + remoteScript[localID].moving_end(localID, itemID); + } + + public void object_rez(uint localID, LLUUID itemID) + { + remoteScript[localID].object_rez(localID, itemID); + } + + public void remote_data(uint localID, LLUUID itemID) + { + remoteScript[localID].remote_data(localID, itemID); + } + + public void http_response(uint localID, LLUUID itemID) + { + remoteScript[localID].http_response(localID, itemID); + } + + } +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/RemoteServer/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/RemoteServer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..b013562 --- /dev/null +++ b/OpenSim/Region/ScriptEngine/RemoteServer/Properties/AssemblyInfo.cs @@ -0,0 +1,38 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. + +[assembly : AssemblyTitle("OpenSim.Region.ScriptEngine.RemoteServer")] +[assembly : AssemblyDescription("")] +[assembly : AssemblyConfiguration("")] +[assembly : AssemblyCompany("")] +[assembly : AssemblyProduct("OpenSim.Region.ScriptEngine.RemoteServer")] +[assembly : AssemblyCopyright("Copyright © 2007")] +[assembly : AssemblyTrademark("")] +[assembly : AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. + +[assembly : ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM + +[assembly : Guid("2842257e-6fde-4460-9368-4cde57fa9cc4")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: + +[assembly : AssemblyVersion("1.0.0.0")] +[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/RemoteServer/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/RemoteServer/ScriptEngine.cs new file mode 100644 index 0000000..ae29ad5 --- /dev/null +++ b/OpenSim/Region/ScriptEngine/RemoteServer/ScriptEngine.cs @@ -0,0 +1,103 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +/* Original code: Tedd Hansen */ +using System; +using Nini.Config; +using OpenSim.Framework.Console; +using OpenSim.Region.Environment.Interfaces; +using OpenSim.Region.Environment.Scenes; + +namespace OpenSim.Region.ScriptEngine.RemoteServer +{ + /// + /// This is the root object for ScriptEngine. Objects access each other trough this class. + /// + /// + [Serializable] + public class ScriptEngine : IRegionModule + { + internal Scene World; + internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim + + private LogBase m_log; + + public ScriptEngine() + { + Common.mySE = this; + } + + public LogBase Log + { + get { return m_log; } + } + + public void InitializeEngine(Scene Sceneworld, LogBase logger) + { + World = Sceneworld; + m_log = logger; + + Log.Verbose("ScriptEngine", "RemoteEngine (Remote Script Server) initializing"); + // Create all objects we'll be using + m_EventManager = new EventManager(this); + } + + public void Shutdown() + { + // We are shutting down + } + + + #region IRegionModule + + public void Initialise(Scene scene, IConfigSource config) + { + InitializeEngine(scene, MainLog.Instance); + } + + public void PostInitialise() + { + } + + public void Close() + { + } + + public string Name + { + get { return "LSLScriptingModule"; } + } + + public bool IsSharedModule + { + get { return false; } + } + + #endregion + + } +} \ No newline at end of file -- cgit v1.1