private void SendLandCollisionEvent(SceneObjectGroup dest, scriptEvents ev, ScriptCollidingNotification notify) { if ((dest.RootPart.ScriptEvents & ev) != 0) { ColliderArgs LandCollidingMessage = new ColliderArgs(); List<DetectedObject> colliding = new List<DetectedObject>(); colliding.Add(CreateDetObjectForGround()); LandCollidingMessage.Colliders = colliding; notify(dest.RootPart.LocalId, LandCollidingMessage); } }
private void SendCollisionEvent(SceneObjectGroup dest, scriptEvents ev, List<uint> colliders, ScriptCollidingNotification notify) { ColliderArgs CollidingMessage; if (colliders.Count > 0) { if ((dest.RootPart.ScriptEvents & ev) != 0) { CollidingMessage = CreateColliderArgs(dest.RootPart, colliders); if (CollidingMessage.Colliders.Count > 0) notify(dest.RootPart.LocalId, CollidingMessage); } } }
private void SendLandCollisionEvent(scriptEvents ev, ScriptCollidingNotification notify) { bool sendToRoot = true; ColliderArgs LandCollidingMessage = new ColliderArgs(); List<DetectedObject> colliding = new List<DetectedObject>(); colliding.Add(CreateDetObjectForGround()); LandCollidingMessage.Colliders = colliding; if (Inventory.ContainsScripts()) { if (!PassCollisions) sendToRoot = false; } if ((ScriptEvents & ev) != 0) notify(LocalId, LandCollidingMessage); if ((ParentGroup.RootPart.ScriptEvents & ev) != 0 && sendToRoot) { notify(ParentGroup.RootPart.LocalId, LandCollidingMessage); } }
private void SendCollisionEvent(scriptEvents ev, List<uint> colliders, ScriptCollidingNotification notify) { bool sendToRoot = false; ColliderArgs CollidingMessage; if (colliders.Count > 0) { if ((ScriptEvents & ev) != 0) { CollidingMessage = CreateColliderArgs(this, colliders); if (CollidingMessage.Colliders.Count > 0) notify(LocalId, CollidingMessage); if (PassCollisions) sendToRoot = true; } else { if ((ParentGroup.RootPart.ScriptEvents & ev) != 0) sendToRoot = true; } if (sendToRoot && ParentGroup.RootPart != this) { CollidingMessage = CreateColliderArgs(ParentGroup.RootPart, colliders); if (CollidingMessage.Colliders.Count > 0) notify(ParentGroup.RootPart.LocalId, CollidingMessage); } } }
private void DoNotify(ScriptCollidingNotification notify, uint id, ColliderArgs collargs) { if (m_parentGroup != null && ParentGroup.Scene != null && ParentGroup.Scene.ShouldUseFireAndForgetForCollisions) { // For those learning C#, FireAndForget takes a function, an object to pass // to that function and an ID string. The "oo => {}" construct is a lambda expression // for a function with one arguement ('oo'). The 'new Object[] {}" construct creates an Object // that is an object array and initializes it with three items (the parameters // being passed). The parameters passed are the function to call ('notify') and // its two arguements. Finally, once in the function (called later by the FireAndForget // thread scheduler), the passed object is cast to an object array and then each // of its items (aoo[0] to aoo[2]) are individually cast to what they are and // then used in a call of the passed ScriptCollidingNotification function. Util.FireAndForget(oo => { Object[] aoo = (Object[])oo; ((ScriptCollidingNotification)aoo[0])((uint)aoo[1], (ColliderArgs)aoo[2]); }, new Object[] { notify, id, collargs }, "SOP.Collision"); } else { notify(id, collargs); } }