Skip to content

Commit

Permalink
Fix wrong system usage (#33679)
Browse files Browse the repository at this point in the history
Fix wrong system using
  • Loading branch information
MilenVolf authored Dec 1, 2024
1 parent 237324e commit d4067bc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Content.Shared/Random/Rules/NearbyTilesPercent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ public sealed partial class NearbyTilesPercentRule : RulesRule
[DataField]
public float Range = 10f;

private readonly SharedMapSystem _map;

public override bool Check(EntityManager entManager, EntityUid uid)
{
if (!entManager.TryGetComponent(uid, out TransformComponent? xform) ||
Expand All @@ -34,13 +32,14 @@ public override bool Check(EntityManager entManager, EntityUid uid)
}

var transform = entManager.System<SharedTransformSystem>();
var mapSys = entManager.System<SharedMapSystem>();
var tileDef = IoCManager.Resolve<ITileDefinitionManager>();

var physicsQuery = entManager.GetEntityQuery<PhysicsComponent>();
var tileCount = 0;
var matchingTileCount = 0;

foreach (var tile in _map.GetTilesIntersecting(xform.GridUid.Value, grid, new Circle(transform.GetWorldPosition(xform),
foreach (var tile in mapSys.GetTilesIntersecting(xform.GridUid.Value, grid, new Circle(transform.GetWorldPosition(xform),
Range)))
{
// Only consider collidable anchored (for reasons some subfloor stuff has physics but non-collidable)
Expand Down

0 comments on commit d4067bc

Please sign in to comment.