Skip to content

Commit

Permalink
Раундстартовые газы (#184)
Browse files Browse the repository at this point in the history
* AutoPipes

* AutoPipesFix

* Update Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs

Co-authored-by: FN <[email protected]>

---------

Co-authored-by: FN <[email protected]>
  • Loading branch information
Vonsant and FireNameFN authored Dec 23, 2024
1 parent 80eb8ac commit 9af89d3
Show file tree
Hide file tree
Showing 10 changed files with 123 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,10 @@ public sealed partial class GasPressurePumpComponent : Component
[ViewVariables(VVAccess.ReadWrite)]
[DataField("maxTargetPressure")]
public float MaxTargetPressure = Atmospherics.MaxOutputPressure;

/// Corvax-Next-AutoPipes-Start
[DataField]
public bool StartOnMapInit { get; set; } = false;
/// Corvax-Next-AutoPipes-End
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,10 @@ public sealed partial class GasVolumePumpComponent : Component

[DataField("lastMolesTransferred")]
public float LastMolesTransferred;

/// Corvax-Next-AutoPipes-Start
[DataField]
public bool StartOnMapInit { get; set; } = false;
/// Corvax-Next-AutoPipes-End
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public override void Initialize()
// Bound UI subscriptions
SubscribeLocalEvent<GasPressurePumpComponent, GasPressurePumpChangeOutputPressureMessage>(OnOutputPressureChangeMessage);
SubscribeLocalEvent<GasPressurePumpComponent, GasPressurePumpToggleStatusMessage>(OnToggleStatusMessage);

SubscribeLocalEvent<GasPressurePumpComponent, MapInitEvent>(OnMapInit); // Corvax-Next-AutoPipes
}

private void OnInit(EntityUid uid, GasPressurePumpComponent pump, ComponentInit args)
Expand Down Expand Up @@ -165,5 +167,19 @@ private void UpdateAppearance(EntityUid uid, GasPressurePumpComponent? pump = nu
bool pumpOn = pump.Enabled && (TryComp<ApcPowerReceiverComponent>(uid, out var power) && power.Powered);
_appearance.SetData(uid, PumpVisuals.Enabled, pumpOn, appearance);
}

/// Corvax-Next-AutoPipes-Start
private void OnMapInit(EntityUid uid, GasPressurePumpComponent pump, MapInitEvent args)
{
if (pump.StartOnMapInit)
{
pump.Enabled = true;
UpdateAppearance(uid, pump);

DirtyUI(uid, pump);
_userInterfaceSystem.CloseUi(uid, GasPressurePumpUiKey.Key);
}
}
/// Corvax-Next-AutoPipes-End
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public override void Initialize()
SubscribeLocalEvent<GasVolumePumpComponent, GasVolumePumpToggleStatusMessage>(OnToggleStatusMessage);

SubscribeLocalEvent<GasVolumePumpComponent, DeviceNetworkPacketEvent>(OnPacketRecv);

SubscribeLocalEvent<GasVolumePumpComponent, MapInitEvent>(OnMapInit); // Corvax-Next-AutoPipes
}

private void OnInit(EntityUid uid, GasVolumePumpComponent pump, ComponentInit args)
Expand Down Expand Up @@ -218,5 +220,19 @@ private void OnPacketRecv(EntityUid uid, GasVolumePumpComponent component, Devic
return;
}
}

/// Corvax-Next-AutoPipes-Start
private void OnMapInit(EntityUid uid, GasVolumePumpComponent pump, MapInitEvent args)
{
if (pump.StartOnMapInit)
{
pump.Enabled = true;
UpdateAppearance(uid, pump);

DirtyUI(uid, pump);
_userInterfaceSystem.CloseUi(uid, GasVolumePumpUiKey.Key);
}
}
/// Corvax-Next-AutoPipes-End
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,10 @@ public sealed partial class GasMixerComponent : Component
[ViewVariables(VVAccess.ReadWrite)]
[DataField("inletTwoConcentration")]
public float InletTwoConcentration = 0.5f;

/// Corvax-Next-AutoPipes-Start
[DataField]
public bool StartOnMapInit { get; set; } = false;
/// Corvax-Next-AutoPipes-Start
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public override void Initialize()
SubscribeLocalEvent<GasMixerComponent, GasMixerToggleStatusMessage>(OnToggleStatusMessage);

SubscribeLocalEvent<GasMixerComponent, AtmosDeviceDisabledEvent>(OnMixerLeaveAtmosphere);

SubscribeLocalEvent<GasMixerComponent, MapInitEvent>(OnMapInit); // Corvax-Next-AutoPipes
}

private void OnInit(EntityUid uid, GasMixerComponent mixer, ComponentInit args)
Expand Down Expand Up @@ -235,5 +237,19 @@ private void OnMixerAnalyzed(EntityUid uid, GasMixerComponent component, GasAnal

args.DeviceFlipped = inletOne != null && inletTwo != null && inletOne.CurrentPipeDirection.ToDirection() == inletTwo.CurrentPipeDirection.ToDirection().GetClockwise90Degrees();
}

// Corvax-Next-AutoPipes-Start
private void OnMapInit(EntityUid uid, GasMixerComponent mixer, MapInitEvent args) // Frontier - Init on map
{
if (mixer.StartOnMapInit)
{
mixer.Enabled = true;
DirtyUI(uid, mixer);

UpdateAppearance(uid, mixer);
_userInterfaceSystem.CloseUi(uid, GasFilterUiKey.Key);
}
}
// Corvax-Next-AutoPipes-End
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ent-GasPressurePumpOn = { ent-GasPressurePump }
.desc = { ent-GasPressurePump.desc }
.suffix = ВКЛ
ent-GasPressurePumpOnMax = { ent-GasPressurePump }
.desc = { ent-GasPressurePump.desc }
.suffix = ВКЛ, 4500
ent-GasVolumePumpOn = { ent-GasVolumePump }
.desc = { ent-GasVolumePump.desc }
.suffix = ВКЛ
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ent-GasMixerOn = { ent-GasMixer }
.desc = { ent-GasMixer.desc }
.suffix = ВКЛ
ent-GasMixerOnFlipped = { ent-GasMixerFlipped }
.desc = { ent-GasMixerFlipped.desc }
.suffix = ВКЛ, Перевёрнутый
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
- type: entity
parent: GasPressurePump
id: GasPressurePumpOn
suffix: On
placement:
mode: SnapgridCenter
components:
- type: GasPressurePump
startOnMapInit: true

- type: entity
parent: GasPressurePumpOn
id: GasPressurePumpOnMax
suffix: On, Max
placement:
mode: SnapgridCenter
components:
- type: GasPressurePump
targetPressure: 4500

- type: entity
parent: GasVolumePump
id: GasVolumePumpOn
suffix: On
placement:
mode: SnapgridCenter
components:
- type: GasVolumePump
startOnMapInit: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
- type: entity
parent: GasMixer
id: GasMixerOn
suffix: On
placement:
mode: SnapgridCenter
components:
- type: GasMixer
startOnMapInit: true

- type: entity
parent: [GasMixerFlipped, GasMixerOn]
id: GasMixerOnFlipped
suffix: On, Flipped
placement:
mode: SnapgridCenter

0 comments on commit 9af89d3

Please sign in to comment.