From 564258b6a4d2c298d7ebb9e7807ee66b13b733f0 Mon Sep 17 00:00:00 2001 From: Pspritechologist <81725545+Pspritechologist@users.noreply.github.com> Date: Sat, 24 Jun 2023 01:18:15 -0400 Subject: [PATCH] Fixed issue with IPC charge, and review suggestions. --- .../Power/Components/BatteryDrinkerComponent.cs | 2 +- .../Power/Components/RandomBatteryChargeComponent.cs | 2 +- .../Power/Systems/BatteryDrinkerSystem.cs | 2 -- .../Power/Systems/BatteryElectrocuteChargeSystem.cs | 4 +--- .../Charge/Systems/SiliconChargeDeathSystem.cs | 6 +----- .../Silicon/Charge/Systems/SiliconChargeSystem.cs | 2 -- .../Silicon/Charge/Systems/SiliconChargerSystem.cs | 12 ++++-------- .../Silicon/Components/SiliconChargerComponent.cs | 1 + .../Silicon/Systems/SharedSiliconSystem.cs | 1 + .../Entities/Mobs/Customization/ipcScreens.ftl | 2 +- .../Prototypes/SimpleStation14/Body/Parts/ipc.yml | 2 -- 11 files changed, 11 insertions(+), 25 deletions(-) diff --git a/Content.Server/SimpleStation14/Power/Components/BatteryDrinkerComponent.cs b/Content.Server/SimpleStation14/Power/Components/BatteryDrinkerComponent.cs index ca51684709..ea254dfbdc 100644 --- a/Content.Server/SimpleStation14/Power/Components/BatteryDrinkerComponent.cs +++ b/Content.Server/SimpleStation14/Power/Components/BatteryDrinkerComponent.cs @@ -13,7 +13,7 @@ public class BatteryDrinkerComponent : Component /// /// How long it takes to drink from a battery, in seconds. - /// Is mutliplied by the source. + /// Is multiplied by the source. /// [DataField("drinkSpeed"), ViewVariables(VVAccess.ReadWrite)] public float DrinkSpeed = 1.5f; diff --git a/Content.Server/SimpleStation14/Power/Components/RandomBatteryChargeComponent.cs b/Content.Server/SimpleStation14/Power/Components/RandomBatteryChargeComponent.cs index 4b1892ac95..505ff3176c 100644 --- a/Content.Server/SimpleStation14/Power/Components/RandomBatteryChargeComponent.cs +++ b/Content.Server/SimpleStation14/Power/Components/RandomBatteryChargeComponent.cs @@ -19,5 +19,5 @@ public class RandomBatteryChargeComponent : Component /// True if the current charge is based on the preexisting current charge, or false if it's based on the max charge. /// [DataField("basedOnMaxCharge")] - public bool BasedOnMaxCharge = false; + public bool BasedOnMaxCharge = true; } diff --git a/Content.Server/SimpleStation14/Power/Systems/BatteryDrinkerSystem.cs b/Content.Server/SimpleStation14/Power/Systems/BatteryDrinkerSystem.cs index a34f6d33f3..e9eb0e6a57 100644 --- a/Content.Server/SimpleStation14/Power/Systems/BatteryDrinkerSystem.cs +++ b/Content.Server/SimpleStation14/Power/Systems/BatteryDrinkerSystem.cs @@ -122,9 +122,7 @@ private void OnDoAfter(EntityUid uid, BatteryDrinkerComponent drinkerComp, DoAft amountToDrink = MathF.Min(amountToDrink, drinkerBattery.MaxCharge - drinkerBattery.CurrentCharge); if (sourceComp != null && sourceComp.MaxAmount > 0) - { amountToDrink = MathF.Min(amountToDrink, (float) sourceComp.MaxAmount); - } if (amountToDrink <= 0) { diff --git a/Content.Server/SimpleStation14/Power/Systems/BatteryElectrocuteChargeSystem.cs b/Content.Server/SimpleStation14/Power/Systems/BatteryElectrocuteChargeSystem.cs index 382106dddb..03504e5afb 100644 --- a/Content.Server/SimpleStation14/Power/Systems/BatteryElectrocuteChargeSystem.cs +++ b/Content.Server/SimpleStation14/Power/Systems/BatteryElectrocuteChargeSystem.cs @@ -32,8 +32,6 @@ private void OnElectrocuted(EntityUid uid, BatteryComponent battery, Electrocute battery.CurrentCharge += charge; - var message = Loc.GetString("battery-electrocute-charge"); - - _popup.PopupEntity(message, uid, uid); + _popup.PopupEntity(Loc.GetString("battery-electrocute-charge"), uid, uid); } } diff --git a/Content.Server/SimpleStation14/Silicon/Charge/Systems/SiliconChargeDeathSystem.cs b/Content.Server/SimpleStation14/Silicon/Charge/Systems/SiliconChargeDeathSystem.cs index 55b9e63007..d69e65f4f7 100644 --- a/Content.Server/SimpleStation14/Silicon/Charge/Systems/SiliconChargeDeathSystem.cs +++ b/Content.Server/SimpleStation14/Silicon/Charge/Systems/SiliconChargeDeathSystem.cs @@ -28,13 +28,9 @@ private void OnSiliconChargeStateUpdate(EntityUid uid, SiliconDownOnDeadComponen Logger.Debug($"Silicon battery: {batteryComp?.CurrentCharge}"); if (args.ChargeState == ChargeState.Dead && !siliconDeadComp.Dead) - { SiliconDead(uid, siliconDeadComp, batteryComp); - } else if (args.ChargeState != ChargeState.Dead && siliconDeadComp.Dead) - { SiliconUnDead(uid, siliconDeadComp, batteryComp); - } } private void SiliconDead(EntityUid uid, SiliconDownOnDeadComponent siliconDeadComp, BatteryComponent? batteryComp) @@ -65,7 +61,7 @@ private void SiliconUnDead(EntityUid uid, SiliconDownOnDeadComponent siliconDead } /// -/// A canellable event raised when a Silicon is about to go down due to charge. +/// A cancellable event raised when a Silicon is about to go down due to charge. /// public sealed class SiliconChargeDyingEvent : CancellableEntityEventArgs { diff --git a/Content.Server/SimpleStation14/Silicon/Charge/Systems/SiliconChargeSystem.cs b/Content.Server/SimpleStation14/Silicon/Charge/Systems/SiliconChargeSystem.cs index e4042c61be..4cd2e0c1ef 100644 --- a/Content.Server/SimpleStation14/Silicon/Charge/Systems/SiliconChargeSystem.cs +++ b/Content.Server/SimpleStation14/Silicon/Charge/Systems/SiliconChargeSystem.cs @@ -115,8 +115,6 @@ public override void Update(float frameTime) RaiseLocalEvent(silicon, new SiliconChargeStateUpdateEvent(currentState)); - Logger.DebugS("silicon", $"Silicon {silicon} charge state updated to {currentState}."); - _moveMod.RefreshMovementSpeedModifiers(silicon); } } diff --git a/Content.Server/SimpleStation14/Silicon/Charge/Systems/SiliconChargerSystem.cs b/Content.Server/SimpleStation14/Silicon/Charge/Systems/SiliconChargerSystem.cs index 45522c77b1..9e92177b8d 100644 --- a/Content.Server/SimpleStation14/Silicon/Charge/Systems/SiliconChargerSystem.cs +++ b/Content.Server/SimpleStation14/Silicon/Charge/Systems/SiliconChargerSystem.cs @@ -61,8 +61,8 @@ public override void Update(float frameTime) #region Entity Storage Chargers // Check for any chargers with the EntityStorageComponent. - var entstorQuery = EntityQueryEnumerator(); - while (entstorQuery.MoveNext(out var uid, out var chargerComp, out var entStorage)) + var entityStorageQuery = EntityQueryEnumerator(); + while (entityStorageQuery.MoveNext(out var uid, out var chargerComp, out var entStorage)) { var wasActive = chargerComp.Active; chargerComp.Active = false; @@ -81,8 +81,6 @@ public override void Update(float frameTime) var chargeRate = chargerComp.ChargeMulti * frameTime * 10; - - HandleChargingEntity(entity, chargeRate, chargerComp, uid, frameTime); // Heat up the air in the charger. @@ -234,10 +232,8 @@ private List SearchThroughEntities(EntityUid entity, bool burn = true private void ChargeBattery(EntityUid entity, BatteryComponent batteryComp, float chargeRate, SiliconChargerComponent chargerComp, EntityUid chargerUid) { // Do some math so a charger never charges a battery from zero to full in less than 10 seconds, just for the effect of it. - if (chargerComp.ChargeMulti * 10 > batteryComp.MaxCharge / 10) - { - chargeRate /= chargerComp.ChargeMulti * 10 / (batteryComp.MaxCharge / 10); - } + if (chargerComp.ChargeMulti * 10 > batteryComp.MaxCharge / chargerComp.MinChargeTime) + chargeRate /= chargerComp.ChargeMulti * 10 / (batteryComp.MaxCharge / chargerComp.MinChargeTime); if (batteryComp.CurrentCharge + chargeRate < batteryComp.MaxCharge) _battery.SetCharge(entity, batteryComp.CurrentCharge + chargeRate, batteryComp); diff --git a/Content.Shared/SimpleStation14/Silicon/Components/SiliconChargerComponent.cs b/Content.Shared/SimpleStation14/Silicon/Components/SiliconChargerComponent.cs index 46203475f9..14e3e95674 100644 --- a/Content.Shared/SimpleStation14/Silicon/Components/SiliconChargerComponent.cs +++ b/Content.Shared/SimpleStation14/Silicon/Components/SiliconChargerComponent.cs @@ -54,6 +54,7 @@ public sealed class SiliconChargerComponent : Component /// The minimum amount of time it will take to charge a battery, in seconds. /// /// + /// Note that this is from empty. A battery that is already half full will take half as long as this value to reach full, if it would've been faster from empty. /// This is for the sake of feeling cooler- It's lame to just charge instantly. /// [DataField("minChargeTime"), ViewVariables(VVAccess.ReadWrite)] diff --git a/Content.Shared/SimpleStation14/Silicon/Systems/SharedSiliconSystem.cs b/Content.Shared/SimpleStation14/Silicon/Systems/SharedSiliconSystem.cs index 4c18e08587..beb4246f65 100644 --- a/Content.Shared/SimpleStation14/Silicon/Systems/SharedSiliconSystem.cs +++ b/Content.Shared/SimpleStation14/Silicon/Systems/SharedSiliconSystem.cs @@ -5,6 +5,7 @@ namespace Content.Shared.SimpleStation14.Silicon.Systems; + public sealed class SharedSiliconChargeSystem : EntitySystem { [Dependency] private readonly AlertsSystem _alertsSystem = default!; diff --git a/Resources/Locale/en-US/SimpleStation14/Prototypes/Entities/Mobs/Customization/ipcScreens.ftl b/Resources/Locale/en-US/SimpleStation14/Prototypes/Entities/Mobs/Customization/ipcScreens.ftl index 656d928c69..3f53f2d3f9 100644 --- a/Resources/Locale/en-US/SimpleStation14/Prototypes/Entities/Mobs/Customization/ipcScreens.ftl +++ b/Resources/Locale/en-US/SimpleStation14/Prototypes/Entities/Mobs/Customization/ipcScreens.ftl @@ -5,7 +5,7 @@ marking-ScreenEight = Eight marking-ScreenGoggles = Goggles marking-ScreenExclaim = Exclaim marking-ScreenHeart = Heart -marking-ScreenMonoeye = Cylops +marking-ScreenMonoeye = Cyclops marking-ScreenNature = Naturalist marking-ScreenOrange = Orange marking-ScreenPink = Pink diff --git a/Resources/Prototypes/SimpleStation14/Body/Parts/ipc.yml b/Resources/Prototypes/SimpleStation14/Body/Parts/ipc.yml index 138e2d47e7..b46c6997a9 100644 --- a/Resources/Prototypes/SimpleStation14/Body/Parts/ipc.yml +++ b/Resources/Prototypes/SimpleStation14/Body/Parts/ipc.yml @@ -1,5 +1,3 @@ -# TODO: Add descriptions (many) -# TODO BODY: Part damage - type: entity id: PartIPC parent: BaseItem