mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-02-15 01:15:13 +01:00
* Initial commit * Fixing merge conflict * Merge conflict fixed * Anchorable entities can now be marked as 'unanchorable' * Revert "Anchorable entities can now be marked as 'unanchorable'" This reverts commit 6a502e62a703cf06bd36ed3bdefe655fc074cfc5 This functionality will be made into a separate PR * Error sprite * Update AI core appearance with sustained damage, spawn scrap on destroyed * Added intellicard sprite * AI damage overlays * Added fixtures * AI core accent changes when damaged or low on power * Bug fix and pop up messages for inserting AIs into inoperable cores * Updated 'dead' sprite * Destroying the AI core reduces the number of AI job slots available * AI battery duration set to 10 minutes * Initial commit * Allow MMIs used in the construction of AI cores to take them over * Initial resources commit * Initial code commit * Sprite update * Bug fixes and updates * Basic console UI * Code refactor * Added lock screen * Added all outstanding UI features * Added purge sprites * Better appearance handling * Fixed issue with purge sprite * Finalized UI design * Major components finalized * Bit of clean up * Removed some code that was used for testing * Tweaked some text * Removed extra space * Added the circuitboard to the RD's locker * Addressed reviewer comments plus tweaks * Addressed reviewer comments plus tweaks * Removed instances of granular damage * Various improvements * Removed testing code * Fixed issue with disabled buttons * Finalized code * Addressed review comments * Added a spare Station AI core electronics to the research director's locker * Fixing build failure * Addressed review comments * Addressed review comments * Added reverse path for construction graph * Removed unneeded reference * Parts can be purchased through cargo * Fixing merge conflict * Merge conflict resolved * Fixing merge conflict * Code update * Code updates * Increased AI core health and gave it a sell price to fix test fail * Added screen static sprite * Added better support for ghosted AI players plus code tweaks * Various improvements and clean up * Increased purge duration to 60 seconds * Fixed needless complication * Addressed reviewer comments part 1 * Addressed reviewer comments part 2 * Further fixes * Trying lower battery values to see if it fixes the test fail * Adjusted power values again * Addressed review comments * Addressed review comments * Fixed test fail * Fixed bug with endless rebooting. Using rejuvenation on an AI core revives the AI inside. * Added pop up text * Bug fix * Tweaks and fixes * Fixed restoration console not updating when the AI finishes rebooting * Update SharedStationAiSystem.Held.cs --------- Co-authored-by: ScarKy0 <scarky0@onet.eu>
96 lines
2.9 KiB
C#
96 lines
2.9 KiB
C#
using Content.Shared.Silicons.StationAi;
|
|
using Robust.Client.GameObjects;
|
|
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!;
|
|
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
|
[Dependency] private readonly SpriteSystem _sprite = 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);
|
|
SubscribeLocalEvent<StationAiCoreComponent, AppearanceChangeEvent>(OnAppearanceChange);
|
|
}
|
|
|
|
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();
|
|
}
|
|
|
|
private void OnAppearanceChange(Entity<StationAiCoreComponent> entity, ref AppearanceChangeEvent args)
|
|
{
|
|
if (args.Sprite == null)
|
|
return;
|
|
|
|
if (_appearance.TryGetData<PrototypeLayerData>(entity.Owner, StationAiVisualLayers.Icon, out var layerData, args.Component))
|
|
_sprite.LayerSetData((entity.Owner, args.Sprite), StationAiVisualLayers.Icon, layerData);
|
|
|
|
_sprite.LayerSetVisible((entity.Owner, args.Sprite), StationAiVisualLayers.Icon, layerData != null);
|
|
}
|
|
|
|
public override void Shutdown()
|
|
{
|
|
base.Shutdown();
|
|
_overlayMgr.RemoveOverlay<StationAiOverlay>();
|
|
}
|
|
}
|