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
Exemplo n.º 1
0
 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
         }
     }
 }
Exemplo n.º 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);
 }
Exemplo n.º 3
0
        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);
                }
            }
        }
Exemplo n.º 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);
         }
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 6
0
        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));
                }
            }
        }
Exemplo n.º 7
0
        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);
                }
            }
        }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 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);
                                                }

                                            }
                                        }
                                    });
        }
Exemplo n.º 10
0
        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();
                            }
                        }
                    }));
            }
        }
Exemplo n.º 11
0
 public virtual void Objects_OnObjectKilled(object sender, KillObjectEventArgs e) { OnEvent("On-Object-Killed", paramNamesOnObjectKilled, paramTypesOnObjectKilled, e); }
Exemplo n.º 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;
            }
        }
Exemplo n.º 13
0
        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();
                }));
            }
        }
Exemplo n.º 14
0
 void Objects_KillObject(object sender, KillObjectEventArgs e)
 {
     if (e.ObjectLocalID == objectoColocado)
     {
         gotKillObject = true;
         objectKillWait.Set();
     }
 }
Exemplo n.º 15
0
        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();
                    }
                }
            }
        }