More miscellaneous compiler warning fixes (#18228)

This commit is contained in:
metalgearsloth
2023-07-23 16:03:57 +10:00
committed by GitHub
parent cfb827c99b
commit e755509fc7
12 changed files with 103 additions and 82 deletions

View File

@@ -1,6 +1,4 @@
using Content.Shared.StepTrigger.Components;
using Content.Shared.Tag;
using Robust.Shared.Collections;
using Robust.Shared.GameStates;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics;
@@ -74,26 +72,26 @@ public sealed class StepTriggerSystem : EntitySystem
foreach (var otherUid in component.Colliding)
{
UpdateColliding(component, transform, otherUid, query);
UpdateColliding(uid, component, transform, otherUid, query);
}
return false;
}
private void UpdateColliding(StepTriggerComponent component, TransformComponent ownerTransform, EntityUid otherUid, EntityQuery<PhysicsComponent> query)
private void UpdateColliding(EntityUid uid, StepTriggerComponent component, TransformComponent ownerTransform, EntityUid otherUid, EntityQuery<PhysicsComponent> query)
{
if (!query.TryGetComponent(otherUid, out var otherPhysics))
return;
// TODO: This shouldn't be calculating based on world AABBs.
var ourAabb = _entityLookup.GetWorldAABB(component.Owner, ownerTransform);
var ourAabb = _entityLookup.GetWorldAABB(uid, ownerTransform);
var otherAabb = _entityLookup.GetWorldAABB(otherUid);
if (!ourAabb.Intersects(otherAabb))
{
if (component.CurrentlySteppedOn.Remove(otherUid))
{
Dirty(component);
Dirty(uid, component);
}
return;
}
@@ -101,17 +99,16 @@ public sealed class StepTriggerSystem : EntitySystem
if (otherPhysics.LinearVelocity.Length() < component.RequiredTriggerSpeed
|| component.CurrentlySteppedOn.Contains(otherUid)
|| otherAabb.IntersectPercentage(ourAabb) < component.IntersectRatio
|| !CanTrigger(component.Owner, otherUid, component))
|| !CanTrigger(uid, otherUid, component))
{
return;
}
var ev = new StepTriggeredEvent { Source = component.Owner, Tripper = otherUid };
RaiseLocalEvent(component.Owner, ref ev, true);
var ev = new StepTriggeredEvent { Source = uid, Tripper = otherUid };
RaiseLocalEvent(uid, ref ev, true);
component.CurrentlySteppedOn.Add(otherUid);
Dirty(component);
return;
Dirty(uid, component);
}
private bool CanTrigger(EntityUid uid, EntityUid otherUid, StepTriggerComponent component)
@@ -140,7 +137,7 @@ public sealed class StepTriggerSystem : EntitySystem
if (component.Colliding.Add(otherUid))
{
Dirty(component);
Dirty(uid, component);
}
}
@@ -152,7 +149,7 @@ public sealed class StepTriggerSystem : EntitySystem
return;
component.CurrentlySteppedOn.Remove(otherUid);
Dirty(component);
Dirty(uid, component);
if (component.Colliding.Count == 0)
{
@@ -211,7 +208,7 @@ public sealed class StepTriggerSystem : EntitySystem
return;
component.IntersectRatio = ratio;
Dirty(component);
Dirty(uid, component);
}
public void SetRequiredTriggerSpeed(EntityUid uid, float speed, StepTriggerComponent? component = null)
@@ -223,7 +220,7 @@ public sealed class StepTriggerSystem : EntitySystem
return;
component.RequiredTriggerSpeed = speed;
Dirty(component);
Dirty(uid, component);
}
public void SetActive(EntityUid uid, bool active, StepTriggerComponent? component = null)
@@ -235,7 +232,7 @@ public sealed class StepTriggerSystem : EntitySystem
return;
component.Active = active;
Dirty(component);
Dirty(uid, component);
}
}