Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…-station-14 into barge-guidebook
  • Loading branch information
whatston3 committed Sep 30, 2024
2 parents af4f4a8 + 08cbef0 commit bf2a760
Show file tree
Hide file tree
Showing 11 changed files with 177 additions and 43 deletions.
3 changes: 0 additions & 3 deletions Content.Server/Power/EntitySystems/BatterySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,6 @@ public bool IsFull(EntityUid uid, BatteryComponent? battery = null)
if (!Resolve(uid, ref battery))
return false;

// If the battery is full, remove its charging component.
RemComp<ChargingComponent>(uid); // Frontier: Upstream - #28984

return battery.CurrentCharge / battery.MaxCharge >= 0.99f;
}
}
Expand Down
47 changes: 33 additions & 14 deletions Content.Server/Power/EntitySystems/ChargerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public override void Update(float frameTime)
var query = EntityQueryEnumerator<ChargingComponent>(); // Frontier: Upstream - #28984
while (query.MoveNext(out var uid, out var charging)) // Frontier: Upstream - #28984
{
if (!HasComp<ChargerComponent>(charging.ChargerUid)) // Frontier: Upstream - #28984
if (!TryComp<ChargerComponent>(charging.ChargerUid, out var charger)) // Frontier: Upstream - #28984
continue;

if (charging.ChargerComponent.Status == CellChargerStatus.Off || charging.ChargerComponent.Status == CellChargerStatus.Empty) // Frontier: Upstream - #28984
Expand All @@ -135,7 +135,20 @@ public override void Update(float frameTime)

if (Math.Abs(battery.MaxCharge - battery.CurrentCharge) < 0.01)
StopChargingBattery(charging.ChargerUid, charging.ChargerComponent, uid);
TransferPower(charging.ChargerUid, uid, charging.ChargerComponent, frameTime);

// Frontier: we already have the battery separated (it is what charges)
// so we will charge the battery ourselves, instead of finding it
// again through TransferPower
_battery.TrySetCharge(uid, battery.CurrentCharge + charger.ChargeRate * frameTime, battery); // Frontier: Upstream - #28984
// Just so the sprite won't be set to 99.99999% visibility
if (battery.MaxCharge - battery.CurrentCharge < 0.01)
{
_battery.TrySetCharge(uid, battery.MaxCharge, battery); // Frontier: Upstream - #28984
}

UpdateStatus(uid, charger);

//TransferPower(charging.ChargerUid, uid, charging.ChargerComponent, frameTime);
// Frontier: Upstream - #28984 End
}
}
Expand All @@ -153,15 +166,21 @@ private void OnInserted(EntityUid uid, ChargerComponent component, EntInsertedIn
if (args.Container.ID != component.SlotId)
return;

StartChargingBattery(uid, component, args.Entity); // Frontier: Upstream - #28984
if (!SearchForBattery(args.Entity, out var batteryEntity, out _)) // Frontier: fixing #28984
return; // Frontier

StartChargingBattery(uid, component, batteryEntity.Value); // Frontier: Upstream - #28984
}

private void OnRemoved(EntityUid uid, ChargerComponent component, EntRemovedFromContainerMessage args)
{
if (args.Container.ID != component.SlotId)
return;

StopChargingBattery(uid, component, args.Entity); // Frontier: Upstream - #28984
if (!SearchForBattery(args.Entity, out var batteryEntity, out _)) // Frontier: fixing #28984
return; // Frontier

StopChargingBattery(uid, component, batteryEntity.Value); // Frontier: Upstream - #28984
}

/// <summary>
Expand Down Expand Up @@ -225,19 +244,19 @@ private void UpdateStatus(EntityUid uid, ChargerComponent component)
switch (component.Status)
{
case CellChargerStatus.Off:
receiver.Load = 0;
receiver.Load = 1;
_appearance.SetData(uid, CellVisual.Light, CellChargerStatus.Off, appearance);
break;
case CellChargerStatus.Empty:
receiver.Load = 0;
receiver.Load = 1;
_appearance.SetData(uid, CellVisual.Light, CellChargerStatus.Empty, appearance);
break;
case CellChargerStatus.Charging:
receiver.Load = component.ChargeRate; //does not scale with multiple slotted batteries
_appearance.SetData(uid, CellVisual.Light, CellChargerStatus.Charging, appearance);
break;
case CellChargerStatus.Charged:
receiver.Load = 0;
receiver.Load = 1;
_appearance.SetData(uid, CellVisual.Light, CellChargerStatus.Charged, appearance);
break;
default:
Expand All @@ -260,10 +279,10 @@ private void OnEmpPulse(EntityUid uid, ChargerComponent component, ref EmpPulseE

foreach (var containedEntity in container.ContainedEntities)
{
if (!SearchForBattery(containedEntity, out _, out _))
if (!SearchForBattery(containedEntity, out var batteryEntity, out _))
continue;

StopChargingBattery(uid, component, containedEntity);
StopChargingBattery(uid, component, batteryEntity.Value);
}
}

Expand All @@ -276,10 +295,10 @@ private void OnEmpDisabledRemoved(EntityUid uid, ChargerComponent component, ref

foreach (var containedEntity in container.ContainedEntities)
{
if (!SearchForBattery(containedEntity, out _, out _))
if (!SearchForBattery(containedEntity, out var batteryEntity, out _))
continue;

StartChargingBattery(uid, component, containedEntity);
StartChargingBattery(uid, component, batteryEntity.Value);
}
}

Expand Down Expand Up @@ -308,15 +327,15 @@ private CellChargerStatus GetStatus(EntityUid uid, ChargerComponent component) /
foreach (var containedEntity in container.ContainedEntities)
{
// if none of the slotted items are actually batteries, represent the charger as off
if (!SearchForBattery(containedEntity, out _, out _))
if (!SearchForBattery(containedEntity, out var batteryEntity, out _))
continue;

// if all batteries are either EMP'd or fully charged, represent the charger as fully charged
statusOut = CellChargerStatus.Charged;
if (HasComp<EmpDisabledComponent>(containedEntity))
if (HasComp<EmpDisabledComponent>(batteryEntity))
continue;

if (!HasComp<ChargingComponent>(containedEntity))
if (!HasComp<ChargingComponent>(batteryEntity))
continue;

// if we have atleast one battery being charged, represent the charger as charging;
Expand Down
6 changes: 6 additions & 0 deletions Resources/Changelog/Frontier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4162,3 +4162,9 @@ Entries:
meters.
id: 5349
time: '2024-09-29T15:08:36.0000000+00:00'
- author: whatston3
changes:
- type: Fix
message: Cyborgs should now recharge properly in cyborg recharge stations.
id: 5350
time: '2024-09-30T14:39:40.0000000+00:00'
1 change: 1 addition & 0 deletions Resources/Locale/en-US/_NF/guidebook/guides.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ guide-entry-shipyard-garden = Garden
guide-entry-shipyard-gasbender = Gasbender
guide-entry-shipyard-gourd = Gourd
guide-entry-shipyard-hammer = Hammer
guide-entry-shipyard-hauler = Hauler
guide-entry-shipyard-harbormaster = Harbormaster
guide-entry-shipyard-investigator = Investigator
guide-entry-shipyard-kestrel = Kestrel
Expand Down
5 changes: 0 additions & 5 deletions Resources/Maps/_NF/Outpost/frontier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31944,39 +31944,34 @@ entities:
- uid: 1310
components:
- type: Transform
rot: 1.5707963267948966 rad
pos: 10.5,9.5
parent: 2173
- proto: SignNanotrasen2
entities:
- uid: 4308
components:
- type: Transform
rot: 1.5707963267948966 rad
pos: 11.5,9.5
parent: 2173
- proto: SignNanotrasen3
entities:
- uid: 4309
components:
- type: Transform
rot: 1.5707963267948966 rad
pos: 12.5,9.5
parent: 2173
- proto: SignNanotrasen4
entities:
- uid: 4310
components:
- type: Transform
rot: 1.5707963267948966 rad
pos: 13.5,9.5
parent: 2173
- proto: SignNanotrasen5
entities:
- uid: 4311
components:
- type: Transform
rot: 1.5707963267948966 rad
pos: 14.5,9.5
parent: 2173
- proto: SignPrison
Expand Down
6 changes: 6 additions & 0 deletions Resources/Prototypes/_NF/Guidebook/shipyard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- ShipyardGasbender
- ShipyardGourd
- ShipyardHammer
- ShipyardHauler
- ShipyardHarbormaster
- ShipyardInvestigator
- ShipyardKestrel
Expand Down Expand Up @@ -135,6 +136,11 @@
name: guide-entry-shipyard-hammer
text: "/ServerInfo/_NF/Guidebook/Shipyard/Hammer.xml"

- type: guideEntry
id: ShipyardHauler
name: guide-entry-shipyard-hauler
text: "/ServerInfo/_NF/Guidebook/Shipyard/Hauler.xml"

- type: guideEntry
id: ShipyardInvestigator
name: guide-entry-shipyard-investigator
Expand Down
38 changes: 26 additions & 12 deletions Resources/Prototypes/_NF/Guidebook/shuttle_maps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,18 @@
state: harbormaster
scale: 1.2, 1.2

- type: entity
parent: PosterBase
id: ShuttleMapHauler
name: "NC Hauler"
description: "Detailed map of a Hauler shuttle."
categories: [ HideSpawnMenu ]
components:
- type: Sprite
sprite: _NF/Guidebook/shuttle_maps/128x96.rsi
state: hauler
scale: 1.2, 1.2

- type: entity
parent: PosterBase
id: ShuttleMapInvestigator
Expand Down Expand Up @@ -298,23 +310,12 @@
state: searchlight
scale: 1.2, 1.2

- type: entity
parent: PosterBase
id: ShuttleMapVagabond
name: "NT Vagabond"
description: "Detailed map of a Vagabond shuttle."
categories: [ HideSpawnMenu ]
components:
- type: Sprite
sprite: _NF/Guidebook/shuttle_maps/128x96.rsi
state: vagabond
scale: 1.2, 1.2

- type: entity
parent: PosterBase
id: ShuttleMapSpirit
name: "NM Spirit"
description: "Detailed map of a Spirit shuttle."
categories: [ HideSpawnMenu ]
components:
- type: Sprite
sprite: _NF/Guidebook/shuttle_maps/128x96.rsi
Expand All @@ -326,8 +327,21 @@
id: ShuttleMapStasis
name: "NM Stasis"
description: "Detailed map of a Stasis shuttle."
categories: [ HideSpawnMenu ]
components:
- type: Sprite
sprite: _NF/Guidebook/shuttle_maps/128x96.rsi
state: stasis
scale: 1.2, 1.2

- type: entity
parent: PosterBase
id: ShuttleMapVagabond
name: "NT Vagabond"
description: "Detailed map of a Vagabond shuttle."
categories: [ HideSpawnMenu ]
components:
- type: Sprite
sprite: _NF/Guidebook/shuttle_maps/128x96.rsi
state: vagabond
scale: 1.2, 1.2
2 changes: 1 addition & 1 deletion Resources/Prototypes/_NF/Shipyard/hauler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
category: Medium
group: Shipyard
shuttlePath: /Maps/_NF/Shuttles/hauler.yml
guidebookPage: Null
guidebookPage: ShipyardHauler
class:
- Cargo
- Salvage
Expand Down
93 changes: 93 additions & 0 deletions Resources/ServerInfo/_NF/Guidebook/Shipyard/Hauler.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<Document>
# HAULER-CLASS SALVAGE SHUTTLE
<Box>
<GuideEntityEmbed Entity="CrateTradeSecureHighFilled" Caption="trading crate"/>
<GuideEntityEmbed Entity="CrateGenericSteel" Caption="mystery loot"/>
<GuideEntityEmbed Entity="OreProcessor"/>
</Box>
<Box>
<GuideEntityEmbed Entity="ShuttleMapHauler" Caption=""/>
</Box>
[color=#a4885c]Ship Size:[/color] Medium

[color=#a4885c]Recommended Crew:[/color] 2-4

[color=#a4885c]Power Gen Type:[/color] Uranium

[color=#a4885c]Expeditions:[/color] None

[color=#a4885c]IFF Console:[/color] None

"A medium sized vessel specializing in long-haul salvage, mining, and cargo operations."

# PREFLIGHT CHECKLIST

## 1. Power supply

## 1.1. Battery units
<Box>
<GuideEntityEmbed Entity="SMESBasic"/>
<GuideEntityEmbed Entity="SubstationBasic"/>
<GuideEntityEmbed Entity="APCBasic"/>
</Box>

- Check that the substation unit is anchored to the floor.
- Check that all APC units' Main Breakers are toggled on.
- Check the APC unit's current Load* (W).

## 1.2. S.U.P.E.R.P.A.C.M.A.N. generator unit
<Box>
<GuideEntityEmbed Entity="PortableGeneratorSuperPacman"/>
<GuideEntityEmbed Entity="SheetUranium"/>
<GuideEntityEmbed Entity="SignRadiationMed"/>
</Box>

- Check that the S.U.P.E.R.P.A.C.M.A.N. generator unit is anchored to the floor.
- Check that the S.U.P.E.R.P.A.C.M.A.N. generator unit has fuel. For extended flights make sure that you have enough fuel stockpiled to sustain prolonged power generation during flight.
- Check that the S.U.P.E.R.P.A.C.M.A.N. generator unit is set to HV output.
- Set Target Power for 30-35[bold]**[/bold] [bold]kW[/bold].
- Start the S.U.P.E.R.P.A.C.M.A.N. generator unit.

## 2. Atmospherics

## 2.1. Distribution Loop
<Box>
<GuideEntityEmbed Entity="GasPort"/>
<GuideEntityEmbed Entity="OxygenCanister"/>
<GuideEntityEmbed Entity="NitrogenCanister"/>
<GuideEntityEmbed Entity="GasMixer"/>
<GuideEntityEmbed Entity="GasPressurePump"/>
</Box>

- Check that the O2 canister is anchored to connector port.
- Check that the N2 canister is anchored to connector port.
- Check that the gas mixer is set to the correct mixing ratio (21% Oxygen, 79% Nitrogen).
- Check that the gas mixer is set to 101kPa.
- Enable gas mixer.

## 2.2. Waste Loop
<Box>
<GuideEntityEmbed Entity="GasPressurePump"/>
<GuideEntityEmbed Entity="AirAlarm"/>
</Box>

- Locate the release valve leading to the passive ventilation duct located on the back exterior of the ship and make sure it is open. The release valve can be found inside the back airlock leading up to the ship exterior.

## 3. Other checks
<Box>
<GuideEntityEmbed Entity="Gyroscope"/>
<GuideEntityEmbed Entity="GravityGeneratorMini"/>
</Box>

- Check if the gyroscope is anchored, powered, and enabled. It can be found adjacent to your engine.
- Check if the mini gravity generator is anchored, powered, and enabled inside the engine room.

## Sidenotes

* - Hauler-class salvage ships are equipped with three APC units that can be used to appraise the ship's total power consumption. Unmodified Hauler-class ships require ~27 kW of power to remain operational.

** - Hauler-class salvage ships have higher power demand than a standard P.A.C.M.A.N. can provide at optimal settings, and come equipped with a S.U.P.E.R.P.A.C.M.A.N. instead. Please note that the recommended Target Power value to avoid blackouts during Gravity Generator charging sequence is 35 kW.

[bold]Note:[/bold] Without a working generator, fully charged battery units (SMES and substation) can provide power in a stock Hauler for approximately 5 minutes.

</Document>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit bf2a760

Please sign in to comment.