/// <summary> /// Removes an item from the world and raises the LeaveRegion event. /// </summary> /// <param name="item"></param> public void RemoveItem(MabiItem item) { lock (_items) _items.Remove(item); var disappears = new MabiPacket(Op.ItemDisappears, Id.Broadcast); disappears.PutLong(item.Id); this.Broadcast(disappears, SendTargets.Range, item); EventManager.EntityEvents.OnEntityLeavesRegion(item); item.Dispose(); }
/// <summary> /// Removes an item from the world and raises the LeaveRegion event. /// </summary> /// <param name="item"></param> public void RemoveItem(MabiItem item) { lock (_items) _items.Remove(item); var disappears = new MabiPacket(Op.ItemDisappears, Id.Broadcast); disappears.PutLong(item.Id); // Temp fix, because item's position might've changed by now... this.BroadcastRegion(disappears, item.Region); EventManager.EntityEvents.OnEntityLeavesRegion(item); item.Dispose(); }