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

Раундстартовые газы #184

Merged
merged 3 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Vonsant marked this conversation as resolved.
Show resolved Hide resolved
}
}
/// 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);
Vonsant marked this conversation as resolved.
Show resolved Hide resolved
}
}
/// 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);
Vonsant marked this conversation as resolved.
Show resolved Hide resolved
}
}
// 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
Loading