Fix ore silo clients showing up when out of range (#36741)

This commit is contained in:
Nemanja
2025-04-19 21:00:23 -04:00
committed by GitHub
parent 5b3a72e9b5
commit f04f19a7aa
2 changed files with 8 additions and 4 deletions

View 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),

View 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;