Fix assert when trying to get TEG circuit component (#33071)
* Fix crash that was happening while testing nukeops * Update Content.Server/Power/Generation/Teg/TegSystem.cs Co-authored-by: Thomas <87614336+Aeshus@users.noreply.github.com> * Fix incorrect review --------- Co-authored-by: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Co-authored-by: Thomas <87614336+Aeshus@users.noreply.github.com> Co-authored-by: EmoGarbage404 <retron404@gmail.com>
This commit is contained in:
@@ -15,6 +15,7 @@ using Content.Shared.Power.EntitySystems;
|
||||
using Content.Shared.Power.Generation.Teg;
|
||||
using Content.Shared.Rounding;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.Power.Generation.Teg;
|
||||
|
||||
@@ -260,13 +261,16 @@ public sealed class TegSystem : EntitySystem
|
||||
// Otherwise, make sure circulator is set to nothing.
|
||||
if (!group.IsFullyBuilt)
|
||||
{
|
||||
UpdateCirculatorAppearance(uid, false);
|
||||
UpdateCirculatorAppearance((uid, component), false);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateCirculatorAppearance(EntityUid uid, bool powered)
|
||||
private void UpdateCirculatorAppearance(Entity<TegCirculatorComponent?> ent, bool powered)
|
||||
{
|
||||
var circ = Comp<TegCirculatorComponent>(uid);
|
||||
if (!Resolve(ent, ref ent.Comp))
|
||||
return;
|
||||
|
||||
var circ = ent.Comp;
|
||||
|
||||
TegCirculatorSpeed speed;
|
||||
if (powered && circ.LastPressureDelta > 0 && circ.LastMolesTransferred > 0)
|
||||
@@ -281,13 +285,13 @@ public sealed class TegSystem : EntitySystem
|
||||
speed = TegCirculatorSpeed.SpeedStill;
|
||||
}
|
||||
|
||||
_appearance.SetData(uid, TegVisuals.CirculatorSpeed, speed);
|
||||
_appearance.SetData(uid, TegVisuals.CirculatorPower, powered);
|
||||
_appearance.SetData(ent, TegVisuals.CirculatorSpeed, speed);
|
||||
_appearance.SetData(ent, TegVisuals.CirculatorPower, powered);
|
||||
|
||||
if (_pointLight.TryGetLight(uid, out var pointLight))
|
||||
if (_pointLight.TryGetLight(ent, out var pointLight))
|
||||
{
|
||||
_pointLight.SetEnabled(uid, powered, pointLight);
|
||||
_pointLight.SetColor(uid, speed == TegCirculatorSpeed.SpeedFast ? circ.LightColorFast : circ.LightColorSlow, pointLight);
|
||||
_pointLight.SetEnabled(ent, powered, pointLight);
|
||||
_pointLight.SetColor(ent, speed == TegCirculatorSpeed.SpeedFast ? circ.LightColorFast : circ.LightColorSlow, pointLight);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user