From 99476e00d214efd362bea2662e05de52e3afb4d3 Mon Sep 17 00:00:00 2001 From: Rinary Date: Fri, 1 Nov 2024 17:51:29 +0200 Subject: [PATCH] upd --- Content.Server/_Sunrise/Synth/SynthSystem.cs | 10 +++++++--- .../_Sunrise/Entities/Mobs/Species/synth.yml | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Content.Server/_Sunrise/Synth/SynthSystem.cs b/Content.Server/_Sunrise/Synth/SynthSystem.cs index 890ee2b1109..d2a4c02c71a 100644 --- a/Content.Server/_Sunrise/Synth/SynthSystem.cs +++ b/Content.Server/_Sunrise/Synth/SynthSystem.cs @@ -27,7 +27,7 @@ using Content.Shared.Verbs; using Robust.Shared.Utility; using Robust.Server.GameObjects; -using Robust.Server.Containers; +using Robust.Shared.Containers; using Robust.Shared.Audio.Systems; using Robust.Shared.Player; using Robust.Shared.Prototypes; @@ -41,7 +41,7 @@ public sealed class SynthSystem : SharedSynthSystem [Dependency] private readonly SharedPopupSystem _popup = default!; [Dependency] private readonly SharedAudioSystem _audioSystem = default!; [Dependency] private readonly BatterySystem _batterySystem = default!; - [Dependency] private readonly ContainerSystem _containerSystem = default!; + [Dependency] private readonly SharedContainerSystem _containerSystem = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; [Dependency] private readonly BodySystem _bodySystem = default!; [Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifier = default!; @@ -233,8 +233,11 @@ private bool TryGetBattery(EntityUid uid, [NotNullWhen(true)] out EntityUid? pow { powercell = null; batteryComponent = null; + + if (!TryComp(uid, out ContainerManagerComponent? containerComp)) + return false; - if (_containerSystem.TryGetContainer(uid, "cell_slot", out var container) && container.ContainedEntities.Count > 0) + if (_containerSystem.TryGetContainer(uid, "cell_slot", out var container, containerComp) && container.ContainedEntities.Count > 0) { foreach (var content in container.ContainedEntities) { @@ -306,6 +309,7 @@ private bool TryChangeEnergy(EntityUid uid, FixedPoint2 delta, SynthComponent? c { _batterySystem.SetCharge(battery.Value, newEnergy.Float(), batteryComponent); component.Energy = newEnergy.Float(); + component.MaxEnergy = batteryComponent.MaxCharge; } switch (component.SlowState) diff --git a/Resources/Prototypes/_Sunrise/Entities/Mobs/Species/synth.yml b/Resources/Prototypes/_Sunrise/Entities/Mobs/Species/synth.yml index b7f5ad5febc..9b4b4e25119 100644 --- a/Resources/Prototypes/_Sunrise/Entities/Mobs/Species/synth.yml +++ b/Resources/Prototypes/_Sunrise/Entities/Mobs/Species/synth.yml @@ -283,6 +283,7 @@ - type: ActivatableUI key: enum.BorgUiKey.Key - type: BorgChassis + brainContainerId: "synth_brain" - type: LockingWhitelist blacklist: components: