diff options
author | Teravus Ovares | 2008-06-05 13:24:59 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-06-05 13:24:59 +0000 |
commit | e12baa5eb33882fc1d4c6aa0886037e00d726e2e (patch) | |
tree | 79c88e2ceef55f8430dec81b91e9086f2f5876e7 /OpenSim/Region/ScriptEngine/Common/ScriptEngineBase | |
parent | * Don't create ghost prim when rezzing objects from inventory (diff) | |
download | opensim-SC_OLD-e12baa5eb33882fc1d4c6aa0886037e00d726e2e.zip opensim-SC_OLD-e12baa5eb33882fc1d4c6aa0886037e00d726e2e.tar.gz opensim-SC_OLD-e12baa5eb33882fc1d4c6aa0886037e00d726e2e.tar.bz2 opensim-SC_OLD-e12baa5eb33882fc1d4c6aa0886037e00d726e2e.tar.xz |
* This sends collision events to the script engine.
* Unfortunately, there's some kludges with the Async manager and the llDetected functions that I have yet to decipher... so llDetected functions don't work with collision events at the moment....
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common/ScriptEngineBase')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs | 85 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs | 3 |
2 files changed, 79 insertions, 9 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs index 5ef4a6b..ae84f65 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs | |||
@@ -26,9 +26,12 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using libsecondlife; | 30 | using libsecondlife; |
30 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
31 | using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney; | 32 | using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney; |
33 | using OpenSim.Region.Environment; | ||
34 | using OpenSim.Region; | ||
32 | using OpenSim.Region.Environment.Scenes; | 35 | using OpenSim.Region.Environment.Scenes; |
33 | using OpenSim.Region.Environment.Interfaces; | 36 | using OpenSim.Region.Environment.Interfaces; |
34 | 37 | ||
@@ -74,6 +77,9 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
74 | myScriptEngine.World.EventManager.OnScriptAtTargetEvent += at_target; | 77 | myScriptEngine.World.EventManager.OnScriptAtTargetEvent += at_target; |
75 | myScriptEngine.World.EventManager.OnScriptNotAtTargetEvent += not_at_target; | 78 | myScriptEngine.World.EventManager.OnScriptNotAtTargetEvent += not_at_target; |
76 | myScriptEngine.World.EventManager.OnScriptControlEvent += control; | 79 | myScriptEngine.World.EventManager.OnScriptControlEvent += control; |
80 | myScriptEngine.World.EventManager.OnScriptColliderStart += collision_start; | ||
81 | myScriptEngine.World.EventManager.OnScriptColliding += collision; | ||
82 | myScriptEngine.World.EventManager.OnScriptCollidingEnd += collision_end; | ||
77 | 83 | ||
78 | // TODO: HOOK ALL EVENTS UP TO SERVER! | 84 | // TODO: HOOK ALL EVENTS UP TO SERVER! |
79 | IMoneyModule money=myScriptEngine.World.RequestModuleInterface<IMoneyModule>(); | 85 | IMoneyModule money=myScriptEngine.World.RequestModuleInterface<IMoneyModule>(); |
@@ -171,19 +177,82 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
171 | myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "touch_end", EventQueueManager.llDetectNull, new object[] { new LSL_Types.LSLInteger(1) }); | 177 | myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "touch_end", EventQueueManager.llDetectNull, new object[] { new LSL_Types.LSLInteger(1) }); |
172 | } | 178 | } |
173 | 179 | ||
174 | public void collision_start(uint localID, LLUUID itemID) | 180 | public void collision_start(uint localID, ColliderArgs col) |
175 | { | 181 | { |
176 | myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "collision_start", EventQueueManager.llDetectNull, new object[] { new LSL_Types.LSLInteger(1) }); | 182 | EventQueueManager.Queue_llDetectParams_Struct detstruct = new EventQueueManager.Queue_llDetectParams_Struct(); |
183 | detstruct._string = new string[col.Colliders.Count]; | ||
184 | detstruct._Quaternion = new LSL_Types.Quaternion[col.Colliders.Count]; | ||
185 | detstruct._int = new int[col.Colliders.Count]; | ||
186 | detstruct._key = new LSL_Types.key[col.Colliders.Count]; | ||
187 | detstruct._Vector3 = new LSL_Types.Vector3[col.Colliders.Count]; | ||
188 | detstruct._Vector32 = new LSL_Types.Vector3[col.Colliders.Count]; | ||
189 | detstruct._bool = new bool[col.Colliders.Count]; | ||
190 | |||
191 | int i = 0; | ||
192 | foreach (DetectedObject detobj in col.Colliders) | ||
193 | { | ||
194 | detstruct._key[i] = new LSL_Types.key(detobj.keyUUID.ToString()); | ||
195 | detstruct._Quaternion[i] = new LSL_Types.Quaternion(detobj.rotQuat.X, detobj.rotQuat.Y, detobj.rotQuat.Z, detobj.rotQuat.W); | ||
196 | detstruct._string[i] = detobj.nameStr; | ||
197 | detstruct._int[i] = detobj.colliderType; | ||
198 | detstruct._Vector3[i] = new LSL_Types.Vector3(detobj.posVector.X, detobj.posVector.Y, detobj.posVector.Z); | ||
199 | detstruct._Vector32[i] = new LSL_Types.Vector3(detobj.velVector.X, detobj.velVector.Y, detobj.velVector.Z); | ||
200 | detstruct._bool[i] = true; // Apparently the script engine uses this to see if this is a valid entry... | ||
201 | i++; | ||
202 | } | ||
203 | |||
204 | myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "collision_start", detstruct, new object[] { new LSL_Types.LSLInteger(col.Colliders.Count) }); | ||
177 | } | 205 | } |
178 | 206 | ||
179 | public void collision(uint localID, LLUUID itemID) | 207 | public void collision(uint localID, ColliderArgs col) |
180 | { | 208 | { |
181 | myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "collision", EventQueueManager.llDetectNull, new object[] { new LSL_Types.LSLInteger(1) }); | 209 | EventQueueManager.Queue_llDetectParams_Struct detstruct = new EventQueueManager.Queue_llDetectParams_Struct(); |
210 | detstruct._string = new string[col.Colliders.Count]; | ||
211 | detstruct._Quaternion = new LSL_Types.Quaternion[col.Colliders.Count]; | ||
212 | detstruct._int = new int[col.Colliders.Count]; | ||
213 | detstruct._key = new LSL_Types.key[col.Colliders.Count]; | ||
214 | detstruct._Vector3 = new LSL_Types.Vector3[col.Colliders.Count]; | ||
215 | detstruct._Vector32 = new LSL_Types.Vector3[col.Colliders.Count]; | ||
216 | detstruct._bool = new bool[col.Colliders.Count]; | ||
217 | |||
218 | int i = 0; | ||
219 | foreach (DetectedObject detobj in col.Colliders) | ||
220 | { | ||
221 | detstruct._key[i] = new LSL_Types.key(detobj.keyUUID.ToString()); | ||
222 | detstruct._Quaternion[i] = new LSL_Types.Quaternion(detobj.rotQuat.X, detobj.rotQuat.Y, detobj.rotQuat.Z, detobj.rotQuat.W); | ||
223 | detstruct._string[i] = detobj.nameStr; | ||
224 | detstruct._int[i] = detobj.colliderType; | ||
225 | detstruct._Vector3[i] = new LSL_Types.Vector3(detobj.posVector.X, detobj.posVector.Y, detobj.posVector.Z); | ||
226 | detstruct._Vector32[i] = new LSL_Types.Vector3(detobj.velVector.X, detobj.velVector.Y, detobj.velVector.Z); | ||
227 | detstruct._bool[i] = true; // Apparently the script engine uses this to see if this is a valid entry... i++; | ||
228 | } | ||
229 | myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "collision", detstruct, new object[] { new LSL_Types.LSLInteger(col.Colliders.Count) }); | ||
182 | } | 230 | } |
183 | 231 | ||
184 | public void collision_end(uint localID, LLUUID itemID) | 232 | public void collision_end(uint localID, ColliderArgs col) |
185 | { | 233 | { |
186 | myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "collision_end", EventQueueManager.llDetectNull, new object[] { new LSL_Types.LSLInteger(1) }); | 234 | EventQueueManager.Queue_llDetectParams_Struct detstruct = new EventQueueManager.Queue_llDetectParams_Struct(); |
235 | detstruct._string = new string[col.Colliders.Count]; | ||
236 | detstruct._Quaternion = new LSL_Types.Quaternion[col.Colliders.Count]; | ||
237 | detstruct._int = new int[col.Colliders.Count]; | ||
238 | detstruct._key = new LSL_Types.key[col.Colliders.Count]; | ||
239 | detstruct._Vector3 = new LSL_Types.Vector3[col.Colliders.Count]; | ||
240 | detstruct._Vector32 = new LSL_Types.Vector3[col.Colliders.Count]; | ||
241 | detstruct._bool = new bool[col.Colliders.Count]; | ||
242 | |||
243 | int i = 0; | ||
244 | foreach (DetectedObject detobj in col.Colliders) | ||
245 | { | ||
246 | detstruct._key[i] = new LSL_Types.key(detobj.keyUUID.ToString()); | ||
247 | detstruct._Quaternion[i] = new LSL_Types.Quaternion(detobj.rotQuat.X, detobj.rotQuat.Y, detobj.rotQuat.Z, detobj.rotQuat.W); | ||
248 | detstruct._string[i] = detobj.nameStr; | ||
249 | detstruct._int[i] = detobj.colliderType; | ||
250 | detstruct._Vector3[i] = new LSL_Types.Vector3(detobj.posVector.X, detobj.posVector.Y, detobj.posVector.Z); | ||
251 | detstruct._Vector32[i] = new LSL_Types.Vector3(detobj.velVector.X, detobj.velVector.Y, detobj.velVector.Z); | ||
252 | detstruct._bool[i] = true; // Apparently the script engine uses this to see if this is a valid entry... | ||
253 | i++; | ||
254 | } | ||
255 | myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "collision_end", EventQueueManager.llDetectNull, new object[] { new LSL_Types.LSLInteger(col.Colliders.Count) }); | ||
187 | } | 256 | } |
188 | 257 | ||
189 | public void land_collision_start(uint localID, LLUUID itemID) | 258 | public void land_collision_start(uint localID, LLUUID itemID) |
@@ -191,9 +260,9 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
191 | myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "land_collision_start", EventQueueManager.llDetectNull); | 260 | myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "land_collision_start", EventQueueManager.llDetectNull); |
192 | } | 261 | } |
193 | 262 | ||
194 | public void land_collision(uint localID, LLUUID itemID) | 263 | public void land_collision(uint localID, ColliderArgs col) |
195 | { | 264 | { |
196 | myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "land_collision", EventQueueManager.llDetectNull); | 265 | myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "land_collision", EventQueueManager.llDetectNull); |
197 | } | 266 | } |
198 | 267 | ||
199 | public void land_collision_end(uint localID, LLUUID itemID) | 268 | public void land_collision_end(uint localID, LLUUID itemID) |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs index 7cbbd4f..c6eebf1 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs | |||
@@ -155,7 +155,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
155 | // should be fixed to something better :) | 155 | // should be fixed to something better :) |
156 | public LSL_Types.key[] _key; | 156 | public LSL_Types.key[] _key; |
157 | public LSL_Types.Quaternion[] _Quaternion; | 157 | public LSL_Types.Quaternion[] _Quaternion; |
158 | public LSL_Types.Vector3[] _Vector3; | 158 | public LSL_Types.Vector3[] _Vector3; // Pos |
159 | public LSL_Types.Vector3[] _Vector32; // Vel | ||
159 | public bool[] _bool; | 160 | public bool[] _bool; |
160 | public int[] _int; | 161 | public int[] _int; |
161 | public string[] _string; | 162 | public string[] _string; |