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