private void Process(Client client, ClientContainerRemoveItem msg) { var container = state.history.container.GetOrAddNew(msg.ownerGuid); container.items.Remove(msg.itemGuid); SendToAll(client.peer, msg); }
public static void RemoveItem(Pickupable pickupable, GameObject owner) { if (Multiplayer.main.blocked) { return; } var res = new ClientContainerRemoveItem(); res.ownerGuid = GuidHelper.Get(owner); res.itemGuid = GuidHelper.Get(pickupable.gameObject); res.tech = pickupable.GetTechType(); res.position = owner.transform.position; Multiplayer.main.Send(res); }
private void Process(ClientContainerRemoveItem msg) { var owner = GuidHelper.Find(msg.ownerGuid); var container = Helpers.GetItemsContainer(owner); if (container == null) { FindRemoteInventory(msg.ownerGuid)?.Remove(msg.itemGuid); return; } var pickupable = GuidHelper.FindComponent <Pickupable>(msg.itemGuid); if (pickupable == null) { return; } using (new MessageBlocker()) { container.RemoveItem(pickupable, true); } }