]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
increase thieving beacon range to 2 (#31340)
authordeltanedas <39013340+deltanedas@users.noreply.github.com>
Thu, 19 Sep 2024 13:55:31 +0000 (13:55 +0000)
committerGitHub <noreply@github.com>
Thu, 19 Sep 2024 13:55:31 +0000 (23:55 +1000)
* 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>
Content.Server/Objectives/Systems/StealConditionSystem.cs
Resources/Prototypes/Entities/Objects/Tools/thief_beacon.yml

index e2d81e011cf5e286291b4fb06e7db772c2cd6315..48814e7ba3c10f3aae33c5ee9ba96120aaf7f3e0 100644 (file)
@@ -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);
                 }
             }
index 042b3fe51735854f192f071570e70d1d54ad539b..f0f373741756daf69ca34562371bce0259e3db3a 100644 (file)
@@ -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