aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorUbitUmarov2016-08-05 22:50:15 +0100
committerUbitUmarov2016-08-05 22:50:15 +0100
commit9102f6e5da1731aab9d1f9a449dce781ffd0ba36 (patch)
tree4f70e80611b1ea0aa5eaee19bdca735f615d1cde /OpenSim/Region
parent remove country from avatars DetectParams, since it is only used on a cm func... (diff)
downloadopensim-SC_OLD-9102f6e5da1731aab9d1f9a449dce781ffd0ba36.zip
opensim-SC_OLD-9102f6e5da1731aab9d1f9a449dce781ffd0ba36.tar.gz
opensim-SC_OLD-9102f6e5da1731aab9d1f9a449dce781ffd0ba36.tar.bz2
opensim-SC_OLD-9102f6e5da1731aab9d1f9a449dce781ffd0ba36.tar.xz
fill data for llDetected funtions of collisions closer to the event. (xengine wasn't update with this on merge bc was not used there). fix some parameters
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs52
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Helpers.cs76
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/EventManager.cs19
4 files changed, 106 insertions, 58 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 0b8076a..0847b0b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2712,8 +2712,7 @@ namespace OpenSim.Region.Framework.Scenes
2712 detobj.velVector = obj.Velocity; 2712 detobj.velVector = obj.Velocity;
2713 detobj.colliderType = 0; 2713 detobj.colliderType = 0;
2714 detobj.groupUUID = obj.GroupID; 2714 detobj.groupUUID = obj.GroupID;
2715 detobj.linkNumber = LinkNum; // pass my link number 2715 detobj.linkNumber = LinkNum;
2716
2717 return detobj; 2716 return detobj;
2718 } 2717 }
2719 2718
@@ -2726,9 +2725,13 @@ namespace OpenSim.Region.Framework.Scenes
2726 detobj.posVector = av.AbsolutePosition; 2725 detobj.posVector = av.AbsolutePosition;
2727 detobj.rotQuat = av.Rotation; 2726 detobj.rotQuat = av.Rotation;
2728 detobj.velVector = av.Velocity; 2727 detobj.velVector = av.Velocity;
2729 detobj.colliderType = 0; 2728 detobj.colliderType = av.isNPC ? 0x20 : 0x1; // OpenSim\Region\ScriptEngine\Shared\Helpers.cs
2729 if(av.IsSatOnObject)
2730 detobj.colliderType |= 0x4; //passive
2731 else if(detobj.velVector != Vector3.Zero)
2732 detobj.colliderType |= 0x2; //active
2730 detobj.groupUUID = av.ControllingClient.ActiveGroupId; 2733 detobj.groupUUID = av.ControllingClient.ActiveGroupId;
2731 detobj.linkNumber = LinkNum; // pass my link number 2734 detobj.linkNumber = LinkNum;
2732 2735
2733 return detobj; 2736 return detobj;
2734 } 2737 }
@@ -2842,7 +2845,8 @@ namespace OpenSim.Region.Framework.Scenes
2842 if (ParentGroup.Scene == null || ParentGroup.IsDeleted) 2845 if (ParentGroup.Scene == null || ParentGroup.IsDeleted)
2843 return; 2846 return;
2844 2847
2845 // single threaded here 2848 // this a thread from physics ( heartbeat )
2849
2846 CollisionEventUpdate a = (CollisionEventUpdate)e; 2850 CollisionEventUpdate a = (CollisionEventUpdate)e;
2847 Dictionary<uint, ContactPoint> collissionswith = a.m_objCollisionList; 2851 Dictionary<uint, ContactPoint> collissionswith = a.m_objCollisionList;
2848 List<uint> thisHitColliders = new List<uint>(); 2852 List<uint> thisHitColliders = new List<uint>();
@@ -2860,7 +2864,6 @@ namespace OpenSim.Region.Framework.Scenes
2860 } 2864 }
2861 m_lastColliders.Clear(); 2865 m_lastColliders.Clear();
2862 } 2866 }
2863
2864 else 2867 else
2865 { 2868 {
2866 List<CollisionForSoundInfo> soundinfolist = new List<CollisionForSoundInfo>(); 2869 List<CollisionForSoundInfo> soundinfolist = new List<CollisionForSoundInfo>();
@@ -5256,7 +5259,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
5256 { 5259 {
5257 // subscribe to physics updates. 5260 // subscribe to physics updates.
5258 pa.OnCollisionUpdate += PhysicsCollision; 5261 pa.OnCollisionUpdate += PhysicsCollision;
5259 pa.SubscribeEvents(50); // 20 reports per second 5262 pa.SubscribeEvents(100); // 10 reports per second
5260 } 5263 }
5261 else 5264 else
5262 { 5265 {
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 3d8aad7..732d5ef 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -6037,7 +6037,11 @@ namespace OpenSim.Region.Framework.Scenes
6037 detobj.posVector = av.AbsolutePosition; 6037 detobj.posVector = av.AbsolutePosition;
6038 detobj.rotQuat = av.Rotation; 6038 detobj.rotQuat = av.Rotation;
6039 detobj.velVector = av.Velocity; 6039 detobj.velVector = av.Velocity;
6040 detobj.colliderType = 0; 6040 detobj.colliderType = av.isNPC ? 0x20 : 0x1; // OpenSim\Region\ScriptEngine\Shared\Helpers.cs
6041 if(av.IsSatOnObject)
6042 detobj.colliderType |= 0x4; //passive
6043 else if(detobj.velVector != Vector3.Zero)
6044 detobj.colliderType |= 0x2; //active
6041 detobj.groupUUID = av.ControllingClient.ActiveGroupId; 6045 detobj.groupUUID = av.ControllingClient.ActiveGroupId;
6042 detobj.linkNumber = 0; 6046 detobj.linkNumber = 0;
6043 6047
@@ -6129,9 +6133,6 @@ namespace OpenSim.Region.Framework.Scenes
6129 List<uint> thisHitColliders = new List<uint>(); 6133 List<uint> thisHitColliders = new List<uint>();
6130 List<uint> endedColliders = new List<uint>(); 6134 List<uint> endedColliders = new List<uint>();
6131 List<uint> startedColliders = new List<uint>(); 6135 List<uint> startedColliders = new List<uint>();
6132 List<CollisionForSoundInfo> soundinfolist = new List<CollisionForSoundInfo>();
6133 CollisionForSoundInfo soundinfo;
6134 ContactPoint curcontact;
6135 6136
6136 if (coldata.Count == 0) 6137 if (coldata.Count == 0)
6137 { 6138 {
@@ -6144,30 +6145,41 @@ namespace OpenSim.Region.Framework.Scenes
6144 } 6145 }
6145 m_lastColliders.Clear(); 6146 m_lastColliders.Clear();
6146 } 6147 }
6147
6148 else 6148 else
6149 { 6149 {
6150 bool candoparcelSound = ParcelAllowThisAvatarSounds; 6150 List<CollisionForSoundInfo> soundinfolist = new List<CollisionForSoundInfo>();
6151 6151 if(ParcelAllowThisAvatarSounds)
6152 foreach (uint id in coldata.Keys)
6153 { 6152 {
6154 thisHitColliders.Add(id); 6153 CollisionForSoundInfo soundinfo;
6155 if (!m_lastColliders.Contains(id)) 6154 ContactPoint curcontact;
6155
6156 foreach (uint id in coldata.Keys)
6156 { 6157 {
6157 startedColliders.Add(id); 6158 thisHitColliders.Add(id);
6158 curcontact = coldata[id]; 6159 if (!m_lastColliders.Contains(id))
6159 if (candoparcelSound && Math.Abs(curcontact.RelativeSpeed) > 0.2)
6160 { 6160 {
6161 soundinfo = new CollisionForSoundInfo(); 6161 startedColliders.Add(id);
6162 soundinfo.colliderID = id; 6162 curcontact = coldata[id];
6163 soundinfo.position = curcontact.Position; 6163 if (Math.Abs(curcontact.RelativeSpeed) > 0.2)
6164 soundinfo.relativeVel = curcontact.RelativeSpeed; 6164 {
6165 soundinfolist.Add(soundinfo); 6165 soundinfo = new CollisionForSoundInfo();
6166 soundinfo.colliderID = id;
6167 soundinfo.position = curcontact.Position;
6168 soundinfo.relativeVel = curcontact.RelativeSpeed;
6169 soundinfolist.Add(soundinfo);
6170 }
6166 } 6171 }
6167 } 6172 }
6168 //m_log.Debug("[SCENE PRESENCE]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
6169 } 6173 }
6170 6174 else
6175 {
6176 foreach (uint id in coldata.Keys)
6177 {
6178 thisHitColliders.Add(id);
6179 if (!m_lastColliders.Contains(id))
6180 startedColliders.Add(id);
6181 }
6182 }
6171 // calculate things that ended colliding 6183 // calculate things that ended colliding
6172 foreach (uint localID in m_lastColliders) 6184 foreach (uint localID in m_lastColliders)
6173 { 6185 {
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",