From: chromiumboy <50505512+chromiumboy@users.noreply.github.com>
Date: Thu, 5 Jun 2025 23:15:55 +0000 (-0500)
Subject: Tweak for the visual coverage granted to station AIs by holopads (#38059)
X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=ea1ecad3ffae48a36068439186b7c07c6fec09e9;p=space-station-14.git
Tweak for the visual coverage granted to station AIs by holopads (#38059)
* Initial commit
* Added option to require anchoring
---
diff --git a/Content.Shared/Silicons/StationAi/StationAiVisionComponent.cs b/Content.Shared/Silicons/StationAi/StationAiVisionComponent.cs
index f047fe41e4..3c5f3896b0 100644
--- a/Content.Shared/Silicons/StationAi/StationAiVisionComponent.cs
+++ b/Content.Shared/Silicons/StationAi/StationAiVisionComponent.cs
@@ -3,17 +3,38 @@ using Robust.Shared.GameStates;
namespace Content.Shared.StationAi;
+///
+/// Attached to entities that grant vision to the station AI, such as cameras.
+///
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, Access(typeof(SharedStationAiSystem))]
public sealed partial class StationAiVisionComponent : Component
{
+ ///
+ /// Determines whether the entity is actively providing vision to the station AI.
+ ///
[DataField, AutoNetworkedField]
public bool Enabled = true;
+ ///
+ /// Determines whether the entity's vision is blocked by walls.
+ ///
[DataField, AutoNetworkedField]
public bool Occluded = true;
///
- /// Range in tiles
+ /// Determines whether the entity needs to be receiving power to provide vision to the station AI.
+ ///
+ [DataField, AutoNetworkedField]
+ public bool NeedsPower = false;
+
+ ///
+ /// Determines whether the entity needs to be anchored to provide vision to the station AI.
+ ///
+ [DataField, AutoNetworkedField]
+ public bool NeedsAnchoring = false;
+
+ ///
+ /// Vision range in tiles.
///
[DataField, AutoNetworkedField]
public float Range = 7.5f;
diff --git a/Content.Shared/Silicons/StationAi/StationAiVisionSystem.cs b/Content.Shared/Silicons/StationAi/StationAiVisionSystem.cs
index d3416949d5..7ae27da497 100644
--- a/Content.Shared/Silicons/StationAi/StationAiVisionSystem.cs
+++ b/Content.Shared/Silicons/StationAi/StationAiVisionSystem.cs
@@ -1,8 +1,8 @@
+using Content.Shared.Power.EntitySystems;
using Content.Shared.StationAi;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics;
using Robust.Shared.Threading;
-using Robust.Shared.Utility;
namespace Content.Shared.Silicons.StationAi;
@@ -18,6 +18,7 @@ public sealed class StationAiVisionSystem : EntitySystem
[Dependency] private readonly EntityLookupSystem _lookup = default!;
[Dependency] private readonly SharedMapSystem _maps = default!;
[Dependency] private readonly SharedTransformSystem _xforms = default!;
+ [Dependency] private readonly SharedPowerReceiverSystem _power = default!;
private SeedJob _seedJob;
private ViewJob _job;
@@ -83,6 +84,12 @@ public sealed class StationAiVisionSystem : EntitySystem
if (!seed.Comp.Enabled)
continue;
+ if (seed.Comp.NeedsPower && !_power.IsPowered(seed.Owner))
+ continue;
+
+ if (seed.Comp.NeedsAnchoring && !Transform(seed.Owner).Anchored)
+ continue;
+
_job.Data.Add(seed);
}
@@ -164,6 +171,12 @@ public sealed class StationAiVisionSystem : EntitySystem
if (!seed.Comp.Enabled)
continue;
+ if (seed.Comp.NeedsPower && !_power.IsPowered(seed.Owner))
+ continue;
+
+ if (seed.Comp.NeedsAnchoring && !Transform(seed.Owner).Anchored)
+ continue;
+
_job.Data.Add(seed);
}
diff --git a/Resources/Prototypes/Entities/Structures/Machines/holopad.yml b/Resources/Prototypes/Entities/Structures/Machines/holopad.yml
index 1a1712991a..95a1fba489 100644
--- a/Resources/Prototypes/Entities/Structures/Machines/holopad.yml
+++ b/Resources/Prototypes/Entities/Structures/Machines/holopad.yml
@@ -17,6 +17,8 @@
- type: ApcPowerReceiver
powerLoad: 300
- type: StationAiVision
+ range: 1
+ needsAnchoring: true
- type: Sprite
sprite: Structures/Machines/holopad.rsi
drawdepth: HighFloorObjects