private static void AddItemsInternal(AddItemsMsg msg) { IMyInventoryOwner owner = MyEntities.GetEntityById(msg.OwnerEntityId) as IMyInventoryOwner; MyInventory inv = owner.GetInventory(msg.InventoryIndex); inv.AddItemsInternal(msg.Amount, msg.Item, msg.itemIdx); }
static void OnAddItemsSuccess(ref AddItemsMsg msg, MyNetworkClient sender) { if (!MyEntities.EntityExists(msg.OwnerEntityId)) { return; } AddItemsInternal(msg); }
static void OnAddItemsRequest(ref AddItemsMsg msg, MyNetworkClient sender) { if (!MyEntities.EntityExists(msg.OwnerEntityId)) { return; } IMyInventoryOwner owner = MyEntities.GetEntityById(msg.OwnerEntityId) as IMyInventoryOwner; owner.GetInventory(msg.InventoryIndex).AddItems(msg.Amount, msg.Item, msg.itemIdx); }
public void SendAddItemsRequest(MyInventory inv, int index, MyFixedPoint amount, MyObjectBuilder_PhysicalObject objectBuilder) { Debug.Assert(inv.Owner != null, "Inventory must have owner to be able to add items synchronously!"); var msg = new AddItemsMsg(); msg.OwnerEntityId = inv.Owner.EntityId; msg.InventoryIndex = inv.InventoryIdx; msg.itemIdx = index; msg.Item = objectBuilder; msg.Amount = amount; Sync.Layer.SendMessageToServer(ref msg, MyTransportMessageEnum.Request); }
private static void AddItemsInternal(AddItemsMsg msg) { IMyInventoryOwner owner = MyEntities.GetEntityById(msg.OwnerEntityId) as IMyInventoryOwner; MyInventory inv = owner.GetInventory(msg.InventoryIndex); inv.AddItemsInternal(msg.Amount, msg.Item, msg.itemIdx); }
static void OnAddItemsSuccess(ref AddItemsMsg msg, MyNetworkClient sender) { if (!MyEntities.EntityExists(msg.OwnerEntityId)) return; AddItemsInternal(msg); }
static void OnAddItemsRequest(ref AddItemsMsg msg, MyNetworkClient sender) { if (!MyEntities.EntityExists(msg.OwnerEntityId)) return; IMyInventoryOwner owner = MyEntities.GetEntityById(msg.OwnerEntityId) as IMyInventoryOwner; owner.GetInventory(msg.InventoryIndex).AddItems(msg.Amount, msg.Item, msg.itemIdx); }
public void SendAddItemsRequest(MyInventory inv, int index, MyFixedPoint amount, MyObjectBuilder_PhysicalObject objectBuilder) { Debug.Assert(inv.Owner != null, "Inventory must have owner to be able to add items synchronously!"); var msg = new AddItemsMsg(); msg.OwnerEntityId = inv.Owner.EntityId; msg.InventoryIndex = inv.InventoryIdx; msg.itemIdx = index; msg.Item = objectBuilder; msg.Amount = amount; Sync.Layer.SendMessageToServer(ref msg, MyTransportMessageEnum.Request); }