private void AddItemToRepair_Implementation(MyFixedPoint amount, SerializableDefinitionId blueprintId, uint inventoryItemId, MyObjectBuilderType inventoryItemType, MyStringHash inventoryItemSubtypeId) { System.Diagnostics.Debug.Assert(amount > 0, "Adding zero or negative amount!"); MyBlueprintDefinitionBase blueprint = MyDefinitionManager.Static.GetBlueprintDefinition(blueprintId); if (blueprint == null) { System.Diagnostics.Debug.Fail("Couldn't find blueprint definition for: " + blueprintId); return; } Predicate <MyBlueprintToProduce> condition = x => (x is MyRepairBlueprintToProduce) && (x as MyRepairBlueprintToProduce).Blueprint == blueprint && (x as MyRepairBlueprintToProduce).InventoryItemId == inventoryItemId && (x as MyRepairBlueprintToProduce).InventoryItemType == inventoryItemType && (x as MyRepairBlueprintToProduce).InventoryItemSubtypeId == inventoryItemSubtypeId; MyRepairBlueprintToProduce itemToProduce = m_itemsToProduce.Find(condition) as MyRepairBlueprintToProduce; if (itemToProduce != null) { itemToProduce.Amount = itemToProduce.Amount + amount; } else { itemToProduce = new MyRepairBlueprintToProduce(amount, blueprint, inventoryItemId, inventoryItemType, inventoryItemSubtypeId); m_itemsToProduce.Add(itemToProduce); } var handler = ProductionChanged; if (handler != null) { handler(this, itemToProduce); } }
private void AddItemToRepair_Implementation(MyFixedPoint amount, SerializableDefinitionId blueprintId, uint inventoryItemId, MyObjectBuilderType inventoryItemType, MyStringHash inventoryItemSubtypeId) { System.Diagnostics.Debug.Assert(amount > 0, "Adding zero or negative amount!"); MyBlueprintDefinitionBase blueprint = MyDefinitionManager.Static.GetBlueprintDefinition(blueprintId); if (blueprint == null) { System.Diagnostics.Debug.Fail("Couldn't find blueprint definition for: " + blueprintId); return; } Predicate<MyBlueprintToProduce> condition = x => (x is MyRepairBlueprintToProduce) && (x as MyRepairBlueprintToProduce).Blueprint == blueprint && (x as MyRepairBlueprintToProduce).InventoryItemId == inventoryItemId && (x as MyRepairBlueprintToProduce).InventoryItemType == inventoryItemType && (x as MyRepairBlueprintToProduce).InventoryItemSubtypeId == inventoryItemSubtypeId; MyRepairBlueprintToProduce itemToProduce = m_itemsToProduce.Find(condition) as MyRepairBlueprintToProduce; if (itemToProduce != null) { itemToProduce.Amount = itemToProduce.Amount + amount; } else { itemToProduce = new MyRepairBlueprintToProduce(amount, blueprint, inventoryItemId, inventoryItemType, inventoryItemSubtypeId); m_itemsToProduce.Add(itemToProduce); } var handler = ProductionChanged; if (handler != null) { handler(this, itemToProduce); } }