Horrendously makes PowerDevice connect to the closest Provider (#326)

* Somewhat decently makes PowerDevice connect to the closest Provider

* Fix NullRef on server shutdown

* Fix null reference

* piss

* revert bad fix
This commit is contained in:
DamianX
2019-09-06 10:05:17 +02:00
committed by Pieter-Jan Briers
parent 36078382e4
commit 0815050b2a
2 changed files with 24 additions and 0 deletions

View File

@@ -269,5 +269,13 @@ namespace Content.Server.GameObjects.Components.Power
device.Owner, Owner);
}
}
/// <summary>
/// Whether the device can be serviced by this provider.
/// </summary>
public bool CanServiceDevice(PowerDeviceComponent device)
{
return (device.Owner.Transform.WorldPosition - Owner.Transform.WorldPosition).LengthSquared <= _range;
}
}
}