]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix ore silo clients showing up when out of range (#36741)
authorNemanja <98561806+EmoGarbage404@users.noreply.github.com>
Sun, 20 Apr 2025 01:00:23 +0000 (21:00 -0400)
committerGitHub <noreply@github.com>
Sun, 20 Apr 2025 01:00:23 +0000 (11:00 +1000)
Content.Server/Materials/OreSiloSystem.cs
Content.Shared/Materials/OreSilo/SharedOreSiloSystem.cs

index 87e6db16cf3d87e208c30dd1c56518142d2d6160..a0aab4fcae5222012243d659502e8addf142ae4a 100644 (file)
@@ -39,6 +39,10 @@ public sealed class OreSiloSystem : SharedOreSiloSystem
             if (client.Comp.Silo is not null)
                 continue;
 
+            // Don't show clients on the screen if we can't link them.
+            if (!CanTransmitMaterials((ent, ent, xform), client))
+                continue;
+
             var netEnt = GetNetEntity(client);
             var name = Identity.Name(client, EntityManager);
             var beacon = _navMap.GetNearestBeaconString(client.Owner, onlyName: true);
@@ -58,7 +62,7 @@ public sealed class OreSiloSystem : SharedOreSiloSystem
             var netEnt = GetNetEntity(client);
             var name = Identity.Name(client, EntityManager);
             var beacon = _navMap.GetNearestBeaconString(client, onlyName: true);
-            var inRange = CanTransmitMaterials((ent, ent), client);
+            var inRange = CanTransmitMaterials((ent, ent, xform), client);
 
             var txt = Loc.GetString("ore-silo-ui-itemlist-entry",
                 ("name", name),
index 729a71006510a04b3f2cf8c81424fc02c792bbd5..33168db1db334d0eb50e8f0c80db3440b7f230dc 100644 (file)
@@ -149,9 +149,9 @@ public abstract class SharedOreSiloSystem : EntitySystem
     /// Checks if a given client fulfills the criteria to link/receive materials from an ore silo.
     /// </summary>
     [PublicAPI]
-    public bool CanTransmitMaterials(Entity<OreSiloComponent?> silo, EntityUid client)
+    public bool CanTransmitMaterials(Entity<OreSiloComponent?, TransformComponent?> silo, EntityUid client)
     {
-        if (!Resolve(silo, ref silo.Comp))
+        if (!Resolve(silo, ref silo.Comp1, ref silo.Comp2))
             return false;
 
         if (!_powerReceiver.IsPowered(silo.Owner))
@@ -160,7 +160,7 @@ public abstract class SharedOreSiloSystem : EntitySystem
         if (_transform.GetGrid(client) != _transform.GetGrid(silo.Owner))
             return false;
 
-        if (!_transform.InRange(silo.Owner, client, silo.Comp.Range))
+        if (!_transform.InRange((silo.Owner, silo.Comp2), client, silo.Comp1.Range))
             return false;
 
         return true;