Skip to content

Commit

Permalink
Moves get user world pos outside of the loop
Browse files Browse the repository at this point in the history
  • Loading branch information
keronshb committed Jan 23, 2025
1 parent 414e26e commit bbaaa4c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Content.Shared/RepulseAttract/RepulseAttractSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ private bool TryRepulseAttract(Entity<RepulseAttractComponent> ent)
caster = comp.User.Value;

var xForm = Transform(caster);
var userWorldPos = _xForm.GetWorldPosition(xForm);

var entsInRange = _lookup.GetEntitiesInRange(caster, comp.Range);

Expand All @@ -78,7 +79,6 @@ private bool TryRepulseAttract(Entity<RepulseAttractComponent> ent)
if (targetXForm.Anchored || HasComp<GhostComponent>(target))
continue;

var userWorldPos = _xForm.GetWorldPosition(xForm);
var targetWorldPos = _xForm.GetWorldPosition(target);

var direction = targetWorldPos - userWorldPos;
Expand Down

0 comments on commit bbaaa4c

Please sign in to comment.