From 19e9654faa071f31c77e313367a6da116667d34a Mon Sep 17 00:00:00 2001 From: joshepvodka Date: Tue, 31 Oct 2023 18:43:34 -0300 Subject: [PATCH 01/24] substation wear added --- .../Power/Components/SubstationComponent.cs | 16 +++ .../Power/EntitySystems/SubstationSystem.cs | 113 ++++++++++++++++++ .../Entities/Structures/Power/substation.yml | 1 + 3 files changed, 130 insertions(+) create mode 100644 Content.Server/Power/Components/SubstationComponent.cs create mode 100644 Content.Server/Power/EntitySystems/SubstationSystem.cs diff --git a/Content.Server/Power/Components/SubstationComponent.cs b/Content.Server/Power/Components/SubstationComponent.cs new file mode 100644 index 00000000000000..90e956add85cbd --- /dev/null +++ b/Content.Server/Power/Components/SubstationComponent.cs @@ -0,0 +1,16 @@ +using Content.Server.Power.NodeGroups; +using Robust.Shared.Audio; + +namespace Content.Server.Power.Components; + +[RegisterComponent] +public sealed partial class SubstationComponent : Component +{ + + [DataField("integrity")] + public float Integrity = 100.0f; + + [DataField("enabled")] + public bool Enabled = true; + +} diff --git a/Content.Server/Power/EntitySystems/SubstationSystem.cs b/Content.Server/Power/EntitySystems/SubstationSystem.cs new file mode 100644 index 00000000000000..aa1e92cff66a3f --- /dev/null +++ b/Content.Server/Power/EntitySystems/SubstationSystem.cs @@ -0,0 +1,113 @@ +using System; +using System.Diagnostics.SymbolStore; +using System.Security.Cryptography; +using System.Security.Permissions; +using Content.Server.Power.Components; +using Content.Server.Power.Pow3r; +using Content.Shared.Access.Components; +using Content.Shared.Access.Systems; +using Content.Shared.Emag.Components; +using Content.Shared.Emag.Systems; +using Content.Shared.Examine; +using Robust.Server.GameObjects; +using Robust.Shared.GameObjects; +using Robust.Shared.Timing; + +namespace Content.Server.Power.EntitySystems; + +public sealed class SubstationSystem : EntitySystem +{ + + [Dependency] private readonly IGameTiming _gameTiming = default!; + + private bool _substationWearEnabled = true; + private const int _defaultSubstationWearTimeout = 300000; //5 minutes + private float _substationWearCoeficient = 1 / 300000; + + public override void Initialize() + { + base.Initialize(); + + UpdatesAfter.Add(typeof(PowerNetSystem)); + + SubscribeLocalEvent(OnSubstationInit); + SubscribeLocalEvent(OnExamine); + SubscribeLocalEvent(OnEmagged); + } + + private void OnSubstationInit(EntityUid uid, SubstationComponent component, MapInitEvent args) + {} + + private void OnExamine(EntityUid uid, SubstationComponent component, ExaminedEvent args) + { + if (args.IsInDetailsRange) + { + if(component.Enabled) + { + var integrityPercentRounded = (int) (component.Integrity); + args.PushMarkup( + Loc.GetString( + "substation-component-examine-integrity", + ("percent", integrityPercentRounded), + ("markupPercentColor", "green") + ) + ); + } + else + { + args.PushMarkup( + Loc.GetString( + "substation-component-examine-malfunction" + ) + ); + } + } + } + + public override void Update(float deltaTime) + { + if(!_substationWearEnabled) + return; + + var query = EntityQueryEnumerator(); + while (query.MoveNext(out var uid, out var subs, out var battery)) + { + + if(subs.Integrity > 0.0f && subs.Enabled) { + var wear = battery.CurrentSupply * deltaTime * _substationWearCoeficient; + subs.Integrity -= wear; + + if(subs.Integrity <= 0.0f) { + ShutdownSubstation(uid, subs, battery); + _substationWearEnabled = false; + Timer.Spawn(_defaultSubstationWearTimeout, EnableSubstationWear); + } + } + } + } + + private void EnableSubstationWear() + { + _substationWearEnabled = true; + }} + + private void OnEmagged(EntityUid uid, SubstationComponent comp, ref GotEmaggedEvent args) + { + args.Handled = true; + TryComp(uid, out var battery); + ShutdownSubstation(uid, comp, battery); + } + + private void ShutdownSubstation(EntityUid uid, SubstationComponent? subs=null, PowerNetworkBatteryComponent? battery=null) + { + if (!Resolve(uid, ref subs, ref battery, false)) + return; + subs.Enabled = false; + subs.Integrity = 0.0f; + battery.Enabled = false; + battery.CanCharge = false; + battery.CanDischarge = false; + RemComp(uid); + } + +} \ No newline at end of file diff --git a/Resources/Prototypes/Entities/Structures/Power/substation.yml b/Resources/Prototypes/Entities/Structures/Power/substation.yml index bd3dcc4b8cac6f..2dabd9ac91e26c 100644 --- a/Resources/Prototypes/Entities/Structures/Power/substation.yml +++ b/Resources/Prototypes/Entities/Structures/Power/substation.yml @@ -214,6 +214,7 @@ id: SubstationBasic suffix: Basic, 2.5MJ components: + - type: Substation - type: Battery maxCharge: 2500000 startingCharge: 2500000 From 670358d35d5f5f303d6861edd3a79434bb076c50 Mon Sep 17 00:00:00 2001 From: joshepvodka Date: Tue, 31 Oct 2023 23:30:39 -0300 Subject: [PATCH 02/24] removed emag --- .../Power/EntitySystems/SubstationSystem.cs | 44 +++++++------------ .../power/components/substation-component.ftl | 7 +++ 2 files changed, 22 insertions(+), 29 deletions(-) create mode 100644 Resources/Locale/en-US/power/components/substation-component.ftl diff --git a/Content.Server/Power/EntitySystems/SubstationSystem.cs b/Content.Server/Power/EntitySystems/SubstationSystem.cs index aa1e92cff66a3f..c74bb397673996 100644 --- a/Content.Server/Power/EntitySystems/SubstationSystem.cs +++ b/Content.Server/Power/EntitySystems/SubstationSystem.cs @@ -1,28 +1,21 @@ -using System; -using System.Diagnostics.SymbolStore; -using System.Security.Cryptography; -using System.Security.Permissions; using Content.Server.Power.Components; -using Content.Server.Power.Pow3r; -using Content.Shared.Access.Components; using Content.Shared.Access.Systems; -using Content.Shared.Emag.Components; -using Content.Shared.Emag.Systems; -using Content.Shared.Examine; using Robust.Server.GameObjects; -using Robust.Shared.GameObjects; -using Robust.Shared.Timing; +using Robust.Shared.Timing; +using Content.Shared.Examine; + namespace Content.Server.Power.EntitySystems; public sealed class SubstationSystem : EntitySystem { + [Dependency] private readonly AccessReaderSystem _accessReader = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; private bool _substationWearEnabled = true; private const int _defaultSubstationWearTimeout = 300000; //5 minutes - private float _substationWearCoeficient = 1 / 300000; + private float _substationWearCoeficient = 300000; public override void Initialize() { @@ -32,11 +25,13 @@ public override void Initialize() SubscribeLocalEvent(OnSubstationInit); SubscribeLocalEvent(OnExamine); - SubscribeLocalEvent(OnEmagged); } private void OnSubstationInit(EntityUid uid, SubstationComponent component, MapInitEvent args) - {} + { + component.Enabled = true; + component.Integrity = 100.0f; + } private void OnExamine(EntityUid uid, SubstationComponent component, ExaminedEvent args) { @@ -66,21 +61,19 @@ private void OnExamine(EntityUid uid, SubstationComponent component, ExaminedEve public override void Update(float deltaTime) { - if(!_substationWearEnabled) - return; - var query = EntityQueryEnumerator(); while (query.MoveNext(out var uid, out var subs, out var battery)) { - - if(subs.Integrity > 0.0f && subs.Enabled) { - var wear = battery.CurrentSupply * deltaTime * _substationWearCoeficient; + if(subs.Integrity > 0.0f && subs.Enabled) + { + var wear = battery.CurrentSupply * deltaTime / _substationWearCoeficient; subs.Integrity -= wear; - if(subs.Integrity <= 0.0f) { + if(subs.Integrity <= 0.0f) + { ShutdownSubstation(uid, subs, battery); _substationWearEnabled = false; - Timer.Spawn(_defaultSubstationWearTimeout, EnableSubstationWear); + //Timer.Spawn(_defaultSubstationWearTimeout, EnableSubstationWear); } } } @@ -89,13 +82,6 @@ public override void Update(float deltaTime) private void EnableSubstationWear() { _substationWearEnabled = true; - }} - - private void OnEmagged(EntityUid uid, SubstationComponent comp, ref GotEmaggedEvent args) - { - args.Handled = true; - TryComp(uid, out var battery); - ShutdownSubstation(uid, comp, battery); } private void ShutdownSubstation(EntityUid uid, SubstationComponent? subs=null, PowerNetworkBatteryComponent? battery=null) diff --git a/Resources/Locale/en-US/power/components/substation-component.ftl b/Resources/Locale/en-US/power/components/substation-component.ftl new file mode 100644 index 00000000000000..dab83ec6a826e3 --- /dev/null +++ b/Resources/Locale/en-US/power/components/substation-component.ftl @@ -0,0 +1,7 @@ + +### UI + +# Shown when the substation is examined in details range +substation-component-examine-integrity = The substation is at [color={$markupPercentColor}]{$percent}%[/color] integrity. +substation-component-examine-malfunction = The substation is [color=red]malfunctioning[/color]. + From d985825cdff285406b51b000a60c102015dc069e Mon Sep 17 00:00:00 2001 From: joshepvodka Date: Sat, 4 Nov 2023 19:30:32 -0300 Subject: [PATCH 03/24] fixed timer and added VVrw --- .../Power/Components/SubstationComponent.cs | 8 ++- .../Power/EntitySystems/SubstationSystem.cs | 55 ++++++++++++------- 2 files changed, 41 insertions(+), 22 deletions(-) diff --git a/Content.Server/Power/Components/SubstationComponent.cs b/Content.Server/Power/Components/SubstationComponent.cs index 90e956add85cbd..f3fcdf96d508e8 100644 --- a/Content.Server/Power/Components/SubstationComponent.cs +++ b/Content.Server/Power/Components/SubstationComponent.cs @@ -7,10 +7,12 @@ namespace Content.Server.Power.Components; public sealed partial class SubstationComponent : Component { - [DataField("integrity")] + [DataField("Integrity")] + [ViewVariables(VVAccess.ReadWrite)] public float Integrity = 100.0f; - [DataField("enabled")] - public bool Enabled = true; + [DataField("DecayEnabled")] + [ViewVariables(VVAccess.ReadWrite)] + public bool DecayEnabled = true; } diff --git a/Content.Server/Power/EntitySystems/SubstationSystem.cs b/Content.Server/Power/EntitySystems/SubstationSystem.cs index c74bb397673996..b3b9abcaa491be 100644 --- a/Content.Server/Power/EntitySystems/SubstationSystem.cs +++ b/Content.Server/Power/EntitySystems/SubstationSystem.cs @@ -1,6 +1,7 @@ using Content.Server.Power.Components; using Content.Shared.Access.Systems; using Robust.Server.GameObjects; +using Content.Shared.Rejuvenate; using Robust.Shared.Timing; using Content.Shared.Examine; @@ -13,9 +14,10 @@ public sealed class SubstationSystem : EntitySystem [Dependency] private readonly AccessReaderSystem _accessReader = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; - private bool _substationWearEnabled = true; - private const int _defaultSubstationWearTimeout = 300000; //5 minutes - private float _substationWearCoeficient = 300000; + private bool _substationDecayEnabled = true; + private const int _defaultSubstationDecayTimeout = 300; //5 minute + private float _substationDecayCoeficient = 300000; + private float _substationDecayTimer; public override void Initialize() { @@ -25,19 +27,17 @@ public override void Initialize() SubscribeLocalEvent(OnSubstationInit); SubscribeLocalEvent(OnExamine); + SubscribeLocalEvent(OnRejuvenate); } private void OnSubstationInit(EntityUid uid, SubstationComponent component, MapInitEvent args) - { - component.Enabled = true; - component.Integrity = 100.0f; - } + {} private void OnExamine(EntityUid uid, SubstationComponent component, ExaminedEvent args) { if (args.IsInDetailsRange) { - if(component.Enabled) + if(component.Integrity > 0.0f) { var integrityPercentRounded = (int) (component.Integrity); args.PushMarkup( @@ -61,34 +61,39 @@ private void OnExamine(EntityUid uid, SubstationComponent component, ExaminedEve public override void Update(float deltaTime) { + if(!_substationDecayEnabled) + { + _substationDecayTimer -= deltaTime; + if(_substationDecayTimer <= 0.0f) + { + _substationDecayTimer = 0.0f; + _substationDecayEnabled = true; + } + return; + } + var query = EntityQueryEnumerator(); while (query.MoveNext(out var uid, out var subs, out var battery)) { - if(subs.Integrity > 0.0f && subs.Enabled) + if(subs.DecayEnabled && subs.Integrity >= 0.0f) { - var wear = battery.CurrentSupply * deltaTime / _substationWearCoeficient; - subs.Integrity -= wear; + var decay = battery.CurrentSupply * deltaTime / _substationDecayCoeficient; + subs.Integrity -= decay; if(subs.Integrity <= 0.0f) { ShutdownSubstation(uid, subs, battery); - _substationWearEnabled = false; - //Timer.Spawn(_defaultSubstationWearTimeout, EnableSubstationWear); + _substationDecayTimer = _defaultSubstationDecayTimeout; + _substationDecayEnabled = false; } } } } - private void EnableSubstationWear() - { - _substationWearEnabled = true; - } - private void ShutdownSubstation(EntityUid uid, SubstationComponent? subs=null, PowerNetworkBatteryComponent? battery=null) { if (!Resolve(uid, ref subs, ref battery, false)) return; - subs.Enabled = false; subs.Integrity = 0.0f; battery.Enabled = false; battery.CanCharge = false; @@ -96,4 +101,16 @@ private void ShutdownSubstation(EntityUid uid, SubstationComponent? subs=null, P RemComp(uid); } + private void OnRejuvenate(EntityUid uid, SubstationComponent subs, RejuvenateEvent args) + { + TryComp(uid, out var battery); + if(battery == null) + return; + subs.Integrity = 100.0f; + battery.Enabled = true; + battery.CanCharge = true; + battery.CanDischarge = true; + AddComp(uid); + } + } \ No newline at end of file From 89196cf31ce25ba890eb91b19511e96ae47aa6c6 Mon Sep 17 00:00:00 2001 From: joshepvodka Date: Sat, 4 Nov 2023 19:35:23 -0300 Subject: [PATCH 04/24] added component to all substations --- Resources/Prototypes/Entities/Structures/Power/substation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/Prototypes/Entities/Structures/Power/substation.yml b/Resources/Prototypes/Entities/Structures/Power/substation.yml index 2dabd9ac91e26c..4e9f1da9185ecf 100644 --- a/Resources/Prototypes/Entities/Structures/Power/substation.yml +++ b/Resources/Prototypes/Entities/Structures/Power/substation.yml @@ -17,6 +17,7 @@ shader: unshaded - state: full shader: unshaded + - type: Substation - type: UpgradeBattery maxChargeMultiplier: 2 baseMaxCharge: 2500000 @@ -214,7 +215,6 @@ id: SubstationBasic suffix: Basic, 2.5MJ components: - - type: Substation - type: Battery maxCharge: 2500000 startingCharge: 2500000 From ff93fc9f5bc9a23d7de2f3364148d32e5dc94eda Mon Sep 17 00:00:00 2001 From: joshepvodka Date: Wed, 8 Nov 2023 17:36:51 -0300 Subject: [PATCH 05/24] blinking lights and screen change --- .../Substation/SubstationVisualsComponent.cs | 13 +++ .../Substation/SubstationVisualsSystem.cs | 22 +++++ .../Power/Components/SubstationComponent.cs | 10 +- .../Power/EntitySystems/SubstationSystem.cs | 90 +++++++++++++++++- .../Substation/SharedSubstationComponent.cs | 17 ++++ .../Entities/Structures/Power/substation.yml | 24 ++++- .../Structures/Power/substation.rsi/meta.json | 28 +++++- .../{screen.png => screen0.png} | Bin .../Power/substation.rsi/screen1.png | Bin 0 -> 501 bytes .../Power/substation.rsi/screen2.png | Bin 0 -> 467 bytes 10 files changed, 192 insertions(+), 12 deletions(-) create mode 100644 Content.Client/Power/Substation/SubstationVisualsComponent.cs create mode 100644 Content.Client/Power/Substation/SubstationVisualsSystem.cs create mode 100644 Content.Shared/Power/Substation/SharedSubstationComponent.cs rename Resources/Textures/Structures/Power/substation.rsi/{screen.png => screen0.png} (100%) create mode 100644 Resources/Textures/Structures/Power/substation.rsi/screen1.png create mode 100644 Resources/Textures/Structures/Power/substation.rsi/screen2.png diff --git a/Content.Client/Power/Substation/SubstationVisualsComponent.cs b/Content.Client/Power/Substation/SubstationVisualsComponent.cs new file mode 100644 index 00000000000000..d5044c8d4b4673 --- /dev/null +++ b/Content.Client/Power/Substation/SubstationVisualsComponent.cs @@ -0,0 +1,13 @@ +using Content.Shared.Power.Substation; + +namespace Content.Client.Power.Substation; + +[RegisterComponent] +public sealed partial class SubstationVisualsComponent : Component +{ + [DataField("screenLayer")] + public string LayerMap { get; private set; } = string.Empty; + + [DataField("integrityStates")] + public Dictionary IntegrityStates = new(); +} diff --git a/Content.Client/Power/Substation/SubstationVisualsSystem.cs b/Content.Client/Power/Substation/SubstationVisualsSystem.cs new file mode 100644 index 00000000000000..4dbc3e4c3a9a56 --- /dev/null +++ b/Content.Client/Power/Substation/SubstationVisualsSystem.cs @@ -0,0 +1,22 @@ +using Robust.Shared.GameObjects; +using Robust.Client.GameObjects; +using Robust.Client.Graphics; +using Content.Shared.Power.Substation; + +namespace Content.Client.Power.Substation; + +public sealed class SubstationVisualsSystem : VisualizerSystem +{ + protected override void OnAppearanceChange(EntityUid uid, SubstationVisualsComponent component, ref AppearanceChangeEvent args) + { + if (args.Sprite == null || !args.Sprite.LayerMapTryGet(component.LayerMap, out var layer)) + return; + + if(args.AppearanceData.TryGetValue(SubstationVisuals.Screen, out var stateObject) + && stateObject is SubstationIntegrityState + && component.IntegrityStates.TryGetValue((SubstationIntegrityState)stateObject, out var state)) + { + args.Sprite.LayerSetState(layer, new RSI.StateId(state)); + } + } +} diff --git a/Content.Server/Power/Components/SubstationComponent.cs b/Content.Server/Power/Components/SubstationComponent.cs index f3fcdf96d508e8..17889942e92e25 100644 --- a/Content.Server/Power/Components/SubstationComponent.cs +++ b/Content.Server/Power/Components/SubstationComponent.cs @@ -1,5 +1,4 @@ -using Content.Server.Power.NodeGroups; -using Robust.Shared.Audio; +using Content.Shared.Power.Substation; namespace Content.Server.Power.Components; @@ -7,12 +6,15 @@ namespace Content.Server.Power.Components; public sealed partial class SubstationComponent : Component { - [DataField("Integrity")] + [DataField("integrity")] [ViewVariables(VVAccess.ReadWrite)] public float Integrity = 100.0f; - [DataField("DecayEnabled")] + [DataField("decayEnabled")] [ViewVariables(VVAccess.ReadWrite)] public bool DecayEnabled = true; + + [ViewVariables(VVAccess.ReadWrite)] + public SubstationIntegrityState State = SubstationIntegrityState.Healthy; } diff --git a/Content.Server/Power/EntitySystems/SubstationSystem.cs b/Content.Server/Power/EntitySystems/SubstationSystem.cs index b3b9abcaa491be..8227e792268b9e 100644 --- a/Content.Server/Power/EntitySystems/SubstationSystem.cs +++ b/Content.Server/Power/EntitySystems/SubstationSystem.cs @@ -1,11 +1,11 @@ +using Robust.Server.GameObjects; +using Robust.Shared.Timing; using Content.Server.Power.Components; +using Content.Shared.Power.Substation; using Content.Shared.Access.Systems; -using Robust.Server.GameObjects; using Content.Shared.Rejuvenate; -using Robust.Shared.Timing; using Content.Shared.Examine; - namespace Content.Server.Power.EntitySystems; public sealed class SubstationSystem : EntitySystem @@ -13,12 +13,20 @@ public sealed class SubstationSystem : EntitySystem [Dependency] private readonly AccessReaderSystem _accessReader = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; + [Dependency] private readonly PointLightSystem _lightSystem = default!; + [Dependency] private readonly SharedPointLightSystem _sharedLightSystem = default!; + [Dependency] private readonly AppearanceSystem _appearance = default!; + private bool _substationDecayEnabled = true; private const int _defaultSubstationDecayTimeout = 300; //5 minute private float _substationDecayCoeficient = 300000; private float _substationDecayTimer; + private float _substationLightBlinkInterval = 1f; //1 second + private float _substationLightBlinkTimer = 1f; + private bool _substationLightBlinkState = true; + public override void Initialize() { base.Initialize(); @@ -61,6 +69,27 @@ private void OnExamine(EntityUid uid, SubstationComponent component, ExaminedEve public override void Update(float deltaTime) { + + _substationLightBlinkTimer -= deltaTime; + if(_substationLightBlinkTimer <= 0f) + { + _substationLightBlinkTimer = _substationLightBlinkInterval; + _substationLightBlinkState = !_substationLightBlinkState; +; + var lightquery = EntityQueryEnumerator(); + while (lightquery.MoveNext(out var uid, out var subs, out var light)) + { + if(subs.State == SubstationIntegrityState.Healthy) + continue; + + _lightSystem.TryGetLight(uid, out var shlight); + if(_substationLightBlinkState) + _sharedLightSystem.SetEnergy(uid, 1.6f, shlight); + else + _sharedLightSystem.SetEnergy(uid, 1f, shlight); + } + } + if(!_substationDecayEnabled) { _substationDecayTimer -= deltaTime; @@ -75,8 +104,10 @@ public override void Update(float deltaTime) var query = EntityQueryEnumerator(); while (query.MoveNext(out var uid, out var subs, out var battery)) { + if(subs.DecayEnabled && subs.Integrity >= 0.0f) { + var lastIntegrity = subs.Integrity; var decay = battery.CurrentSupply * deltaTime / _substationDecayCoeficient; subs.Integrity -= decay; @@ -86,6 +117,20 @@ public override void Update(float deltaTime) _substationDecayTimer = _defaultSubstationDecayTimeout; _substationDecayEnabled = false; } + + if(subs.Integrity < 30f && lastIntegrity >= 30f) + { + subs.State = SubstationIntegrityState.Bad; + _lightSystem.TryGetLight(uid, out var shlight); + ChangeLightColor(uid, subs, shlight); + continue; + } + if(subs.Integrity < 70f && lastIntegrity >= 70f) + { + subs.State = SubstationIntegrityState.Unhealthy; + _lightSystem.TryGetLight(uid, out var shlight); + ChangeLightColor(uid, subs, shlight); + } } } } @@ -103,14 +148,49 @@ private void ShutdownSubstation(EntityUid uid, SubstationComponent? subs=null, P private void OnRejuvenate(EntityUid uid, SubstationComponent subs, RejuvenateEvent args) { + + subs.Integrity = 100.0f; + subs.State = SubstationIntegrityState.Healthy; + + TryComp(uid, out var light); + ChangeLightColor(uid, subs, light); + TryComp(uid, out var battery); if(battery == null) return; - subs.Integrity = 100.0f; battery.Enabled = true; battery.CanCharge = true; battery.CanDischarge = true; - AddComp(uid); + + if(!HasComp(uid)) + AddComp(uid); } + private void ChangeLightColor(EntityUid uid, SubstationComponent? subs=null, SharedPointLightComponent? light= null) + { + if (!Resolve(uid, ref subs, ref light, false)) + return; + + if(subs.State == SubstationIntegrityState.Healthy) + { + _lightSystem.SetColor(uid, new Color(0x3d, 0xb8, 0x3b), light); + } + else if(subs.State == SubstationIntegrityState.Unhealthy) + { + _lightSystem.SetColor(uid, Color.Yellow, light); + } + else + { + _lightSystem.SetColor(uid, Color.Red, light); + } + + UpdateAppearance(uid, subs.State); + } + + private void UpdateAppearance(EntityUid uid, SubstationIntegrityState subsState) + { + if(!TryComp(uid, out var appearance)) + return; + _appearance.SetData(uid, SubstationVisuals.Screen, subsState, appearance); + } } \ No newline at end of file diff --git a/Content.Shared/Power/Substation/SharedSubstationComponent.cs b/Content.Shared/Power/Substation/SharedSubstationComponent.cs new file mode 100644 index 00000000000000..13ee60ab5d39e4 --- /dev/null +++ b/Content.Shared/Power/Substation/SharedSubstationComponent.cs @@ -0,0 +1,17 @@ +using Robust.Shared.Serialization; + +namespace Content.Shared.Power.Substation; + +[Serializable, NetSerializable] +public enum SubstationIntegrityState +{ + Healthy, //At 70% or more + Unhealthy, // <70% to 30% + Bad // <30% +} + +[Serializable, NetSerializable] +public enum SubstationVisuals +{ + Screen +} \ No newline at end of file diff --git a/Resources/Prototypes/Entities/Structures/Power/substation.yml b/Resources/Prototypes/Entities/Structures/Power/substation.yml index 4e9f1da9185ecf..1ffdf1832a0444 100644 --- a/Resources/Prototypes/Entities/Structures/Power/substation.yml +++ b/Resources/Prototypes/Entities/Structures/Power/substation.yml @@ -13,11 +13,21 @@ snapCardinals: true layers: - state: substation - - state: screen + map: ["substationBase"] + - state: screen0 + map: ["substationScreen"] shader: unshaded - state: full + map: ["substationBattery"] shader: unshaded - type: Substation + - type: SubstationVisuals + screenLayer: "substationScreen" + integrityStates: + Healthy: screen0 + Unhealthy: screen1 + Bad: screen2 + - type: Appearance - type: UpgradeBattery maxChargeMultiplier: 2 baseMaxCharge: 2500000 @@ -152,8 +162,18 @@ sprite: Structures/Power/substation.rsi layers: - state: substation_wall - - state: screen + map: ["substationBase"] + - state: screen0 + map: ["substationScreen"] shader: unshaded + - type: Substation + - type: SubstationVisuals + screenLayer: "substationScreen" + integrityStates: + Healthy: screen0 + Unhealthy: screen1 + Bad: screen2 + - type: Appearance - type: Battery maxCharge: 2000000 startingCharge: 0 diff --git a/Resources/Textures/Structures/Power/substation.rsi/meta.json b/Resources/Textures/Structures/Power/substation.rsi/meta.json index 83d05c9ff0323f..7dc38393d18121 100644 --- a/Resources/Textures/Structures/Power/substation.rsi/meta.json +++ b/Resources/Textures/Structures/Power/substation.rsi/meta.json @@ -23,7 +23,33 @@ "name": "dead" }, { - "name": "screen", + "name": "screen0", + "delays": [ + [ + 0.15, + 0.15, + 0.15, + 0.15, + 0.15, + 0.15 + ] + ] + }, + { + "name": "screen1", + "delays": [ + [ + 0.15, + 0.15, + 0.15, + 0.15, + 0.15, + 0.15 + ] + ] + }, + { + "name": "screen2", "delays": [ [ 0.15, diff --git a/Resources/Textures/Structures/Power/substation.rsi/screen.png b/Resources/Textures/Structures/Power/substation.rsi/screen0.png similarity index 100% rename from Resources/Textures/Structures/Power/substation.rsi/screen.png rename to Resources/Textures/Structures/Power/substation.rsi/screen0.png diff --git a/Resources/Textures/Structures/Power/substation.rsi/screen1.png b/Resources/Textures/Structures/Power/substation.rsi/screen1.png new file mode 100644 index 0000000000000000000000000000000000000000..5e53a05f800c6857e38730fc7829cbced27df5c8 GIT binary patch literal 501 zcmeAS@N?(olHy`uVBq!ia0vp^2Y^_CgAGW!%qVXKQk(@Ik;M!Q+(IDCcaTv{r3VDZieOcjjoT{S+Hdpdc~tY-YD z@@%W`?fhTdhZ{6MIx#S^2soe;7PXD%$Q%Z1QJyZv8p7nCiw{e67W`tSGW9lxWq`_7hYy*KB|X5O~nUh|vr!^f!SYfFRc z8Dzcd=3ctLS#OV~`7^Zu`|z!MOM`ngAAkE*?tb;!&s}_TSBKVB-kTHq?XBs{TS}`o zomy4qGVj}!%FwAZSKpddopHC4X^Ql-4M%GvG;bfyhiW9XHFLv%u3G!4H16t&n(v$o9HNbV{{3Dr{_}_b-+#sP8FpPhp7n*-VA|@!PsyxL zY{HT+x97|1ek#vvIR8l7|BK_^zbC(kJUaHK|Hae###M*j>{{h|PGz@$?!L{U&KwF2 i3``Uf2Uc?ZVYsriBkRS@l~uraWbkzLb6Mw<&;$Uy&)p3G literal 0 HcmV?d00001 diff --git a/Resources/Textures/Structures/Power/substation.rsi/screen2.png b/Resources/Textures/Structures/Power/substation.rsi/screen2.png new file mode 100644 index 0000000000000000000000000000000000000000..dc7a970bcf94f9d2658ea070cff8f4e9f064a230 GIT binary patch literal 467 zcmeAS@N?(olHy`uVBq!ia0vp^2Y^_CgAGW!%qVXKQk(@Ik;M!Q+(IDCcN|4!QOwdzzm10xd)hk$}Z1B~(D6YDFRquXb%I{Vw}?e6od{^#93Clxnq(fie} zOE@2W{$IAaNAJi#>C(TeX1&|@SLE&Cw`*i$-`@+jWO(#>{^rTa|IbQVn?74r@$seQ z+rF}JH(S|_Ij;pCKmNCIzWFJ;Z*3p_i|%UtSGm8};nF>&|2t+2X2-bM9$OROwl9$H z`@-(M1%F@-re%yWKRh&mKZ!; L{an^LB{Ts5V6Dj? literal 0 HcmV?d00001 From 65b977d16f8acfd2ece1ebc79422cb16e777ed3a Mon Sep 17 00:00:00 2001 From: joshepvodka Date: Sun, 19 Nov 2023 16:31:14 -0300 Subject: [PATCH 06/24] added substation fuse --- .../Power/Components/SubstationComponent.cs | 9 +- .../Power/EntitySystems/SubstationSystem.cs | 298 ++++++++++++++---- .../Substation/SharedSubstationComponent.cs | 26 +- .../Substation/SharedSubstationSystem.cs | 89 ++++++ .../power/components/substation-component.ftl | 1 + .../Catalog/Fills/Items/gas_tanks.yml | 17 + .../Circuitboards/Machine/production.yml | 5 + .../Entities/Objects/Tools/gas_tanks.yml | 19 ++ .../Entities/Structures/Machines/lathe.yml | 1 + .../Entities/Structures/Power/substation.yml | 55 ++++ .../Graphs/utilities/wallmount_substation.yml | 2 +- Resources/Prototypes/Recipes/Lathes/misc.yml | 8 + Resources/Prototypes/tags.yml | 3 + 13 files changed, 462 insertions(+), 71 deletions(-) create mode 100644 Content.Shared/Power/Substation/SharedSubstationSystem.cs diff --git a/Content.Server/Power/Components/SubstationComponent.cs b/Content.Server/Power/Components/SubstationComponent.cs index 17889942e92e25..fccfcd605d42f0 100644 --- a/Content.Server/Power/Components/SubstationComponent.cs +++ b/Content.Server/Power/Components/SubstationComponent.cs @@ -6,15 +6,18 @@ namespace Content.Server.Power.Components; public sealed partial class SubstationComponent : Component { - [DataField("integrity")] - [ViewVariables(VVAccess.ReadWrite)] - public float Integrity = 100.0f; + [ViewVariables(VVAccess.ReadOnly)] + public float LastIntegrity = 100f; [DataField("decayEnabled")] [ViewVariables(VVAccess.ReadWrite)] public bool DecayEnabled = true; + [DataField("state")] [ViewVariables(VVAccess.ReadWrite)] public SubstationIntegrityState State = SubstationIntegrityState.Healthy; + //9.231205828 is the amount of moles in a 5L container (the default fuse) at 1000Kpa 20C° + public float initialFuseMoles = 2.051379050f; + } diff --git a/Content.Server/Power/EntitySystems/SubstationSystem.cs b/Content.Server/Power/EntitySystems/SubstationSystem.cs index 8227e792268b9e..475f5a2d311f09 100644 --- a/Content.Server/Power/EntitySystems/SubstationSystem.cs +++ b/Content.Server/Power/EntitySystems/SubstationSystem.cs @@ -1,18 +1,21 @@ +using System.Diagnostics.CodeAnalysis; using Robust.Server.GameObjects; -using Robust.Shared.Timing; +using Robust.Shared.Timing; +using Robust.Shared.Containers; using Content.Server.Power.Components; +using Content.Server.Atmos.Components; +using Content.Server.Atmos; using Content.Shared.Power.Substation; using Content.Shared.Access.Systems; using Content.Shared.Rejuvenate; using Content.Shared.Examine; +using Content.Shared.Atmos; namespace Content.Server.Power.EntitySystems; public sealed class SubstationSystem : EntitySystem { - - [Dependency] private readonly AccessReaderSystem _accessReader = default!; - [Dependency] private readonly IGameTiming _gameTiming = default!; + [Dependency] private readonly PointLightSystem _lightSystem = default!; [Dependency] private readonly SharedPointLightSystem _sharedLightSystem = default!; [Dependency] private readonly AppearanceSystem _appearance = default!; @@ -33,62 +36,100 @@ public override void Initialize() UpdatesAfter.Add(typeof(PowerNetSystem)); - SubscribeLocalEvent(OnSubstationInit); + SubscribeLocalEvent(OnComponentInit); SubscribeLocalEvent(OnExamine); SubscribeLocalEvent(OnRejuvenate); + SubscribeLocalEvent(OnAnalyzed); + SubscribeLocalEvent(OnFuseChanged); + } - private void OnSubstationInit(EntityUid uid, SubstationComponent component, MapInitEvent args) - {} + private void OnComponentInit(EntityUid uid, SubstationComponent component, ComponentInit args) + { + if(component.State == SubstationIntegrityState.Bad) + { + TryComp(uid, out var battery); + if(battery == null) + return; + + component.LastIntegrity = 0.0f; + battery.Enabled = false; + battery.CanCharge = false; + battery.CanDischarge = false; + if(HasComp(uid)) + RemComp(uid); + + _lightSystem.TryGetLight(uid, out var light); + if(light == null) + return; + + _lightSystem.SetColor(uid, Color.Red, light); + UpdateAppearance(uid, component.State); + } + } private void OnExamine(EntityUid uid, SubstationComponent component, ExaminedEvent args) { if (args.IsInDetailsRange) { - if(component.Integrity > 0.0f) + if(!GetFuseMixture(uid, out var mix)) { - var integrityPercentRounded = (int) (component.Integrity); args.PushMarkup( - Loc.GetString( - "substation-component-examine-integrity", - ("percent", integrityPercentRounded), - ("markupPercentColor", "green") - ) + Loc.GetString("substation-component-examine-no-fuse") ); + return; } else + { + var integrity = CheckFuseIntegrity(component, mix); + if(integrity > 0.0f) + { + var integrityPercentRounded = (int) (integrity); + args.PushMarkup( + Loc.GetString( + "substation-component-examine-integrity", + ("percent", integrityPercentRounded), + ("markupPercentColor", "green") + ) + ); + } + else { args.PushMarkup( - Loc.GetString( - "substation-component-examine-malfunction" - ) + Loc.GetString("substation-component-examine-malfunction") ); } + } + } } public override void Update(float deltaTime) { + base.Update(deltaTime); + _substationLightBlinkTimer -= deltaTime; - if(_substationLightBlinkTimer <= 0f) - { - _substationLightBlinkTimer = _substationLightBlinkInterval; - _substationLightBlinkState = !_substationLightBlinkState; -; - var lightquery = EntityQueryEnumerator(); - while (lightquery.MoveNext(out var uid, out var subs, out var light)) - { + if(_substationLightBlinkTimer <= 0f) + { + _substationLightBlinkTimer = _substationLightBlinkInterval; + _substationLightBlinkState = !_substationLightBlinkState; + + var lightquery = EntityQueryEnumerator(); + while (lightquery.MoveNext(out var uid, out var subs)) + { if(subs.State == SubstationIntegrityState.Healthy) continue; - _lightSystem.TryGetLight(uid, out var shlight); + if(!_lightSystem.TryGetLight(uid, out var shlight)) + return; + if(_substationLightBlinkState) - _sharedLightSystem.SetEnergy(uid, 1.6f, shlight); + _sharedLightSystem.SetEnergy(uid, 1.6f, shlight); else - _sharedLightSystem.SetEnergy(uid, 1f, shlight); - } - } + _sharedLightSystem.SetEnergy(uid, 1f, shlight); + } + } if(!_substationDecayEnabled) { @@ -104,57 +145,139 @@ public override void Update(float deltaTime) var query = EntityQueryEnumerator(); while (query.MoveNext(out var uid, out var subs, out var battery)) { + + if(!GetFuseMixture(uid, out var fuse)) + continue; - if(subs.DecayEnabled && subs.Integrity >= 0.0f) + if(subs.DecayEnabled && subs.LastIntegrity >= 0.0f) { - var lastIntegrity = subs.Integrity; - var decay = battery.CurrentSupply * deltaTime / _substationDecayCoeficient; - subs.Integrity -= decay; + ConsumeFuseGas(deltaTime, subs, battery, fuse); + var fuseIntegrity = CheckFuseIntegrity(subs, fuse); - if(subs.Integrity <= 0.0f) + if(fuseIntegrity <= 0.0f) { - ShutdownSubstation(uid, subs, battery); + ShutdownSubstation(uid, subs); _substationDecayTimer = _defaultSubstationDecayTimeout; _substationDecayEnabled = false; + + subs.LastIntegrity = fuseIntegrity; + continue; } - if(subs.Integrity < 30f && lastIntegrity >= 30f) + if(fuseIntegrity < 30f && subs.LastIntegrity >= 30f) { - subs.State = SubstationIntegrityState.Bad; - _lightSystem.TryGetLight(uid, out var shlight); - ChangeLightColor(uid, subs, shlight); - continue; + ChangeState(uid, SubstationIntegrityState.Bad, subs); } - if(subs.Integrity < 70f && lastIntegrity >= 70f) + else if(fuseIntegrity < 70f && subs.LastIntegrity >= 70f) { - subs.State = SubstationIntegrityState.Unhealthy; - _lightSystem.TryGetLight(uid, out var shlight); - ChangeLightColor(uid, subs, shlight); + ChangeState(uid, SubstationIntegrityState.Unhealthy, subs); } + + subs.LastIntegrity = fuseIntegrity; } } } - private void ShutdownSubstation(EntityUid uid, SubstationComponent? subs=null, PowerNetworkBatteryComponent? battery=null) + private void ConsumeFuseGas(float deltaTime, SubstationComponent subs, PowerNetworkBatteryComponent battery, GasMixture mixture) { - if (!Resolve(uid, ref subs, ref battery, false)) + var initialN2 = mixture.GetMoles(Gas.Nitrogen); + var initialPlasma = mixture.GetMoles(Gas.Plasma); + + var molesConsumed = subs.initialFuseMoles * battery.CurrentSupply * deltaTime / _substationDecayCoeficient; + + var minimumReaction = Math.Min(initialN2, initialPlasma) * molesConsumed / 2; + + mixture.AdjustMoles(Gas.Nitrogen, -minimumReaction); + mixture.AdjustMoles(Gas.Plasma, -minimumReaction); + mixture.AdjustMoles(Gas.NitrousOxide, minimumReaction*2); + } + + private float CheckFuseIntegrity(SubstationComponent subs, GasMixture mixture) + { + + if(subs.initialFuseMoles <= 0f) + return 0f; + + var initialN2 = mixture.GetMoles(Gas.Nitrogen); + var initialPlasma = mixture.GetMoles(Gas.Plasma); + + var usableMoles = Math.Min(initialN2, initialPlasma); + //return in percentage points; + return 100 * usableMoles / (subs.initialFuseMoles / 2); + } + + private void OnFuseChanged(EntityUid uid, SubstationComponent subs, SubstationFuseChangedEvent args) + { + if(!GetFuseMixture(uid, out var mix)) + { + ShutdownSubstation(uid, subs); + subs.LastIntegrity = 0f; return; - subs.Integrity = 0.0f; + } + + var initialFuseMoles = 0f; + for(var i = 0; i < Atmospherics.TotalNumberOfGases; i++) + { + initialFuseMoles += mix.GetMoles(i); + } + + subs.initialFuseMoles = initialFuseMoles; + + var fuseIntegrity = CheckFuseIntegrity(subs, mix); + + if(fuseIntegrity <= 0.0f) + { + ShutdownSubstation(uid, subs); + subs.LastIntegrity = fuseIntegrity; + return; + } + if(fuseIntegrity < 30f) + { + ChangeState(uid, SubstationIntegrityState.Bad, subs); + } + else if(fuseIntegrity < 70f) + { + ChangeState(uid, SubstationIntegrityState.Unhealthy, subs); + } + else + { + ChangeState(uid, SubstationIntegrityState.Healthy, subs); + } + subs.LastIntegrity = fuseIntegrity; + } + + private void ShutdownSubstation(EntityUid uid, SubstationComponent subs) + { + TryComp(uid, out var battery); + if(battery == null) + return; + + subs.LastIntegrity = 0.0f; battery.Enabled = false; battery.CanCharge = false; battery.CanDischarge = false; - RemComp(uid); + if(HasComp(uid)) + RemComp(uid); + + ChangeState(uid, SubstationIntegrityState.Bad, subs); } private void OnRejuvenate(EntityUid uid, SubstationComponent subs, RejuvenateEvent args) { - subs.Integrity = 100.0f; - subs.State = SubstationIntegrityState.Healthy; + subs.LastIntegrity = 100.0f; - TryComp(uid, out var light); - ChangeLightColor(uid, subs, light); + ChangeState(uid, SubstationIntegrityState.Healthy, subs); + if(GetFuseMixture(uid, out var mix)) + { + mix.SetMoles(Gas.Nitrogen, 1.025689525f); + mix.SetMoles(Gas.Plasma, 1.025689525f); + } + } + + private void RestoreSubstation(EntityUid uid, SubstationComponent subs) + { TryComp(uid, out var battery); if(battery == null) return; @@ -166,26 +289,42 @@ private void OnRejuvenate(EntityUid uid, SubstationComponent subs, RejuvenateEve AddComp(uid); } - private void ChangeLightColor(EntityUid uid, SubstationComponent? subs=null, SharedPointLightComponent? light= null) - { - if (!Resolve(uid, ref subs, ref light, false)) + private void ChangeState(EntityUid uid, SubstationIntegrityState state, SubstationComponent? subs=null) + { + + if(!_lightSystem.TryGetLight(uid, out var light)) + return; + + if (!Resolve(uid, ref subs, ref light, false)) + return; + + if(subs.State == state) return; - - if(subs.State == SubstationIntegrityState.Healthy) + + if(state == SubstationIntegrityState.Healthy) { - _lightSystem.SetColor(uid, new Color(0x3d, 0xb8, 0x3b), light); + if(subs.State == SubstationIntegrityState.Bad) + { + RestoreSubstation(uid, subs); + } + _lightSystem.SetColor(uid, new Color(0x3d, 0xb8, 0x3b), light); } else if(subs.State == SubstationIntegrityState.Unhealthy) { - _lightSystem.SetColor(uid, Color.Yellow, light); + if(subs.State == SubstationIntegrityState.Bad) + { + RestoreSubstation(uid, subs); + } + _lightSystem.SetColor(uid, Color.Yellow, light); } else { - _lightSystem.SetColor(uid, Color.Red, light); + _lightSystem.SetColor(uid, Color.Red, light); } + subs.State = state; UpdateAppearance(uid, subs.State); - } + } private void UpdateAppearance(EntityUid uid, SubstationIntegrityState subsState) { @@ -193,4 +332,39 @@ private void UpdateAppearance(EntityUid uid, SubstationIntegrityState subsState) return; _appearance.SetData(uid, SubstationVisuals.Screen, subsState, appearance); } + + private void OnAnalyzed(EntityUid uid, SubstationFuseSlotComponent slot, GasAnalyzerScanEvent args) + { + if(!TryComp(uid, out var containers)) + return; + + if (!containers.TryGetContainer(slot.FuseSlotId, out var container)) + return; + + if (container.ContainedEntities.Count > 0) + { + args.GasMixtures = new Dictionary { {Name(uid), Comp(container.ContainedEntities[0]).Air} }; + } + } + + private bool GetFuseMixture(EntityUid uid, [NotNullWhen(true)] out GasMixture? mix) + { + mix = null; + + if(!TryComp(uid, out var slot) || !TryComp(uid, out var containers)) + return false; + + if (!containers.TryGetContainer(slot.FuseSlotId, out var container)) + return false; + + if (container.ContainedEntities.Count > 0) + { + var gasTank = Comp(container.ContainedEntities[0]); + mix = gasTank.Air; + return true; + } + + return false; + } + } \ No newline at end of file diff --git a/Content.Shared/Power/Substation/SharedSubstationComponent.cs b/Content.Shared/Power/Substation/SharedSubstationComponent.cs index 13ee60ab5d39e4..0f3c927e3a48d8 100644 --- a/Content.Shared/Power/Substation/SharedSubstationComponent.cs +++ b/Content.Shared/Power/Substation/SharedSubstationComponent.cs @@ -1,17 +1,33 @@ using Robust.Shared.Serialization; +using Content.Shared.Containers.ItemSlots; namespace Content.Shared.Power.Substation; [Serializable, NetSerializable] public enum SubstationIntegrityState { - Healthy, //At 70% or more - Unhealthy, // <70% to 30% - Bad // <30% + Healthy, //At 70% or more + Unhealthy, // <70% to 30% + Bad // <30% } [Serializable, NetSerializable] public enum SubstationVisuals { - Screen -} \ No newline at end of file + Screen +} + +[RegisterComponent] +public sealed partial class SubstationFuseSlotComponent : Component +{ + + [DataField("fuseSlotId", required: true)] + [ViewVariables(VVAccess.ReadOnly)] + public string FuseSlotId = string.Empty; + + public bool AllowInsert = true; + +} + +public sealed class SubstationFuseChangedEvent : EntityEventArgs +{} diff --git a/Content.Shared/Power/Substation/SharedSubstationSystem.cs b/Content.Shared/Power/Substation/SharedSubstationSystem.cs new file mode 100644 index 00000000000000..4567114a53771d --- /dev/null +++ b/Content.Shared/Power/Substation/SharedSubstationSystem.cs @@ -0,0 +1,89 @@ +using Content.Shared.Containers.ItemSlots; +using Content.Shared.Wires; +using Content.Shared.Tag; +using Robust.Shared.Containers; + +namespace Content.Shared.Power.Substation; + +public sealed partial class SharedSubstationSystem : EntitySystem +{ + + [Dependency] private TagSystem _tagSystem = default!; + + public override void Initialize() + { + base.Initialize(); + SubscribeLocalEvent(OnFuseInserted); + SubscribeLocalEvent(OnFuseRemoved); + SubscribeLocalEvent(OnFuseInsertAttempt); + SubscribeLocalEvent(OnFuseRemoveAttempt); + + } + + private void OnFuseInsertAttempt(EntityUid uid, SubstationFuseSlotComponent component, ContainerIsInsertingAttemptEvent args) + { + if(!component.Initialized) + return; + + if(args.Container.ID != component.FuseSlotId) + return; + + if(!TryComp(uid, out var panel)) + return; + + if(!_tagSystem.HasTag(args.EntityUid, "Fuse")) + { + args.Cancel(); + return; + } + + if(component.AllowInsert) + { + component.AllowInsert = false; + return; + } + + if(!panel.Open) + { + args.Cancel(); + } + + } + + private void OnFuseRemoveAttempt(EntityUid uid, SubstationFuseSlotComponent component, ContainerIsRemovingAttemptEvent args) + { + if (!component.Initialized) + return; + + if (args.Container.ID != component.FuseSlotId) + return; + + if(!TryComp(uid, out var panel)) + return; + + if(!panel.Open) + { + args.Cancel(); + } + + } + + private void OnFuseInserted(EntityUid uid, SubstationFuseSlotComponent component, EntInsertedIntoContainerMessage args) + { + if (!component.Initialized) + return; + + if (args.Container.ID != component.FuseSlotId) + return; + + RaiseLocalEvent(uid, new SubstationFuseChangedEvent(), false); + } + + private void OnFuseRemoved(EntityUid uid, SubstationFuseSlotComponent component, EntRemovedFromContainerMessage args) + { + if (args.Container.ID != component.FuseSlotId) + return; + + RaiseLocalEvent(uid, new SubstationFuseChangedEvent(), false); + } +} diff --git a/Resources/Locale/en-US/power/components/substation-component.ftl b/Resources/Locale/en-US/power/components/substation-component.ftl index dab83ec6a826e3..61ead50621a608 100644 --- a/Resources/Locale/en-US/power/components/substation-component.ftl +++ b/Resources/Locale/en-US/power/components/substation-component.ftl @@ -4,4 +4,5 @@ # Shown when the substation is examined in details range substation-component-examine-integrity = The substation is at [color={$markupPercentColor}]{$percent}%[/color] integrity. substation-component-examine-malfunction = The substation is [color=red]malfunctioning[/color]. +substation-component-examine-no-fuse = The substation is [color=red]missing a fuse[/color]. diff --git a/Resources/Prototypes/Catalog/Fills/Items/gas_tanks.yml b/Resources/Prototypes/Catalog/Fills/Items/gas_tanks.yml index e013fb3710922a..14bcdac76cc539 100644 --- a/Resources/Prototypes/Catalog/Fills/Items/gas_tanks.yml +++ b/Resources/Prototypes/Catalog/Fills/Items/gas_tanks.yml @@ -159,3 +159,20 @@ - 0 # CO2 - 2.051379050 # plasma temperature: 293.15 + +- type: entity + id: GasFuseFilled + parent: GasFuse + name: HV Fuse + suffix: Filled + components: + - type: GasTank + outputPressure: 101.3 + air: + volume: 5 + moles: + - 0 # oxygen + - 1.025689525 # nitrogen + - 0 # CO2 + - 1.025689525 # plasma + temperature: 293.15 diff --git a/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/production.yml b/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/production.yml index a25e5b7069d5a0..4ad8db14410fa4 100644 --- a/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/production.yml +++ b/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/production.yml @@ -561,6 +561,11 @@ materialRequirements: CableMV: 5 CableHV: 5 +# tagRequirements: +# Fuse: +# Amount: 1 +# DefaultPrototype: GasFuse +# ExamineName: HV Fuse - type: PhysicalComposition materialComposition: Glass: 200 diff --git a/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml b/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml index 9887d8cdc01a13..48f0f4204c59ae 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml @@ -214,3 +214,22 @@ temperature: 293.15 - type: Clothing sprite: Objects/Tanks/plasma.rsi + +- type: entity + parent: GasTankRoundBase + id: GasFuse + name: HV fuse + description: High power fuse filled with protective gas. + components: + - type: Sprite + sprite: Objects/Tanks/plasma.rsi + - type: Item + sprite: Objects/Tanks/plasma.rsi + - type: GasTank + outputPressure: 101.3 + air: + volume: 5 + temperature: 293.15 + - type: Tag + tags: + - Fuse diff --git a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml index fbd19d5fd070f6..dcc9afc1dd8664 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml @@ -97,6 +97,7 @@ - TRayScanner - GasAnalyzer - UtilityBelt + - GasFuse - Fulton - FultonBeacon - Pickaxe diff --git a/Resources/Prototypes/Entities/Structures/Power/substation.yml b/Resources/Prototypes/Entities/Structures/Power/substation.yml index 1ffdf1832a0444..810bd250b1e61a 100644 --- a/Resources/Prototypes/Entities/Structures/Power/substation.yml +++ b/Resources/Prototypes/Entities/Structures/Power/substation.yml @@ -21,6 +21,20 @@ map: ["substationBattery"] shader: unshaded - type: Substation + - type: SubstationFuseSlot + fuseSlotId: fuse_slot + - type: ContainerContainer + containers: + fuse_slot: !type:ContainerSlot {} + - type: ItemSlots + slots: + fuse_slot: + ejectOnInteract: true + name: HV Fuse + startingItem: GasFuseFilled + whitelist: + tags: + - Fuse - type: SubstationVisuals screenLayer: "substationScreen" integrityStates: @@ -150,6 +164,22 @@ - type: ContainerContainer containers: board: !type:Container + fuse_slot: !type:ContainerSlot + - type: SubstationFuseSlot + fuseSlotId: fuse_slot + - type: ItemSlots + slots: + fuse_slot: + ejectOnInteract: true + name: HV Fuse + startingItem: GasFuseFilled + whitelist: + tags: + - Fuse + - type: WiresPanel + - type: Wires + boardName: wires-board-name-substation + layoutId: Substation - type: InteractionOutline - type: Physics bodyType: Static @@ -246,6 +276,14 @@ components: - type: Battery startingCharge: 0 + - type: ItemSlots + slots: + fuse_slot: + ejectOnInteract: true + name: HV Fuse + startingItem: + - type: Substation + state: Bad - type: entity parent: BaseSubstationWall @@ -256,6 +294,23 @@ maxCharge: 2000000 startingCharge: 2000000 +- type: entity + parent: BaseSubstationWall + id: SubstationWallBasicEmpty + suffix: Empty + components: + - type: Battery + maxCharge: 2000000 + startingCharge: 0 + - type: ItemSlots + slots: + fuse_slot: + ejectOnInteract: true + name: HV Fuse + startingItem: + - type: Substation + state: Bad + # Construction Frame - type: entity id: BaseSubstationWallFrame diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/utilities/wallmount_substation.yml b/Resources/Prototypes/Recipes/Construction/Graphs/utilities/wallmount_substation.yml index 78a1a34c6a2dd7..3a00abaacd6659 100644 --- a/Resources/Prototypes/Recipes/Construction/Graphs/utilities/wallmount_substation.yml +++ b/Resources/Prototypes/Recipes/Construction/Graphs/utilities/wallmount_substation.yml @@ -60,7 +60,7 @@ doAfter: 2 - node: substation - entity: BaseSubstationWall + entity: SubstationWallBasicEmpty edges: - to: parts conditions: diff --git a/Resources/Prototypes/Recipes/Lathes/misc.yml b/Resources/Prototypes/Recipes/Lathes/misc.yml index 5aff63ed9255c9..18468f572bc1ee 100644 --- a/Resources/Prototypes/Recipes/Lathes/misc.yml +++ b/Resources/Prototypes/Recipes/Lathes/misc.yml @@ -92,3 +92,11 @@ materials: Steel: 750 Plastic: 100 + +- type: latheRecipe + id: GasFuse + result: GasFuse + completetime: 2 + materials: + Steel: 100 + Glass: 100 diff --git a/Resources/Prototypes/tags.yml b/Resources/Prototypes/tags.yml index 8a120d7bf03476..b38b8118aa2018 100644 --- a/Resources/Prototypes/tags.yml +++ b/Resources/Prototypes/tags.yml @@ -482,6 +482,9 @@ - type: Tag id: Fruit +- type: Tag + id: Fuse + - type: Tag id: Galaxythistle From b8eaa3616f8d4b08d9971ed624a3f1d83f760bb2 Mon Sep 17 00:00:00 2001 From: joshepvodka Date: Sun, 19 Nov 2023 17:28:10 -0300 Subject: [PATCH 07/24] fuse lifetime upgrades --- .../ConstructionSystem.Machine.cs | 6 +++++ .../Power/Components/SubstationComponent.cs | 2 +- .../Power/EntitySystems/SubstationSystem.cs | 26 ++++++++++++++----- Resources/Locale/en-US/machine/machine.ftl | 2 ++ 4 files changed, 29 insertions(+), 7 deletions(-) diff --git a/Content.Server/Construction/ConstructionSystem.Machine.cs b/Content.Server/Construction/ConstructionSystem.Machine.cs index a6472c38d15eaf..b43a04a8e3d2c3 100644 --- a/Content.Server/Construction/ConstructionSystem.Machine.cs +++ b/Content.Server/Construction/ConstructionSystem.Machine.cs @@ -225,4 +225,10 @@ public void AddNumberUpgrade(string upgradedLocId, int number) var upgraded = Loc.GetString(upgradedLocId); this.Message.AddMarkup(Loc.GetString(locId, ("upgraded", upgraded), ("difference", difference)) + '\n'); } + + public void AddMaxUpgrade(string upgradedLocId) + { + var upgraded = Loc.GetString(upgradedLocId); + this.Message.AddMarkup(Loc.GetString("machine-upgrade-max-upgrade", ("upgraded", upgraded)) + '\n'); + } } diff --git a/Content.Server/Power/Components/SubstationComponent.cs b/Content.Server/Power/Components/SubstationComponent.cs index fccfcd605d42f0..b942e6253f2fbd 100644 --- a/Content.Server/Power/Components/SubstationComponent.cs +++ b/Content.Server/Power/Components/SubstationComponent.cs @@ -18,6 +18,6 @@ public sealed partial class SubstationComponent : Component public SubstationIntegrityState State = SubstationIntegrityState.Healthy; //9.231205828 is the amount of moles in a 5L container (the default fuse) at 1000Kpa 20C° - public float initialFuseMoles = 2.051379050f; + public float initialFuseMoles = 2.051379050f; } diff --git a/Content.Server/Power/EntitySystems/SubstationSystem.cs b/Content.Server/Power/EntitySystems/SubstationSystem.cs index 475f5a2d311f09..c748323f07b343 100644 --- a/Content.Server/Power/EntitySystems/SubstationSystem.cs +++ b/Content.Server/Power/EntitySystems/SubstationSystem.cs @@ -3,6 +3,7 @@ using Robust.Shared.Timing; using Robust.Shared.Containers; using Content.Server.Power.Components; +using Content.Server.Construction; using Content.Server.Atmos.Components; using Content.Server.Atmos; using Content.Shared.Power.Substation; @@ -37,6 +38,7 @@ public override void Initialize() UpdatesAfter.Add(typeof(PowerNetSystem)); SubscribeLocalEvent(OnComponentInit); + SubscribeLocalEvent(OnFuseLifetimeUpgradeExamine); SubscribeLocalEvent(OnExamine); SubscribeLocalEvent(OnRejuvenate); SubscribeLocalEvent(OnAnalyzed); @@ -104,6 +106,18 @@ private void OnExamine(EntityUid uid, SubstationComponent component, ExaminedEve } } + private void OnFuseLifetimeUpgradeExamine(EntityUid uid, SubstationComponent component, UpgradeExamineEvent args) + { + TryComp(uid, out var upgrade); + if(upgrade == null) + return; + + if(upgrade.ActualScalar < 3) + args.AddPercentageUpgrade("upgrade-fuse-lifetime", upgrade.ActualScalar); + else + args.AddMaxUpgrade("upgrade-fuse-lifetime"); + } + public override void Update(float deltaTime) { @@ -142,16 +156,16 @@ public override void Update(float deltaTime) return; } - var query = EntityQueryEnumerator(); - while (query.MoveNext(out var uid, out var subs, out var battery)) + var query = EntityQueryEnumerator(); + while (query.MoveNext(out var uid, out var subs, out var battery, out var upgrade)) { if(!GetFuseMixture(uid, out var fuse)) continue; - if(subs.DecayEnabled && subs.LastIntegrity >= 0.0f) + if(subs.DecayEnabled && subs.LastIntegrity >= 0.0f && upgrade.ActualScalar < 3f) { - ConsumeFuseGas(deltaTime, subs, battery, fuse); + ConsumeFuseGas(deltaTime, upgrade.ActualScalar, subs, battery, fuse); var fuseIntegrity = CheckFuseIntegrity(subs, fuse); if(fuseIntegrity <= 0.0f) @@ -178,12 +192,12 @@ public override void Update(float deltaTime) } } - private void ConsumeFuseGas(float deltaTime, SubstationComponent subs, PowerNetworkBatteryComponent battery, GasMixture mixture) + private void ConsumeFuseGas(float deltaTime, float scalar, SubstationComponent subs, PowerNetworkBatteryComponent battery, GasMixture mixture) { var initialN2 = mixture.GetMoles(Gas.Nitrogen); var initialPlasma = mixture.GetMoles(Gas.Plasma); - var molesConsumed = subs.initialFuseMoles * battery.CurrentSupply * deltaTime / _substationDecayCoeficient; + var molesConsumed = (subs.initialFuseMoles * battery.CurrentSupply * deltaTime) / (_substationDecayCoeficient * scalar); var minimumReaction = Math.Min(initialN2, initialPlasma) * molesConsumed / 2; diff --git a/Resources/Locale/en-US/machine/machine.ftl b/Resources/Locale/en-US/machine/machine.ftl index e23c9791cda4f0..a565f3131454db 100644 --- a/Resources/Locale/en-US/machine/machine.ftl +++ b/Resources/Locale/en-US/machine/machine.ftl @@ -7,6 +7,7 @@ machine-upgrade-decreased-by-percentage = [color=yellow]{CAPITALIZE($upgraded)}[ machine-upgrade-increased-by-amount = [color=yellow]{CAPITALIZE($upgraded)}[/color] increased by {$difference}. machine-upgrade-decreased-by-amount = [color=yellow]{CAPITALIZE($upgraded)}[/color] decreased by {$difference}. machine-upgrade-not-upgraded = [color=yellow]{CAPITALIZE($upgraded)}[/color] not upgraded. +machine-upgrade-max-upgrade = [color=yellow]{CAPITALIZE($upgraded)}[/color] fully upgraded. machine-part-name-capacitor = Capacitor machine-part-name-manipulator = Manipulator @@ -17,6 +18,7 @@ upgrade-power-draw = power draw upgrade-max-charge = max charge upgrade-power-supply = power supply upgrade-power-supply-ramping = power ramp rate +upgrade-fuse-lifetime = fuse lifetime two-way-lever-left = push left two-way-lever-right = push right From 11d969101e6c7aa1bd8b35a45f13a8c0974a88a0 Mon Sep 17 00:00:00 2001 From: joshepvodka Date: Sun, 19 Nov 2023 18:48:48 -0300 Subject: [PATCH 08/24] fixed formatting --- .../Substation/SubstationVisualsComponent.cs | 2 +- .../Substation/SubstationVisualsSystem.cs | 14 +++--- .../Power/Components/SubstationComponent.cs | 6 +-- .../Power/EntitySystems/SubstationSystem.cs | 49 +++++++++---------- .../Substation/SharedSubstationSystem.cs | 12 ++--- 5 files changed, 39 insertions(+), 44 deletions(-) diff --git a/Content.Client/Power/Substation/SubstationVisualsComponent.cs b/Content.Client/Power/Substation/SubstationVisualsComponent.cs index d5044c8d4b4673..8c80a674f16b70 100644 --- a/Content.Client/Power/Substation/SubstationVisualsComponent.cs +++ b/Content.Client/Power/Substation/SubstationVisualsComponent.cs @@ -8,6 +8,6 @@ public sealed partial class SubstationVisualsComponent : Component [DataField("screenLayer")] public string LayerMap { get; private set; } = string.Empty; - [DataField("integrityStates")] + [DataField] public Dictionary IntegrityStates = new(); } diff --git a/Content.Client/Power/Substation/SubstationVisualsSystem.cs b/Content.Client/Power/Substation/SubstationVisualsSystem.cs index 4dbc3e4c3a9a56..df0b11e6e1822b 100644 --- a/Content.Client/Power/Substation/SubstationVisualsSystem.cs +++ b/Content.Client/Power/Substation/SubstationVisualsSystem.cs @@ -9,14 +9,14 @@ public sealed class SubstationVisualsSystem : VisualizerSystem 0.0f) { - var integrityPercentRounded = (int) (integrity); + var integrityPercentRounded = (int)integrity; args.PushMarkup( Loc.GetString( "substation-component-examine-integrity", ("percent", integrityPercentRounded), ("markupPercentColor", "green") - ) - ); + )); + } + else + { + args.PushMarkup( + Loc.GetString("substation-component-examine-malfunction")); } - else - { - args.PushMarkup( - Loc.GetString("substation-component-examine-malfunction") - ); - } } - } } @@ -130,7 +125,7 @@ public override void Update(float deltaTime) _substationLightBlinkState = !_substationLightBlinkState; var lightquery = EntityQueryEnumerator(); - while (lightquery.MoveNext(out var uid, out var subs)) + while(lightquery.MoveNext(out var uid, out var subs)) { if(subs.State == SubstationIntegrityState.Healthy) continue; @@ -157,7 +152,7 @@ public override void Update(float deltaTime) } var query = EntityQueryEnumerator(); - while (query.MoveNext(out var uid, out var subs, out var battery, out var upgrade)) + while(query.MoveNext(out var uid, out var subs, out var battery, out var upgrade)) { if(!GetFuseMixture(uid, out var fuse)) @@ -197,7 +192,7 @@ private void ConsumeFuseGas(float deltaTime, float scalar, SubstationComponent s var initialN2 = mixture.GetMoles(Gas.Nitrogen); var initialPlasma = mixture.GetMoles(Gas.Plasma); - var molesConsumed = (subs.initialFuseMoles * battery.CurrentSupply * deltaTime) / (_substationDecayCoeficient * scalar); + var molesConsumed = (subs.InitialFuseMoles * battery.CurrentSupply * deltaTime) / (_substationDecayCoeficient * scalar); var minimumReaction = Math.Min(initialN2, initialPlasma) * molesConsumed / 2; @@ -209,7 +204,7 @@ private void ConsumeFuseGas(float deltaTime, float scalar, SubstationComponent s private float CheckFuseIntegrity(SubstationComponent subs, GasMixture mixture) { - if(subs.initialFuseMoles <= 0f) + if(subs.InitialFuseMoles <= 0f) return 0f; var initialN2 = mixture.GetMoles(Gas.Nitrogen); @@ -217,7 +212,7 @@ private float CheckFuseIntegrity(SubstationComponent subs, GasMixture mixture) var usableMoles = Math.Min(initialN2, initialPlasma); //return in percentage points; - return 100 * usableMoles / (subs.initialFuseMoles / 2); + return 100 * usableMoles / (subs.InitialFuseMoles / 2); } private void OnFuseChanged(EntityUid uid, SubstationComponent subs, SubstationFuseChangedEvent args) @@ -235,7 +230,7 @@ private void OnFuseChanged(EntityUid uid, SubstationComponent subs, SubstationFu initialFuseMoles += mix.GetMoles(i); } - subs.initialFuseMoles = initialFuseMoles; + subs.InitialFuseMoles = initialFuseMoles; var fuseIntegrity = CheckFuseIntegrity(subs, mix); @@ -309,7 +304,7 @@ private void ChangeState(EntityUid uid, SubstationIntegrityState state, Substati if(!_lightSystem.TryGetLight(uid, out var light)) return; - if (!Resolve(uid, ref subs, ref light, false)) + if(!Resolve(uid, ref subs, ref light, false)) return; if(subs.State == state) @@ -344,7 +339,7 @@ private void UpdateAppearance(EntityUid uid, SubstationIntegrityState subsState) { if(!TryComp(uid, out var appearance)) return; - _appearance.SetData(uid, SubstationVisuals.Screen, subsState, appearance); + _appearanceSystem.SetData(uid, SubstationVisuals.Screen, subsState, appearance); } private void OnAnalyzed(EntityUid uid, SubstationFuseSlotComponent slot, GasAnalyzerScanEvent args) @@ -352,10 +347,10 @@ private void OnAnalyzed(EntityUid uid, SubstationFuseSlotComponent slot, GasAnal if(!TryComp(uid, out var containers)) return; - if (!containers.TryGetContainer(slot.FuseSlotId, out var container)) + if(!containers.TryGetContainer(slot.FuseSlotId, out var container)) return; - if (container.ContainedEntities.Count > 0) + if(container.ContainedEntities.Count > 0) { args.GasMixtures = new Dictionary { {Name(uid), Comp(container.ContainedEntities[0]).Air} }; } @@ -368,10 +363,10 @@ private bool GetFuseMixture(EntityUid uid, [NotNullWhen(true)] out GasMixture? m if(!TryComp(uid, out var slot) || !TryComp(uid, out var containers)) return false; - if (!containers.TryGetContainer(slot.FuseSlotId, out var container)) + if(!containers.TryGetContainer(slot.FuseSlotId, out var container)) return false; - if (container.ContainedEntities.Count > 0) + if(container.ContainedEntities.Count > 0) { var gasTank = Comp(container.ContainedEntities[0]); mix = gasTank.Air; diff --git a/Content.Shared/Power/Substation/SharedSubstationSystem.cs b/Content.Shared/Power/Substation/SharedSubstationSystem.cs index 4567114a53771d..a22152da1eac27 100644 --- a/Content.Shared/Power/Substation/SharedSubstationSystem.cs +++ b/Content.Shared/Power/Substation/SharedSubstationSystem.cs @@ -8,7 +8,7 @@ namespace Content.Shared.Power.Substation; public sealed partial class SharedSubstationSystem : EntitySystem { - [Dependency] private TagSystem _tagSystem = default!; + [Dependency] private readonly TagSystem _tagSystem = default!; public override void Initialize() { @@ -52,10 +52,10 @@ private void OnFuseInsertAttempt(EntityUid uid, SubstationFuseSlotComponent comp private void OnFuseRemoveAttempt(EntityUid uid, SubstationFuseSlotComponent component, ContainerIsRemovingAttemptEvent args) { - if (!component.Initialized) + if(!component.Initialized) return; - if (args.Container.ID != component.FuseSlotId) + if(args.Container.ID != component.FuseSlotId) return; if(!TryComp(uid, out var panel)) @@ -70,10 +70,10 @@ private void OnFuseRemoveAttempt(EntityUid uid, SubstationFuseSlotComponent comp private void OnFuseInserted(EntityUid uid, SubstationFuseSlotComponent component, EntInsertedIntoContainerMessage args) { - if (!component.Initialized) + if(!component.Initialized) return; - if (args.Container.ID != component.FuseSlotId) + if(args.Container.ID != component.FuseSlotId) return; RaiseLocalEvent(uid, new SubstationFuseChangedEvent(), false); @@ -81,7 +81,7 @@ private void OnFuseInserted(EntityUid uid, SubstationFuseSlotComponent component private void OnFuseRemoved(EntityUid uid, SubstationFuseSlotComponent component, EntRemovedFromContainerMessage args) { - if (args.Container.ID != component.FuseSlotId) + if(args.Container.ID != component.FuseSlotId) return; RaiseLocalEvent(uid, new SubstationFuseChangedEvent(), false); From 22635492be274b1f6ca1f43532d1b0c3d0f63832 Mon Sep 17 00:00:00 2001 From: joshepvodka Date: Sun, 31 Dec 2023 18:28:37 -0300 Subject: [PATCH 09/24] added sprites fixed some code --- .../Substation/SubstationVisualsComponent.cs | 2 +- .../Substation/SubstationVisualsSystem.cs | 2 +- .../Power/Components/SubstationComponent.cs | 12 +- .../Power/EntitySystems/SubstationSystem.cs | 157 +++++++++++++----- Content.Shared/Power/SharedSubstation.cs | 18 ++ .../Substation/SharedSubstationComponent.cs | 33 ---- .../Substation/SharedSubstationSystem.cs | 89 ---------- Resources/Locale/en-US/machine/machine.ftl | 2 +- .../power/components/substation-component.ftl | 2 +- .../Catalog/Fills/Items/gas_tanks.yml | 6 +- .../Entities/Objects/Tools/gas_tanks.yml | 12 +- .../Entities/Structures/Machines/lathe.yml | 2 +- .../Entities/Structures/Power/substation.yml | 34 ++-- Resources/Prototypes/Recipes/Lathes/misc.yml | 4 +- Resources/Prototypes/tags.yml | 2 +- .../Tanks/gasconduit.rsi/equipped-BELT.png | Bin 0 -> 368 bytes .../Objects/Tanks/gasconduit.rsi/icon.png | Bin 0 -> 695 bytes .../Tanks/gasconduit.rsi/inhand-left.png | Bin 0 -> 447 bytes .../Tanks/gasconduit.rsi/inhand-right.png | Bin 0 -> 441 bytes .../Objects/Tanks/gasconduit.rsi/meta.json | 26 +++ 20 files changed, 199 insertions(+), 204 deletions(-) create mode 100644 Content.Shared/Power/SharedSubstation.cs delete mode 100644 Content.Shared/Power/Substation/SharedSubstationComponent.cs delete mode 100644 Content.Shared/Power/Substation/SharedSubstationSystem.cs create mode 100644 Resources/Textures/Objects/Tanks/gasconduit.rsi/equipped-BELT.png create mode 100644 Resources/Textures/Objects/Tanks/gasconduit.rsi/icon.png create mode 100644 Resources/Textures/Objects/Tanks/gasconduit.rsi/inhand-left.png create mode 100644 Resources/Textures/Objects/Tanks/gasconduit.rsi/inhand-right.png create mode 100644 Resources/Textures/Objects/Tanks/gasconduit.rsi/meta.json diff --git a/Content.Client/Power/Substation/SubstationVisualsComponent.cs b/Content.Client/Power/Substation/SubstationVisualsComponent.cs index 8c80a674f16b70..e766feb9024918 100644 --- a/Content.Client/Power/Substation/SubstationVisualsComponent.cs +++ b/Content.Client/Power/Substation/SubstationVisualsComponent.cs @@ -1,4 +1,4 @@ -using Content.Shared.Power.Substation; +using Content.Shared.Power; namespace Content.Client.Power.Substation; diff --git a/Content.Client/Power/Substation/SubstationVisualsSystem.cs b/Content.Client/Power/Substation/SubstationVisualsSystem.cs index df0b11e6e1822b..de63392793c9f2 100644 --- a/Content.Client/Power/Substation/SubstationVisualsSystem.cs +++ b/Content.Client/Power/Substation/SubstationVisualsSystem.cs @@ -1,7 +1,7 @@ using Robust.Shared.GameObjects; using Robust.Client.GameObjects; using Robust.Client.Graphics; -using Content.Shared.Power.Substation; +using Content.Shared.Power; namespace Content.Client.Power.Substation; diff --git a/Content.Server/Power/Components/SubstationComponent.cs b/Content.Server/Power/Components/SubstationComponent.cs index 0a832045e6987e..cd2e088569b67b 100644 --- a/Content.Server/Power/Components/SubstationComponent.cs +++ b/Content.Server/Power/Components/SubstationComponent.cs @@ -1,4 +1,4 @@ -using Content.Shared.Power.Substation; +using Content.Shared.Power; namespace Content.Server.Power.Components; @@ -17,7 +17,13 @@ public sealed partial class SubstationComponent : Component [ViewVariables(VVAccess.ReadWrite)] public SubstationIntegrityState State = SubstationIntegrityState.Healthy; - //9.231205828 is the amount of moles in a 5L container (the default fuse) at 1000Kpa 20C° - public float InitialFuseMoles = 2.051379050f; + //9.231205828 is the amount of moles in a 5L container (the default conduit) at 1000Kpa 20C° + public float InitialConduitMoles = 2.051379050f; + + [DataField("conduitSlotId", required: true)] + [ViewVariables(VVAccess.ReadOnly)] + public string ConduitSlotId = string.Empty; + + public bool AllowInsert = true; } diff --git a/Content.Server/Power/EntitySystems/SubstationSystem.cs b/Content.Server/Power/EntitySystems/SubstationSystem.cs index a247d242ea8df6..ccf28ee1f9ce02 100644 --- a/Content.Server/Power/EntitySystems/SubstationSystem.cs +++ b/Content.Server/Power/EntitySystems/SubstationSystem.cs @@ -1,16 +1,16 @@ using System.Diagnostics.CodeAnalysis; -using Robust.Server.GameObjects; -using Robust.Shared.Timing; -using Robust.Shared.Containers; using Content.Server.Power.Components; using Content.Server.Construction; using Content.Server.Atmos.Components; using Content.Server.Atmos; -using Content.Shared.Power.Substation; -using Content.Shared.Access.Systems; +using Content.Shared.Power; using Content.Shared.Rejuvenate; +using Content.Shared.Wires; +using Content.Shared.Tag; using Content.Shared.Examine; using Content.Shared.Atmos; +using Robust.Server.GameObjects; +using Robust.Shared.Containers; namespace Content.Server.Power.EntitySystems; @@ -20,6 +20,7 @@ public sealed class SubstationSystem : EntitySystem [Dependency] private readonly PointLightSystem _lightSystem = default!; [Dependency] private readonly SharedPointLightSystem _sharedLightSystem = default!; [Dependency] private readonly AppearanceSystem _appearanceSystem = default!; + [Dependency] private readonly TagSystem _tagSystem = default!; private bool _substationDecayEnabled = true; private const int _defaultSubstationDecayTimeout = 300; //5 minute @@ -37,12 +38,15 @@ public override void Initialize() UpdatesAfter.Add(typeof(PowerNetSystem)); SubscribeLocalEvent(OnComponentInit); - SubscribeLocalEvent(OnFuseLifetimeUpgradeExamine); + SubscribeLocalEvent(OnConduitLifetimeUpgradeExamine); SubscribeLocalEvent(OnExamine); SubscribeLocalEvent(OnRejuvenate); - SubscribeLocalEvent(OnAnalyzed); - SubscribeLocalEvent(OnFuseChanged); + SubscribeLocalEvent(OnAnalyzed); + SubscribeLocalEvent(OnConduitInserted); + SubscribeLocalEvent(OnConduitRemoved); + SubscribeLocalEvent(OnConduitInsertAttempt); + SubscribeLocalEvent(OnConduitRemoveAttempt); } private void OnComponentInit(EntityUid uid, SubstationComponent component, ComponentInit args) @@ -73,15 +77,15 @@ private void OnExamine(EntityUid uid, SubstationComponent component, ExaminedEve { if(args.IsInDetailsRange) { - if(!GetFuseMixture(uid, out var mix)) + if(!GetConduitMixture(uid, out var mix)) { args.PushMarkup( - Loc.GetString("substation-component-examine-no-fuse")); + Loc.GetString("substation-component-examine-no-conduit")); return; } else { - var integrity = CheckFuseIntegrity(component, mix); + var integrity = CheckConduitIntegrity(component, mix); if(integrity > 0.0f) { var integrityPercentRounded = (int)integrity; @@ -101,16 +105,16 @@ private void OnExamine(EntityUid uid, SubstationComponent component, ExaminedEve } } - private void OnFuseLifetimeUpgradeExamine(EntityUid uid, SubstationComponent component, UpgradeExamineEvent args) + private void OnConduitLifetimeUpgradeExamine(EntityUid uid, SubstationComponent component, UpgradeExamineEvent args) { TryComp(uid, out var upgrade); if(upgrade == null) return; if(upgrade.ActualScalar < 3) - args.AddPercentageUpgrade("upgrade-fuse-lifetime", upgrade.ActualScalar); + args.AddPercentageUpgrade("upgrade-conduit-lifetime", upgrade.ActualScalar); else - args.AddMaxUpgrade("upgrade-fuse-lifetime"); + args.AddMaxUpgrade("upgrade-conduit-lifetime"); } public override void Update(float deltaTime) @@ -155,44 +159,44 @@ public override void Update(float deltaTime) while(query.MoveNext(out var uid, out var subs, out var battery, out var upgrade)) { - if(!GetFuseMixture(uid, out var fuse)) + if(!GetConduitMixture(uid, out var conduit)) continue; if(subs.DecayEnabled && subs.LastIntegrity >= 0.0f && upgrade.ActualScalar < 3f) { - ConsumeFuseGas(deltaTime, upgrade.ActualScalar, subs, battery, fuse); - var fuseIntegrity = CheckFuseIntegrity(subs, fuse); + ConsumeConduitGas(deltaTime, upgrade.ActualScalar, subs, battery, conduit); + var conduitIntegrity = CheckConduitIntegrity(subs, conduit); - if(fuseIntegrity <= 0.0f) + if(conduitIntegrity <= 0.0f) { ShutdownSubstation(uid, subs); _substationDecayTimer = _defaultSubstationDecayTimeout; _substationDecayEnabled = false; - subs.LastIntegrity = fuseIntegrity; + subs.LastIntegrity = conduitIntegrity; continue; } - if(fuseIntegrity < 30f && subs.LastIntegrity >= 30f) + if(conduitIntegrity < 30f && subs.LastIntegrity >= 30f) { ChangeState(uid, SubstationIntegrityState.Bad, subs); } - else if(fuseIntegrity < 70f && subs.LastIntegrity >= 70f) + else if(conduitIntegrity < 70f && subs.LastIntegrity >= 70f) { ChangeState(uid, SubstationIntegrityState.Unhealthy, subs); } - subs.LastIntegrity = fuseIntegrity; + subs.LastIntegrity = conduitIntegrity; } } } - private void ConsumeFuseGas(float deltaTime, float scalar, SubstationComponent subs, PowerNetworkBatteryComponent battery, GasMixture mixture) + private void ConsumeConduitGas(float deltaTime, float scalar, SubstationComponent subs, PowerNetworkBatteryComponent battery, GasMixture mixture) { var initialN2 = mixture.GetMoles(Gas.Nitrogen); var initialPlasma = mixture.GetMoles(Gas.Plasma); - var molesConsumed = (subs.InitialFuseMoles * battery.CurrentSupply * deltaTime) / (_substationDecayCoeficient * scalar); + var molesConsumed = (subs.InitialConduitMoles * battery.CurrentSupply * deltaTime) / (_substationDecayCoeficient * scalar); var minimumReaction = Math.Min(initialN2, initialPlasma) * molesConsumed / 2; @@ -201,10 +205,10 @@ private void ConsumeFuseGas(float deltaTime, float scalar, SubstationComponent s mixture.AdjustMoles(Gas.NitrousOxide, minimumReaction*2); } - private float CheckFuseIntegrity(SubstationComponent subs, GasMixture mixture) + private float CheckConduitIntegrity(SubstationComponent subs, GasMixture mixture) { - if(subs.InitialFuseMoles <= 0f) + if(subs.InitialConduitMoles <= 0f) return 0f; var initialN2 = mixture.GetMoles(Gas.Nitrogen); @@ -212,39 +216,39 @@ private float CheckFuseIntegrity(SubstationComponent subs, GasMixture mixture) var usableMoles = Math.Min(initialN2, initialPlasma); //return in percentage points; - return 100 * usableMoles / (subs.InitialFuseMoles / 2); + return 100 * usableMoles / (subs.InitialConduitMoles / 2); } - private void OnFuseChanged(EntityUid uid, SubstationComponent subs, SubstationFuseChangedEvent args) + private void ConduitChanged(EntityUid uid, SubstationComponent subs) { - if(!GetFuseMixture(uid, out var mix)) + if(!GetConduitMixture(uid, out var mix)) { ShutdownSubstation(uid, subs); subs.LastIntegrity = 0f; return; } - var initialFuseMoles = 0f; + var initialConduitMoles = 0f; for(var i = 0; i < Atmospherics.TotalNumberOfGases; i++) { - initialFuseMoles += mix.GetMoles(i); + initialConduitMoles += mix.GetMoles(i); } - subs.InitialFuseMoles = initialFuseMoles; + subs.InitialConduitMoles = initialConduitMoles; - var fuseIntegrity = CheckFuseIntegrity(subs, mix); + var conduitIntegrity = CheckConduitIntegrity(subs, mix); - if(fuseIntegrity <= 0.0f) + if(conduitIntegrity <= 0.0f) { ShutdownSubstation(uid, subs); - subs.LastIntegrity = fuseIntegrity; + subs.LastIntegrity = conduitIntegrity; return; } - if(fuseIntegrity < 30f) + if(conduitIntegrity < 30f) { ChangeState(uid, SubstationIntegrityState.Bad, subs); } - else if(fuseIntegrity < 70f) + else if(conduitIntegrity < 70f) { ChangeState(uid, SubstationIntegrityState.Unhealthy, subs); } @@ -252,7 +256,7 @@ private void OnFuseChanged(EntityUid uid, SubstationComponent subs, SubstationFu { ChangeState(uid, SubstationIntegrityState.Healthy, subs); } - subs.LastIntegrity = fuseIntegrity; + subs.LastIntegrity = conduitIntegrity; } private void ShutdownSubstation(EntityUid uid, SubstationComponent subs) @@ -278,7 +282,7 @@ private void OnRejuvenate(EntityUid uid, SubstationComponent subs, RejuvenateEve ChangeState(uid, SubstationIntegrityState.Healthy, subs); - if(GetFuseMixture(uid, out var mix)) + if(GetConduitMixture(uid, out var mix)) { mix.SetMoles(Gas.Nitrogen, 1.025689525f); mix.SetMoles(Gas.Plasma, 1.025689525f); @@ -342,12 +346,12 @@ private void UpdateAppearance(EntityUid uid, SubstationIntegrityState subsState) _appearanceSystem.SetData(uid, SubstationVisuals.Screen, subsState, appearance); } - private void OnAnalyzed(EntityUid uid, SubstationFuseSlotComponent slot, GasAnalyzerScanEvent args) + private void OnAnalyzed(EntityUid uid, SubstationComponent slot, GasAnalyzerScanEvent args) { if(!TryComp(uid, out var containers)) return; - if(!containers.TryGetContainer(slot.FuseSlotId, out var container)) + if(!containers.TryGetContainer(slot.ConduitSlotId, out var container)) return; if(container.ContainedEntities.Count > 0) @@ -356,14 +360,14 @@ private void OnAnalyzed(EntityUid uid, SubstationFuseSlotComponent slot, GasAnal } } - private bool GetFuseMixture(EntityUid uid, [NotNullWhen(true)] out GasMixture? mix) + private bool GetConduitMixture(EntityUid uid, [NotNullWhen(true)] out GasMixture? mix) { mix = null; - if(!TryComp(uid, out var slot) || !TryComp(uid, out var containers)) + if(!TryComp(uid, out var subs) || !TryComp(uid, out var containers)) return false; - if(!containers.TryGetContainer(slot.FuseSlotId, out var container)) + if(!containers.TryGetContainer(subs.ConduitSlotId, out var container)) return false; if(container.ContainedEntities.Count > 0) @@ -376,4 +380,69 @@ private bool GetFuseMixture(EntityUid uid, [NotNullWhen(true)] out GasMixture? m return false; } + private void OnConduitInsertAttempt(EntityUid uid, SubstationComponent component, ContainerIsInsertingAttemptEvent args) + { + if(!component.Initialized) + return; + + if(args.Container.ID != component.ConduitSlotId) + return; + + if(!TryComp(uid, out var panel)) + { + args.Cancel(); + return; + } + + //for when the substation is initialized. + if(component.AllowInsert) + { + component.AllowInsert = false; + return; + } + + if(!panel.Open) + { + args.Cancel(); + } + + } + + private void OnConduitRemoveAttempt(EntityUid uid, SubstationComponent component, ContainerIsRemovingAttemptEvent args) + { + if(!component.Initialized) + return; + + if(args.Container.ID != component.ConduitSlotId) + return; + + if(!TryComp(uid, out var panel)) + return; + + if(!panel.Open) + { + args.Cancel(); + } + + } + + private void OnConduitInserted(EntityUid uid, SubstationComponent component, EntInsertedIntoContainerMessage args) + { + if(!component.Initialized) + return; + + if(args.Container.ID != component.ConduitSlotId) + return; + + ConduitChanged(uid, component); + } + + private void OnConduitRemoved(EntityUid uid, SubstationComponent component, EntRemovedFromContainerMessage args) + { + if(args.Container.ID != component.ConduitSlotId) + return; + + ConduitChanged(uid, component); + } + } \ No newline at end of file diff --git a/Content.Shared/Power/SharedSubstation.cs b/Content.Shared/Power/SharedSubstation.cs new file mode 100644 index 00000000000000..dc1aecac27a9fa --- /dev/null +++ b/Content.Shared/Power/SharedSubstation.cs @@ -0,0 +1,18 @@ +using Robust.Shared.Serialization; +using Content.Shared.Containers.ItemSlots; + +namespace Content.Shared.Power; + +[Serializable, NetSerializable] +public enum SubstationIntegrityState +{ + Healthy, //At 70% or more + Unhealthy, // <70% to 30% + Bad // <30% +} + +[Serializable, NetSerializable] +public enum SubstationVisuals +{ + Screen +} \ No newline at end of file diff --git a/Content.Shared/Power/Substation/SharedSubstationComponent.cs b/Content.Shared/Power/Substation/SharedSubstationComponent.cs deleted file mode 100644 index 0f3c927e3a48d8..00000000000000 --- a/Content.Shared/Power/Substation/SharedSubstationComponent.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Robust.Shared.Serialization; -using Content.Shared.Containers.ItemSlots; - -namespace Content.Shared.Power.Substation; - -[Serializable, NetSerializable] -public enum SubstationIntegrityState -{ - Healthy, //At 70% or more - Unhealthy, // <70% to 30% - Bad // <30% -} - -[Serializable, NetSerializable] -public enum SubstationVisuals -{ - Screen -} - -[RegisterComponent] -public sealed partial class SubstationFuseSlotComponent : Component -{ - - [DataField("fuseSlotId", required: true)] - [ViewVariables(VVAccess.ReadOnly)] - public string FuseSlotId = string.Empty; - - public bool AllowInsert = true; - -} - -public sealed class SubstationFuseChangedEvent : EntityEventArgs -{} diff --git a/Content.Shared/Power/Substation/SharedSubstationSystem.cs b/Content.Shared/Power/Substation/SharedSubstationSystem.cs deleted file mode 100644 index a22152da1eac27..00000000000000 --- a/Content.Shared/Power/Substation/SharedSubstationSystem.cs +++ /dev/null @@ -1,89 +0,0 @@ -using Content.Shared.Containers.ItemSlots; -using Content.Shared.Wires; -using Content.Shared.Tag; -using Robust.Shared.Containers; - -namespace Content.Shared.Power.Substation; - -public sealed partial class SharedSubstationSystem : EntitySystem -{ - - [Dependency] private readonly TagSystem _tagSystem = default!; - - public override void Initialize() - { - base.Initialize(); - SubscribeLocalEvent(OnFuseInserted); - SubscribeLocalEvent(OnFuseRemoved); - SubscribeLocalEvent(OnFuseInsertAttempt); - SubscribeLocalEvent(OnFuseRemoveAttempt); - - } - - private void OnFuseInsertAttempt(EntityUid uid, SubstationFuseSlotComponent component, ContainerIsInsertingAttemptEvent args) - { - if(!component.Initialized) - return; - - if(args.Container.ID != component.FuseSlotId) - return; - - if(!TryComp(uid, out var panel)) - return; - - if(!_tagSystem.HasTag(args.EntityUid, "Fuse")) - { - args.Cancel(); - return; - } - - if(component.AllowInsert) - { - component.AllowInsert = false; - return; - } - - if(!panel.Open) - { - args.Cancel(); - } - - } - - private void OnFuseRemoveAttempt(EntityUid uid, SubstationFuseSlotComponent component, ContainerIsRemovingAttemptEvent args) - { - if(!component.Initialized) - return; - - if(args.Container.ID != component.FuseSlotId) - return; - - if(!TryComp(uid, out var panel)) - return; - - if(!panel.Open) - { - args.Cancel(); - } - - } - - private void OnFuseInserted(EntityUid uid, SubstationFuseSlotComponent component, EntInsertedIntoContainerMessage args) - { - if(!component.Initialized) - return; - - if(args.Container.ID != component.FuseSlotId) - return; - - RaiseLocalEvent(uid, new SubstationFuseChangedEvent(), false); - } - - private void OnFuseRemoved(EntityUid uid, SubstationFuseSlotComponent component, EntRemovedFromContainerMessage args) - { - if(args.Container.ID != component.FuseSlotId) - return; - - RaiseLocalEvent(uid, new SubstationFuseChangedEvent(), false); - } -} diff --git a/Resources/Locale/en-US/machine/machine.ftl b/Resources/Locale/en-US/machine/machine.ftl index a565f3131454db..cd3ab8d4412e6c 100644 --- a/Resources/Locale/en-US/machine/machine.ftl +++ b/Resources/Locale/en-US/machine/machine.ftl @@ -18,7 +18,7 @@ upgrade-power-draw = power draw upgrade-max-charge = max charge upgrade-power-supply = power supply upgrade-power-supply-ramping = power ramp rate -upgrade-fuse-lifetime = fuse lifetime +upgrade-conduit-lifetime = conduit lifetime two-way-lever-left = push left two-way-lever-right = push right diff --git a/Resources/Locale/en-US/power/components/substation-component.ftl b/Resources/Locale/en-US/power/components/substation-component.ftl index 61ead50621a608..0cec2fe8efdcdb 100644 --- a/Resources/Locale/en-US/power/components/substation-component.ftl +++ b/Resources/Locale/en-US/power/components/substation-component.ftl @@ -4,5 +4,5 @@ # Shown when the substation is examined in details range substation-component-examine-integrity = The substation is at [color={$markupPercentColor}]{$percent}%[/color] integrity. substation-component-examine-malfunction = The substation is [color=red]malfunctioning[/color]. -substation-component-examine-no-fuse = The substation is [color=red]missing a fuse[/color]. +substation-component-examine-no-conduit = The substation is [color=red]missing a conduit[/color]. diff --git a/Resources/Prototypes/Catalog/Fills/Items/gas_tanks.yml b/Resources/Prototypes/Catalog/Fills/Items/gas_tanks.yml index 14bcdac76cc539..2b74ae3b45de07 100644 --- a/Resources/Prototypes/Catalog/Fills/Items/gas_tanks.yml +++ b/Resources/Prototypes/Catalog/Fills/Items/gas_tanks.yml @@ -161,9 +161,9 @@ temperature: 293.15 - type: entity - id: GasFuseFilled - parent: GasFuse - name: HV Fuse + id: GasConduitFilled + parent: GasConduit + name: power conduit suffix: Filled components: - type: GasTank diff --git a/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml b/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml index 48f0f4204c59ae..96282bee7d5b87 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml @@ -217,14 +217,14 @@ - type: entity parent: GasTankRoundBase - id: GasFuse - name: HV fuse - description: High power fuse filled with protective gas. + id: GasConduit + name: power conduit + description: A bulky ceramic conduit filled with gas. Used in high power machines such as substations. components: - type: Sprite - sprite: Objects/Tanks/plasma.rsi + sprite: Objects/Tanks/gasconduit.rsi - type: Item - sprite: Objects/Tanks/plasma.rsi + sprite: Objects/Tanks/gasconduit.rsi - type: GasTank outputPressure: 101.3 air: @@ -232,4 +232,4 @@ temperature: 293.15 - type: Tag tags: - - Fuse + - Conduit diff --git a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml index dcc9afc1dd8664..b0dd3a142921d3 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml @@ -97,7 +97,7 @@ - TRayScanner - GasAnalyzer - UtilityBelt - - GasFuse + - GasConduit - Fulton - FultonBeacon - Pickaxe diff --git a/Resources/Prototypes/Entities/Structures/Power/substation.yml b/Resources/Prototypes/Entities/Structures/Power/substation.yml index 810bd250b1e61a..92147d3dca6b56 100644 --- a/Resources/Prototypes/Entities/Structures/Power/substation.yml +++ b/Resources/Prototypes/Entities/Structures/Power/substation.yml @@ -21,20 +21,19 @@ map: ["substationBattery"] shader: unshaded - type: Substation - - type: SubstationFuseSlot - fuseSlotId: fuse_slot + conduitSlotId: conduit_slot - type: ContainerContainer containers: - fuse_slot: !type:ContainerSlot {} + conduit_slot: !type:ContainerSlot {} - type: ItemSlots slots: - fuse_slot: + conduit_slot: ejectOnInteract: true - name: HV Fuse - startingItem: GasFuseFilled + name: HV Conduit + startingItem: GasConduitFilled whitelist: tags: - - Fuse + - Conduit - type: SubstationVisuals screenLayer: "substationScreen" integrityStates: @@ -164,18 +163,16 @@ - type: ContainerContainer containers: board: !type:Container - fuse_slot: !type:ContainerSlot - - type: SubstationFuseSlot - fuseSlotId: fuse_slot + conduit_slot: !type:ContainerSlot - type: ItemSlots slots: - fuse_slot: + conduit_slot: ejectOnInteract: true - name: HV Fuse - startingItem: GasFuseFilled + name: HV Conduit + startingItem: GasCOnduitFilled whitelist: tags: - - Fuse + - Conduit - type: WiresPanel - type: Wires boardName: wires-board-name-substation @@ -197,6 +194,7 @@ map: ["substationScreen"] shader: unshaded - type: Substation + conduitSlotId: conduit_slot - type: SubstationVisuals screenLayer: "substationScreen" integrityStates: @@ -278,9 +276,9 @@ startingCharge: 0 - type: ItemSlots slots: - fuse_slot: + conduit_slot: ejectOnInteract: true - name: HV Fuse + name: HV Conduit startingItem: - type: Substation state: Bad @@ -304,9 +302,9 @@ startingCharge: 0 - type: ItemSlots slots: - fuse_slot: + conduit_slot: ejectOnInteract: true - name: HV Fuse + name: HV Conduit startingItem: - type: Substation state: Bad diff --git a/Resources/Prototypes/Recipes/Lathes/misc.yml b/Resources/Prototypes/Recipes/Lathes/misc.yml index 18468f572bc1ee..302142c0aef6a1 100644 --- a/Resources/Prototypes/Recipes/Lathes/misc.yml +++ b/Resources/Prototypes/Recipes/Lathes/misc.yml @@ -94,8 +94,8 @@ Plastic: 100 - type: latheRecipe - id: GasFuse - result: GasFuse + id: GasConduit + result: GasConduit completetime: 2 materials: Steel: 100 diff --git a/Resources/Prototypes/tags.yml b/Resources/Prototypes/tags.yml index b38b8118aa2018..d4aacdd055499b 100644 --- a/Resources/Prototypes/tags.yml +++ b/Resources/Prototypes/tags.yml @@ -483,7 +483,7 @@ id: Fruit - type: Tag - id: Fuse + id: Conduit - type: Tag id: Galaxythistle diff --git a/Resources/Textures/Objects/Tanks/gasconduit.rsi/equipped-BELT.png b/Resources/Textures/Objects/Tanks/gasconduit.rsi/equipped-BELT.png new file mode 100644 index 0000000000000000000000000000000000000000..ef0e4a7f81dec216309eb9455750fc69d5896721 GIT binary patch literal 368 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=oCO|{#S9F5he4R}c>anM1_nkY zPZ!6K3dXm$4EdTI1RO3Nj99qPK+H^SmPEGR0+R|pY3=jLo{w#Ft{7)Hz7}0j%G%7i zP*GSZ@$2OSYQ{I`9xt(0vf)r@U|>Qgu5h&+ymf^wQs_a(`O5p%$7FXJ&8alHcl1@w z+q(OG@3YN2E-&<$m1--Lo2CBvD#K|r}}gq;m%KQr~d|DHQvJm5ZG`0T6SZa+H4kb9n6ME1Feu-4W83**e$GIle6 z`pdVy^+c!&k6Mvc{1w;f!dE^sK7I0M_uIT6>YgBY|16_F;AjzV=2Ry&>Q z53p*4_}C>95orxtgGkVgfhZwSUl9=>Fd}yMb1R(%HoC z&+jyK+|D8d{OBa><~u{?|^g52gm$J`co_`1jiza0EV|TyXflrh7$3VNTzzQ6R@2d!!gcx_IWM( zoFW7~8gkS6`aY3|1bl3)mm;%KbByJm^CZKkZ#yY*aA;d!9Aj|+a6qwh^qveHmyOwe z4p!~l2^@KH9KZ)aS%eC1hGIQhF+2Z_B(m7VzabwSM~oY)y%ad|SOnmsIRBFEe7+~! z>&WeC6~8EQ_CfQFNpfmC7~GTsFbNU3+0ayQh(HTOPPGe81W1p(0Q8cFF(%002ovPDHLkV1kw;GNAwf literal 0 HcmV?d00001 diff --git a/Resources/Textures/Objects/Tanks/gasconduit.rsi/inhand-left.png b/Resources/Textures/Objects/Tanks/gasconduit.rsi/inhand-left.png new file mode 100644 index 0000000000000000000000000000000000000000..f24f9842dac6f35d00dbeab6da40092d42d21417 GIT binary patch literal 447 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=oCO|{#S9F5he4R}c>anM1_s7L zPZ!6K3dXm$46~RVMUH(8T$9_Bpcoj$QpC9NqDkYICUXH6Me`3DJDvF^s#P##i%KhY zv?RO)TUu)PG-#o%R0X^hn*XW$CXbvN&45zpyp- zZ#+YT^J%9|@0VS>In{nkyozDr+OjyAJ^vT&V^X_(Q}0&p-?qr(ddG7&Ut2y`f1men z-YxHM-KzXoBdOfLz{H_|gK%VeUNiCGjg}?0SLJ(UXTPxg9?hcJQc?HV(ehW#-u_Ab zn~p5hWZX9WZDw`p0 zR7G>nYH*vlWc#h(jPIVQS88gp9R9j>>-2ZBM)6q!Ka!cGPunIuo%Tw?6Br{5p00i_ I>zopr0OPZ{egFUf literal 0 HcmV?d00001 diff --git a/Resources/Textures/Objects/Tanks/gasconduit.rsi/inhand-right.png b/Resources/Textures/Objects/Tanks/gasconduit.rsi/inhand-right.png new file mode 100644 index 0000000000000000000000000000000000000000..bd5de325be175abf6a7afdb93c6b29acd572d8cc GIT binary patch literal 441 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=oCO|{#S9F5he4R}c>anM1_s7# zPZ!6K3dXm$HhLX)kU9Qw|0T^Se7a4|TaGS#@G2l?OZSDHtnp4Ccz-E18pRjg?#k$mrk0Es4nd`^5pLiLPQV{a=)BM=S#_u+-`gV#s!0?tDnm{r-UW| D19iTj literal 0 HcmV?d00001 diff --git a/Resources/Textures/Objects/Tanks/gasconduit.rsi/meta.json b/Resources/Textures/Objects/Tanks/gasconduit.rsi/meta.json new file mode 100644 index 00000000000000..cdc584b5551033 --- /dev/null +++ b/Resources/Textures/Objects/Tanks/gasconduit.rsi/meta.json @@ -0,0 +1,26 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "Made by joshepvodka", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "icon" + }, + { + "name": "equipped-BELT", + "directions": 4 + }, + { + "name": "inhand-left", + "directions": 4 + }, + { + "name": "inhand-right", + "directions": 4 + } + ] +} From 92b3a57f86153448748bcd2519ef36c2bbe8ef47 Mon Sep 17 00:00:00 2001 From: joshepvodka Date: Sun, 31 Dec 2023 19:09:47 -0300 Subject: [PATCH 10/24] fixed lights and yml --- Content.Server/Power/EntitySystems/SubstationSystem.cs | 2 +- .../Prototypes/Entities/Structures/Power/substation.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Content.Server/Power/EntitySystems/SubstationSystem.cs b/Content.Server/Power/EntitySystems/SubstationSystem.cs index ccf28ee1f9ce02..3d81b9974a2e7b 100644 --- a/Content.Server/Power/EntitySystems/SubstationSystem.cs +++ b/Content.Server/Power/EntitySystems/SubstationSystem.cs @@ -322,7 +322,7 @@ private void ChangeState(EntityUid uid, SubstationIntegrityState state, Substati } _lightSystem.SetColor(uid, new Color(0x3d, 0xb8, 0x3b), light); } - else if(subs.State == SubstationIntegrityState.Unhealthy) + else if(state == SubstationIntegrityState.Unhealthy) { if(subs.State == SubstationIntegrityState.Bad) { diff --git a/Resources/Prototypes/Entities/Structures/Power/substation.yml b/Resources/Prototypes/Entities/Structures/Power/substation.yml index 92147d3dca6b56..e7fb2db6625e36 100644 --- a/Resources/Prototypes/Entities/Structures/Power/substation.yml +++ b/Resources/Prototypes/Entities/Structures/Power/substation.yml @@ -29,7 +29,7 @@ slots: conduit_slot: ejectOnInteract: true - name: HV Conduit + name: power conduit startingItem: GasConduitFilled whitelist: tags: @@ -168,8 +168,8 @@ slots: conduit_slot: ejectOnInteract: true - name: HV Conduit - startingItem: GasCOnduitFilled + name: power conduit + startingItem: GasConduitFilled whitelist: tags: - Conduit From 9d47c0ee6ba8bb3a7105b7e85f7724219bfb5a82 Mon Sep 17 00:00:00 2001 From: joshepvodka Date: Sun, 31 Dec 2023 19:22:07 -0300 Subject: [PATCH 11/24] changed conduit material composition --- Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml | 4 ++++ Resources/Prototypes/Recipes/Lathes/misc.yml | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml b/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml index 56da67ffc1217d..85f3e560afcbc8 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml @@ -256,3 +256,7 @@ - type: Tag tags: - Conduit + - type: PhysicalComposition + materialComposition: + Steel: 200 + Glass: 200 diff --git a/Resources/Prototypes/Recipes/Lathes/misc.yml b/Resources/Prototypes/Recipes/Lathes/misc.yml index 4e9b9ad8c4dc54..7ce73eecc29cd1 100644 --- a/Resources/Prototypes/Recipes/Lathes/misc.yml +++ b/Resources/Prototypes/Recipes/Lathes/misc.yml @@ -123,8 +123,8 @@ result: GasConduit completetime: 2 materials: - Steel: 100 - Glass: 100 + Steel: 200 + Glass: 200 - type: latheRecipe id: FauxTileAstroGrass From b2dc9a63b65ddd24a81cd8102982b4692567432b Mon Sep 17 00:00:00 2001 From: joshepvodka Date: Sun, 31 Dec 2023 19:37:03 -0300 Subject: [PATCH 12/24] fix some checks --- .../Power/EntitySystems/SubstationSystem.cs | 20 ------------------- .../Entities/Objects/Tools/gas_tanks.yml | 4 ++-- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/Content.Server/Power/EntitySystems/SubstationSystem.cs b/Content.Server/Power/EntitySystems/SubstationSystem.cs index 3d81b9974a2e7b..d6d9323991b0fb 100644 --- a/Content.Server/Power/EntitySystems/SubstationSystem.cs +++ b/Content.Server/Power/EntitySystems/SubstationSystem.cs @@ -51,26 +51,6 @@ public override void Initialize() private void OnComponentInit(EntityUid uid, SubstationComponent component, ComponentInit args) { - if(component.State == SubstationIntegrityState.Bad) - { - TryComp(uid, out var battery); - if(battery == null) - return; - - component.LastIntegrity = 0.0f; - battery.Enabled = false; - battery.CanCharge = false; - battery.CanDischarge = false; - if(HasComp(uid)) - RemComp(uid); - - _lightSystem.TryGetLight(uid, out var light); - if(light == null) - return; - - _lightSystem.SetColor(uid, Color.Red, light); - UpdateAppearance(uid, component.State); - } } private void OnExamine(EntityUid uid, SubstationComponent component, ExaminedEvent args) diff --git a/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml b/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml index 85f3e560afcbc8..bc0b3082aecd91 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml @@ -258,5 +258,5 @@ - Conduit - type: PhysicalComposition materialComposition: - Steel: 200 - Glass: 200 + Steel: 100 + Glass: 100 From f193cba6620989d4ab64ef405288c7fffce32db2 Mon Sep 17 00:00:00 2001 From: joshepvodka Date: Sun, 31 Dec 2023 20:36:26 -0300 Subject: [PATCH 13/24] change item name --- Content.Server/Power/EntitySystems/SubstationSystem.cs | 5 ----- Resources/Prototypes/Catalog/Fills/Items/gas_tanks.yml | 2 +- Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml | 2 +- .../Prototypes/Entities/Structures/Power/substation.yml | 4 ++-- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Content.Server/Power/EntitySystems/SubstationSystem.cs b/Content.Server/Power/EntitySystems/SubstationSystem.cs index d6d9323991b0fb..bb7c848f801911 100644 --- a/Content.Server/Power/EntitySystems/SubstationSystem.cs +++ b/Content.Server/Power/EntitySystems/SubstationSystem.cs @@ -37,7 +37,6 @@ public override void Initialize() UpdatesAfter.Add(typeof(PowerNetSystem)); - SubscribeLocalEvent(OnComponentInit); SubscribeLocalEvent(OnConduitLifetimeUpgradeExamine); SubscribeLocalEvent(OnExamine); SubscribeLocalEvent(OnRejuvenate); @@ -49,10 +48,6 @@ public override void Initialize() SubscribeLocalEvent(OnConduitRemoveAttempt); } - private void OnComponentInit(EntityUid uid, SubstationComponent component, ComponentInit args) - { - } - private void OnExamine(EntityUid uid, SubstationComponent component, ExaminedEvent args) { if(args.IsInDetailsRange) diff --git a/Resources/Prototypes/Catalog/Fills/Items/gas_tanks.yml b/Resources/Prototypes/Catalog/Fills/Items/gas_tanks.yml index 5909a7d46155e2..4554b49799ddcc 100644 --- a/Resources/Prototypes/Catalog/Fills/Items/gas_tanks.yml +++ b/Resources/Prototypes/Catalog/Fills/Items/gas_tanks.yml @@ -211,7 +211,7 @@ - type: entity id: GasConduitFilled parent: GasConduit - name: power conduit + name: gas conduit suffix: Filled components: - type: GasTank diff --git a/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml b/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml index bc0b3082aecd91..d47326ac1b2c4f 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml @@ -241,7 +241,7 @@ - type: entity parent: GasTankRoundBase id: GasConduit - name: power conduit + name: gas conduit description: A bulky ceramic conduit filled with gas. Used in high power machines such as substations. components: - type: Sprite diff --git a/Resources/Prototypes/Entities/Structures/Power/substation.yml b/Resources/Prototypes/Entities/Structures/Power/substation.yml index 4c375e237f0dab..0b3e2ce6e99f4d 100644 --- a/Resources/Prototypes/Entities/Structures/Power/substation.yml +++ b/Resources/Prototypes/Entities/Structures/Power/substation.yml @@ -29,7 +29,7 @@ slots: conduit_slot: ejectOnInteract: true - name: power conduit + name: gas conduit startingItem: GasConduitFilled whitelist: tags: @@ -176,7 +176,7 @@ slots: conduit_slot: ejectOnInteract: true - name: power conduit + name: gas conduit startingItem: GasConduitFilled whitelist: tags: From c2e71c06ca167fce108a0195714eb3a7bc51bb41 Mon Sep 17 00:00:00 2001 From: Peptide90 Date: Tue, 13 Feb 2024 19:18:18 +0000 Subject: [PATCH 14/24] changes all naming from conduit to nitrogen booster. Removes machine upgrade stuff. --- .../Power/EntitySystems/SubstationSystem.cs | 152 ++++++------------ .../Power}/SubstationComponent.cs | 12 +- Resources/Locale/en-US/machine/machine.ftl | 2 +- .../power/components/substation-component.ftl | 2 +- .../Catalog/Fills/Items/gas_tanks.yml | 10 +- .../Circuitboards/Machine/production.yml | 5 - .../Entities/Objects/Tools/gas_tanks.yml | 16 +- .../Entities/Structures/Machines/lathe.yml | 2 +- .../Entities/Structures/Power/substation.yml | 40 ++--- Resources/Prototypes/Recipes/Lathes/misc.yml | 5 +- Resources/Prototypes/tags.yml | 6 +- .../equipped-BELT.png | Bin .../icon.png | Bin .../inhand-left.png | Bin .../inhand-right.png | Bin .../meta.json | 0 16 files changed, 93 insertions(+), 159 deletions(-) rename {Content.Server/Power/Components => Content.Shared/Power}/SubstationComponent.cs (71%) rename Resources/Textures/Objects/Tanks/{gasconduit.rsi => nitrogenbooster.rsi}/equipped-BELT.png (100%) rename Resources/Textures/Objects/Tanks/{gasconduit.rsi => nitrogenbooster.rsi}/icon.png (100%) rename Resources/Textures/Objects/Tanks/{gasconduit.rsi => nitrogenbooster.rsi}/inhand-left.png (100%) rename Resources/Textures/Objects/Tanks/{gasconduit.rsi => nitrogenbooster.rsi}/inhand-right.png (100%) rename Resources/Textures/Objects/Tanks/{gasconduit.rsi => nitrogenbooster.rsi}/meta.json (100%) diff --git a/Content.Server/Power/EntitySystems/SubstationSystem.cs b/Content.Server/Power/EntitySystems/SubstationSystem.cs index bb7c848f801911..5c5b7080375d46 100644 --- a/Content.Server/Power/EntitySystems/SubstationSystem.cs +++ b/Content.Server/Power/EntitySystems/SubstationSystem.cs @@ -14,9 +14,9 @@ namespace Content.Server.Power.EntitySystems; -public sealed class SubstationSystem : EntitySystem +public sealed class SubstationSystem : EntitySystem { - + [Dependency] private readonly PointLightSystem _lightSystem = default!; [Dependency] private readonly SharedPointLightSystem _sharedLightSystem = default!; [Dependency] private readonly AppearanceSystem _appearanceSystem = default!; @@ -37,30 +37,29 @@ public override void Initialize() UpdatesAfter.Add(typeof(PowerNetSystem)); - SubscribeLocalEvent(OnConduitLifetimeUpgradeExamine); SubscribeLocalEvent(OnExamine); SubscribeLocalEvent(OnRejuvenate); SubscribeLocalEvent(OnAnalyzed); - SubscribeLocalEvent(OnConduitInserted); - SubscribeLocalEvent(OnConduitRemoved); - SubscribeLocalEvent(OnConduitInsertAttempt); - SubscribeLocalEvent(OnConduitRemoveAttempt); + SubscribeLocalEvent(OnNitrogenBoosterInserted); + SubscribeLocalEvent(OnNitrogenBoosterRemoved); + SubscribeLocalEvent(OnNitrogenBoosterInsertAttempt); + SubscribeLocalEvent(OnNitrogenBoosterRemoveAttempt); } - private void OnExamine(EntityUid uid, SubstationComponent component, ExaminedEvent args) + private void OnExamine(EntityUid uid, SubstationComponent component, ExaminedEvent args) { if(args.IsInDetailsRange) { - if(!GetConduitMixture(uid, out var mix)) + if(!GetNitrogenBoosterMixture(uid, out var mix)) { args.PushMarkup( - Loc.GetString("substation-component-examine-no-conduit")); + Loc.GetString("substation-component-examine-no-nitrogenbooster")); return; } else { - var integrity = CheckConduitIntegrity(component, mix); + var integrity = CheckNitrogenBoosterIntegrity(component, mix); if(integrity > 0.0f) { var integrityPercentRounded = (int)integrity; @@ -80,18 +79,6 @@ private void OnExamine(EntityUid uid, SubstationComponent component, ExaminedEve } } - private void OnConduitLifetimeUpgradeExamine(EntityUid uid, SubstationComponent component, UpgradeExamineEvent args) - { - TryComp(uid, out var upgrade); - if(upgrade == null) - return; - - if(upgrade.ActualScalar < 3) - args.AddPercentageUpgrade("upgrade-conduit-lifetime", upgrade.ActualScalar); - else - args.AddMaxUpgrade("upgrade-conduit-lifetime"); - } - public override void Update(float deltaTime) { @@ -108,7 +95,7 @@ public override void Update(float deltaTime) { if(subs.State == SubstationIntegrityState.Healthy) continue; - + if(!_lightSystem.TryGetLight(uid, out var shlight)) return; @@ -129,50 +116,15 @@ public override void Update(float deltaTime) } return; } - - var query = EntityQueryEnumerator(); - while(query.MoveNext(out var uid, out var subs, out var battery, out var upgrade)) - { - - if(!GetConduitMixture(uid, out var conduit)) - continue; - - if(subs.DecayEnabled && subs.LastIntegrity >= 0.0f && upgrade.ActualScalar < 3f) - { - ConsumeConduitGas(deltaTime, upgrade.ActualScalar, subs, battery, conduit); - var conduitIntegrity = CheckConduitIntegrity(subs, conduit); - - if(conduitIntegrity <= 0.0f) - { - ShutdownSubstation(uid, subs); - _substationDecayTimer = _defaultSubstationDecayTimeout; - _substationDecayEnabled = false; - - subs.LastIntegrity = conduitIntegrity; - continue; - } - - if(conduitIntegrity < 30f && subs.LastIntegrity >= 30f) - { - ChangeState(uid, SubstationIntegrityState.Bad, subs); - } - else if(conduitIntegrity < 70f && subs.LastIntegrity >= 70f) - { - ChangeState(uid, SubstationIntegrityState.Unhealthy, subs); - } - - subs.LastIntegrity = conduitIntegrity; - } - } } - private void ConsumeConduitGas(float deltaTime, float scalar, SubstationComponent subs, PowerNetworkBatteryComponent battery, GasMixture mixture) + private void ConsumeNitrogenBoosterGas(float deltaTime, float scalar, SubstationComponent subs, PowerNetworkBatteryComponent battery, GasMixture mixture) { var initialN2 = mixture.GetMoles(Gas.Nitrogen); var initialPlasma = mixture.GetMoles(Gas.Plasma); - var molesConsumed = (subs.InitialConduitMoles * battery.CurrentSupply * deltaTime) / (_substationDecayCoeficient * scalar); - + var molesConsumed = (subs.InitialNitrogenBoosterMoles * battery.CurrentSupply * deltaTime) / (_substationDecayCoeficient * scalar); + var minimumReaction = Math.Min(initialN2, initialPlasma) * molesConsumed / 2; mixture.AdjustMoles(Gas.Nitrogen, -minimumReaction); @@ -180,10 +132,10 @@ private void ConsumeConduitGas(float deltaTime, float scalar, SubstationComponen mixture.AdjustMoles(Gas.NitrousOxide, minimumReaction*2); } - private float CheckConduitIntegrity(SubstationComponent subs, GasMixture mixture) + private float CheckNitrogenBoosterIntegrity(SubstationComponent subs, GasMixture mixture) { - if(subs.InitialConduitMoles <= 0f) + if(subs.InitialNitrogenBoosterMoles <= 0f) return 0f; var initialN2 = mixture.GetMoles(Gas.Nitrogen); @@ -191,39 +143,39 @@ private float CheckConduitIntegrity(SubstationComponent subs, GasMixture mixture var usableMoles = Math.Min(initialN2, initialPlasma); //return in percentage points; - return 100 * usableMoles / (subs.InitialConduitMoles / 2); + return 100 * usableMoles / (subs.InitialNitrogenBoosterMoles / 2); } - private void ConduitChanged(EntityUid uid, SubstationComponent subs) + private void NitrogenBoosterChanged(EntityUid uid, SubstationComponent subs) { - if(!GetConduitMixture(uid, out var mix)) + if(!GetNitrogenBoosterMixture(uid, out var mix)) { ShutdownSubstation(uid, subs); subs.LastIntegrity = 0f; return; } - - var initialConduitMoles = 0f; + + var initialNitrogenBoosterMoles = 0f; for(var i = 0; i < Atmospherics.TotalNumberOfGases; i++) { - initialConduitMoles += mix.GetMoles(i); + initialNitrogenBoosterMoles += mix.GetMoles(i); } - subs.InitialConduitMoles = initialConduitMoles; + subs.InitialNitrogenBoosterMoles = initialNitrogenBoosterMoles; - var conduitIntegrity = CheckConduitIntegrity(subs, mix); + var NitrogenBoosterIntegrity = CheckNitrogenBoosterIntegrity(subs, mix); - if(conduitIntegrity <= 0.0f) + if(NitrogenBoosterIntegrity <= 0.0f) { ShutdownSubstation(uid, subs); - subs.LastIntegrity = conduitIntegrity; + subs.LastIntegrity = NitrogenBoosterIntegrity; return; } - if(conduitIntegrity < 30f) + if(NitrogenBoosterIntegrity < 30f) { ChangeState(uid, SubstationIntegrityState.Bad, subs); } - else if(conduitIntegrity < 70f) + else if(NitrogenBoosterIntegrity < 70f) { ChangeState(uid, SubstationIntegrityState.Unhealthy, subs); } @@ -231,7 +183,7 @@ private void ConduitChanged(EntityUid uid, SubstationComponent subs) { ChangeState(uid, SubstationIntegrityState.Healthy, subs); } - subs.LastIntegrity = conduitIntegrity; + subs.LastIntegrity = NitrogenBoosterIntegrity; } private void ShutdownSubstation(EntityUid uid, SubstationComponent subs) @@ -257,7 +209,7 @@ private void OnRejuvenate(EntityUid uid, SubstationComponent subs, RejuvenateEve ChangeState(uid, SubstationIntegrityState.Healthy, subs); - if(GetConduitMixture(uid, out var mix)) + if(GetNitrogenBoosterMixture(uid, out var mix)) { mix.SetMoles(Gas.Nitrogen, 1.025689525f); mix.SetMoles(Gas.Plasma, 1.025689525f); @@ -326,7 +278,7 @@ private void OnAnalyzed(EntityUid uid, SubstationComponent slot, GasAnalyzerScan if(!TryComp(uid, out var containers)) return; - if(!containers.TryGetContainer(slot.ConduitSlotId, out var container)) + if(!containers.TryGetContainer(slot.NitrogenBoosterSlotId, out var container)) return; if(container.ContainedEntities.Count > 0) @@ -335,32 +287,32 @@ private void OnAnalyzed(EntityUid uid, SubstationComponent slot, GasAnalyzerScan } } - private bool GetConduitMixture(EntityUid uid, [NotNullWhen(true)] out GasMixture? mix) + private bool GetNitrogenBoosterMixture(EntityUid uid, [NotNullWhen(true)] out GasMixture? mix) { mix = null; if(!TryComp(uid, out var subs) || !TryComp(uid, out var containers)) return false; - if(!containers.TryGetContainer(subs.ConduitSlotId, out var container)) + if(!containers.TryGetContainer(subs.NitrogenBoosterSlotId, out var container)) return false; - + if(container.ContainedEntities.Count > 0) { var gasTank = Comp(container.ContainedEntities[0]); mix = gasTank.Air; return true; } - + return false; } - private void OnConduitInsertAttempt(EntityUid uid, SubstationComponent component, ContainerIsInsertingAttemptEvent args) + private void OnNitrogenBoosterInsertAttempt(EntityUid uid, SubstationComponent component, ContainerIsInsertingAttemptEvent args) { if(!component.Initialized) return; - if(args.Container.ID != component.ConduitSlotId) + if(args.Container.ID != component.NitrogenBoosterSlotId) return; if(!TryComp(uid, out var panel)) @@ -368,7 +320,7 @@ private void OnConduitInsertAttempt(EntityUid uid, SubstationComponent component args.Cancel(); return; } - + //for when the substation is initialized. if(component.AllowInsert) { @@ -380,44 +332,44 @@ private void OnConduitInsertAttempt(EntityUid uid, SubstationComponent component { args.Cancel(); } - + } - private void OnConduitRemoveAttempt(EntityUid uid, SubstationComponent component, ContainerIsRemovingAttemptEvent args) + private void OnNitrogenBoosterRemoveAttempt(EntityUid uid, SubstationComponent component, ContainerIsRemovingAttemptEvent args) { if(!component.Initialized) return; - if(args.Container.ID != component.ConduitSlotId) + if(args.Container.ID != component.NitrogenBoosterSlotId) return; if(!TryComp(uid, out var panel)) return; - + if(!panel.Open) { args.Cancel(); } - + } - private void OnConduitInserted(EntityUid uid, SubstationComponent component, EntInsertedIntoContainerMessage args) + private void OnNitrogenBoosterInserted(EntityUid uid, SubstationComponent component, EntInsertedIntoContainerMessage args) { if(!component.Initialized) return; - if(args.Container.ID != component.ConduitSlotId) + if(args.Container.ID != component.NitrogenBoosterSlotId) return; - - ConduitChanged(uid, component); + + NitrogenBoosterChanged(uid, component); } - private void OnConduitRemoved(EntityUid uid, SubstationComponent component, EntRemovedFromContainerMessage args) + private void OnNitrogenBoosterRemoved(EntityUid uid, SubstationComponent component, EntRemovedFromContainerMessage args) { - if(args.Container.ID != component.ConduitSlotId) + if(args.Container.ID != component.NitrogenBoosterSlotId) return; - - ConduitChanged(uid, component); + + NitrogenBoosterChanged(uid, component); } -} \ No newline at end of file +} diff --git a/Content.Server/Power/Components/SubstationComponent.cs b/Content.Shared/Power/SubstationComponent.cs similarity index 71% rename from Content.Server/Power/Components/SubstationComponent.cs rename to Content.Shared/Power/SubstationComponent.cs index cd2e088569b67b..719b7983d01330 100644 --- a/Content.Server/Power/Components/SubstationComponent.cs +++ b/Content.Shared/Power/SubstationComponent.cs @@ -1,6 +1,4 @@ -using Content.Shared.Power; - -namespace Content.Server.Power.Components; +namespace Content.Shared.Power; [RegisterComponent] public sealed partial class SubstationComponent : Component @@ -12,17 +10,17 @@ public sealed partial class SubstationComponent : Component [DataField] [ViewVariables(VVAccess.ReadWrite)] public bool DecayEnabled = true; - + [DataField] [ViewVariables(VVAccess.ReadWrite)] public SubstationIntegrityState State = SubstationIntegrityState.Healthy; //9.231205828 is the amount of moles in a 5L container (the default conduit) at 1000Kpa 20C° - public float InitialConduitMoles = 2.051379050f; + public float InitialNitrogenBoosterMoles = 2.051379050f; - [DataField("conduitSlotId", required: true)] + [DataField("NitrogenBoosterSlotId", required: true)] [ViewVariables(VVAccess.ReadOnly)] - public string ConduitSlotId = string.Empty; + public string NitrogenBoosterSlotId = string.Empty; public bool AllowInsert = true; diff --git a/Resources/Locale/en-US/machine/machine.ftl b/Resources/Locale/en-US/machine/machine.ftl index ab771a96a93f53..b8ee4a1293ba29 100644 --- a/Resources/Locale/en-US/machine/machine.ftl +++ b/Resources/Locale/en-US/machine/machine.ftl @@ -18,7 +18,7 @@ upgrade-power-draw = power draw upgrade-max-charge = max charge upgrade-power-supply = power supply upgrade-power-supply-ramping = power ramp rate -upgrade-conduit-lifetime = conduit lifetime +upgrade-nitrogenbooster-lifetime = conduit lifetime two-way-lever-left = push left two-way-lever-right = push right diff --git a/Resources/Locale/en-US/power/components/substation-component.ftl b/Resources/Locale/en-US/power/components/substation-component.ftl index 0cec2fe8efdcdb..69c58231137509 100644 --- a/Resources/Locale/en-US/power/components/substation-component.ftl +++ b/Resources/Locale/en-US/power/components/substation-component.ftl @@ -4,5 +4,5 @@ # Shown when the substation is examined in details range substation-component-examine-integrity = The substation is at [color={$markupPercentColor}]{$percent}%[/color] integrity. substation-component-examine-malfunction = The substation is [color=red]malfunctioning[/color]. -substation-component-examine-no-conduit = The substation is [color=red]missing a conduit[/color]. +substation-component-examine-no-nitrogenbooster = The substation is [color=red]missing a nitrogen booster gas tank[/color]. diff --git a/Resources/Prototypes/Catalog/Fills/Items/gas_tanks.yml b/Resources/Prototypes/Catalog/Fills/Items/gas_tanks.yml index 2e6028de08e6a3..5231fc8b4579c6 100644 --- a/Resources/Prototypes/Catalog/Fills/Items/gas_tanks.yml +++ b/Resources/Prototypes/Catalog/Fills/Items/gas_tanks.yml @@ -223,9 +223,9 @@ temperature: 293.15 - type: entity - id: GasConduitFilled - parent: GasConduit - name: gas conduit + id: GasTankNitrogenBoosterFilled + parent: GasTankNitrogenBooster + name: nitrogen booster suffix: Filled components: - type: GasTank @@ -234,7 +234,7 @@ volume: 5 moles: - 0 # oxygen - - 1.025689525 # nitrogen + - 2.051379050 # nitrogen - 0 # CO2 - - 1.025689525 # plasma + - 0 # plasma temperature: 293.15 diff --git a/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/production.yml b/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/production.yml index c41351b3fce0dd..6581fecbac8e5d 100644 --- a/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/production.yml +++ b/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/production.yml @@ -762,11 +762,6 @@ materialRequirements: CableMV: 5 CableHV: 5 -# tagRequirements: -# Fuse: -# Amount: 1 -# DefaultPrototype: GasFuse -# ExamineName: HV Fuse - type: PhysicalComposition materialComposition: Glass: 200 diff --git a/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml b/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml index 444757bd5ebe39..deecf11e1b0bd5 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml @@ -241,14 +241,14 @@ - type: entity parent: GasTankRoundBase - id: GasConduit - name: gas conduit - description: A bulky ceramic conduit filled with gas. Used in high power machines such as substations. + id: GasTankNitrogenBooster + name: nitrogen booster + description: A bulky tank filled with nitrogen designed to maintain substations. components: - type: Sprite - sprite: Objects/Tanks/gasconduit.rsi + sprite: Objects/Tanks/nitrogenbooster.rsi - type: Item - sprite: Objects/Tanks/gasconduit.rsi + sprite: Objects/Tanks/nitrogenbooster.rsi - type: GasTank outputPressure: 101.3 air: @@ -256,8 +256,4 @@ temperature: 293.15 - type: Tag tags: - - Conduit - - type: PhysicalComposition - materialComposition: - Steel: 100 - Glass: 100 + - NitrogenBooster \ No newline at end of file diff --git a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml index 7256c10a0522ee..3b7a3553c67c35 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml @@ -101,7 +101,7 @@ - AirTank - GasAnalyzer - UtilityBelt - - GasConduit + - GasTankNitrogenBooster - Fulton - FultonBeacon - Pickaxe diff --git a/Resources/Prototypes/Entities/Structures/Power/substation.yml b/Resources/Prototypes/Entities/Structures/Power/substation.yml index 24ae91786f1fde..9f400002acfbb7 100644 --- a/Resources/Prototypes/Entities/Structures/Power/substation.yml +++ b/Resources/Prototypes/Entities/Structures/Power/substation.yml @@ -8,7 +8,7 @@ placement: mode: SnapgridCenter components: - - type: Sprite # TODO: add sprite for maintenance panel open + - type: Sprite # TODO: add sprite for maintenance panel open. This will show the nitrogen booster there or not. sprite: Structures/Power/substation.rsi snapCardinals: true layers: @@ -21,19 +21,19 @@ map: ["substationBattery"] shader: unshaded - type: Substation - conduitSlotId: conduit_slot + NitrogenBoosterSlotId: NitrogenBooster_slot - type: ContainerContainer containers: - conduit_slot: !type:ContainerSlot {} + NitrogenBooster_slot: !type:ContainerSlot {} - type: ItemSlots slots: - conduit_slot: + NitrogenBooster_slot: ejectOnInteract: true - name: gas conduit - startingItem: GasConduitFilled + name: nitrogen booster gas tank + startingItem: GasTankNitrogenBoosterFilled whitelist: tags: - - Conduit + - NitrogenBooster - type: SubstationVisuals screenLayer: "substationScreen" integrityStates: @@ -41,12 +41,6 @@ Unhealthy: screen1 Bad: screen2 - type: Appearance - - type: UpgradeBattery - maxChargeMultiplier: 2 - baseMaxCharge: 2500000 - - type: UpgradePowerSupplyRamping - scaling: Linear - supplyRampingMultiplier: 1 - type: Battery maxCharge: 2500000 startingCharge: 0 @@ -172,16 +166,16 @@ - type: ContainerContainer containers: board: !type:Container - conduit_slot: !type:ContainerSlot + NitrogenBooster_slot: !type:ContainerSlot - type: ItemSlots slots: - conduit_slot: + NitrogenBooster_slot: ejectOnInteract: true - name: gas conduit - startingItem: GasConduitFilled + name: nitrogen booster + startingItem: GasTankNitrogenBoosterFilled whitelist: tags: - - Conduit + - GasTankNitrogenBoosterFilled - type: WiresPanel - type: Wires boardName: wires-board-name-substation @@ -203,7 +197,7 @@ map: ["substationScreen"] shader: unshaded - type: Substation - conduitSlotId: conduit_slot + NitrogenBoosterSlotId: NitrogenBooster_slot - type: SubstationVisuals screenLayer: "substationScreen" integrityStates: @@ -292,9 +286,9 @@ startingCharge: 0 - type: ItemSlots slots: - conduit_slot: + NitrogenBooster_slot: ejectOnInteract: true - name: HV Conduit + name: nitrogen booster gas tank startingItem: - type: Substation state: Bad @@ -318,9 +312,9 @@ startingCharge: 0 - type: ItemSlots slots: - conduit_slot: + NitrogenBooster_slot: ejectOnInteract: true - name: HV Conduit + name: nitrogen booster gas tank startingItem: - type: Substation state: Bad diff --git a/Resources/Prototypes/Recipes/Lathes/misc.yml b/Resources/Prototypes/Recipes/Lathes/misc.yml index fad8d48970b00d..44a0c76bb1d407 100644 --- a/Resources/Prototypes/Recipes/Lathes/misc.yml +++ b/Resources/Prototypes/Recipes/Lathes/misc.yml @@ -135,12 +135,11 @@ Plastic: 100 - type: latheRecipe - id: GasConduit - result: GasConduit + id: GasTankNitrogenBooster + result: GasTankNitrogenBooster completetime: 2 materials: Steel: 200 - Glass: 200 - type: latheRecipe id: FauxTileAstroGrass diff --git a/Resources/Prototypes/tags.yml b/Resources/Prototypes/tags.yml index bac541ba9645f3..5c3b79ce47b4d4 100644 --- a/Resources/Prototypes/tags.yml +++ b/Resources/Prototypes/tags.yml @@ -539,9 +539,6 @@ - type: Tag id: Fruit -- type: Tag - id: Conduit - - type: Tag id: Galaxythistle @@ -831,6 +828,9 @@ - type: Tag id: Multitool + +- type: Tag + id: NitrogenBooster - type: Tag id: NoBlockAnchoring diff --git a/Resources/Textures/Objects/Tanks/gasconduit.rsi/equipped-BELT.png b/Resources/Textures/Objects/Tanks/nitrogenbooster.rsi/equipped-BELT.png similarity index 100% rename from Resources/Textures/Objects/Tanks/gasconduit.rsi/equipped-BELT.png rename to Resources/Textures/Objects/Tanks/nitrogenbooster.rsi/equipped-BELT.png diff --git a/Resources/Textures/Objects/Tanks/gasconduit.rsi/icon.png b/Resources/Textures/Objects/Tanks/nitrogenbooster.rsi/icon.png similarity index 100% rename from Resources/Textures/Objects/Tanks/gasconduit.rsi/icon.png rename to Resources/Textures/Objects/Tanks/nitrogenbooster.rsi/icon.png diff --git a/Resources/Textures/Objects/Tanks/gasconduit.rsi/inhand-left.png b/Resources/Textures/Objects/Tanks/nitrogenbooster.rsi/inhand-left.png similarity index 100% rename from Resources/Textures/Objects/Tanks/gasconduit.rsi/inhand-left.png rename to Resources/Textures/Objects/Tanks/nitrogenbooster.rsi/inhand-left.png diff --git a/Resources/Textures/Objects/Tanks/gasconduit.rsi/inhand-right.png b/Resources/Textures/Objects/Tanks/nitrogenbooster.rsi/inhand-right.png similarity index 100% rename from Resources/Textures/Objects/Tanks/gasconduit.rsi/inhand-right.png rename to Resources/Textures/Objects/Tanks/nitrogenbooster.rsi/inhand-right.png diff --git a/Resources/Textures/Objects/Tanks/gasconduit.rsi/meta.json b/Resources/Textures/Objects/Tanks/nitrogenbooster.rsi/meta.json similarity index 100% rename from Resources/Textures/Objects/Tanks/gasconduit.rsi/meta.json rename to Resources/Textures/Objects/Tanks/nitrogenbooster.rsi/meta.json From 1911b0957cbf05ef71440a620dd77db3c3c9b068 Mon Sep 17 00:00:00 2001 From: Peptide90 Date: Tue, 13 Feb 2024 19:35:26 +0000 Subject: [PATCH 15/24] remove plasma needs --- .../Power/EntitySystems/SubstationSystem.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Content.Server/Power/EntitySystems/SubstationSystem.cs b/Content.Server/Power/EntitySystems/SubstationSystem.cs index 5c5b7080375d46..bed33efff081d8 100644 --- a/Content.Server/Power/EntitySystems/SubstationSystem.cs +++ b/Content.Server/Power/EntitySystems/SubstationSystem.cs @@ -121,15 +121,13 @@ public override void Update(float deltaTime) private void ConsumeNitrogenBoosterGas(float deltaTime, float scalar, SubstationComponent subs, PowerNetworkBatteryComponent battery, GasMixture mixture) { var initialN2 = mixture.GetMoles(Gas.Nitrogen); - var initialPlasma = mixture.GetMoles(Gas.Plasma); var molesConsumed = (subs.InitialNitrogenBoosterMoles * battery.CurrentSupply * deltaTime) / (_substationDecayCoeficient * scalar); - var minimumReaction = Math.Min(initialN2, initialPlasma) * molesConsumed / 2; + var minimumReaction = (initialN2); mixture.AdjustMoles(Gas.Nitrogen, -minimumReaction); - mixture.AdjustMoles(Gas.Plasma, -minimumReaction); - mixture.AdjustMoles(Gas.NitrousOxide, minimumReaction*2); + mixture.AdjustMoles(Gas.NitrousOxide, minimumReaction/2); } private float CheckNitrogenBoosterIntegrity(SubstationComponent subs, GasMixture mixture) @@ -139,11 +137,10 @@ private float CheckNitrogenBoosterIntegrity(SubstationComponent subs, GasMixture return 0f; var initialN2 = mixture.GetMoles(Gas.Nitrogen); - var initialPlasma = mixture.GetMoles(Gas.Plasma); - var usableMoles = Math.Min(initialN2, initialPlasma); + var usableMoles = (initialN2); //return in percentage points; - return 100 * usableMoles / (subs.InitialNitrogenBoosterMoles / 2); + return 100 * usableMoles / (subs.InitialNitrogenBoosterMoles); } private void NitrogenBoosterChanged(EntityUid uid, SubstationComponent subs) @@ -212,7 +209,6 @@ private void OnRejuvenate(EntityUid uid, SubstationComponent subs, RejuvenateEve if(GetNitrogenBoosterMixture(uid, out var mix)) { mix.SetMoles(Gas.Nitrogen, 1.025689525f); - mix.SetMoles(Gas.Plasma, 1.025689525f); } } From 09e61b46cbc475f2b3153e9b6b7a9122a983201e Mon Sep 17 00:00:00 2001 From: Peptide90 Date: Thu, 15 Feb 2024 09:35:41 +0000 Subject: [PATCH 16/24] math changes --- Content.Server/Power/EntitySystems/SubstationSystem.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Content.Server/Power/EntitySystems/SubstationSystem.cs b/Content.Server/Power/EntitySystems/SubstationSystem.cs index bed33efff081d8..2edbfc386601e2 100644 --- a/Content.Server/Power/EntitySystems/SubstationSystem.cs +++ b/Content.Server/Power/EntitySystems/SubstationSystem.cs @@ -124,10 +124,10 @@ private void ConsumeNitrogenBoosterGas(float deltaTime, float scalar, Substation var molesConsumed = (subs.InitialNitrogenBoosterMoles * battery.CurrentSupply * deltaTime) / (_substationDecayCoeficient * scalar); - var minimumReaction = (initialN2); + var minimumReaction = Math.Abs(initialN2) * molesConsumed / 2; mixture.AdjustMoles(Gas.Nitrogen, -minimumReaction); - mixture.AdjustMoles(Gas.NitrousOxide, minimumReaction/2); + mixture.AdjustMoles(Gas.NitrousOxide, minimumReaction); } private float CheckNitrogenBoosterIntegrity(SubstationComponent subs, GasMixture mixture) From b3bb50e1de5726c5a342aeb56d7e19d1b10e716a Mon Sep 17 00:00:00 2001 From: AwareFoxy Date: Mon, 30 Sep 2024 22:10:51 +0300 Subject: [PATCH 17/24] Resprite screens to make it more accessible to colorblind --- .../Structures/Power/substation.rsi/screen1.png | Bin 501 -> 443 bytes .../Structures/Power/substation.rsi/screen2.png | Bin 467 -> 375 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/Resources/Textures/Structures/Power/substation.rsi/screen1.png b/Resources/Textures/Structures/Power/substation.rsi/screen1.png index 5e53a05f800c6857e38730fc7829cbced27df5c8..f8a0d42131b92df46bc02a7b930ae3aec56773da 100644 GIT binary patch delta 417 zcmV;S0bc&~1G@u|B!2;OQb$4nuFf3k0004XNklrWy71cn7j>7v`29+N`rt2Yh;MdUH3Ye1A9o=ei0TZp$eSd%7_H zF)#JcdD-8VLSBj#tKoj7 z%-8a)>esRzZCq0K!Fv8-h%&0000000000000000000002%-Q_=COyQ9-BM0BY-v00000 LNkvXXu0mjfsd35* literal 501 zcmeAS@N?(olHy`uVBq!ia0vp^2Y^_CgAGW!%qVXKQk(@Ik;M!Q+(IDCcaTv{r3VDZieOcjjoT{S+Hdpdc~tY-YD z@@%W`?fhTdhZ{6MIx#S^2soe;7PXD%$Q%Z1QJyZv8p7nCiw{e67W`tSGW9lxWq`_7hYy*KB|X5O~nUh|vr!^f!SYfFRc z8Dzcd=3ctLS#OV~`7^Zu`|z!MOM`ngAAkE*?tb;!&s}_TSBKVB-kTHq?XBs{TS}`o zomy4qGVj}!%FwAZSKpddopHC4X^Ql-4M%GvG;bfyhiW9XHFLv%u3G!4H16t&n(v$o9HNbV{{3Dr{_}_b-+#sP8FpPhp7n*-VA|@!PsyxL zY{HT+x97|1ek#vvIR8l7|BK_^zbC(kJUaHK|Hae###M*j>{{h|PGz@$?!L{U&KwF2 i3``Uf2Uc?ZVYsriBkRS@l~uraWbkzLb6Mw<&;$Uy&)p3G diff --git a/Resources/Textures/Structures/Power/substation.rsi/screen2.png b/Resources/Textures/Structures/Power/substation.rsi/screen2.png index dc7a970bcf94f9d2658ea070cff8f4e9f064a230..ed0c574aaee525414be27110cf305a7134f0a248 100644 GIT binary patch delta 348 zcmcc2{GDlnNGZx^prw85kH1JzX3_D(1YsVV!l@L8SHJ>j#(a<{b7tz|j+C zaMmPpxwLtlBS(vaRQ}_#cT=4vu956L;5hU3_5V{R9eXZ!vRPh<0Sqc?y1yLw?lsF> zY~Q?FTYZZ!KE2GW^GNW7`hWeO#l3M$ZmwI*cyC{ylG3Kz^=lrt${$xUS2#OACVh(k z|J(2EuY12+5LWsxOMcn;zv}XfEPwgP|0)*yskt_5_Meo#=$H9Z=hwb#{WN`N^SPaW zuD0*>nWMRA_Tu@^H<rV5<;`bsi=HF#-zUV%m zKh0cm_3gi{_c>PG%KwsBAG-F{w}laV1t<3=T#bLS=Vtrgxy8?Cu3P9(U&nmsXZeHl o_x9rdnI_g>{|WIL8tMOl{h+~;=hqy85}Sb4q9e0B~!mOaK4? literal 467 zcmeAS@N?(olHy`uVBq!ia0vp^2Y^_CgAGW!%qVXKQk(@Ik;M!Q+(IDCcN|4!QOwdzzm10xd)hk$}Z1B~(D6YDFRquXb%I{Vw}?e6od{^#93Clxnq(fie} zOE@2W{$IAaNAJi#>C(TeX1&|@SLE&Cw`*i$-`@+jWO(#>{^rTa|IbQVn?74r@$seQ z+rF}JH(S|_Ij;pCKmNCIzWFJ;Z*3p_i|%UtSGm8};nF>&|2t+2X2-bM9$OROwl9$H z`@-(M1%F@-re%yWKRh&mKZ!; L{an^LB{Ts5V6Dj? From 063cd1db4bec985034b23689031086cdba14c367 Mon Sep 17 00:00:00 2001 From: AwareFoxy Date: Mon, 30 Sep 2024 23:58:00 +0300 Subject: [PATCH 18/24] some code cleanup + cvars --- .../Power/EntitySystems/SubstationSystem.cs | 119 +++++++++--------- Content.Shared/CCVar/CCVars.cs | 18 +++ Content.Shared/Power/SubstationComponent.cs | 2 +- 3 files changed, 82 insertions(+), 57 deletions(-) diff --git a/Content.Server/Power/EntitySystems/SubstationSystem.cs b/Content.Server/Power/EntitySystems/SubstationSystem.cs index 2edbfc386601e2..048de7deee0dd3 100644 --- a/Content.Server/Power/EntitySystems/SubstationSystem.cs +++ b/Content.Server/Power/EntitySystems/SubstationSystem.cs @@ -1,15 +1,17 @@ using System.Diagnostics.CodeAnalysis; -using Content.Server.Power.Components; -using Content.Server.Construction; -using Content.Server.Atmos.Components; using Content.Server.Atmos; +using Content.Server.Atmos.Components; +using Content.Server.Construction; +using Content.Server.Power.Components; +using Content.Shared.Atmos; +using Content.Shared.CCVar; using Content.Shared.Power; using Content.Shared.Rejuvenate; using Content.Shared.Wires; using Content.Shared.Tag; using Content.Shared.Examine; -using Content.Shared.Atmos; using Robust.Server.GameObjects; +using Robust.Shared.Configuration; using Robust.Shared.Containers; namespace Content.Server.Power.EntitySystems; @@ -21,12 +23,13 @@ public sealed class SubstationSystem : EntitySystem [Dependency] private readonly SharedPointLightSystem _sharedLightSystem = default!; [Dependency] private readonly AppearanceSystem _appearanceSystem = default!; [Dependency] private readonly TagSystem _tagSystem = default!; + [Dependency] private readonly IConfigurationManager _cfg = default!; - private bool _substationDecayEnabled = true; - private const int _defaultSubstationDecayTimeout = 300; //5 minute - private float _substationDecayCoeficient = 300000; - private float _substationDecayTimer; + private bool _substationDecayEnabled; + private int _substationDecayTimeout; + private float _substationDecayCoeficient; + private float _substationDecayTimer; private float _substationLightBlinkInterval = 1f; //1 second private float _substationLightBlinkTimer = 1f; private bool _substationLightBlinkState = true; @@ -37,6 +40,10 @@ public override void Initialize() UpdatesAfter.Add(typeof(PowerNetSystem)); + _substationDecayEnabled = _cfg.GetCVar(CCVars.SubstationDecayEnabled); + _substationDecayTimeout = _cfg.GetCVar(CCVars.SubstationDecayTimeout); + _substationDecayCoeficient = _cfg.GetCVar(CCVars.SubstationDecayCoefficient); + SubscribeLocalEvent(OnExamine); SubscribeLocalEvent(OnRejuvenate); SubscribeLocalEvent(OnAnalyzed); @@ -49,9 +56,9 @@ public override void Initialize() private void OnExamine(EntityUid uid, SubstationComponent component, ExaminedEvent args) { - if(args.IsInDetailsRange) + if (args.IsInDetailsRange) { - if(!GetNitrogenBoosterMixture(uid, out var mix)) + if (!GetNitrogenBoosterMixture(uid, out var mix)) { args.PushMarkup( Loc.GetString("substation-component-examine-no-nitrogenbooster")); @@ -60,7 +67,7 @@ private void OnExamine(EntityUid uid, SubstationComponent component, ExaminedEve else { var integrity = CheckNitrogenBoosterIntegrity(component, mix); - if(integrity > 0.0f) + if (integrity > 0.0f) { var integrityPercentRounded = (int)integrity; args.PushMarkup( @@ -85,31 +92,31 @@ public override void Update(float deltaTime) base.Update(deltaTime); _substationLightBlinkTimer -= deltaTime; - if(_substationLightBlinkTimer <= 0f) + if (_substationLightBlinkTimer <= 0f) { _substationLightBlinkTimer = _substationLightBlinkInterval; _substationLightBlinkState = !_substationLightBlinkState; var lightquery = EntityQueryEnumerator(); - while(lightquery.MoveNext(out var uid, out var subs)) + while (lightquery.MoveNext(out var uid, out var subs)) { - if(subs.State == SubstationIntegrityState.Healthy) + if (subs.State == SubstationIntegrityState.Healthy) continue; - if(!_lightSystem.TryGetLight(uid, out var shlight)) + if (!_lightSystem.TryGetLight(uid, out var shlight)) return; - if(_substationLightBlinkState) + if (_substationLightBlinkState) _sharedLightSystem.SetEnergy(uid, 1.6f, shlight); else _sharedLightSystem.SetEnergy(uid, 1f, shlight); } } - if(!_substationDecayEnabled) + if (!_substationDecayEnabled) { _substationDecayTimer -= deltaTime; - if(_substationDecayTimer <= 0.0f) + if (_substationDecayTimer <= 0.0f) { _substationDecayTimer = 0.0f; _substationDecayEnabled = true; @@ -133,7 +140,7 @@ private void ConsumeNitrogenBoosterGas(float deltaTime, float scalar, Substation private float CheckNitrogenBoosterIntegrity(SubstationComponent subs, GasMixture mixture) { - if(subs.InitialNitrogenBoosterMoles <= 0f) + if (subs.InitialNitrogenBoosterMoles <= 0f) return 0f; var initialN2 = mixture.GetMoles(Gas.Nitrogen); @@ -145,7 +152,7 @@ private float CheckNitrogenBoosterIntegrity(SubstationComponent subs, GasMixture private void NitrogenBoosterChanged(EntityUid uid, SubstationComponent subs) { - if(!GetNitrogenBoosterMixture(uid, out var mix)) + if (!GetNitrogenBoosterMixture(uid, out var mix)) { ShutdownSubstation(uid, subs); subs.LastIntegrity = 0f; @@ -153,7 +160,7 @@ private void NitrogenBoosterChanged(EntityUid uid, SubstationComponent subs) } var initialNitrogenBoosterMoles = 0f; - for(var i = 0; i < Atmospherics.TotalNumberOfGases; i++) + for (var i = 0; i < Atmospherics.TotalNumberOfGases; i++) { initialNitrogenBoosterMoles += mix.GetMoles(i); } @@ -162,17 +169,17 @@ private void NitrogenBoosterChanged(EntityUid uid, SubstationComponent subs) var NitrogenBoosterIntegrity = CheckNitrogenBoosterIntegrity(subs, mix); - if(NitrogenBoosterIntegrity <= 0.0f) + if (NitrogenBoosterIntegrity <= 0.0f) { ShutdownSubstation(uid, subs); subs.LastIntegrity = NitrogenBoosterIntegrity; return; } - if(NitrogenBoosterIntegrity < 30f) + if (NitrogenBoosterIntegrity < 30f) { ChangeState(uid, SubstationIntegrityState.Bad, subs); } - else if(NitrogenBoosterIntegrity < 70f) + else if (NitrogenBoosterIntegrity < 70f) { ChangeState(uid, SubstationIntegrityState.Unhealthy, subs); } @@ -186,14 +193,14 @@ private void NitrogenBoosterChanged(EntityUid uid, SubstationComponent subs) private void ShutdownSubstation(EntityUid uid, SubstationComponent subs) { TryComp(uid, out var battery); - if(battery == null) + if (battery == null) return; subs.LastIntegrity = 0.0f; battery.Enabled = false; battery.CanCharge = false; battery.CanDischarge = false; - if(HasComp(uid)) + if (HasComp(uid)) RemComp(uid); ChangeState(uid, SubstationIntegrityState.Bad, subs); @@ -206,7 +213,7 @@ private void OnRejuvenate(EntityUid uid, SubstationComponent subs, RejuvenateEve ChangeState(uid, SubstationIntegrityState.Healthy, subs); - if(GetNitrogenBoosterMixture(uid, out var mix)) + if (GetNitrogenBoosterMixture(uid, out var mix)) { mix.SetMoles(Gas.Nitrogen, 1.025689525f); } @@ -215,39 +222,39 @@ private void OnRejuvenate(EntityUid uid, SubstationComponent subs, RejuvenateEve private void RestoreSubstation(EntityUid uid, SubstationComponent subs) { TryComp(uid, out var battery); - if(battery == null) + if (battery == null) return; battery.Enabled = true; battery.CanCharge = true; battery.CanDischarge = true; - if(!HasComp(uid)) + if (!HasComp(uid)) AddComp(uid); } private void ChangeState(EntityUid uid, SubstationIntegrityState state, SubstationComponent? subs=null) { - if(!_lightSystem.TryGetLight(uid, out var light)) + if (!_lightSystem.TryGetLight(uid, out var light)) return; - if(!Resolve(uid, ref subs, ref light, false)) + if (!Resolve(uid, ref subs, ref light, false)) return; - if(subs.State == state) + if (subs.State == state) return; - if(state == SubstationIntegrityState.Healthy) + if (state == SubstationIntegrityState.Healthy) { - if(subs.State == SubstationIntegrityState.Bad) + if (subs.State == SubstationIntegrityState.Bad) { RestoreSubstation(uid, subs); } - _lightSystem.SetColor(uid, new Color(0x3d, 0xb8, 0x3b), light); + _lightSystem.SetColor(uid, new Color(61, 139, 59), light); } - else if(state == SubstationIntegrityState.Unhealthy) + else if (state == SubstationIntegrityState.Unhealthy) { - if(subs.State == SubstationIntegrityState.Bad) + if (subs.State == SubstationIntegrityState.Bad) { RestoreSubstation(uid, subs); } @@ -264,20 +271,20 @@ private void ChangeState(EntityUid uid, SubstationIntegrityState state, Substati private void UpdateAppearance(EntityUid uid, SubstationIntegrityState subsState) { - if(!TryComp(uid, out var appearance)) + if (!TryComp(uid, out var appearance)) return; _appearanceSystem.SetData(uid, SubstationVisuals.Screen, subsState, appearance); } private void OnAnalyzed(EntityUid uid, SubstationComponent slot, GasAnalyzerScanEvent args) { - if(!TryComp(uid, out var containers)) + if (!TryComp(uid, out var containers)) return; - if(!containers.TryGetContainer(slot.NitrogenBoosterSlotId, out var container)) + if (!containers.TryGetContainer(slot.NitrogenBoosterSlotId, out var container)) return; - if(container.ContainedEntities.Count > 0) + if (container.ContainedEntities.Count > 0) { args.GasMixtures = new Dictionary { {Name(uid), Comp(container.ContainedEntities[0]).Air} }; } @@ -287,13 +294,13 @@ private bool GetNitrogenBoosterMixture(EntityUid uid, [NotNullWhen(true)] out Ga { mix = null; - if(!TryComp(uid, out var subs) || !TryComp(uid, out var containers)) + if (!TryComp(uid, out var subs) || !TryComp(uid, out var containers)) return false; - if(!containers.TryGetContainer(subs.NitrogenBoosterSlotId, out var container)) + if (!containers.TryGetContainer(subs.NitrogenBoosterSlotId, out var container)) return false; - if(container.ContainedEntities.Count > 0) + if (container.ContainedEntities.Count > 0) { var gasTank = Comp(container.ContainedEntities[0]); mix = gasTank.Air; @@ -305,26 +312,26 @@ private bool GetNitrogenBoosterMixture(EntityUid uid, [NotNullWhen(true)] out Ga private void OnNitrogenBoosterInsertAttempt(EntityUid uid, SubstationComponent component, ContainerIsInsertingAttemptEvent args) { - if(!component.Initialized) + if (!component.Initialized) return; - if(args.Container.ID != component.NitrogenBoosterSlotId) + if (args.Container.ID != component.NitrogenBoosterSlotId) return; - if(!TryComp(uid, out var panel)) + if (!TryComp(uid, out var panel)) { args.Cancel(); return; } //for when the substation is initialized. - if(component.AllowInsert) + if (component.AllowInsert) { component.AllowInsert = false; return; } - if(!panel.Open) + if (!panel.Open) { args.Cancel(); } @@ -333,16 +340,16 @@ private void OnNitrogenBoosterInsertAttempt(EntityUid uid, SubstationComponent c private void OnNitrogenBoosterRemoveAttempt(EntityUid uid, SubstationComponent component, ContainerIsRemovingAttemptEvent args) { - if(!component.Initialized) + if (!component.Initialized) return; - if(args.Container.ID != component.NitrogenBoosterSlotId) + if (args.Container.ID != component.NitrogenBoosterSlotId) return; - if(!TryComp(uid, out var panel)) + if (!TryComp(uid, out var panel)) return; - if(!panel.Open) + if (!panel.Open) { args.Cancel(); } @@ -351,10 +358,10 @@ private void OnNitrogenBoosterRemoveAttempt(EntityUid uid, SubstationComponent c private void OnNitrogenBoosterInserted(EntityUid uid, SubstationComponent component, EntInsertedIntoContainerMessage args) { - if(!component.Initialized) + if (!component.Initialized) return; - if(args.Container.ID != component.NitrogenBoosterSlotId) + if (args.Container.ID != component.NitrogenBoosterSlotId) return; NitrogenBoosterChanged(uid, component); @@ -362,7 +369,7 @@ private void OnNitrogenBoosterInserted(EntityUid uid, SubstationComponent compon private void OnNitrogenBoosterRemoved(EntityUid uid, SubstationComponent component, EntRemovedFromContainerMessage args) { - if(args.Container.ID != component.NitrogenBoosterSlotId) + if (args.Container.ID != component.NitrogenBoosterSlotId) return; NitrogenBoosterChanged(uid, component); diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index a4f315d62c567f..3ac37628c521bf 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -436,6 +436,24 @@ public static readonly CVarDef public static readonly CVarDef GameEntityMenuLookup = CVarDef.Create("game.entity_menu_lookup", 0.25f, CVar.CLIENTONLY | CVar.ARCHIVE); + /// + /// If true, substation decay will be enabled + /// + public static readonly CVarDef SubstationDecayEnabled = + CVarDef.Create("game.substation_decay_enabled", true, CVar.SERVER | CVar.REPLICATED); + + /// + /// Timeout to substation decay + /// + public static readonly CVarDef SubstationDecayTimeout = + CVarDef.Create("game.substation_decay_timeout", 300, CVar.SERVER | CVar.REPLICATED); + + /// + /// Substation decay coefficient + /// + public static readonly CVarDef SubstationDecayCoefficient = + CVarDef.Create("game.substation_decay_coefficient", 300000f, CVar.SERVER | CVar.REPLICATED); + /* * Discord */ diff --git a/Content.Shared/Power/SubstationComponent.cs b/Content.Shared/Power/SubstationComponent.cs index 719b7983d01330..89b184bb9e0327 100644 --- a/Content.Shared/Power/SubstationComponent.cs +++ b/Content.Shared/Power/SubstationComponent.cs @@ -18,7 +18,7 @@ public sealed partial class SubstationComponent : Component //9.231205828 is the amount of moles in a 5L container (the default conduit) at 1000Kpa 20C° public float InitialNitrogenBoosterMoles = 2.051379050f; - [DataField("NitrogenBoosterSlotId", required: true)] + [DataField(required: true)] [ViewVariables(VVAccess.ReadOnly)] public string NitrogenBoosterSlotId = string.Empty; From d12de7dca4639e5badaf8d9a6bd8820716b7f4f0 Mon Sep 17 00:00:00 2001 From: AwareFoxy Date: Tue, 1 Oct 2024 15:25:37 +0300 Subject: [PATCH 19/24] gazanalyzer error fix --- Content.Server/Power/EntitySystems/SubstationSystem.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Content.Server/Power/EntitySystems/SubstationSystem.cs b/Content.Server/Power/EntitySystems/SubstationSystem.cs index 048de7deee0dd3..45fc5e403d3467 100644 --- a/Content.Server/Power/EntitySystems/SubstationSystem.cs +++ b/Content.Server/Power/EntitySystems/SubstationSystem.cs @@ -13,6 +13,7 @@ using Robust.Server.GameObjects; using Robust.Shared.Configuration; using Robust.Shared.Containers; +using Content.Server.Atmos.EntitySystems; namespace Content.Server.Power.EntitySystems; From 0b042310645630db1f9d644c4f0682230215c01e Mon Sep 17 00:00:00 2001 From: AwareFoxy Date: Tue, 1 Oct 2024 20:04:44 +0300 Subject: [PATCH 20/24] weh --- .../ConstructionSystem.Machine.cs | 6 --- .../Power/EntitySystems/SubstationSystem.cs | 50 ++++++++++--------- Content.Shared/CCVar/CCVars.cs | 7 +++ Content.Shared/Power/SubstationComponent.cs | 7 ++- 4 files changed, 39 insertions(+), 31 deletions(-) diff --git a/Content.Server/Construction/ConstructionSystem.Machine.cs b/Content.Server/Construction/ConstructionSystem.Machine.cs index a18b46f538a322..eb922f198c7b69 100644 --- a/Content.Server/Construction/ConstructionSystem.Machine.cs +++ b/Content.Server/Construction/ConstructionSystem.Machine.cs @@ -72,10 +72,4 @@ private void CreateBoardAndStockParts(EntityUid uid, MachineComponent component) } } } - public void AddMaxUpgrade(string upgradedLocId) - { - var upgraded = Loc.GetString(upgradedLocId); - this.Message.AddMarkup(Loc.GetString("machine-upgrade-max-upgrade", ("upgraded", upgraded)) + '\n'); - } - } diff --git a/Content.Server/Power/EntitySystems/SubstationSystem.cs b/Content.Server/Power/EntitySystems/SubstationSystem.cs index 45fc5e403d3467..598b77fd47806c 100644 --- a/Content.Server/Power/EntitySystems/SubstationSystem.cs +++ b/Content.Server/Power/EntitySystems/SubstationSystem.cs @@ -31,9 +31,6 @@ public sealed class SubstationSystem : EntitySystem private int _substationDecayTimeout; private float _substationDecayCoeficient; private float _substationDecayTimer; - private float _substationLightBlinkInterval = 1f; //1 second - private float _substationLightBlinkTimer = 1f; - private bool _substationLightBlinkState = true; public override void Initialize() { @@ -44,6 +41,7 @@ public override void Initialize() _substationDecayEnabled = _cfg.GetCVar(CCVars.SubstationDecayEnabled); _substationDecayTimeout = _cfg.GetCVar(CCVars.SubstationDecayTimeout); _substationDecayCoeficient = _cfg.GetCVar(CCVars.SubstationDecayCoefficient); + _substationDecayTimer = _cfg.GetCVar(CCVars.SubstationDecayTimer); SubscribeLocalEvent(OnExamine); SubscribeLocalEvent(OnRejuvenate); @@ -89,48 +87,49 @@ private void OnExamine(EntityUid uid, SubstationComponent component, ExaminedEve public override void Update(float deltaTime) { - base.Update(deltaTime); - _substationLightBlinkTimer -= deltaTime; - if (_substationLightBlinkTimer <= 0f) + var lightquery = EntityQueryEnumerator(); + while (lightquery.MoveNext(out var uid, out var subs)) { - _substationLightBlinkTimer = _substationLightBlinkInterval; - _substationLightBlinkState = !_substationLightBlinkState; - - var lightquery = EntityQueryEnumerator(); - while (lightquery.MoveNext(out var uid, out var subs)) + subs.SubstationLightBlinkTimer -= deltaTime; + if (subs.SubstationLightBlinkTimer <= 0f) { + subs.SubstationLightBlinkTimer = subs.SubstationLightBlinkInterval; + subs.SubstationLightBlinkState = !subs.SubstationLightBlinkState; + if (subs.State == SubstationIntegrityState.Healthy) continue; if (!_lightSystem.TryGetLight(uid, out var shlight)) return; - if (_substationLightBlinkState) + if (subs.SubstationLightBlinkState) _sharedLightSystem.SetEnergy(uid, 1.6f, shlight); else _sharedLightSystem.SetEnergy(uid, 1f, shlight); } - } - if (!_substationDecayEnabled) - { - _substationDecayTimer -= deltaTime; - if (_substationDecayTimer <= 0.0f) + if (!_substationDecayEnabled) { - _substationDecayTimer = 0.0f; - _substationDecayEnabled = true; + _substationDecayTimer -= deltaTime; + if (_substationDecayTimer <= 0.0f) + { + _substationDecayTimer = 0.0f; + _substationDecayEnabled = true; + } + return; } - return; } } - private void ConsumeNitrogenBoosterGas(float deltaTime, float scalar, SubstationComponent subs, PowerNetworkBatteryComponent battery, GasMixture mixture) { var initialN2 = mixture.GetMoles(Gas.Nitrogen); + var boosterMoles = subs.InitialNitrogenBoosterMoles; + var currentSupply = battery.CurrentSupply; + var decayFactor = _substationDecayCoeficient * scalar; - var molesConsumed = (subs.InitialNitrogenBoosterMoles * battery.CurrentSupply * deltaTime) / (_substationDecayCoeficient * scalar); + var molesConsumed = boosterMoles * currentSupply * deltaTime / decayFactor; var minimumReaction = Math.Abs(initialN2) * molesConsumed / 2; @@ -233,7 +232,7 @@ private void RestoreSubstation(EntityUid uid, SubstationComponent subs) AddComp(uid); } - private void ChangeState(EntityUid uid, SubstationIntegrityState state, SubstationComponent? subs=null) + private void ChangeState(EntityUid uid, SubstationIntegrityState state, SubstationComponent? subs = null) { if (!_lightSystem.TryGetLight(uid, out var light)) @@ -287,7 +286,10 @@ private void OnAnalyzed(EntityUid uid, SubstationComponent slot, GasAnalyzerScan if (container.ContainedEntities.Count > 0) { - args.GasMixtures = new Dictionary { {Name(uid), Comp(container.ContainedEntities[0]).Air} }; + args.GasMixtures = + [ + (Name(uid), Comp(container.ContainedEntities[0]).Air) + ]; } } diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index 3ac37628c521bf..706ca2ef86677d 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -454,6 +454,13 @@ public static readonly CVarDef public static readonly CVarDef SubstationDecayCoefficient = CVarDef.Create("game.substation_decay_coefficient", 300000f, CVar.SERVER | CVar.REPLICATED); + /// + /// Substation decay timer + /// + + public static readonly CVarDef SubstationDecayTimer = + CVarDef.Create("game.substation_decay_timer", 0f, CVar.SERVER | CVar.REPLICATED); + /* * Discord */ diff --git a/Content.Shared/Power/SubstationComponent.cs b/Content.Shared/Power/SubstationComponent.cs index 89b184bb9e0327..61ceb54b41e592 100644 --- a/Content.Shared/Power/SubstationComponent.cs +++ b/Content.Shared/Power/SubstationComponent.cs @@ -15,7 +15,7 @@ public sealed partial class SubstationComponent : Component [ViewVariables(VVAccess.ReadWrite)] public SubstationIntegrityState State = SubstationIntegrityState.Healthy; - //9.231205828 is the amount of moles in a 5L container (the default conduit) at 1000Kpa 20C° + // 9.231205828 is the amount of moles in a 5L container (the default conduit) at 1000Kpa 20C° public float InitialNitrogenBoosterMoles = 2.051379050f; [DataField(required: true)] @@ -24,4 +24,9 @@ public sealed partial class SubstationComponent : Component public bool AllowInsert = true; + public float SubstationLightBlinkInterval = 1f; + + public float SubstationLightBlinkTimer = 1f; + + public bool SubstationLightBlinkState = true; } From c11894772c9a3f21490d74d3f8ffdd21e932c18f Mon Sep 17 00:00:00 2001 From: AwareFoxy Date: Wed, 2 Oct 2024 23:47:10 +0200 Subject: [PATCH 21/24] uh --- .../Entities/Structures/Power/substation.yml | 8 +- .../Structures/Power/substation.rsi/meta.json | 136 +++++++++--------- 2 files changed, 72 insertions(+), 72 deletions(-) diff --git a/Resources/Prototypes/Entities/Structures/Power/substation.yml b/Resources/Prototypes/Entities/Structures/Power/substation.yml index 931f6756d71763..0e2585223c0d7f 100644 --- a/Resources/Prototypes/Entities/Structures/Power/substation.yml +++ b/Resources/Prototypes/Entities/Structures/Power/substation.yml @@ -21,7 +21,7 @@ map: ["substationBattery"] shader: unshaded - type: Substation - NitrogenBoosterSlotId: NitrogenBooster_slot + nitrogenBoosterSlotId: NitrogenBooster_slot - type: ContainerContainer containers: NitrogenBooster_slot: !type:ContainerSlot {} @@ -53,10 +53,10 @@ - type: NodeContainer examinable: true nodes: - input: + hv: !type:CableDeviceNode nodeGroupID: HVPower - output: + mv: !type:CableDeviceNode nodeGroupID: MVPower - type: PowerMonitoringDevice @@ -195,7 +195,7 @@ map: ["substationScreen"] shader: unshaded - type: Substation - NitrogenBoosterSlotId: NitrogenBooster_slot + nitrogenBoosterSlotId: NitrogenBooster_slot - type: SubstationVisuals screenLayer: "substationScreen" integrityStates: diff --git a/Resources/Textures/Structures/Power/substation.rsi/meta.json b/Resources/Textures/Structures/Power/substation.rsi/meta.json index ae56704acb1e89..4ff4011aa75a4f 100644 --- a/Resources/Textures/Structures/Power/substation.rsi/meta.json +++ b/Resources/Textures/Structures/Power/substation.rsi/meta.json @@ -1,112 +1,112 @@ { - "version": 1, - "license": "CC0-1.0", - "copyright": "Created by EmoGarbage404 (github)", - "size": { +"version": 1, +"license": "CC0-1.0", +"copyright": "Created by EmoGarbage404 (github)", +"size": { "x": 32, "y": 32 - }, - "states": [ +}, +"states": [ { - "name": "substation" + "name": "substation" }, { - "name": "substation_static" + "name": "substation_static" }, { - "name": "substation_wall", - "directions": 4 + "name": "substation_wall", + "directions": 4 }, { - "name": "screen_wall", - "directions": 4, - "delays": [ + "name": "screen_wall", + "directions": 4, + "delays": [ [ - 5.0, - 0.5, - 0.5, - 0.5 + 5.0, + 0.5, + 0.5, + 0.5 ], [ - 5.0, - 0.5, - 0.5, - 0.5 + 5.0, + 0.5, + 0.5, + 0.5 ], [ - 5.0, - 0.5, - 0.5, - 0.5 + 5.0, + 0.5, + 0.5, + 0.5 ], [ - 5.0, - 0.5, - 0.5, - 0.5 + 5.0, + 0.5, + 0.5, + 0.5 ] - ] + ] }, { - "name": "substation_wall_static" + "name": "substation_wall_static" }, { - "name": "full" + "name": "full" }, { - "name": "charging", - "delays": [ + "name": "charging", + "delays": [ [ - 0.1, - 0.1 + 0.1, + 0.1 ] - ] + ] }, { - "name": "dead", - "delays": [ + "name": "dead", + "delays": [ [ - 0.3, - 0.1 + 0.3, + 0.1 ] - ] + ] }, { - "name": "screen0", - "delays": [ + "name": "screen0", + "delays": [ [ - 0.15, - 0.15, - 0.15, - 0.15, - 0.15, - 0.15 + 0.15, + 0.15, + 0.15, + 0.15, + 0.15, + 0.15 ] - ] + ] }, { - "name": "screen1", - "delays": [ + "name": "screen1", + "delays": [ [ - 0.15, - 0.15, - 0.15, - 0.15, - 0.15, - 0.15 + 0.15, + 0.15, + 0.15, + 0.15, + 0.15, + 0.15 ] - ] + ] }, { - "name": "screen2", - "delays": [ + "name": "screen2", + "delays": [ [ - 5.0, - 0.5, - 0.5, - 0.5 + 5.0, + 0.5, + 0.5, + 0.5 ] - ] + ] } - ] +] } From 6ff3278f83dfd2d5782281212b6af37e68fa2672 Mon Sep 17 00:00:00 2001 From: AwareFoxy Date: Mon, 14 Oct 2024 19:22:34 +0200 Subject: [PATCH 22/24] some code cleanup --- .../Power/EntitySystems/SubstationSystem.cs | 107 ++++++++---------- Content.Shared/Power/SubstationComponent.cs | 4 + 2 files changed, 54 insertions(+), 57 deletions(-) diff --git a/Content.Server/Power/EntitySystems/SubstationSystem.cs b/Content.Server/Power/EntitySystems/SubstationSystem.cs index 598b77fd47806c..57f6b534806db7 100644 --- a/Content.Server/Power/EntitySystems/SubstationSystem.cs +++ b/Content.Server/Power/EntitySystems/SubstationSystem.cs @@ -14,22 +14,25 @@ using Robust.Shared.Configuration; using Robust.Shared.Containers; using Content.Server.Atmos.EntitySystems; +using Robust.Shared.GameObjects; +using Robust.Shared.IoC; +using Robust.Shared.Maths; +using Robust.Shared.Prototypes; +using Robust.Shared.Timing; namespace Content.Server.Power.EntitySystems; public sealed class SubstationSystem : EntitySystem { - [Dependency] private readonly PointLightSystem _lightSystem = default!; [Dependency] private readonly SharedPointLightSystem _sharedLightSystem = default!; [Dependency] private readonly AppearanceSystem _appearanceSystem = default!; [Dependency] private readonly TagSystem _tagSystem = default!; [Dependency] private readonly IConfigurationManager _cfg = default!; - private bool _substationDecayEnabled; private int _substationDecayTimeout; - private float _substationDecayCoeficient; + private float _substationDecayCoefficient; private float _substationDecayTimer; public override void Initialize() @@ -40,7 +43,7 @@ public override void Initialize() _substationDecayEnabled = _cfg.GetCVar(CCVars.SubstationDecayEnabled); _substationDecayTimeout = _cfg.GetCVar(CCVars.SubstationDecayTimeout); - _substationDecayCoeficient = _cfg.GetCVar(CCVars.SubstationDecayCoefficient); + _substationDecayCoefficient = _cfg.GetCVar(CCVars.SubstationDecayCoefficient); _substationDecayTimer = _cfg.GetCVar(CCVars.SubstationDecayTimer); SubscribeLocalEvent(OnExamine); @@ -59,28 +62,19 @@ private void OnExamine(EntityUid uid, SubstationComponent component, ExaminedEve { if (!GetNitrogenBoosterMixture(uid, out var mix)) { - args.PushMarkup( - Loc.GetString("substation-component-examine-no-nitrogenbooster")); + args.PushMarkup(Loc.GetString("substation-component-examine-no-nitrogenbooster")); return; } + + var integrity = CheckNitrogenBoosterIntegrity(component, mix); + if (integrity > 0.0f) + { + var integrityPercentRounded = (int)integrity; + args.PushMarkup(Loc.GetString("substation-component-examine-integrity", ("percent", integrityPercentRounded), ("markupPercentColor", "green"))); + } else { - var integrity = CheckNitrogenBoosterIntegrity(component, mix); - if (integrity > 0.0f) - { - var integrityPercentRounded = (int)integrity; - args.PushMarkup( - Loc.GetString( - "substation-component-examine-integrity", - ("percent", integrityPercentRounded), - ("markupPercentColor", "green") - )); - } - else - { - args.PushMarkup( - Loc.GetString("substation-component-examine-malfunction")); - } + args.PushMarkup(Loc.GetString("substation-component-examine-malfunction")); } } } @@ -89,8 +83,8 @@ public override void Update(float deltaTime) { base.Update(deltaTime); - var lightquery = EntityQueryEnumerator(); - while (lightquery.MoveNext(out var uid, out var subs)) + var lightQuery = EntityQueryEnumerator(); + while (lightQuery.MoveNext(out var uid, out var subs)) { subs.SubstationLightBlinkTimer -= deltaTime; if (subs.SubstationLightBlinkTimer <= 0f) @@ -104,10 +98,7 @@ public override void Update(float deltaTime) if (!_lightSystem.TryGetLight(uid, out var shlight)) return; - if (subs.SubstationLightBlinkState) - _sharedLightSystem.SetEnergy(uid, 1.6f, shlight); - else - _sharedLightSystem.SetEnergy(uid, 1f, shlight); + _sharedLightSystem.SetEnergy(uid, subs.SubstationLightBlinkState ? 1.6f : 1f, shlight); } if (!_substationDecayEnabled) @@ -122,15 +113,15 @@ public override void Update(float deltaTime) } } } + private void ConsumeNitrogenBoosterGas(float deltaTime, float scalar, SubstationComponent subs, PowerNetworkBatteryComponent battery, GasMixture mixture) { var initialN2 = mixture.GetMoles(Gas.Nitrogen); var boosterMoles = subs.InitialNitrogenBoosterMoles; var currentSupply = battery.CurrentSupply; - var decayFactor = _substationDecayCoeficient * scalar; + var decayFactor = _substationDecayCoefficient * scalar; var molesConsumed = boosterMoles * currentSupply * deltaTime / decayFactor; - var minimumReaction = Math.Abs(initialN2) * molesConsumed / 2; mixture.AdjustMoles(Gas.Nitrogen, -minimumReaction); @@ -139,15 +130,12 @@ private void ConsumeNitrogenBoosterGas(float deltaTime, float scalar, Substation private float CheckNitrogenBoosterIntegrity(SubstationComponent subs, GasMixture mixture) { - if (subs.InitialNitrogenBoosterMoles <= 0f) return 0f; var initialN2 = mixture.GetMoles(Gas.Nitrogen); - - var usableMoles = (initialN2); - //return in percentage points; - return 100 * usableMoles / (subs.InitialNitrogenBoosterMoles); + var usableMoles = initialN2; + return 100 * usableMoles / subs.InitialNitrogenBoosterMoles; } private void NitrogenBoosterChanged(EntityUid uid, SubstationComponent subs) @@ -166,20 +154,20 @@ private void NitrogenBoosterChanged(EntityUid uid, SubstationComponent subs) } subs.InitialNitrogenBoosterMoles = initialNitrogenBoosterMoles; + var nitrogenBoosterIntegrity = CheckNitrogenBoosterIntegrity(subs, mix); - var NitrogenBoosterIntegrity = CheckNitrogenBoosterIntegrity(subs, mix); - - if (NitrogenBoosterIntegrity <= 0.0f) + if (nitrogenBoosterIntegrity <= 0.0f) { ShutdownSubstation(uid, subs); - subs.LastIntegrity = NitrogenBoosterIntegrity; + subs.LastIntegrity = nitrogenBoosterIntegrity; return; } - if (NitrogenBoosterIntegrity < 30f) + + if (nitrogenBoosterIntegrity < 30f) { ChangeState(uid, SubstationIntegrityState.Bad, subs); } - else if (NitrogenBoosterIntegrity < 70f) + else if (nitrogenBoosterIntegrity < 70f) { ChangeState(uid, SubstationIntegrityState.Unhealthy, subs); } @@ -187,19 +175,20 @@ private void NitrogenBoosterChanged(EntityUid uid, SubstationComponent subs) { ChangeState(uid, SubstationIntegrityState.Healthy, subs); } - subs.LastIntegrity = NitrogenBoosterIntegrity; + + subs.LastIntegrity = nitrogenBoosterIntegrity; } private void ShutdownSubstation(EntityUid uid, SubstationComponent subs) { - TryComp(uid, out var battery); - if (battery == null) + if (!TryComp(uid, out var battery)) return; subs.LastIntegrity = 0.0f; battery.Enabled = false; battery.CanCharge = false; battery.CanDischarge = false; + if (HasComp(uid)) RemComp(uid); @@ -208,9 +197,7 @@ private void ShutdownSubstation(EntityUid uid, SubstationComponent subs) private void OnRejuvenate(EntityUid uid, SubstationComponent subs, RejuvenateEvent args) { - subs.LastIntegrity = 100.0f; - ChangeState(uid, SubstationIntegrityState.Healthy, subs); if (GetNitrogenBoosterMixture(uid, out var mix)) @@ -221,9 +208,9 @@ private void OnRejuvenate(EntityUid uid, SubstationComponent subs, RejuvenateEve private void RestoreSubstation(EntityUid uid, SubstationComponent subs) { - TryComp(uid, out var battery); - if (battery == null) + if (!TryComp(uid, out var battery)) return; + battery.Enabled = true; battery.CanCharge = true; battery.CanDischarge = true; @@ -234,7 +221,6 @@ private void RestoreSubstation(EntityUid uid, SubstationComponent subs) private void ChangeState(EntityUid uid, SubstationIntegrityState state, SubstationComponent? subs = null) { - if (!_lightSystem.TryGetLight(uid, out var light)) return; @@ -273,6 +259,7 @@ private void UpdateAppearance(EntityUid uid, SubstationIntegrityState subsState) { if (!TryComp(uid, out var appearance)) return; + _appearanceSystem.SetData(uid, SubstationVisuals.Screen, subsState, appearance); } @@ -284,12 +271,22 @@ private void OnAnalyzed(EntityUid uid, SubstationComponent slot, GasAnalyzerScan if (!containers.TryGetContainer(slot.NitrogenBoosterSlotId, out var container)) return; + if (!slot.MaintenanceDoorOpen) + return; + if (container.ContainedEntities.Count > 0) { - args.GasMixtures = - [ - (Name(uid), Comp(container.ContainedEntities[0]).Air) - ]; + if (container.ContainedEntities.Count > 0 && container.ContainedEntities[0] != null) + { + var gasTankComponent = Comp(container.ContainedEntities[0]); + if (gasTankComponent != null) + { + args.GasMixtures = new List<(string, GasMixture?)> + { + (Name(uid), gasTankComponent.Air) + }; + } + } } } @@ -327,7 +324,6 @@ private void OnNitrogenBoosterInsertAttempt(EntityUid uid, SubstationComponent c return; } - //for when the substation is initialized. if (component.AllowInsert) { component.AllowInsert = false; @@ -338,7 +334,6 @@ private void OnNitrogenBoosterInsertAttempt(EntityUid uid, SubstationComponent c { args.Cancel(); } - } private void OnNitrogenBoosterRemoveAttempt(EntityUid uid, SubstationComponent component, ContainerIsRemovingAttemptEvent args) @@ -356,7 +351,6 @@ private void OnNitrogenBoosterRemoveAttempt(EntityUid uid, SubstationComponent c { args.Cancel(); } - } private void OnNitrogenBoosterInserted(EntityUid uid, SubstationComponent component, EntInsertedIntoContainerMessage args) @@ -377,5 +371,4 @@ private void OnNitrogenBoosterRemoved(EntityUid uid, SubstationComponent compone NitrogenBoosterChanged(uid, component); } - } diff --git a/Content.Shared/Power/SubstationComponent.cs b/Content.Shared/Power/SubstationComponent.cs index 61ceb54b41e592..0b3dbafc45d68a 100644 --- a/Content.Shared/Power/SubstationComponent.cs +++ b/Content.Shared/Power/SubstationComponent.cs @@ -15,6 +15,10 @@ public sealed partial class SubstationComponent : Component [ViewVariables(VVAccess.ReadWrite)] public SubstationIntegrityState State = SubstationIntegrityState.Healthy; + [DataField] + [ViewVariables(VVAccess.ReadWrite)] + public bool MaintenanceDoorOpen = false; + // 9.231205828 is the amount of moles in a 5L container (the default conduit) at 1000Kpa 20C° public float InitialNitrogenBoosterMoles = 2.051379050f; From 620c79c2c8f7870249e29369c4c6ecb0fa7547ba Mon Sep 17 00:00:00 2001 From: AwareFoxy Date: Mon, 14 Oct 2024 19:26:18 +0200 Subject: [PATCH 23/24] goddamn --- Content.Client/Power/Substation/SubstationVisualsComponent.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content.Client/Power/Substation/SubstationVisualsComponent.cs b/Content.Client/Power/Substation/SubstationVisualsComponent.cs index e766feb9024918..9a9a0859220a38 100644 --- a/Content.Client/Power/Substation/SubstationVisualsComponent.cs +++ b/Content.Client/Power/Substation/SubstationVisualsComponent.cs @@ -5,7 +5,7 @@ namespace Content.Client.Power.Substation; [RegisterComponent] public sealed partial class SubstationVisualsComponent : Component { - [DataField("screenLayer")] + [DataField] public string LayerMap { get; private set; } = string.Empty; [DataField] From c5fe7d4c0682093a579fa077b715a7cb63c73362 Mon Sep 17 00:00:00 2001 From: AwareFoxy Date: Mon, 14 Oct 2024 20:32:38 +0200 Subject: [PATCH 24/24] meow :33 --- .../Structures/Power/substation.rsi/meta.json | 214 +++++++++--------- .../Power/substation.rsi/screen1.png | Bin 443 -> 369 bytes .../Power/substation.rsi/screen2.png | Bin 375 -> 339 bytes 3 files changed, 105 insertions(+), 109 deletions(-) diff --git a/Resources/Textures/Structures/Power/substation.rsi/meta.json b/Resources/Textures/Structures/Power/substation.rsi/meta.json index 4ff4011aa75a4f..027e1e522af24e 100644 --- a/Resources/Textures/Structures/Power/substation.rsi/meta.json +++ b/Resources/Textures/Structures/Power/substation.rsi/meta.json @@ -1,112 +1,108 @@ { -"version": 1, -"license": "CC0-1.0", -"copyright": "Created by EmoGarbage404 (github)", -"size": { - "x": 32, - "y": 32 -}, -"states": [ - { - "name": "substation" + "version": 1, + "license": "CC0-1.0", + "copyright": "Created by EmoGarbage404 (github), screen sprites created by joshepvodka (github) and updated by AwareFoxy(github)", + "size": { + "x": 32, + "y": 32 }, - { - "name": "substation_static" - }, - { - "name": "substation_wall", - "directions": 4 - }, - { - "name": "screen_wall", - "directions": 4, - "delays": [ - [ - 5.0, - 0.5, - 0.5, - 0.5 - ], - [ - 5.0, - 0.5, - 0.5, - 0.5 - ], - [ - 5.0, - 0.5, - 0.5, - 0.5 - ], - [ - 5.0, - 0.5, - 0.5, - 0.5 - ] - ] - }, - { - "name": "substation_wall_static" - }, - { - "name": "full" - }, - { - "name": "charging", - "delays": [ - [ - 0.1, - 0.1 - ] - ] - }, - { - "name": "dead", - "delays": [ - [ - 0.3, - 0.1 - ] - ] - }, - { - "name": "screen0", - "delays": [ - [ - 0.15, - 0.15, - 0.15, - 0.15, - 0.15, - 0.15 - ] - ] - }, - { - "name": "screen1", - "delays": [ - [ - 0.15, - 0.15, - 0.15, - 0.15, - 0.15, - 0.15 - ] - ] - }, - { - "name": "screen2", - "delays": [ - [ - 5.0, - 0.5, - 0.5, - 0.5 - ] + "states": [ + { + "name": "substation" + }, + { + "name": "substation_static" + }, + { + "name": "substation_wall", + "directions": 4 + }, + { + "name": "screen_wall", + "directions": 4, + "delays": [ + [ + 5.0, + 0.5, + 0.5, + 0.5 + ], + [ + 5.0, + 0.5, + 0.5, + 0.5 + ], + [ + 5.0, + 0.5, + 0.5, + 0.5 + ], + [ + 5.0, + 0.5, + 0.5, + 0.5 + ] + ] + }, + { + "name": "substation_wall_static" + }, + { + "name": "full" + }, + { + "name": "charging", + "delays": [ + [ + 0.1, + 0.1 + ] + ] + }, + { + "name": "dead", + "delays": [ + [ + 0.3, + 0.1 + ] + ] + }, + { + "name": "screen0", + "delays": [ + [ + 0.15, + 0.15, + 0.15, + 0.15 + ] + ] + }, + { + "name": "screen1", + "delays": [ + [ + 0.15, + 0.15, + 0.15, + 0.15 + ] + ] + }, + { + "name": "screen2", + "delays": [ + [ + 5.0, + 0.5, + 0.5, + 0.5 + ] + ] + } ] - } -] -} +} \ No newline at end of file diff --git a/Resources/Textures/Structures/Power/substation.rsi/screen1.png b/Resources/Textures/Structures/Power/substation.rsi/screen1.png index f8a0d42131b92df46bc02a7b930ae3aec56773da..44c5cdce14e5cba9ea25ef23cdc6bfd32f5003f9 100644 GIT binary patch delta 329 zcmdnZ{E=ybVZFAei(^Q|oVV8u^9~t^9Q&xhBKBa{m5a>kFRn#TRSsC0d|htA_m|g% z4K^&kB-&}PV9T*Wjewt$rvL9V6?W|V?jz&Q!~g;Z{)ZoB{_JkLJm$xrUHi9X`u(b` zXS|xo>3q81_Ux+7pFWzKe>`wyy2fJr|9>BcP5M%>Uvtv@=sooe_v84^M}N0BS$t)| z=aE+y>$P@Ioh2T#ZZmVsoauJc?TV`ce0(h?QyN&j<5O0Cta)D+`sXa{h5bX)z?2^%J~0a z-}yUX*|qmyJha~Ml`mw~e}m;tF8`e`MKW|Bnk@7D{?*w}c7*QRdg(7S*h^@{gI8}D XHs4CQ?ex&I0wm?>>gTe~DWM4fSzY~Dkr|D`8w$0nShOT0A2Qr&?-e#k zS$}EWRH?QTCkp3zUOBeD<4=81=+(?mKX3ZYa${itga7ejW;S*n#%af&Z!f#QO!Dj3 z3ieHT;?JhZ-&(UdkiDiVx2o8Dd5!tM=exM1^G<8>RqryW|Nr=Nl#9!|_k7|f{dH{^ z@5k@Do&0t8-(~w4T7EkJUV6^o_CNPpL;bJkD{tPP<`mZ@vif1&(lggTt$B5QlWcBG z(D#E?|B_9QT{~)dMfd>!m#d+_z1FUC*|xjxchY>j=*PznuBw~9^sBS<^p!`&c82~v zo@!&i?QO{3=mqzGa4RlNs=q206@GXAzQ;i>JYo(#p?~Z8uCBc=5%%?Z=xotz?{6(z zGLJz|<=eblW$O0aclWbz+4n1MRh@l$-`C%fD__5#%Mjn@nsw;U>_-c>ML&(+yw3iQ w@b1X|>K#T`FRx!%^ZF+{Bxq2{AIYQr!X24JOh?B;7^DHKET3A}jeIkRNR2}+?9 zy5t(#y1RoL6Du~Pq!Fq8JfnVizb}yz><|C|005Z3RXXtb5ZZG#K7Mt3+xD#G(*>-C zCCL9>K9@Q95ZmYV;0t*9*oP28*gUO=8{hUxx^AZD z{!-lx>gY4;rk~4^pNeIbCqJnpd;be^KQ>qt#rW#oHcZT1#i5SAp4~QM`l;gmHBV68 zbiMxcdn^6V(dY#@Hu&qWn-F8ncMwvCU%x9KgcxIg(U1F&Wz`+VTn90^2)X)S63+mh x0T#_$pnskZ03-ka0000000000006-3eFN66lq|YSRigj^002ovPDHLkV1g7~jZFXm delta 335 zcmcc2^qpyfVZEWJi(^Q|oVPcuvkp6mv_5?O;L_ck!@dVNdcq9OnnW&_Hji`UXmOCr ze_Zx%s?)?ZlD!8UXTHAvf9j-T&*e@w%PTQ}K}AjXmjmCuW_gS4n|EugZ}G*amzi}Q z37$~@um7{SH*U$zb&DDA?dwxg+H`x(<5v0OO6Ce@=f|W^srUbX`Vz1!j-h`|1PdxVAZ2vpA`1#Cr3mxj~nD6{7e~|v(Ui?4P#QN($Aznix a{U5L&G