From fdfbd74bcb697a7574ebc5ebef08f60c82a8479d Mon Sep 17 00:00:00 2001 From: deltanedas <39013340+deltanedas@users.noreply.github.com> Date: Thu, 19 Sep 2024 13:55:31 +0000 Subject: [PATCH] increase thieving beacon range to 2 (#31340) * increase thieving beacon range to 2 * add obstruction check * review * Entity strikes again * webedit ops because github died or something --------- Co-authored-by: deltanedas <@deltanedas:kde.org> --- .../Objectives/Systems/StealConditionSystem.cs | 16 ++++++++++++---- .../Entities/Objects/Tools/thief_beacon.yml | 1 + 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Content.Server/Objectives/Systems/StealConditionSystem.cs b/Content.Server/Objectives/Systems/StealConditionSystem.cs index e2d81e011c..48814e7ba3 100644 --- a/Content.Server/Objectives/Systems/StealConditionSystem.cs +++ b/Content.Server/Objectives/Systems/StealConditionSystem.cs @@ -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 _containerQuery; + private HashSet> _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(); - while (areasQuery.MoveNext(out var uid, out var area)) + var areasQuery = AllEntityQuery(); + 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(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); } } diff --git a/Resources/Prototypes/Entities/Objects/Tools/thief_beacon.yml b/Resources/Prototypes/Entities/Objects/Tools/thief_beacon.yml index 042b3fe517..f0f3737417 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/thief_beacon.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/thief_beacon.yml @@ -6,6 +6,7 @@ components: - type: ThiefBeacon - type: StealArea + range: 2 # Slightly larger than fulton beacon's random offset - type: Item size: Normal - type: Physics