* Station AI overlay * implement * Bunch of ports * Fix a heap of bugs and basic scouting * helldivers * Shuffle interactions a bit * navmap stuff * Revert "navmap stuff" This reverts commit d1f89dd4be83233e22cf5dd062b2581f3c6da062. * AI wires implemented * Fix examines * Optimise the overlay significantly * Back to old static * BUI radial working * lots of work * Saving work * thanks fork * alright * pc * AI upload console * AI upload * stuff * Fix copy-paste shitcode * AI actions * navmap work * Fixes * first impressions * a * reh * Revert "navmap work" This reverts commit 6f63fea6e9245e189f368f97be3e32e9b210580e. # Conflicts: # Content.Client/Silicons/StationAi/StationAiOverlay.cs * OD * radar * weh * Fix examines * scoop mine eyes * fixes * reh * Optimise * Final round of optimisations * Fixes * fixes
81 lines
2.1 KiB
C#
81 lines
2.1 KiB
C#
using Content.Shared.Silicons.StationAi;
|
|
using Robust.Client.Graphics;
|
|
using Robust.Client.Player;
|
|
using Robust.Shared.Player;
|
|
|
|
namespace Content.Client.Silicons.StationAi;
|
|
|
|
public sealed partial class StationAiSystem : SharedStationAiSystem
|
|
{
|
|
[Dependency] private readonly IOverlayManager _overlayMgr = default!;
|
|
[Dependency] private readonly IPlayerManager _player = default!;
|
|
|
|
private StationAiOverlay? _overlay;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
InitializeAirlock();
|
|
InitializePowerToggle();
|
|
|
|
SubscribeLocalEvent<StationAiOverlayComponent, LocalPlayerAttachedEvent>(OnAiAttached);
|
|
SubscribeLocalEvent<StationAiOverlayComponent, LocalPlayerDetachedEvent>(OnAiDetached);
|
|
SubscribeLocalEvent<StationAiOverlayComponent, ComponentInit>(OnAiOverlayInit);
|
|
SubscribeLocalEvent<StationAiOverlayComponent, ComponentRemove>(OnAiOverlayRemove);
|
|
}
|
|
|
|
private void OnAiOverlayInit(Entity<StationAiOverlayComponent> ent, ref ComponentInit args)
|
|
{
|
|
var attachedEnt = _player.LocalEntity;
|
|
|
|
if (attachedEnt != ent.Owner)
|
|
return;
|
|
|
|
AddOverlay();
|
|
}
|
|
|
|
private void OnAiOverlayRemove(Entity<StationAiOverlayComponent> ent, ref ComponentRemove args)
|
|
{
|
|
var attachedEnt = _player.LocalEntity;
|
|
|
|
if (attachedEnt != ent.Owner)
|
|
return;
|
|
|
|
RemoveOverlay();
|
|
}
|
|
|
|
private void AddOverlay()
|
|
{
|
|
if (_overlay != null)
|
|
return;
|
|
|
|
_overlay = new StationAiOverlay();
|
|
_overlayMgr.AddOverlay(_overlay);
|
|
}
|
|
|
|
private void RemoveOverlay()
|
|
{
|
|
if (_overlay == null)
|
|
return;
|
|
|
|
_overlayMgr.RemoveOverlay(_overlay);
|
|
_overlay = null;
|
|
}
|
|
|
|
private void OnAiAttached(Entity<StationAiOverlayComponent> ent, ref LocalPlayerAttachedEvent args)
|
|
{
|
|
AddOverlay();
|
|
}
|
|
|
|
private void OnAiDetached(Entity<StationAiOverlayComponent> ent, ref LocalPlayerDetachedEvent args)
|
|
{
|
|
RemoveOverlay();
|
|
}
|
|
|
|
public override void Shutdown()
|
|
{
|
|
base.Shutdown();
|
|
_overlayMgr.RemoveOverlay<StationAiOverlay>();
|
|
}
|
|
}
|