Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shuttle Generators #846

Merged
merged 12 commits into from
Feb 3, 2024
10 changes: 9 additions & 1 deletion Content.Server/Power/Generator/PortableGeneratorSystem.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -38,6 +38,14 @@ public override void Initialize()
SubscribeLocalEvent<PortableGeneratorComponent, PortableGeneratorSwitchOutputMessage>(GeneratorSwitchOutputMessage);

SubscribeLocalEvent<FuelGeneratorComponent, SwitchPowerCheckEvent>(OnSwitchPowerCheck);

SubscribeLocalEvent<PortableGeneratorComponent, MapInitEvent>(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)
Expand Down
2 changes: 1 addition & 1 deletion Content.Shared/Power/Generator/FuelGeneratorComponent.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Robust.Shared.GameStates;
using Robust.Shared.GameStates;

namespace Content.Shared.Power.Generator;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Robust.Shared.Audio;
using Robust.Shared.Audio;
using Robust.Shared.Serialization;

namespace Content.Shared.Power.Generator;
Expand Down Expand Up @@ -42,6 +42,12 @@ public sealed partial class PortableGeneratorComponent : Component
[DataField("startSoundEmpty")]
[ViewVariables(VVAccess.ReadWrite)]
public SoundSpecifier? StartSoundEmpty { get; set; }

/// <summary>
/// Frontier - Start the generator with the map.
/// </summary>
[DataField("startOnMapInit")]
public bool StartOnMapInit { get; set; } = false;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Loading