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;
+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;
[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;
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);
}
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);
}