static void OnAddQueueItemRequest(ProductionBlockSync sync, ref AddQueueItemMsg msg, MyNetworkClient sender) { var blueprint = MyDefinitionManager.Static.GetBlueprintDefinition(msg.Blueprint); Debug.Assert(blueprint != null, "Blueprint not present in the dictionary."); if (blueprint != null) { sync.Block.InsertQueueItem(msg.Idx, blueprint, msg.Amount); Sync.Layer.SendMessageToAll(ref msg, MyTransportMessageEnum.Success); } }
/// <summary> /// idx - index to insert (-1 = last) /// </summary> public void AddQueueItemRequest(MyBlueprintDefinitionBase blueprint, MyFixedPoint amount, int idx = -1) { Debug.Assert(idx != -2, "No longer supported."); var msg = new AddQueueItemMsg(); msg.Idx = idx; msg.Blueprint = blueprint.Id; msg.Amount = amount; msg.ProductionEntityId = Block.EntityId; Sync.Layer.SendMessageToServer(ref msg); }
public void AddQueueItemAnnounce(MyBlueprintDefinitionBase blueprint, MyFixedPoint amount, int idx = -1) { Debug.Assert(idx != -2, "No longer supported."); Debug.Assert(Sync.IsServer); var msg = new AddQueueItemMsg(); msg.Idx = idx; msg.Blueprint = blueprint.Id; msg.Amount = amount; msg.ProductionEntityId = Block.EntityId; Sync.Layer.SendMessageToAll(ref msg, MyTransportMessageEnum.Success); }
static void OnAddQueueItemSuccess(ProductionBlockSync sync, ref AddQueueItemMsg msg, MyNetworkClient sender) { sync.Block.InsertQueueItem(msg.Idx, MyDefinitionManager.Static.GetBlueprintDefinition(msg.Blueprint), msg.Amount); }