From cdc6716859c3749ae807365c7aa219f6ce468581 Mon Sep 17 00:00:00 2001 From: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Date: Sun, 18 Dec 2022 23:38:30 -0500 Subject: [PATCH] Printable drills and constructable thrusters (#12943) --- .../Shuttles/Components/ThrusterComponent.cs | 14 ++++- .../Shuttles/Systems/ThrusterSystem.cs | 16 ++++++ Resources/Locale/en-US/shuttles/thruster.ftl | 2 + .../Catalog/Research/technologies.yml | 7 ++- .../Circuitboards/Machine/production.yml | 26 +++++++++ .../Entities/Structures/Machines/lathe.yml | 4 ++ .../Structures/Shuttles/thrusters.yml | 56 ++++++++++++------- .../Prototypes/Recipes/Lathes/electronics.yml | 18 ++++++ Resources/Prototypes/Recipes/Lathes/tools.yml | 11 ++++ 9 files changed, 128 insertions(+), 26 deletions(-) diff --git a/Content.Server/Shuttles/Components/ThrusterComponent.cs b/Content.Server/Shuttles/Components/ThrusterComponent.cs index 855b928400..f4ce81de6a 100644 --- a/Content.Server/Shuttles/Components/ThrusterComponent.cs +++ b/Content.Server/Shuttles/Components/ThrusterComponent.cs @@ -1,5 +1,7 @@ using Content.Server.Shuttles.Systems; +using Content.Shared.Construction.Prototypes; using Content.Shared.Damage; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; namespace Content.Server.Shuttles.Components { @@ -41,8 +43,10 @@ namespace Content.Server.Shuttles.Components public bool IsOn; [ViewVariables(VVAccess.ReadWrite)] - [DataField("thrust")] - public float Thrust = 750f; + public float Thrust; + + [DataField("baseThrust"), ViewVariables(VVAccess.ReadWrite)] + public float BaseThrust = 750f; [DataField("thrusterType")] public ThrusterType Type = ThrusterType.Linear; @@ -68,6 +72,12 @@ namespace Content.Server.Shuttles.Components public List Colliding = new(); public bool Firing = false; + + [DataField("machinePartThrust", customTypeSerializer: typeof(PrototypeIdSerializer))] + public string MachinePartThrust = "Laser"; + + [DataField("partRatingThrustMultiplier")] + public float PartRatingThrustMultiplier = 1.5f; } public enum ThrusterType diff --git a/Content.Server/Shuttles/Systems/ThrusterSystem.cs b/Content.Server/Shuttles/Systems/ThrusterSystem.cs index ad025eb3b2..f05c4935c3 100644 --- a/Content.Server/Shuttles/Systems/ThrusterSystem.cs +++ b/Content.Server/Shuttles/Systems/ThrusterSystem.cs @@ -1,6 +1,7 @@ using System.Linq; using System.Runtime.CompilerServices; using Content.Server.Audio; +using Content.Server.Construction; using Content.Server.Power.Components; using Content.Server.Power.EntitySystems; using Content.Server.Shuttles.Components; @@ -58,6 +59,9 @@ namespace Content.Server.Shuttles.Systems SubscribeLocalEvent(OnThrusterExamine); + SubscribeLocalEvent(OnRefreshParts); + SubscribeLocalEvent(OnUpgradeExamine); + _mapManager.TileChanged += OnTileChange; } @@ -515,6 +519,18 @@ namespace Content.Server.Shuttles.Systems } } + private void OnRefreshParts(EntityUid uid, ThrusterComponent component, RefreshPartsEvent args) + { + var thrustRating = args.PartRatings[component.MachinePartThrust]; + + component.Thrust = component.BaseThrust * MathF.Pow(component.PartRatingThrustMultiplier, thrustRating - 1); + } + + private void OnUpgradeExamine(EntityUid uid, ThrusterComponent component, UpgradeExamineEvent args) + { + args.AddPercentageUpgrade("thruster-comp-upgrade-thrust", component.Thrust / component.BaseThrust); + } + #endregion [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/Resources/Locale/en-US/shuttles/thruster.ftl b/Resources/Locale/en-US/shuttles/thruster.ftl index 94035811c7..faed6e8dd2 100644 --- a/Resources/Locale/en-US/shuttles/thruster.ftl +++ b/Resources/Locale/en-US/shuttles/thruster.ftl @@ -3,3 +3,5 @@ thruster-comp-disabled = The thruster is turned [color=red]off[/color]. thruster-comp-nozzle-direction = The nozzle is facing [color=yellow]{$direction}[/color]. thruster-comp-nozzle-exposed = The nozzle [color=green]exposed[/color] to space. thruster-comp-nozzle-not-exposed = The nozzle [color=red]is not exposed[/color] to space. + +thruster-comp-upgrade-thrust = Thrust strength diff --git a/Resources/Prototypes/Catalog/Research/technologies.yml b/Resources/Prototypes/Catalog/Research/technologies.yml index ebd307aa1c..f6c1c3b0e3 100644 --- a/Resources/Prototypes/Catalog/Research/technologies.yml +++ b/Resources/Prototypes/Catalog/Research/technologies.yml @@ -239,7 +239,7 @@ - BasicResearch unlockedRecipes: - AppraisalTool -#TODO- MiningDrill + - MiningDrill - OreProcessorMachineCircuitboard - type: technology @@ -256,8 +256,8 @@ unlockedRecipes: - ShuttleConsoleCircuitboard - RadarConsoleCircuitboard -#TODO- Gyroscope -#TODO- Thruster + - ThrusterMachineCircuitboard + - GyroscopeMachineCircuitboard - type: technology name: technologies-ripley-technology @@ -359,6 +359,7 @@ unlockedRecipes: - RCD - RCDAmmo + - PowerDrill - SMESMachineCircuitboard - PowerComputerCircuitboard - GeneratorPlasmaMachineCircuitboard diff --git a/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/production.yml b/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/production.yml index bdaef2416c..970ae66ce3 100644 --- a/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/production.yml +++ b/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/production.yml @@ -449,6 +449,32 @@ materialRequirements: CableHV: 5 +- type: entity + id: ThrusterMachineCircuitboard + parent: BaseMachineCircuitboard + name: thruster machine board + components: + - type: MachineBoard + prototype: Thruster + requirements: + Laser: 4 + Capacitor: 1 + materialRequirements: + Steel: 5 + +- type: entity + id: GyroscopeMachineCircuitboard + parent: BaseMachineCircuitboard + name: gyroscope machine board + components: + - type: MachineBoard + prototype: Gyroscope + requirements: + ScanningModule: 2 + Capacitor: 1 + materialRequirements: + Glass: 2 + - type: entity id: GeneratorUraniumMachineCircuitboard parent: BaseMachineCircuitboard diff --git a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml index 3dddd25c35..464e9a83f8 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml @@ -167,6 +167,8 @@ - CableStack - CableMVStack - CableHVStack + - PowerDrill + - MiningDrill - ConveyorBeltAssembly - AppraisalTool - RCDAmmo @@ -300,6 +302,8 @@ - WallmountGeneratorAPUElectronics - WallmountSubstationElectronics - EmitterCircuitboard + - ThrusterMachineCircuitboard + - GyroscopeMachineCircuitboard - GasRecyclerMachineCircuitboard - SeedExtractorMachineCircuitboard - AnalysisComputerCircuitboard diff --git a/Resources/Prototypes/Entities/Structures/Shuttles/thrusters.yml b/Resources/Prototypes/Entities/Structures/Shuttles/thrusters.yml index da0ad12e37..6f4d4c05f4 100644 --- a/Resources/Prototypes/Entities/Structures/Shuttles/thrusters.yml +++ b/Resources/Prototypes/Entities/Structures/Shuttles/thrusters.yml @@ -44,9 +44,14 @@ - type: entity id: Thruster - parent: BaseThruster + parent: [ BaseThruster, ConstructibleMachine ] components: - type: Thruster + - type: Machine + board: ThrusterMachineCircuitboard + - type: UpgradePowerDraw + powerDrawMultiplier: 0.75 + scaling: Exponential - type: Sprite sprite: Structures/Shuttles/thruster.rsi layers: @@ -85,12 +90,13 @@ - type: entity id: Gyroscope - parent: BaseThruster + parent: [ BaseThruster, ConstructibleMachine ] components: - type: Thruster thrusterType: Angular requireSpace: false - thrust: 5000 + baseThrust: 5000 + machinePartThrust: ScanningModule - type: Sprite # Listen I'm not the biggest fan of the sprite but it was the most appropriate thing I could find. sprite: Structures/Shuttles/gyroscope.rsi @@ -114,28 +120,36 @@ autoRot: true offset: "0, 0.1" # shine from the top, not bottom of the computer color: "#4246b3" + - type: Machine + board: GyroscopeMachineCircuitboard + - type: UpgradePowerDraw + powerDrawMultiplier: 0.75 + scaling: Exponential - type: StaticPrice price: 2000 - type: entity id: DebugGyroscope - parent: Gyroscope + parent: BaseThruster suffix: DEBUG components: - - type: Thruster - requireSpace: false - - type: ApcPowerReceiver - needsPower: false - powerLoad: 0 - - type: Sprite - sprite: Structures/Shuttles/gyroscope.rsi - layers: - - state: base - map: ["enum.ThrusterVisualLayers.Base"] - - state: thrust - map: ["enum.ThrusterVisualLayers.ThrustOn"] - shader: unshaded - - state: thrust_burn_unshaded - map: ["enum.ThrusterVisualLayers.ThrustingUnshaded"] - shader: unshaded - offset: 0, 1 + - type: Thruster + thrusterType: Angular + requireSpace: false + baseThrust: 5000 + - type: ApcPowerReceiver + needsPower: false + powerLoad: 0 + - type: Sprite + sprite: Structures/Shuttles/gyroscope.rsi + snapCardinals: true + layers: + - state: base + map: ["enum.ThrusterVisualLayers.Base"] + - state: thrust + map: ["enum.ThrusterVisualLayers.ThrustOn"] + shader: unshaded + - state: thrust_burn_unshaded + map: ["enum.ThrusterVisualLayers.ThrustingUnshaded"] + shader: unshaded + offset: 0, 1 diff --git a/Resources/Prototypes/Recipes/Lathes/electronics.yml b/Resources/Prototypes/Recipes/Lathes/electronics.yml index d02671274b..54e5d7218a 100644 --- a/Resources/Prototypes/Recipes/Lathes/electronics.yml +++ b/Resources/Prototypes/Recipes/Lathes/electronics.yml @@ -491,6 +491,24 @@ Steel: 100 Glass: 900 +- type: latheRecipe + id: ThrusterMachineCircuitboard + icon: { sprite: Objects/Misc/module.rsi, state: id_mod } + result: ThrusterMachineCircuitboard + completetime: 4 + materials: + Steel: 100 + Glass: 900 + +- type: latheRecipe + id: GyroscopeMachineCircuitboard + icon: { sprite: Objects/Misc/module.rsi, state: id_mod } + result: GyroscopeMachineCircuitboard + completetime: 4 + materials: + Steel: 100 + Glass: 900 + - type: latheRecipe id: GasRecyclerMachineCircuitboard icon: { sprite: Objects/Misc/module.rsi, state: id_mod } diff --git a/Resources/Prototypes/Recipes/Lathes/tools.yml b/Resources/Prototypes/Recipes/Lathes/tools.yml index e81770937b..edd007dc6e 100644 --- a/Resources/Prototypes/Recipes/Lathes/tools.yml +++ b/Resources/Prototypes/Recipes/Lathes/tools.yml @@ -201,3 +201,14 @@ Steel: 650 Plastic: 150 Gold: 50 + +- type: latheRecipe + id: MiningDrill + icon: + sprite: Objects/Tools/handdrill.rsi + state: handdrill + result: MiningDrill + completetime: 3 + materials: + Steel: 500 + Plastic: 100