Convert "IgnoreWeatherComponent" into "BlockWeatherComponent" (#26135)

* ignore

* doc
This commit is contained in:
Ed
2024-03-16 01:36:09 +03:00
committed by GitHub
parent 3425444c53
commit 4aa72af574
10 changed files with 12 additions and 11 deletions

View File

@@ -19,13 +19,13 @@ public abstract class SharedWeatherSystem : EntitySystem
[Dependency] private readonly MetaDataSystem _metadata = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
private EntityQuery<IgnoreWeatherComponent> _ignoreQuery;
private EntityQuery<BlockWeatherComponent> _blockQuery;
private EntityQuery<PhysicsComponent> _physicsQuery;
public override void Initialize()
{
base.Initialize();
_ignoreQuery = GetEntityQuery<IgnoreWeatherComponent>();
_blockQuery = GetEntityQuery<BlockWeatherComponent>();
_physicsQuery = GetEntityQuery<PhysicsComponent>();
SubscribeLocalEvent<WeatherComponent, EntityUnpausedEvent>(OnWeatherUnpaused);
}
@@ -57,13 +57,8 @@ public abstract class SharedWeatherSystem : EntitySystem
while (anchoredEnts.MoveNext(out var ent))
{
if (!_ignoreQuery.HasComponent(ent.Value) &&
_physicsQuery.TryGetComponent(ent, out var body) &&
body.Hard &&
body.CanCollide)
{
if (_blockQuery.HasComponent(ent.Value))
return false;
}
}
return true;