Sloth's subfloor vismask adventure (#35347)
* Add a subfloor vismask Significantly cuts down on sent entity count. * More optimisations * Fix command * Fixes * namespace cleanup * Review * Vismasks * Content update * Bandaid * awewa * Revert these * reh * Update Content.Shared/SubFloor/TrayScannerComponent.cs --------- Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
using Content.Shared.DrawDepth;
|
||||
using Content.Client.UserInterface.Systems.Sandbox;
|
||||
using Content.Shared.SubFloor;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Client.SubFloor;
|
||||
|
||||
public sealed class SubFloorHideSystem : SharedSubFloorHideSystem
|
||||
{
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly IUserInterfaceManager _ui = default!;
|
||||
|
||||
private bool _showAll;
|
||||
|
||||
@@ -18,8 +21,13 @@ public sealed class SubFloorHideSystem : SharedSubFloorHideSystem
|
||||
{
|
||||
if (_showAll == value) return;
|
||||
_showAll = value;
|
||||
_ui.GetUIController<SandboxUIController>().SetToggleSubfloors(value);
|
||||
|
||||
UpdateAll();
|
||||
var ev = new ShowSubfloorRequestEvent()
|
||||
{
|
||||
Value = value,
|
||||
};
|
||||
RaiseNetworkEvent(ev);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +36,20 @@ public sealed class SubFloorHideSystem : SharedSubFloorHideSystem
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<SubFloorHideComponent, AppearanceChangeEvent>(OnAppearanceChanged);
|
||||
SubscribeNetworkEvent<ShowSubfloorRequestEvent>(OnRequestReceived);
|
||||
SubscribeLocalEvent<LocalPlayerDetachedEvent>(OnPlayerDetached);
|
||||
}
|
||||
|
||||
private void OnPlayerDetached(LocalPlayerDetachedEvent ev)
|
||||
{
|
||||
// Vismask resets so need to reset this.
|
||||
ShowAll = false;
|
||||
}
|
||||
|
||||
private void OnRequestReceived(ShowSubfloorRequestEvent ev)
|
||||
{
|
||||
// When client receives request Queue an update on all vis.
|
||||
UpdateAll();
|
||||
}
|
||||
|
||||
private void OnAppearanceChanged(EntityUid uid, SubFloorHideComponent component, ref AppearanceChangeEvent args)
|
||||
|
||||
Reference in New Issue
Block a user