Skip to content

Commit

Permalink
Merge branch 'master' into 2024-09-21-CaveEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
whatston3 authored Sep 26, 2024
2 parents f1d549a + fe7b654 commit d533819
Show file tree
Hide file tree
Showing 5 changed files with 161 additions and 179 deletions.
14 changes: 14 additions & 0 deletions Content.Server/Shuttles/Components/ThrusterComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Content.Server.Shuttles.Systems;
using Content.Shared.Construction.Prototypes;
using Content.Shared.Damage;
using Content.Shared.DeviceLinking; // Frontier
using Robust.Shared.GameStates;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
Expand Down Expand Up @@ -72,6 +73,19 @@ public sealed partial class ThrusterComponent : Component
/// Frontier - Amount of charge this needs from an APC per second to function.
/// </summary>
public float OriginalLoad { get; set; } = 0;

/// <summary>
/// Frontier - Make linkable to buttons
/// </summary>
[DataField("onPort", customTypeSerializer: typeof(PrototypeIdSerializer<SinkPortPrototype>))] // Frontier
public string OnPort = "On"; // Frontier

[DataField("offPort", customTypeSerializer: typeof(PrototypeIdSerializer<SinkPortPrototype>))] // Frontier
public string OffPort = "Off"; // Frontier

[DataField("togglePort", customTypeSerializer: typeof(PrototypeIdSerializer<SinkPortPrototype>))] // Frontier
public string TogglePort = "Toggle"; // Frontier

}

public enum ThrusterType
Expand Down
35 changes: 31 additions & 4 deletions Content.Server/Shuttles/Systems/ThrusterSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using Robust.Shared.Utility;
using Content.Shared.Localizations;
using Content.Server.Construction; // Frontier
using Content.Server.DeviceLinking.Events; // Frontier

namespace Content.Server.Shuttles.Systems;

Expand Down Expand Up @@ -57,8 +58,36 @@ public override void Initialize()

SubscribeLocalEvent<ThrusterComponent, RefreshPartsEvent>(OnRefreshParts);
SubscribeLocalEvent<ThrusterComponent, UpgradeExamineEvent>(OnUpgradeExamine);
SubscribeLocalEvent<ThrusterComponent, SignalReceivedEvent>(OnSignalReceived); // Frontier
}

// Frontier: signal handler
private void OnSignalReceived(EntityUid uid, ThrusterComponent component, ref SignalReceivedEvent args)
{
if (args.Port == component.OffPort)
component.Enabled = false;
else if (args.Port == component.OnPort)
component.Enabled = true;
else if (args.Port == component.TogglePort)
component.Enabled ^= true;
else
return; // Invalid port, don't change the thruster.

if (!component.Enabled)
{
if (TryComp<ApcPowerReceiverComponent>(uid, out var apcPower) && component.OriginalLoad != 0 && apcPower.Load != 1)
apcPower.Load = 1;
DisableThruster(uid, component);
}
else if (CanEnable(uid, component))
{
if (TryComp<ApcPowerReceiverComponent>(uid, out var apcPower) && component.OriginalLoad != apcPower.Load)
apcPower.Load = component.OriginalLoad;
EnableThruster(uid, component);
}
}
// End Frontier: signal handler

private void OnThrusterExamine(EntityUid uid, ThrusterComponent component, ExaminedEvent args)
{
// Powered is already handled by other power components
Expand Down Expand Up @@ -141,17 +170,15 @@ private void OnActivateThruster(EntityUid uid, ThrusterComponent component, Acti

if (!component.Enabled)
{
if (TryComp<ApcPowerReceiverComponent>(uid, out var apcPower) && component.OriginalLoad != 0) // Frontier
apcPower.Load = 1; // Frontier

if (TryComp<ApcPowerReceiverComponent>(uid, out var apcPower) && component.OriginalLoad != 0 && apcPower.Load != 1) // Frontier
apcPower.Load = 1; // Frontier
DisableThruster(uid, component);
args.Handled = true;
}
else if (CanEnable(uid, component))
{
if (TryComp<ApcPowerReceiverComponent>(uid, out var apcPower) && component.OriginalLoad != apcPower.Load) // Frontier
apcPower.Load = component.OriginalLoad; // Frontier

EnableThruster(uid, component);
args.Handled = true;
}
Expand Down
14 changes: 14 additions & 0 deletions Resources/Changelog/Changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7349,3 +7349,17 @@ Entries:
message: Added Bahama Mama's, an alternative POI to Tinnia's Rest.
id: 5319
time: '2024-09-25T17:35:04.0000000+00:00'
- author: spacedwarf14
changes:
- type: Add
message: >-
Thruster can now be switched on and off with remote buttons, switches,
levers and signalers.
id: 5320
time: '2024-09-25T22:48:50.0000000+00:00'
- author: dustylens
changes:
- type: Tweak
message: updated Bazaar with directional fans, fuel locker and atmos update.
id: 5321
time: '2024-09-25T22:53:57.0000000+00:00'
Loading

0 comments on commit d533819

Please sign in to comment.