using Content.Client.SubFloor; using Content.Shared._DV.NodeCrawl; using Robust.Client.Player; using Robust.Shared.Player; namespace Content.Client._DV.NodeCrawl; public sealed class NodeCrawlSystem : SharedNodeCrawlSystem { [Dependency] private readonly IPlayerManager _player = default!; [Dependency] private readonly SubFloorHideSystem _subfloor = default!; public override void Initialize() { base.Initialize(); SubscribeLocalEvent(OnAttached); SubscribeLocalEvent(OnDetached); SubscribeLocalEvent(OnAfterAutoHandleState); } private void OnAttached(Entity ent, ref LocalPlayerAttachedEvent args) { if (ent.Comp.Mover is not null) _subfloor.Types = ent.Comp.RevealedComponents; } private void OnDetached(Entity ent, ref LocalPlayerDetachedEvent args) { _subfloor.Types = new Type[] { }; } private void OnAfterAutoHandleState(Entity ent, ref AfterAutoHandleStateEvent args) { if (_player.LocalEntity != ent) return; if (ent.Comp.Mover is not null) _subfloor.Types = ent.Comp.RevealedComponents; else _subfloor.Types = new Type[] { }; } }