Provides notification when an Avatar, Object or Attachment is DeRezzed or moves out of the avatars view for the ObjectManager.KillObject event
Inheritance: System.EventArgs
 void Objects_KillObject(object sender, KillObjectEventArgs e)
 {
     // If we know of this avatar, remove it and announce its loss.
     lock (this.nearbyAvatars)
     {
         if (nearbyAvatars.ContainsKey(e.ObjectLocalID))
         {
             Avatar avatar = this.nearbyAvatars[e.ObjectLocalID];
             this.nearbyAvatars.Remove(e.ObjectLocalID);
             //@todo trigger avatar removed event
         }
     }
 }
Exemple #2
0
 ///<summary>Raises the KillObject Event</summary>
 /// <param name="e">A KillObjectEventArgs object containing
 /// the data sent from the simulator</param>
 protected virtual void OnKillObject(KillObjectEventArgs e)
 {
     EventHandler<KillObjectEventArgs> handler = m_KillObject;
     if (handler != null)
         handler(this, e);
 }
        void Objects_KillObject(object sender, KillObjectEventArgs e)
        {
            AttachmentInfo attachment = null;
            lock (attachments)
            {
                foreach (AttachmentInfo att in attachments.Values)
                {
                    if (att.Prim != null && att.Prim.LocalID == e.ObjectLocalID)
                    {
                        attachment = att;
                        break;
                    }
                }

                if (attachment != null)
                {
                    attachments.Remove(attachment.InventoryID);
                    UpdateNodeLabel(attachment.InventoryID);
                }
            }
        }
Exemple #4
0
 void Objects_KillObject(object sender, KillObjectEventArgs e)
 {
     // If we know of this avatar, remove it and announce its loss.
     lock (this.avatars)
     {
         if (avatars.ContainsKey(e.ObjectLocalID))
         {
             Avatar avatar = this.avatars[e.ObjectLocalID];
             this.avatars.Remove(e.ObjectLocalID);
             if(OnAvatarRemoved != null) OnAvatarRemoved(avatar);
         }
     }
 }
Exemple #5
0
        /// <summary>
        /// Handle deletion of a noise-making object
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void Objects_KillObject(object sender, KillObjectEventArgs e)
        {
            Primitive p = null;
            if (!e.Simulator.ObjectsPrimitives.TryGetValue(e.ObjectLocalID, out  p)) return;

            // Objects without sounds are not interesting.
            if (p.Sound == null) return;
            if (p.Sound == UUID.Zero) return;

            BufferSound.Kill(p.ID);
        }
        void Objects_KillObject(object sender, KillObjectEventArgs e)
        {
            AttachmentInfo attachment = null;
            lock (attachments)
            {
                foreach (AttachmentInfo att in attachments.Values)
                {
                    if (att.Prim != null && att.Prim.LocalID == e.ObjectLocalID)
                    {
                        attachment = att;
                        break;
                    }
                }

                if (attachment != null)
                {
                    attachments.Remove(attachment.InventoryID);
                    Inventory_InventoryObjectUpdated(this, new InventoryObjectUpdatedEventArgs(attachment.Item, attachment.Item));
                }
            }
        }
        void Objects_KillObject(object sender, KillObjectEventArgs e)
        {
            if (Client.Network.CurrentSim != e.Simulator) return;

            Primitive prim = null;
            if (Client.Network.CurrentSim.ObjectsPrimitives.TryGetValue(e.ObjectLocalID, out prim))
            {
                UUID invItem = GetAttachmentItem(prim);
                if (invItem != UUID.Zero)
                {
                    RemoveLink(invItem);
                }
            }
        }
        void Objects_KillObject(object sender, KillObjectEventArgs e)
        {
            if (e.Simulator.Handle != Client.Network.CurrentSim.Handle) return;
            if (InvokeRequired)
            {
                if (IsHandleCreated)
                {
                    BeginInvoke(new MethodInvoker(() => Objects_KillObject(sender, e)));
                }
                return;
            }

            // TODO: there should be really cleanup of resources when removing prims and avatars
            lock (Prims) Prims.Remove(e.ObjectLocalID);
            lock (Avatars) Avatars.Remove(e.ObjectLocalID);
        }
Exemple #9
0
        public override void Objects_OnObjectKilled(object sender, KillObjectEventArgs e)
        {
#if COGBOT_LIBOMV
            if (!e.ReallyDead) 
#endif                
            if (IgnoreKillObjects) return;
            Simulator simulator = e.Simulator;
            // had to move this out of the closure because the Primitive is gone later
            Primitive p = GetPrimitive(e.ObjectLocalID, simulator);
            if (p == null)
            {
                //   base.Objects_OnObjectKilled(simulator, objectID);
                return;
            }
            SimObject O = GetSimObjectFromUUID(p.ID);
            if (O == null)
            {
                return;
            }
            EventQueue.Enqueue(() =>
                                    {
                                        //if (O == null)
                                        //    O = GetSimObjectFromUUID(p.ID);
                                        //if (O == null)
                                        //    O = GetSimObject(p, simulator);
                                        //if (O == null)
                                        //{
                                        //    SendNewEvent("on-prim-killed", p);
                                        //    return;
                                        //}
                                        //if (Settings.LOG_LEVEL != Helpers.LogLevel.Info)
                                            //Debug("Killing object: " + O);
                                        {
                                            {
                                                SendOnRemoveSimObject(O);
                                                if (O.KilledPrim(p, simulator))
                                                {
                                                   // lock (SimAvatars)
                                                        foreach (SimAvatar A in SimAvatars)
                                                        {
                                                            A.RemoveObject(O);
                                                        }
                                                    if (O is SimAvatar)
                                                    {
                                                        //lock (SimAvatars)
                                                        {
                                                            //  SimAvatars.Remove((SimAvatar)O);
                                                            Debug("Killing Avatar: " + O);
                                                        }
                                                    }
                                                    // lock (SimObjects) SimObjects.Remove(O);   
                                                    SimRootObjects.Remove(O);
                                                    SimChildObjects.Remove(O);
                                                    SimAttachmentObjects.Remove(O);
                                                    SimAvatars.Remove(O);
                                                }

                                            }
                                        }
                                    });
        }
        void Objects_KillObject(object sender, KillObjectEventArgs e)
        {
            if (e.Simulator.Handle != client.Network.CurrentSim.Handle) return;

            Primitive prim;

            if (client.Network.CurrentSim.ObjectsPrimitives.TryGetValue(e.ObjectLocalID, out prim))
            {
                lstPrims.BeginInvoke(new MethodInvoker(() =>
                    {
                        lock (lstPrims.Items)
                        {
                            if (lstPrims.Items.ContainsKey(prim.ID.ToString()))
                            {
                                lstPrims.Items[prim.ID.ToString()].Remove();
                            }
                        }
                    }));
            }
        }
Exemple #11
0
 public virtual void Objects_OnObjectKilled(object sender, KillObjectEventArgs e) { OnEvent("On-Object-Killed", paramNamesOnObjectKilled, paramTypesOnObjectKilled, e); }
Exemple #12
0
        //Separate thread
        private void Objects_OnObjectKilled(object sender, KillObjectEventArgs e)
        {
            //if (!this.IsHandleCreated) return;

            if (e.Simulator.Handle != client.Network.CurrentSim.Handle) return;

            ObjectsListItem item;

            uint objectID = e.ObjectLocalID;

            try
            {
                if (listItems.ContainsKey(objectID))
                {
                    item = listItems[objectID];
                }
                else
                {
                    return;
                }

                if (item.Prim.ParentID != 0)
                {
                    lock (childItems)
                    {
                        if (!childItems.ContainsKey(objectID)) return;

                        try
                        {
                            BeginInvoke(new MethodInvoker(delegate()
                            {
                                item = childItems[objectID];

                                if (lbxChildren.Items.Contains(item))
                                {
                                    lbxChildren.Items.Remove(item);
                                }

                                try
                                {
                                    childItems.Remove(objectID);
                                }
                                catch
                                {
                                    ;
                                }
                            }));
                        }
                        catch
                        {
                            ;
                        }
                    }
                }
                else
                {
                    lock (listItems)
                    {
                        if (!listItems.ContainsKey(objectID)) return;

                        try
                        {
                            BeginInvoke(new MethodInvoker(delegate()
                            {
                                item = listItems[objectID];

                                if (item != null)
                                {
                                    if (lbxPrims.Items.Contains(item))
                                    {
                                        lock (lbxPrims.Items)
                                        {
                                            lbxPrims.Items.Remove(item);
                                        }
                                    }

                                    if (pB1.Maximum > 0) pB1.Maximum -= 1;

                                    try
                                    {
                                        listItems.Remove(objectID);

                                        lock (ItemsProps)
                                        {
                                            ItemsProps.Remove(objectID);
                                        }
                                    }
                                    catch
                                    {
                                        ;
                                    }

                                    tlbDisplay.Text = lbxPrims.Items.Count.ToString(CultureInfo.CurrentCulture) + " objects";
                                }
                            }));
                        }
                        catch
                        {
                            ;
                        }
                    }
                }
            }
            catch
            {
                // passed key wasn't available
                return;
            }
        }
        private void Objects_OnObjectKilled(object sender, KillObjectEventArgs e)
        {
            if (e.Simulator.Handle != client.Network.CurrentSim.Handle) return;

            //if (!e.Prim.IsAttachment) return;

            //if (e.Prim.ParentID != av.LocalID) return;

            if (listItems.ContainsKey(e.ObjectLocalID))
            {
                lock (listItems)
                {
                    listItems.Clear();
                }

                BeginInvoke(new MethodInvoker(delegate()
                {
                    pBar3.Visible = true;
                    lbxPrims.Items.Clear();
                    lbxPrimGroup.Items.Clear();

                    ReLoadItems();
                }));
            }
        }
Exemple #14
0
 void Objects_KillObject(object sender, KillObjectEventArgs e)
 {
     if (e.ObjectLocalID == objectoColocado)
     {
         gotKillObject = true;
         objectKillWait.Set();
     }
 }
        private void Objects_OnObjectKilled(object sender, KillObjectEventArgs e)
        {
            return;
            var simulator = e.Simulator;
            var objectID = e.ObjectLocalID;
            if (InvokeRequired)
            {
                Invoke(new MethodInvoker(delegate() { Objects_OnObjectKilled(sender,e); }));
                return;
            }

            Primitive prim;

            if (client.Network.CurrentSim.ObjectsPrimitives.TryGetValue(objectID, out prim))
            {
                lock (lstPrims.Items)
                {
                    if (lstPrims.Items.ContainsKey(prim.ID.ToString()))
                    {
                        lstPrims.Items[prim.ID.ToString()].Remove();
                    }
                }
            }
        }