increase thieving beacon range to 2 (#31340)
* increase thieving beacon range to 2 * add obstruction check * review * Entity<T?> strikes again * webedit ops because github died or something --------- Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Content.Server.Objectives.Components;
|
||||
using Content.Server.Objectives.Components.Targets;
|
||||
using Content.Shared.CartridgeLoader;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Objectives.Components;
|
||||
using Content.Shared.Objectives.Systems;
|
||||
@@ -21,11 +22,14 @@ public sealed class StealConditionSystem : EntitySystem
|
||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||
[Dependency] private readonly MetaDataSystem _metaData = default!;
|
||||
[Dependency] private readonly MobStateSystem _mobState = default!;
|
||||
[Dependency] private readonly SharedInteractionSystem _interaction = default!;
|
||||
[Dependency] private readonly SharedObjectivesSystem _objectives = default!;
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
|
||||
private EntityQuery<ContainerManagerComponent> _containerQuery;
|
||||
|
||||
private HashSet<Entity<TransformComponent>> _nearestEnts = new();
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -103,15 +107,19 @@ public sealed class StealConditionSystem : EntitySystem
|
||||
//check stealAreas
|
||||
if (condition.CheckStealAreas)
|
||||
{
|
||||
var areasQuery = AllEntityQuery<StealAreaComponent>();
|
||||
while (areasQuery.MoveNext(out var uid, out var area))
|
||||
var areasQuery = AllEntityQuery<StealAreaComponent, TransformComponent>();
|
||||
while (areasQuery.MoveNext(out var uid, out var area, out var xform))
|
||||
{
|
||||
if (!area.Owners.Contains(mind.Owner))
|
||||
continue;
|
||||
|
||||
var nearestEnt = _lookup.GetEntitiesInRange(uid, area.Range);
|
||||
foreach (var ent in nearestEnt)
|
||||
_nearestEnts.Clear();
|
||||
_lookup.GetEntitiesInRange<TransformComponent>(xform.Coordinates, area.Range, _nearestEnts);
|
||||
foreach (var ent in _nearestEnts)
|
||||
{
|
||||
if (!_interaction.InRangeUnobstructed((uid, xform), (ent, ent.Comp), range: area.Range))
|
||||
continue;
|
||||
|
||||
CheckEntity(ent, condition, ref containerStack, ref count);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user