From 853be3a0c4409454687717cca041a035e2d3d441 Mon Sep 17 00:00:00 2001 From: Dvir <39403717+dvir001@users.noreply.github.com> Date: Sat, 3 Feb 2024 19:52:17 +0200 Subject: [PATCH] Shuttle Generators (#846) * Dont forget the fuel * Generator * Generator * Update mccargo.yml * Enable magnet toggle * Removed * Split magnet * Update portable_generator.yml --- .../Generator/PortableGeneratorSystem.cs | 10 ++- .../Power/Generator/FuelGeneratorComponent.cs | 2 +- .../SharedPortableGeneratorComponent.cs | 8 +- .../Power/Generation/portable_generator.yml | 81 +++++++++++++++++++ 4 files changed, 98 insertions(+), 3 deletions(-) create mode 100644 Resources/Prototypes/_NF/Entities/Structures/Power/Generation/portable_generator.yml diff --git a/Content.Server/Power/Generator/PortableGeneratorSystem.cs b/Content.Server/Power/Generator/PortableGeneratorSystem.cs index 1180665ad12..8eb756133a2 100644 --- a/Content.Server/Power/Generator/PortableGeneratorSystem.cs +++ b/Content.Server/Power/Generator/PortableGeneratorSystem.cs @@ -1,4 +1,4 @@ -using Content.Server.DoAfter; +using Content.Server.DoAfter; using Content.Server.Popups; using Content.Shared.DoAfter; using Content.Shared.Power.Generator; @@ -38,6 +38,14 @@ public override void Initialize() SubscribeLocalEvent(GeneratorSwitchOutputMessage); SubscribeLocalEvent(OnSwitchPowerCheck); + + SubscribeLocalEvent(GeneratorMapInit); // Frontier + } + + private void GeneratorMapInit(EntityUid uid, PortableGeneratorComponent component, MapInitEvent args) // Frontier - Init on map generator + { + if (component.StartOnMapInit) + _generator.SetFuelGeneratorOn(uid, true); } private void GeneratorSwitchOutputMessage(EntityUid uid, PortableGeneratorComponent component, PortableGeneratorSwitchOutputMessage args) diff --git a/Content.Shared/Power/Generator/FuelGeneratorComponent.cs b/Content.Shared/Power/Generator/FuelGeneratorComponent.cs index cdf97fb0859..4f245060382 100644 --- a/Content.Shared/Power/Generator/FuelGeneratorComponent.cs +++ b/Content.Shared/Power/Generator/FuelGeneratorComponent.cs @@ -1,4 +1,4 @@ -using Robust.Shared.GameStates; +using Robust.Shared.GameStates; namespace Content.Shared.Power.Generator; diff --git a/Content.Shared/Power/Generator/SharedPortableGeneratorComponent.cs b/Content.Shared/Power/Generator/SharedPortableGeneratorComponent.cs index 5b83ff1a906..d8a2b5fdeb8 100644 --- a/Content.Shared/Power/Generator/SharedPortableGeneratorComponent.cs +++ b/Content.Shared/Power/Generator/SharedPortableGeneratorComponent.cs @@ -1,4 +1,4 @@ -using Robust.Shared.Audio; +using Robust.Shared.Audio; using Robust.Shared.Serialization; namespace Content.Shared.Power.Generator; @@ -42,6 +42,12 @@ public sealed partial class PortableGeneratorComponent : Component [DataField("startSoundEmpty")] [ViewVariables(VVAccess.ReadWrite)] public SoundSpecifier? StartSoundEmpty { get; set; } + + /// + /// Frontier - Start the generator with the map. + /// + [DataField("startOnMapInit")] + public bool StartOnMapInit { get; set; } = false; } /// diff --git a/Resources/Prototypes/_NF/Entities/Structures/Power/Generation/portable_generator.yml b/Resources/Prototypes/_NF/Entities/Structures/Power/Generation/portable_generator.yml new file mode 100644 index 00000000000..ce051b598de --- /dev/null +++ b/Resources/Prototypes/_NF/Entities/Structures/Power/Generation/portable_generator.yml @@ -0,0 +1,81 @@ +# +# You can use this Desmos sheet to calculate fuel burn rate values: +# https://www.desmos.com/calculator/qcektq5dqs +# + +- type: entity + parent: PortableGeneratorPacman + id: PortableGeneratorPacmanShuttle + suffix: Plasma, 15 kW, Ship + components: + - type: FuelGenerator + on: true + minTargetPower: 1000 + maxTargetPower: 25000 + targetPower: 15000 + optimalPower: 15000 + # 45 minutes at max output + optimalBurnRate: 0.011111 + # a decent curve + fuelEfficiencyConstant: 0.95 + - type: Transform + anchored: true + - type: MaterialStorage + storageLimit: 3000 + materialWhiteList: [Plasma] + storage: + Plasma: 3000 + - type: PortableGenerator + startOnMapInit: true + +- type: entity + parent: PortableGeneratorSuperPacman + id: PortableGeneratorSuperPacmanShuttle + suffix: Uranium, 30 kW, Ship + components: + - type: FuelGenerator + on: true + minTargetPower: 5000 + maxTargetPower: 50000 + targetPower: 30000 + optimalPower: 30000 + # 45 minutes at full power + optimalBurnRate: 0.0111111 + # still decent power curve + fuelEfficiencyConstant: 0.75 + - type: Transform + anchored: true + - type: MaterialStorage + storageLimit: 3000 + materialWhiteList: [Uranium] + storage: + Uranium: 3000 + - type: PortableGenerator + startOnMapInit: true + +- type: entity + parent: PortableGeneratorJrPacman + id: PortableGeneratorJrPacmanShuttle + suffix: Welding Fuel, 5 kW, Ship + components: + - type: FuelGenerator + on: true + targetPower: 2000 + minTargetPower: 1000 + optimalPower: 5000 + maxTargetPower: 15000 + # 7.5 minutes at full tank. + optimalBurnRate: 0.11111111 + # Shallow curve + fuelEfficiencyConstant: 0.5 + - type: Transform + anchored: true + - type: SolutionContainerManager + solutions: + tank: + maxVol: 50 + reagents: + - ReagentId: WeldingFuel + Quantity: 50 + - type: PortableGenerator + startOnMapInit: true