Make the powered examine text fully client predicted (#30441)

* Make the powered examine text fully client predicted

* switch to using the Entity<T> API for the examine event
This commit is contained in:
Mervill
2024-07-29 00:28:17 -07:00
committed by GitHub
parent c586561a9e
commit ec19f9f4a9
3 changed files with 24 additions and 14 deletions

View File

@@ -1,6 +1,7 @@
using Content.Client.Power.Components;
using Content.Client.Power.Components;
using Content.Shared.Power.Components;
using Content.Shared.Power.EntitySystems;
using Content.Shared.Examine;
using Robust.Shared.GameStates;
namespace Content.Client.Power.EntitySystems;
@@ -10,9 +11,15 @@ public sealed class PowerReceiverSystem : SharedPowerReceiverSystem
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ApcPowerReceiverComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<ApcPowerReceiverComponent, ComponentHandleState>(OnHandleState);
}
private void OnExamined(Entity<ApcPowerReceiverComponent> ent, ref ExaminedEvent args)
{
args.PushMarkup(GetExamineText(ent.Comp.Powered));
}
private void OnHandleState(EntityUid uid, ApcPowerReceiverComponent component, ref ComponentHandleState args)
{
if (args.Current is not ApcPowerReceiverComponentState state)