Пример #1
0
 private QueueItem DeserializeQueueItem(MyObjectBuilder_ProductionBlock.QueueItem itemOb)
 {
     QueueItem item = new QueueItem();
     
     item.Amount = itemOb.Amount;
     // Try to get the blueprint by its definition ID
     if (MyDefinitionManager.Static.HasBlueprint(itemOb.Id))
     {
         item.Blueprint = MyDefinitionManager.Static.GetBlueprintDefinition(itemOb.Id);
     }
     // Otherwise, we're dealing with an old save, so we get the blueprint by the result's definition ID
     else
     {
         item.Blueprint = MyDefinitionManager.Static.TryGetBlueprintDefinitionByResultId(itemOb.Id);
     }
     item.ItemId = itemOb.ItemId.HasValue ? itemOb.ItemId.Value : NextItemId;
     return item;
 }
 public ProductionBlockEntity(CubeGridEntity parent, MyObjectBuilder_ProductionBlock definition)
     : base(parent, definition)
 {
     m_inputInventory = new InventoryEntity(definition.InputInventory);
     m_outputInventory = new InventoryEntity(definition.OutputInventory);
 }
 public ProductionBlockEntity(CubeGridEntity parent, MyObjectBuilder_ProductionBlock definition, Object backingObject)
     : base(parent, definition, backingObject)
 {
     m_inputInventory = new InventoryEntity(definition.InputInventory, InternalGetInputInventory());
     m_outputInventory = new InventoryEntity(definition.OutputInventory, InternalGetOutputInventory());
 }
 public ProductionQueueItem(MyObjectBuilder_ProductionBlock.QueueItem q)
 {
     Amount = q.Amount;
     Id = q.Id;
     ItemId = q.ItemId.GetValueOrDefault(0);
 }