From 3420c0e94d40ed117361851a4211d63e3fe9676e Mon Sep 17 00:00:00 2001 From: Pspritechologist <81725545+Pspritechologist@users.noreply.github.com> Date: Fri, 23 Jun 2023 00:22:23 -0400 Subject: [PATCH] Cleaned up tons of stuff. Battery draining seems to be broken right now, reporting 0 charge at all times. Will fix soon. --- .../RandomBatteryChargeComponent.cs | 23 +++++++ .../Power/Systems/BatteryDrinkerSystem.cs | 9 ++- .../Systems/RandomBatteryChargeSystem.cs | 43 ++++++++++++ .../Systems/SiliconChargeDeathSystem.cs | 35 +++++----- .../Charge/Systems/SiliconChargeSystem.cs | 67 ++++++++++++------- .../Charge/Systems/SiliconChargerSystem.cs | 27 +++++--- .../Silicon/Components/SiliconComponent.cs | 32 +++++---- .../Silicon/Systems/SharedSiliconSystem.cs | 14 +--- .../Entities/Mobs/Player/robots.yml | 6 +- .../Entities/Mobs/Player/ipc.yml | 9 ++- .../Entities/Mobs/Player/silicon_base.yml | 8 +-- 11 files changed, 182 insertions(+), 91 deletions(-) create mode 100644 Content.Server/SimpleStation14/Power/Components/RandomBatteryChargeComponent.cs create mode 100644 Content.Server/SimpleStation14/Power/Systems/RandomBatteryChargeSystem.cs diff --git a/Content.Server/SimpleStation14/Power/Components/RandomBatteryChargeComponent.cs b/Content.Server/SimpleStation14/Power/Components/RandomBatteryChargeComponent.cs new file mode 100644 index 0000000000..4b1892ac95 --- /dev/null +++ b/Content.Server/SimpleStation14/Power/Components/RandomBatteryChargeComponent.cs @@ -0,0 +1,23 @@ +namespace Content.Server.SimpleStation14.Power.Components; + +[RegisterComponent] +public class RandomBatteryChargeComponent : Component +{ + /// + /// The minimum and maximum max charge the battery can have. + /// + [DataField("batteryMaxMinMax")] + public Vector2 BatteryMaxMinMax = (0.85f, 1.15f); + + /// + /// The minimum and maximum current charge the battery can have. + /// + [DataField("batteryChargeMinMax")] + public Vector2 BatteryChargeMinMax = (1f, 1f); + + /// + /// 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; +} diff --git a/Content.Server/SimpleStation14/Power/Systems/BatteryDrinkerSystem.cs b/Content.Server/SimpleStation14/Power/Systems/BatteryDrinkerSystem.cs index c5ab29945e..a34f6d33f3 100644 --- a/Content.Server/SimpleStation14/Power/Systems/BatteryDrinkerSystem.cs +++ b/Content.Server/SimpleStation14/Power/Systems/BatteryDrinkerSystem.cs @@ -20,6 +20,7 @@ public sealed class BatteryDrinkerSystem : EntitySystem [Dependency] private readonly SharedDoAfterSystem _doAfter = default!; [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly BatterySystem _battery = default!; + [Dependency] private readonly SiliconChargeSystem _silicon = default!; public override void Initialize() { @@ -52,7 +53,6 @@ private void AddAltVerb(EntityUid uid, BatteryComponent batteryComponent, GetVer private bool TestDrinkableBattery(EntityUid target, BatteryDrinkerComponent drinkerComp) { - if (!drinkerComp.DrinkAll && !HasComp(target)) return false; @@ -61,13 +61,16 @@ private bool TestDrinkableBattery(EntityUid target, BatteryDrinkerComponent drin private bool TryGetFillableBattery(EntityUid uid, [NotNullWhen(true)] out BatteryComponent? battery) { - if (EntityManager.TryGetComponent(uid, out battery)) + if (_silicon.TryGetSiliconBattery(uid, out battery)) + return true; + + if (EntityManager.TryGetComponent(uid, out battery)) return true; if (EntityManager.TryGetComponent(uid, out var powerCellSlot) && _slots.TryGetSlot(uid, powerCellSlot.CellSlotId, out var slot) && slot.Item != null && - EntityManager.TryGetComponent(slot.Item.Value, out battery)) + EntityManager.TryGetComponent(slot.Item.Value, out battery)) return true; return false; diff --git a/Content.Server/SimpleStation14/Power/Systems/RandomBatteryChargeSystem.cs b/Content.Server/SimpleStation14/Power/Systems/RandomBatteryChargeSystem.cs new file mode 100644 index 0000000000..eb3b53628a --- /dev/null +++ b/Content.Server/SimpleStation14/Power/Systems/RandomBatteryChargeSystem.cs @@ -0,0 +1,43 @@ +using Content.Server.Power.Components; +using Content.Server.Power.EntitySystems; +using Content.Server.SimpleStation14.Power.Components; +using Robust.Shared.Random; +using Robust.Shared.Utility; + +namespace Content.Server.SimpleStation14.Power.Systems; + +public sealed class RandomBatteryFillSystem : EntitySystem +{ + [Dependency] private readonly BatterySystem _battery = default!; + [Dependency] private readonly IRobustRandom _random = default!; + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnBatteryInit); + } + + private void OnBatteryInit(EntityUid uid, RandomBatteryChargeComponent component, ComponentInit args) + { + var batteryComp = Comp(uid); + DebugTools.AssertNotNull(batteryComp); + + if (batteryComp == null) + return; + + var (minMaxMod, maxMaxMod) = component.BatteryMaxMinMax; + var (minChargeMod, maxChargeMod) = component.BatteryChargeMinMax; + + var newMax = batteryComp.MaxCharge * _random.NextFloat(minMaxMod, maxMaxMod); + float newCharge; + + if (component.BasedOnMaxCharge) + newCharge = newMax * _random.NextFloat(minChargeMod, maxChargeMod); + else + newCharge = batteryComp.CurrentCharge * _random.NextFloat(minChargeMod, maxChargeMod); + + _battery.SetMaxCharge(uid, newMax); + _battery.SetCharge(uid, newCharge); + } +} diff --git a/Content.Server/SimpleStation14/Silicon/Charge/Systems/SiliconChargeDeathSystem.cs b/Content.Server/SimpleStation14/Silicon/Charge/Systems/SiliconChargeDeathSystem.cs index 180283f174..55b9e63007 100644 --- a/Content.Server/SimpleStation14/Silicon/Charge/Systems/SiliconChargeDeathSystem.cs +++ b/Content.Server/SimpleStation14/Silicon/Charge/Systems/SiliconChargeDeathSystem.cs @@ -1,16 +1,17 @@ using Content.Server.Power.Components; -using Content.Shared.SimpleStation14.Silicon.Components; using Content.Shared.SimpleStation14.Silicon.Systems; -using Robust.Shared.Utility; using Content.Server.Bed.Sleep; using Content.Shared.Bed.Sleep; using Content.Server.Sound.Components; +using Content.Server.SimpleStation14.Silicon.Charge; +using Serilog; namespace Content.Server.SimpleStation14.Silicon.Death; public sealed class SiliconDeathSystem : EntitySystem { - [Dependency] private readonly SleepingSystem _sleepSystem = default!; + [Dependency] private readonly SleepingSystem _sleep = default!; + [Dependency] private readonly SiliconChargeSystem _silicon = default!; public override void Initialize() { @@ -21,14 +22,10 @@ public override void Initialize() private void OnSiliconChargeStateUpdate(EntityUid uid, SiliconDownOnDeadComponent siliconDeadComp, SiliconChargeStateUpdateEvent args) { - EntityManager.TryGetComponent(uid, out var batteryComp); - EntityManager.TryGetComponent(uid, out var siliconComp); + _silicon.TryGetSiliconBattery(uid, out var batteryComp); - DebugTools.AssertNotNull(batteryComp); - DebugTools.AssertNotNull(siliconComp); - - if (batteryComp == null || siliconComp == null) - return; + Logger.Debug($"Silicon charge state update: {args.ChargeState}"); + Logger.Debug($"Silicon battery: {batteryComp?.CurrentCharge}"); if (args.ChargeState == ChargeState.Dead && !siliconDeadComp.Dead) { @@ -40,7 +37,7 @@ private void OnSiliconChargeStateUpdate(EntityUid uid, SiliconDownOnDeadComponen } } - private void SiliconDead(EntityUid uid, SiliconDownOnDeadComponent siliconDeadComp, BatteryComponent batteryComp) + private void SiliconDead(EntityUid uid, SiliconDownOnDeadComponent siliconDeadComp, BatteryComponent? batteryComp) { var deadEvent = new SiliconChargeDyingEvent(uid, batteryComp); RaiseLocalEvent(uid, deadEvent); @@ -57,9 +54,9 @@ private void SiliconDead(EntityUid uid, SiliconDownOnDeadComponent siliconDeadCo RaiseLocalEvent(uid, new SiliconChargeDeathEvent(uid, batteryComp)); } - private void SiliconUnDead(EntityUid uid, SiliconDownOnDeadComponent siliconDeadComp, BatteryComponent batteryComp) + private void SiliconUnDead(EntityUid uid, SiliconDownOnDeadComponent siliconDeadComp, BatteryComponent? batteryComp) { - _sleepSystem.TryWaking(uid, null, true); + _sleep.TryWaking(uid, null, true); siliconDeadComp.Dead = false; @@ -73,9 +70,9 @@ private void SiliconUnDead(EntityUid uid, SiliconDownOnDeadComponent siliconDead public sealed class SiliconChargeDyingEvent : CancellableEntityEventArgs { public EntityUid SiliconUid { get; } - public BatteryComponent BatteryComp { get; } + public BatteryComponent? BatteryComp { get; } - public SiliconChargeDyingEvent(EntityUid siliconUid, BatteryComponent batteryComp) + public SiliconChargeDyingEvent(EntityUid siliconUid, BatteryComponent? batteryComp) { SiliconUid = siliconUid; BatteryComp = batteryComp; @@ -88,9 +85,9 @@ public SiliconChargeDyingEvent(EntityUid siliconUid, BatteryComponent batteryCom public sealed class SiliconChargeDeathEvent : EntityEventArgs { public EntityUid SiliconUid { get; } - public BatteryComponent BatteryComp { get; } + public BatteryComponent? BatteryComp { get; } - public SiliconChargeDeathEvent(EntityUid siliconUid, BatteryComponent batteryComp) + public SiliconChargeDeathEvent(EntityUid siliconUid, BatteryComponent? batteryComp) { SiliconUid = siliconUid; BatteryComp = batteryComp; @@ -103,9 +100,9 @@ public SiliconChargeDeathEvent(EntityUid siliconUid, BatteryComponent batteryCom public sealed class SiliconChargeAliveEvent : EntityEventArgs { public EntityUid SiliconUid { get; } - public BatteryComponent BatteryComp { get; } + public BatteryComponent? BatteryComp { get; } - public SiliconChargeAliveEvent(EntityUid siliconUid, BatteryComponent batteryComp) + public SiliconChargeAliveEvent(EntityUid siliconUid, BatteryComponent? batteryComp) { SiliconUid = siliconUid; BatteryComp = batteryComp; diff --git a/Content.Server/SimpleStation14/Silicon/Charge/Systems/SiliconChargeSystem.cs b/Content.Server/SimpleStation14/Silicon/Charge/Systems/SiliconChargeSystem.cs index a82324d2e3..e4042c61be 100644 --- a/Content.Server/SimpleStation14/Silicon/Charge/Systems/SiliconChargeSystem.cs +++ b/Content.Server/SimpleStation14/Silicon/Charge/Systems/SiliconChargeSystem.cs @@ -11,41 +11,55 @@ using Content.Shared.Movement.Systems; using Content.Server.Body.Components; using Content.Server.Power.EntitySystems; +using Robust.Shared.Containers; +using System.Diagnostics.CodeAnalysis; namespace Content.Server.SimpleStation14.Silicon.Charge; public sealed class SiliconChargeSystem : EntitySystem { [Dependency] private readonly IRobustRandom _random = default!; - [Dependency] private readonly MobStateSystem _mobStateSystem = default!; - [Dependency] private readonly FlammableSystem _flammableSystem = default!; + [Dependency] private readonly MobStateSystem _mobState = default!; + [Dependency] private readonly FlammableSystem _flammable = default!; [Dependency] private readonly PopupSystem _popup = default!; - [Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifierSystem = default!; + [Dependency] private readonly MovementSpeedModifierSystem _moveMod = default!; [Dependency] private readonly BatterySystem _battery = default!; + [Dependency] private readonly SharedContainerSystem _container = default!; public override void Initialize() { base.Initialize(); - // Subscribe for init on entities with both SiliconComponent and BatteryComponent - SubscribeLocalEvent(OnBatteryInit); + SubscribeLocalEvent(OnSiliconStartup); } - - private void OnBatteryInit(EntityUid uid, BatteryComponent component, ComponentInit args) + public bool TryGetSiliconBattery(EntityUid uid, [NotNullWhen(true)] out BatteryComponent? batteryComp) { - if (!EntityManager.TryGetComponent(uid, out var siliconComp) || - !siliconComp.BatteryPowered) - return; + batteryComp = null; + + if (!EntityManager.TryGetComponent(uid, out SiliconComponent? siliconComp)) + return false; + + if (siliconComp.BatteryContainer != null && + siliconComp.BatteryContainer.ContainedEntities.Count > 0 && + TryComp(siliconComp.BatteryContainer.ContainedEntities[0], out batteryComp)) + { + return true; + } - _battery.SetMaxCharge(uid, component.MaxCharge * _random.NextFloat(0.85f, 1.15f)); + if (TryComp(uid, out batteryComp)) + return true; - var batteryLevelFill = component.MaxCharge; + return false; + } - if (siliconComp.StartCharged.Equals(StartChargedData.Randomized)) - batteryLevelFill *= _random.NextFloat(0.40f, 0.80f); + private void OnSiliconStartup(EntityUid uid, SiliconComponent component, ComponentStartup args) + { + if (component.BatterySlot == null) + return; - _battery.SetCharge(uid, batteryLevelFill); + var container = _container.EnsureContainer(uid, component.BatterySlot); + component.BatteryContainer = container; } public override void Update(float frameTime) @@ -53,11 +67,14 @@ public override void Update(float frameTime) base.Update(frameTime); // For each siliconComp entity with a battery component, drain their charge. - var query = EntityQueryEnumerator(); - while (query.MoveNext(out var silicon, out var siliconComp, out var batteryComp)) + var query = EntityQueryEnumerator(); + while (query.MoveNext(out var silicon, out var siliconComp)) { + if (!siliconComp.BatteryPowered || !TryGetSiliconBattery(silicon, out var batteryComp)) + continue; + // If the silicon is dead, skip it. - if (_mobStateSystem.IsDead(silicon)) + if (_mobState.IsDead(silicon)) continue; var drainRate = 10 * siliconComp.DrainRateMulti; @@ -84,10 +101,10 @@ public override void Update(float frameTime) var currentState = chargePercent switch { - var x when x > siliconComp.ChargeStateThresholdMid => ChargeState.Full, - var x when x > siliconComp.ChargeStateThresholdLow => ChargeState.Mid, - var x when x > siliconComp.ChargeStateThresholdCritical => ChargeState.Low, - var x when x > 0 || siliconComp.ChargeStateThresholdCritical == 0 => ChargeState.Critical, + var x when x > siliconComp.ChargeThresholdMid => ChargeState.Full, + var x when x > siliconComp.ChargeThresholdLow => ChargeState.Mid, + var x when x > siliconComp.ChargeThresholdCritical => ChargeState.Low, + var x when x > 0 || siliconComp.ChargeThresholdCritical == 0 => ChargeState.Critical, _ => ChargeState.Dead, }; @@ -98,7 +115,9 @@ public override void Update(float frameTime) RaiseLocalEvent(silicon, new SiliconChargeStateUpdateEvent(currentState)); - _movementSpeedModifierSystem.RefreshMovementSpeedModifiers(silicon); + Logger.DebugS("silicon", $"Silicon {silicon} charge state updated to {currentState}."); + + _moveMod.RefreshMovementSpeedModifiers(silicon); } } } @@ -135,7 +154,7 @@ private float SiliconHeatEffects(EntityUid silicon, float frameTime) !flamComp.OnFire && _random.Prob(Math.Clamp(temperComp.CurrentTemperature / (upperThresh * 5), 0.001f, 0.9f))) { - _flammableSystem.Ignite(silicon, flamComp); + _flammable.Ignite(silicon, flamComp); } else if ((flamComp == null || !flamComp.OnFire) && _random.Prob(Math.Clamp(temperComp.CurrentTemperature / upperThresh, 0.001f, 0.75f))) diff --git a/Content.Server/SimpleStation14/Silicon/Charge/Systems/SiliconChargerSystem.cs b/Content.Server/SimpleStation14/Silicon/Charge/Systems/SiliconChargerSystem.cs index 7f42f9497c..45522c77b1 100644 --- a/Content.Server/SimpleStation14/Silicon/Charge/Systems/SiliconChargerSystem.cs +++ b/Content.Server/SimpleStation14/Silicon/Charge/Systems/SiliconChargerSystem.cs @@ -38,6 +38,7 @@ public sealed class SiliconChargerSystem : EntitySystem [Dependency] private readonly BatterySystem _battery = default!; [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IGameTiming _timing = default!; + [Dependency] private readonly SiliconChargeSystem _silicon = default!; public override void Initialize() { @@ -153,8 +154,8 @@ private void HandleChargingEntity(EntityUid entity, float chargeRate, SiliconCha foreach (var entityToCharge in entitiesToCharge.ToList()) { - if (TryComp(entityToCharge, out _)) - ChargeBattery(entityToCharge, EntityManager.GetComponent(entityToCharge), chargeRate, chargerComp, chargerUid); + if (_silicon.TryGetSiliconBattery(entityToCharge, out var batteryComp)) + ChargeBattery(entityToCharge, batteryComp, chargeRate, chargerComp, chargerUid); else if (TryComp(entityToCharge, out var damageComp)) BurnEntity(entityToCharge, damageComp, frameTime, chargerComp, chargerUid); } @@ -164,22 +165,28 @@ private List SearchThroughEntities(EntityUid entity, bool burn = true { var entitiesToCharge = new List(); + if (_silicon.TryGetSiliconBattery(entity, out var siliconBatteryComp)) + { + if (siliconBatteryComp.CurrentCharge < siliconBatteryComp.MaxCharge) + entitiesToCharge.Add(entity); + } + // If the given entity has a battery, charge it. - if (!HasComp(entity) && // Should probably be charge by the entity holding it, but also might be too small to be safe. - TryComp(entity, out var batteryComp) && - batteryComp.CurrentCharge < batteryComp.MaxCharge) + else if (!HasComp(entity) && // Should probably be charged by the entity holding it. Might be too small to be safe. + TryComp(entity, out var batteryComp)) { - entitiesToCharge.Add(entity); + if (batteryComp.CurrentCharge < batteryComp.MaxCharge) + entitiesToCharge.Add(entity); } // If the given entity contains a battery, charge it. - else if (!HasComp(entity) && // Should probably be charge by the entity holding it, but also might be too small to be safe. + else if (!HasComp(entity) && // Should probably be charged by the entity holding it. Might be too small to be safe. TryComp(entity, out var cellSlotComp) && _itemSlots.TryGetSlot(entity, cellSlotComp.CellSlotId, out var slot) && - TryComp(slot.Item, out var cellBattComp) && - cellBattComp.CurrentCharge < cellBattComp.MaxCharge) + TryComp(slot.Item, out var cellBattComp)) { - entitiesToCharge.Add(slot.Item.Value); + if (cellBattComp.CurrentCharge < cellBattComp.MaxCharge) + entitiesToCharge.Add(slot.Item.Value); } // If the given entity is fleshy, burn the fucker. diff --git a/Content.Shared/SimpleStation14/Silicon/Components/SiliconComponent.cs b/Content.Shared/SimpleStation14/Silicon/Components/SiliconComponent.cs index c6bbf891d5..c8ef4e95ae 100644 --- a/Content.Shared/SimpleStation14/Silicon/Components/SiliconComponent.cs +++ b/Content.Shared/SimpleStation14/Silicon/Components/SiliconComponent.cs @@ -1,6 +1,7 @@ using Robust.Shared.GameStates; using Content.Shared.SimpleStation14.Silicon.Systems; using Robust.Shared.Serialization.TypeSerializers.Implementations; +using Robust.Shared.Containers; namespace Content.Shared.SimpleStation14.Silicon.Components; @@ -22,6 +23,11 @@ public sealed class SiliconComponent : Component [ViewVariables(VVAccess.ReadOnly)] public new EntityUid Owner = EntityUid.Invalid; + /// + /// The Silicon's battery slot, if it has one. + /// + public Container? BatteryContainer = null; + /// /// Is the Silicon currently dead? /// @@ -47,13 +53,11 @@ public sealed class SiliconComponent : Component public bool BatteryPowered = false; /// - /// Should this silicon start charged? + /// Slot this entity's battery is contained in. + /// Leave null if using a battery component. /// - /// - /// Valid values are: , , and . - /// - [DataField("startCharged", customTypeSerializer: typeof(EnumSerializer)), ViewVariables(VVAccess.ReadOnly)] - public Enum StartCharged = StartChargedData.Randomized; + [DataField("batterySlot")] + public string? BatterySlot = null; /// /// Multiplier for the drain rate of the silicon. @@ -70,16 +74,16 @@ public sealed class SiliconComponent : Component /// Setting a value to null will disable that state. /// Setting Critical to 0 will cause the Silicon to never enter the dead state. /// - [DataField("chargeStateThresholdMid"), ViewVariables(VVAccess.ReadWrite)] - public float? ChargeStateThresholdMid = 0.5f; + [DataField("chargeThresholdMid"), ViewVariables(VVAccess.ReadWrite)] + public float? ChargeThresholdMid = 0.5f; - /// - [DataField("chargeStateThresholdLow"), ViewVariables(VVAccess.ReadWrite)] - public float? ChargeStateThresholdLow = 0.25f; + /// + [DataField("chargeThresholdLow"), ViewVariables(VVAccess.ReadWrite)] + public float? ChargeThresholdLow = 0.25f; - /// - [DataField("chargeStateThresholdCritical"), ViewVariables(VVAccess.ReadWrite)] - public float? ChargeStateThresholdCritical = 0.0f; + /// + [DataField("chargeThresholdCritical"), ViewVariables(VVAccess.ReadWrite)] + public float? ChargeThresholdCritical = 0.0f; /// diff --git a/Content.Shared/SimpleStation14/Silicon/Systems/SharedSiliconSystem.cs b/Content.Shared/SimpleStation14/Silicon/Systems/SharedSiliconSystem.cs index 0e7abef928..4c18e08587 100644 --- a/Content.Shared/SimpleStation14/Silicon/Systems/SharedSiliconSystem.cs +++ b/Content.Shared/SimpleStation14/Silicon/Systems/SharedSiliconSystem.cs @@ -54,11 +54,11 @@ private void OnRefreshMovespeed(EntityUid uid, SiliconComponent component, Refre foreach (var state in speedModThresholds) { - if (component.ChargeState >= state.Key && ((float) state.Key) > closest) - closest = ((float) state.Key); + if (component.ChargeState >= state.Key && (float) state.Key > closest) + closest = (float) state.Key; } - var speedMod = speedModThresholds[(ChargeState)closest]; + var speedMod = speedModThresholds[(ChargeState) closest]; args.ModifySpeed(speedMod, speedMod); } @@ -74,7 +74,6 @@ public enum SiliconType public enum ChargeState { - Charging = -1, Full, Mid, Low, @@ -82,13 +81,6 @@ public enum ChargeState Dead } -public enum StartChargedData -{ - False, - True, - Randomized -} - /// /// Event raised when a Silicon's charge state needs to be updated. diff --git a/Resources/Prototypes/Nyanotrasen/Entities/Mobs/Player/robots.yml b/Resources/Prototypes/Nyanotrasen/Entities/Mobs/Player/robots.yml index dcf397817b..8793f6b02b 100644 --- a/Resources/Prototypes/Nyanotrasen/Entities/Mobs/Player/robots.yml +++ b/Resources/Prototypes/Nyanotrasen/Entities/Mobs/Player/robots.yml @@ -193,9 +193,9 @@ batteryPowered: true drainRateMulti: 4 chargeRateMulti: 6 - chargeStateThresholdMid: 0.60 - chargeStateThresholdLow: 0.30 - chargeStateThresholdCritical: 0 + chargeThresholdMid: 0.60 + chargeThresholdLow: 0.30 + chargeThresholdCritical: 0 speedModifierThresholds: 0: 1 1: 1 diff --git a/Resources/Prototypes/SimpleStation14/Entities/Mobs/Player/ipc.yml b/Resources/Prototypes/SimpleStation14/Entities/Mobs/Player/ipc.yml index 6e15756ea0..8a7e71b2ad 100644 --- a/Resources/Prototypes/SimpleStation14/Entities/Mobs/Player/ipc.yml +++ b/Resources/Prototypes/SimpleStation14/Entities/Mobs/Player/ipc.yml @@ -9,13 +9,16 @@ templateId: ipc - type: Battery maxCharge: 150000 + - type: RandomBatteryCharge + batteryMaxMinMax: 0.85, 1.15 + batteryChargeMinMax: 0.40, 0.90 - type: Silicon entityType: enum.SiliconType.Player batteryPowered: true drainRateMulti: 5 - chargeStateThresholdMid: 0.80 - chargeStateThresholdLow: 0.35 - chargeStateThresholdCritical: 0.10 + chargeThresholdMid: 0.80 + chargeThresholdLow: 0.35 + chargeThresholdCritical: 0.10 speedModifierThresholds: 0: 1 1: 1 diff --git a/Resources/Prototypes/SimpleStation14/Entities/Mobs/Player/silicon_base.yml b/Resources/Prototypes/SimpleStation14/Entities/Mobs/Player/silicon_base.yml index 11d4ca1f72..91cce030d4 100644 --- a/Resources/Prototypes/SimpleStation14/Entities/Mobs/Player/silicon_base.yml +++ b/Resources/Prototypes/SimpleStation14/Entities/Mobs/Player/silicon_base.yml @@ -62,12 +62,12 @@ - type: Alerts - type: Silicon entityType: enum.SiliconType.Player - batteryPowered: false # Needs to also have a battery component! + batteryPowered: false # Needs to also have a battery! drainRateMulti: 4.5 chargeRateMulti: 6 - chargeStateThresholdMid: 0.60 - chargeStateThresholdLow: 0.30 - chargeStateThresholdCritical: 0 + chargeThresholdMid: 0.60 + chargeThresholdLow: 0.30 + chargeThresholdCritical: 0 speedModifierThresholds: 0: 1 1: 1