diff --git a/Content.Client/Lathe/UI/LatheMenu.xaml.cs b/Content.Client/Lathe/UI/LatheMenu.xaml.cs index c5e99e1cb7..3c9406e95f 100644 --- a/Content.Client/Lathe/UI/LatheMenu.xaml.cs +++ b/Content.Client/Lathe/UI/LatheMenu.xaml.cs @@ -122,7 +122,11 @@ public sealed partial class LatheMenu : DefaultWindow else sb.Append('\n'); - sb.Append((int) (amount * component.MaterialUseMultiplier)); + var adjustedAmount = amount; + if (prototype.ApplyMaterialDiscount) + adjustedAmount = (int) (adjustedAmount * component.MaterialUseMultiplier); + + sb.Append(adjustedAmount); sb.Append(' '); sb.Append(proto.Name); } diff --git a/Content.Server/Lathe/LatheSystem.cs b/Content.Server/Lathe/LatheSystem.cs index 3eff78ca14..45e6e943fd 100644 --- a/Content.Server/Lathe/LatheSystem.cs +++ b/Content.Server/Lathe/LatheSystem.cs @@ -134,7 +134,11 @@ namespace Content.Server.Lathe foreach (var (mat, amount) in recipe.RequiredMaterials) { - _materialStorage.TryChangeMaterialAmount(uid, mat, (int) (-amount * component.MaterialUseMultiplier)); + var adjustedAmount = recipe.ApplyMaterialDiscount + ? (int) (-amount * component.MaterialUseMultiplier) + : -amount; + + _materialStorage.TryChangeMaterialAmount(uid, mat, adjustedAmount); } component.Queue.Add(recipe); diff --git a/Content.Shared/Lathe/SharedLatheSystem.cs b/Content.Shared/Lathe/SharedLatheSystem.cs index f009570fea..06001bf9d0 100644 --- a/Content.Shared/Lathe/SharedLatheSystem.cs +++ b/Content.Shared/Lathe/SharedLatheSystem.cs @@ -50,7 +50,11 @@ public abstract class SharedLatheSystem : EntitySystem foreach (var (material, needed) in recipe.RequiredMaterials) { - if (_materialStorage.GetMaterialAmount(component.Owner, material) < amount * needed * component.MaterialUseMultiplier) + var adjustedAmount = recipe.ApplyMaterialDiscount + ? (int) (amount * component.MaterialUseMultiplier) + : amount; + + if (_materialStorage.GetMaterialAmount(component.Owner, material) < adjustedAmount * needed) return false; } return true; diff --git a/Content.Shared/Research/Prototypes/LatheRecipePrototype.cs b/Content.Shared/Research/Prototypes/LatheRecipePrototype.cs index be6a0a62d2..af574b7305 100644 --- a/Content.Shared/Research/Prototypes/LatheRecipePrototype.cs +++ b/Content.Shared/Research/Prototypes/LatheRecipePrototype.cs @@ -11,7 +11,7 @@ namespace Content.Shared.Research.Prototypes public sealed class LatheRecipePrototype : IPrototype { [ViewVariables] - [IdDataFieldAttribute] + [IdDataField] public string ID { get; } = default!; [DataField("name")] @@ -42,7 +42,6 @@ namespace Content.Shared.Research.Prototypes { if (_name.Trim().Length != 0) return _name; var protoMan = IoCManager.Resolve(); - if (protoMan == null) return _description; protoMan.TryIndex(_result, out EntityPrototype? prototype); if (prototype?.Name != null) _name = prototype.Name; @@ -60,7 +59,6 @@ namespace Content.Shared.Research.Prototypes { if (_description.Trim().Length != 0) return _description; var protoMan = IoCManager.Resolve(); - if (protoMan == null) return _description; protoMan.TryIndex(_result, out EntityPrototype? prototype); if (prototype?.Description != null) _description = prototype.Description; @@ -98,5 +96,8 @@ namespace Content.Shared.Research.Prototypes /// [ViewVariables] public TimeSpan CompleteTime => _completeTime; + + [DataField("applyMaterialDiscount")] + public bool ApplyMaterialDiscount = true; } } diff --git a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml index 173d612841..a5880d4da2 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml @@ -160,7 +160,7 @@ dynamicRecipes: - LightTube - LightBulb - - SheetSteel + - SheetSteel #these sheet recipe costs don't scale with upgrades - SheetGlass1 - SheetRGlass - SheetPlastic diff --git a/Resources/Prototypes/Recipes/Lathes/sheet.yml b/Resources/Prototypes/Recipes/Lathes/sheet.yml index 5967a30ad7..6e8f477c3b 100644 --- a/Resources/Prototypes/Recipes/Lathes/sheet.yml +++ b/Resources/Prototypes/Recipes/Lathes/sheet.yml @@ -4,6 +4,7 @@ sprite: Objects/Materials/Sheets/metal.rsi state: steel result: SheetSteel1 + applyMaterialDiscount: false completetime: 2 materials: Steel: 100 @@ -24,6 +25,7 @@ sprite: Objects/Materials/Sheets/glass.rsi state: glass result: SheetGlass1 + applyMaterialDiscount: false completetime: 2 materials: Glass: 100 @@ -44,6 +46,7 @@ sprite: Objects/Materials/Sheets/glass.rsi state: rglass result: SheetRGlass1 + applyMaterialDiscount: false completetime: 2 materials: Glass: 100 @@ -129,6 +132,7 @@ sprite: Objects/Materials/Sheets/other.rsi state: plastic result: SheetPlastic1 + applyMaterialDiscount: false completetime: 2 materials: Plastic: 100