Remove Explicit GridId References (#8315)

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
Acruid
2022-06-11 18:54:41 -07:00
committed by GitHub
parent 846321cebb
commit 4f9be42f40
131 changed files with 531 additions and 588 deletions

View File

@@ -18,7 +18,7 @@ namespace Content.Server.Gravity.EntitySystems
[Dependency] private readonly CameraRecoilSystem _cameraRecoil = default!;
private Dictionary<GridId, uint> _gridsToShake = new();
private Dictionary<EntityUid, uint> _gridsToShake = new();
private const float GravityKick = 100.0f;
private const uint ShakeTimes = 10;
@@ -44,7 +44,7 @@ namespace Content.Server.Gravity.EntitySystems
}
}
public void ShakeGrid(GridId gridId, GravityComponent comp)
public void ShakeGrid(EntityUid gridId, GravityComponent comp)
{
_gridsToShake[gridId] = ShakeTimes;
@@ -58,7 +58,7 @@ namespace Content.Server.Gravity.EntitySystems
{
// I have to copy this because C# doesn't allow changing collections while they're
// getting enumerated.
var gridsToShake = new Dictionary<GridId, uint>(_gridsToShake);
var gridsToShake = new Dictionary<EntityUid, uint>(_gridsToShake);
foreach (var gridId in _gridsToShake.Keys)
{
if (_gridsToShake[gridId] == 0)
@@ -73,12 +73,12 @@ namespace Content.Server.Gravity.EntitySystems
_gridsToShake = gridsToShake;
}
private void ShakeGrid(GridId gridId)
private void ShakeGrid(EntityUid gridId)
{
foreach (var player in _playerManager.Sessions)
{
if (player.AttachedEntity is not {Valid: true} attached
|| EntityManager.GetComponent<TransformComponent>(attached).GridID != gridId
|| EntityManager.GetComponent<TransformComponent>(attached).GridEntityId != gridId
|| !EntityManager.HasComponent<CameraRecoilComponent>(attached))
{
continue;