Tweak for the visual coverage granted to station AIs by holopads (#38059)

* Initial commit

* Added option to require anchoring
This commit is contained in:
chromiumboy
2025-06-05 18:15:55 -05:00
committed by GitHub
parent ff4861b7b4
commit ea1ecad3ff
3 changed files with 38 additions and 2 deletions

View File

@@ -3,17 +3,38 @@ using Robust.Shared.GameStates;
namespace Content.Shared.StationAi;
/// <summary>
/// Attached to entities that grant vision to the station AI, such as cameras.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, Access(typeof(SharedStationAiSystem))]
public sealed partial class StationAiVisionComponent : Component
{
/// <summary>
/// Determines whether the entity is actively providing vision to the station AI.
/// </summary>
[DataField, AutoNetworkedField]
public bool Enabled = true;
/// <summary>
/// Determines whether the entity's vision is blocked by walls.
/// </summary>
[DataField, AutoNetworkedField]
public bool Occluded = true;
/// <summary>
/// Range in tiles
/// Determines whether the entity needs to be receiving power to provide vision to the station AI.
/// </summary>
[DataField, AutoNetworkedField]
public bool NeedsPower = false;
/// <summary>
/// Determines whether the entity needs to be anchored to provide vision to the station AI.
/// </summary>
[DataField, AutoNetworkedField]
public bool NeedsAnchoring = false;
/// <summary>
/// Vision range in tiles.
/// </summary>
[DataField, AutoNetworkedField]
public float Range = 7.5f;

View File

@@ -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);
}

View File

@@ -17,6 +17,8 @@
- type: ApcPowerReceiver
powerLoad: 300
- type: StationAiVision
range: 1
needsAnchoring: true
- type: Sprite
sprite: Structures/Machines/holopad.rsi
drawdepth: HighFloorObjects