static void OnRemoveQueueItemSuccess(ProductionBlockSync sync, ref RemoveQueueItemMsg msg, MyNetworkClient sender) { if (!RemoveQueueItemTests(sync, msg)) { return; } OnRemoveQueueItemInternal(sync, msg); }
static void OnRemoveQueueItemRequest(ProductionBlockSync sync, ref RemoveQueueItemMsg msg, MyNetworkClient sender) { if (!RemoveQueueItemTests(sync, msg)) { return; } OnRemoveQueueItemInternal(sync, msg); Sync.Layer.SendMessageToAll(msg, MyTransportMessageEnum.Success); }
private static void OnRemoveQueueItemInternal(ProductionBlockSync sync, RemoveQueueItemMsg msg) { if (msg.Idx >= 0) { sync.Block.RemoveQueueItem(msg.Idx); } else { sync.Block.RemoveFirstQueueItem(msg.Amount, msg.CurrentProgress); } }
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); } }
private static bool RemoveQueueItemTests(ProductionBlockSync sync, RemoveQueueItemMsg msg) { Debug.Assert(msg.Idx != -2, "No longer supported."); if (sync == null) { MySandboxGame.Log.WriteLine("Queue sync object is null!"); return(false); } if (sync != null && sync.Block == null) { MySandboxGame.Log.WriteLine("Block of queue sync object is null!"); return(false); } if (!sync.Block.m_queue.IsValidIndex(msg.Idx) && msg.Idx != -1) { MySandboxGame.Log.WriteLine("Invalid queue index in the remove item message!"); return(false); } return(true); }
private static void OnRemoveQueueItemInternal(ProductionBlockSync sync, RemoveQueueItemMsg msg) { if (msg.Idx >= 0) sync.Block.RemoveQueueItem(msg.Idx); else sync.Block.RemoveFirstQueueItem(msg.Amount, msg.CurrentProgress); }
private static bool RemoveQueueItemTests(ProductionBlockSync sync, RemoveQueueItemMsg msg) { Debug.Assert(msg.Idx != -2, "No longer supported."); if (sync == null) { MySandboxGame.Log.WriteLine("Queue sync object is null!"); return false; } if (sync != null && sync.Block == null) { MySandboxGame.Log.WriteLine("Block of queue sync object is null!"); return false; } if (!sync.Block.m_queue.IsValidIndex(msg.Idx) && msg.Idx != -1) { MySandboxGame.Log.WriteLine("Invalid queue index in the remove item message!"); return false; } return true; }
static void OnRemoveQueueItemSuccess(ProductionBlockSync sync, ref RemoveQueueItemMsg msg, MyNetworkClient sender) { if (!RemoveQueueItemTests(sync, msg)) return; OnRemoveQueueItemInternal(sync, msg); }
static void OnRemoveQueueItemRequest(ProductionBlockSync sync, ref RemoveQueueItemMsg msg, MyNetworkClient sender) { if (!RemoveQueueItemTests(sync, msg)) return; OnRemoveQueueItemInternal(sync, msg); Sync.Layer.SendMessageToAll(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); }
static void OnMoveQueueItemSuccess(ProductionBlockSync sync, ref MoveQueueItemMsg msg, MyNetworkClient sender) { sync.Block.MoveQueueItem(msg.SrcItemId, msg.DstIdx); }