Convert "IgnoreWeatherComponent" into "BlockWeatherComponent" (#26135)
* ignore * doc
This commit is contained in:
@@ -3,10 +3,10 @@ using Robust.Shared.GameStates;
|
||||
namespace Content.Shared.Weather;
|
||||
|
||||
/// <summary>
|
||||
/// This entity will be ignored for considering weather on a tile
|
||||
/// This entity will block the weather if it's anchored to the floor.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed partial class IgnoreWeatherComponent : Component
|
||||
public sealed partial class BlockWeatherComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user