diff --git a/Content.Server/Lathe/LatheSystem.cs b/Content.Server/Lathe/LatheSystem.cs index d76f9a31686..741a21fc3b8 100644 --- a/Content.Server/Lathe/LatheSystem.cs +++ b/Content.Server/Lathe/LatheSystem.cs @@ -3,6 +3,7 @@ using Content.Server.Administration.Logs; using Content.Server.Atmos; using Content.Server.Atmos.EntitySystems; +using Content.Server.Construction; using Content.Server.Lathe.Components; using Content.Server.Materials; using Content.Server.Power.Components; @@ -59,6 +60,10 @@ public override void Initialize() SubscribeLocalEvent(OnGetRecipes); SubscribeLocalEvent(GetEmagLatheRecipes); SubscribeLocalEvent(OnHeatStartPrinting); + + //Frontier Upgrade Code Restore + SubscribeLocalEvent(OnPartsRefresh); + SubscribeLocalEvent(OnUpgradeExamine); } public override void Update(float frameTime) @@ -348,5 +353,22 @@ private void OnLatheSyncRequestMessage(EntityUid uid, LatheComponent component, UpdateUserInterfaceState(uid, component); } #endregion + + //Frontier Upgrade Code Restore + private void OnPartsRefresh(EntityUid uid, LatheComponent component, RefreshPartsEvent args) + { + var printTimeRating = args.PartRatings[component.MachinePartPrintSpeed]; + var materialUseRating = args.PartRatings[component.MachinePartMaterialUse]; + + component.TimeMultiplier = MathF.Pow(component.PartRatingPrintTimeMultiplier, printTimeRating - 1); + component.MaterialUseMultiplier = MathF.Pow(component.PartRatingMaterialUseMultiplier, materialUseRating - 1); + Dirty(component); + } + + private void OnUpgradeExamine(EntityUid uid, LatheComponent component, UpgradeExamineEvent args) + { + args.AddPercentageUpgrade("lathe-component-upgrade-speed", 1 / component.TimeMultiplier); + args.AddPercentageUpgrade("lathe-component-upgrade-material-use", component.MaterialUseMultiplier); + } } } diff --git a/Content.Shared/Lathe/LatheComponent.cs b/Content.Shared/Lathe/LatheComponent.cs index e1110777dc0..5f0da4ba1ae 100644 --- a/Content.Shared/Lathe/LatheComponent.cs +++ b/Content.Shared/Lathe/LatheComponent.cs @@ -62,6 +62,31 @@ public sealed partial class LatheComponent : Component public const float DefaultPartRatingMaterialUseMultiplier = 0.85f; #endregion + + //Frontier Upgrade Code Restore + /// + /// The machine part that reduces how long it takes to print a recipe. + /// + [DataField] + public ProtoId MachinePartPrintSpeed = "Manipulator"; + + /// + /// The value that is used to calculate the modified + /// + [DataField] + public float PartRatingPrintTimeMultiplier = 0.5f; + + /// + /// The machine part that reduces how much material it takes to print a recipe. + /// + [DataField] + public ProtoId MachinePartMaterialUse = "MatterBin"; + + /// + /// The value that is used to calculate the modifier + /// + [DataField] + public float PartRatingMaterialUseMultiplier = DefaultPartRatingMaterialUseMultiplier; } public sealed class LatheGetRecipesEvent : EntityEventArgs