diff options
author | Tedd Hansen | 2007-10-05 19:56:44 +0000 |
---|---|---|
committer | Tedd Hansen | 2007-10-05 19:56:44 +0000 |
commit | 6dd923b01d6864ffcb17030c9de17224f45b4c2a (patch) | |
tree | 83d00d90a13f6803b38988049096296caf9f4c17 /OpenSim/Grid/ScriptEngine/DotNetEngine/EventManager.cs | |
parent | Code from Illumious Beltran (IBM) implementing more LSL (diff) | |
download | opensim-SC-6dd923b01d6864ffcb17030c9de17224f45b4c2a.zip opensim-SC-6dd923b01d6864ffcb17030c9de17224f45b4c2a.tar.gz opensim-SC-6dd923b01d6864ffcb17030c9de17224f45b4c2a.tar.bz2 opensim-SC-6dd923b01d6864ffcb17030c9de17224f45b4c2a.tar.xz |
Some more work on new ScriptEngine.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Grid/ScriptEngine/DotNetEngine/EventManager.cs | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/EventManager.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/EventManager.cs new file mode 100644 index 0000000..9f18f7c --- /dev/null +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/EventManager.cs | |||
@@ -0,0 +1,131 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | /* Original code: Tedd Hansen */ | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using libsecondlife; | ||
33 | using OpenSim.Framework.Interfaces; | ||
34 | using OpenSim.Region.Environment.Scenes.Scripting; | ||
35 | |||
36 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine | ||
37 | { | ||
38 | /// <summary> | ||
39 | /// Prepares events so they can be directly executed upon a script by EventQueueManager, then queues it. | ||
40 | /// </summary> | ||
41 | [Serializable] | ||
42 | class EventManager | ||
43 | { | ||
44 | private ScriptEngine myScriptEngine; | ||
45 | //public IScriptHost TEMP_OBJECT_ID; | ||
46 | public EventManager(ScriptEngine _ScriptEngine) | ||
47 | { | ||
48 | myScriptEngine = _ScriptEngine; | ||
49 | // TODO: HOOK EVENTS UP TO SERVER! | ||
50 | //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Start"); | ||
51 | // TODO: ADD SERVER HOOK TO LOAD A SCRIPT THROUGH myScriptEngine.ScriptManager | ||
52 | |||
53 | // Hook up a test event to our test form | ||
54 | myScriptEngine.Log.Verbose("ScriptEngine", "Hooking up to server events"); | ||
55 | myScriptEngine.World.EventManager.OnObjectGrab += touch_start; | ||
56 | myScriptEngine.World.EventManager.OnRezScript += OnRezScript; | ||
57 | myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; | ||
58 | |||
59 | } | ||
60 | |||
61 | public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) | ||
62 | { | ||
63 | // Add to queue for all scripts in ObjectID object | ||
64 | //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Event: touch_start"); | ||
65 | //Console.WriteLine("touch_start localID: " + localID); | ||
66 | myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", new object[] { (int)1 }); | ||
67 | } | ||
68 | public void OnRezScript(uint localID, LLUUID itemID, string script) | ||
69 | { | ||
70 | //myScriptEngine.myScriptManager.StartScript( | ||
71 | // Path.Combine("ScriptEngines", "Default.lsl"), | ||
72 | // new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost() | ||
73 | //); | ||
74 | Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " + script.Length); | ||
75 | myScriptEngine.m_ScriptManager.StartScript(localID, itemID, script); | ||
76 | } | ||
77 | public void OnRemoveScript(uint localID, LLUUID itemID) | ||
78 | { | ||
79 | //myScriptEngine.myScriptManager.StartScript( | ||
80 | // Path.Combine("ScriptEngines", "Default.lsl"), | ||
81 | // new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost() | ||
82 | //); | ||
83 | Console.WriteLine("OnRemoveScript localID: " + localID + " LLUID: " + itemID.ToString()); | ||
84 | myScriptEngine.m_ScriptManager.StopScript( | ||
85 | localID, | ||
86 | itemID | ||
87 | ); | ||
88 | |||
89 | } | ||
90 | |||
91 | // TODO: Replace placeholders below | ||
92 | // These needs to be hooked up to OpenSim during init of this class | ||
93 | // then queued in EventQueueManager. | ||
94 | // When queued in EventQueueManager they need to be LSL compatible (name and params) | ||
95 | |||
96 | //public void state_entry() { } // | ||
97 | public void state_exit() { } | ||
98 | //public void touch_start() { } | ||
99 | public void touch() { } | ||
100 | public void touch_end() { } | ||
101 | public void collision_start() { } | ||
102 | public void collision() { } | ||
103 | public void collision_end() { } | ||
104 | public void land_collision_start() { } | ||
105 | public void land_collision() { } | ||
106 | public void land_collision_end() { } | ||
107 | public void timer() { } | ||
108 | public void listen() { } | ||
109 | public void on_rez() { } | ||
110 | public void sensor() { } | ||
111 | public void no_sensor() { } | ||
112 | public void control() { } | ||
113 | public void money() { } | ||
114 | public void email() { } | ||
115 | public void at_target() { } | ||
116 | public void not_at_target() { } | ||
117 | public void at_rot_target() { } | ||
118 | public void not_at_rot_target() { } | ||
119 | public void run_time_permissions() { } | ||
120 | public void changed() { } | ||
121 | public void attach() { } | ||
122 | public void dataserver() { } | ||
123 | public void link_message() { } | ||
124 | public void moving_start() { } | ||
125 | public void moving_end() { } | ||
126 | public void object_rez() { } | ||
127 | public void remote_data() { } | ||
128 | public void http_response() { } | ||
129 | |||
130 | } | ||
131 | } | ||