aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Helpers.cs76
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/EventManager.cs19
2 files changed, 64 insertions, 31 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
index d30a1c4..9f34c98 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
@@ -213,24 +213,6 @@ namespace OpenSim.Region.ScriptEngine.Shared
213 if (presence.PresenceType == PresenceType.Npc) 213 if (presence.PresenceType == PresenceType.Npc)
214 Type = 0x20; 214 Type = 0x20;
215 215
216 // Cope Impl. We don't use OS_NPC.
217 //if (presence.PresenceType != PresenceType.Npc)
218 //{
219 // Type = AGENT;
220 //}
221 //else
222 //{
223 // Type = OS_NPC;
224
225 // INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
226 // INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene);
227
228 // if (npcData.SenseAsAgent)
229 // {
230 // Type |= AGENT;
231 // }
232 //}
233
234 if (presence.Velocity != Vector3.Zero) 216 if (presence.Velocity != Vector3.Zero)
235 Type |= ACTIVE; 217 Type |= ACTIVE;
236 218
@@ -267,6 +249,64 @@ namespace OpenSim.Region.ScriptEngine.Shared
267 249
268 Velocity = new LSL_Types.Vector3(part.Velocity); 250 Velocity = new LSL_Types.Vector3(part.Velocity);
269 } 251 }
252
253 public void Populate(Scene scene, DetectedObject obj)
254 {
255 if(obj.keyUUID == UUID.Zero) // land
256 {
257 Position = new LSL_Types.Vector3(obj.posVector);
258 Rotation.s = 1.0;
259 return;
260 }
261
262 if((obj.colliderType & 0x21) != 0) // avatar or npc
263 {
264 ScenePresence presence = scene.GetScenePresence(obj.keyUUID);
265 if (presence == null)
266 return;
267
268 Name = obj.nameStr;
269 Owner = obj.keyUUID;
270 Group = obj.groupUUID;
271 Position = new LSL_Types.Vector3(obj.posVector);
272 Rotation = new LSL_Types.Quaternion(obj.rotQuat);
273 Velocity = new LSL_Types.Vector3(obj.velVector);
274 LinkNum = obj.linkNumber;
275 Type = obj.colliderType;
276 return;
277 }
278
279 SceneObjectPart part = scene.GetSceneObjectPart(obj.keyUUID);
280 if(part == null)
281 return;
282
283 Name = obj.nameStr;
284 Owner = obj.keyUUID;
285 Group = obj.groupUUID;
286 Position = new LSL_Types.Vector3(obj.posVector);
287 Rotation = new LSL_Types.Quaternion(obj.rotQuat);
288 Velocity = new LSL_Types.Vector3(obj.velVector);
289 LinkNum = obj.linkNumber;
290 if(obj.velVector == Vector3.Zero)
291 Type = 4;
292 else
293 Type = 2;
294
295 part = part.ParentGroup.RootPart;
296 foreach (SceneObjectPart p in part.ParentGroup.Parts)
297 {
298 if (p.Inventory.ContainsScripts())
299 {
300 // at sl a physical prim is active also if has active scripts
301 // assuming all scripts are in run state to save time
302 if((part.Flags & PrimFlags.Physics) != 0 )
303 Type = 10; // script + active
304 else
305 Type |= SCRIPTED; // Scripted
306 break;
307 }
308 }
309 }
270 } 310 }
271 311
272 /// <summary> 312 /// <summary>
diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
index ad775ff..f1b1e66 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
@@ -244,7 +244,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
244 { 244 {
245 DetectParams d = new DetectParams(); 245 DetectParams d = new DetectParams();
246 d.Key =detobj.keyUUID; 246 d.Key =detobj.keyUUID;
247 d.Populate(myScriptEngine.World); 247 d.Populate(myScriptEngine.World, detobj);
248 d.LinkNum = detobj.linkNumber; // do it here since currently linknum is collided part 248 d.LinkNum = detobj.linkNumber; // do it here since currently linknum is collided part
249 det.Add(d); 249 det.Add(d);
250 } 250 }
@@ -264,9 +264,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
264 foreach (DetectedObject detobj in col.Colliders) 264 foreach (DetectedObject detobj in col.Colliders)
265 { 265 {
266 DetectParams d = new DetectParams(); 266 DetectParams d = new DetectParams();
267 d.Key =detobj.keyUUID; 267 d.Populate(myScriptEngine.World, detobj);
268 d.Populate(myScriptEngine.World);
269 d.LinkNum = detobj.linkNumber; // do it here since currently linknum is collided part
270 det.Add(d); 268 det.Add(d);
271 } 269 }
272 270
@@ -284,9 +282,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
284 foreach (DetectedObject detobj in col.Colliders) 282 foreach (DetectedObject detobj in col.Colliders)
285 { 283 {
286 DetectParams d = new DetectParams(); 284 DetectParams d = new DetectParams();
287 d.Key =detobj.keyUUID; 285 d.Populate(myScriptEngine.World, detobj);
288 d.Populate(myScriptEngine.World);
289 d.LinkNum = detobj.linkNumber; // do it here since currently linknum is collided part
290 det.Add(d); 286 det.Add(d);
291 } 287 }
292 288
@@ -304,8 +300,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
304 foreach (DetectedObject detobj in col.Colliders) 300 foreach (DetectedObject detobj in col.Colliders)
305 { 301 {
306 DetectParams d = new DetectParams(); 302 DetectParams d = new DetectParams();
307 d.Position = detobj.posVector; 303 d.Populate(myScriptEngine.World, detobj);
308 d.Populate(myScriptEngine.World);
309 det.Add(d); 304 det.Add(d);
310 myScriptEngine.PostObjectEvent(localID, new EventParams( 305 myScriptEngine.PostObjectEvent(localID, new EventParams(
311 "land_collision_start", 306 "land_collision_start",
@@ -322,8 +317,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
322 foreach (DetectedObject detobj in col.Colliders) 317 foreach (DetectedObject detobj in col.Colliders)
323 { 318 {
324 DetectParams d = new DetectParams(); 319 DetectParams d = new DetectParams();
325 d.Position = detobj.posVector; 320 d.Populate(myScriptEngine.World,detobj);
326 d.Populate(myScriptEngine.World);
327 det.Add(d); 321 det.Add(d);
328 myScriptEngine.PostObjectEvent(localID, new EventParams( 322 myScriptEngine.PostObjectEvent(localID, new EventParams(
329 "land_collision", 323 "land_collision",
@@ -339,8 +333,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
339 foreach (DetectedObject detobj in col.Colliders) 333 foreach (DetectedObject detobj in col.Colliders)
340 { 334 {
341 DetectParams d = new DetectParams(); 335 DetectParams d = new DetectParams();
342 d.Position = detobj.posVector; 336 d.Populate(myScriptEngine.World,detobj);
343 d.Populate(myScriptEngine.World);
344 det.Add(d); 337 det.Add(d);
345 myScriptEngine.PostObjectEvent(localID, new EventParams( 338 myScriptEngine.PostObjectEvent(localID, new EventParams(
346 "land_collision_end", 339 "land_collision_end",