Fix weather blocking in some instances (#14561)
This commit is contained in:
12
Content.Shared/Weather/IgnoreWeatherComponent.cs
Normal file
12
Content.Shared/Weather/IgnoreWeatherComponent.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Weather;
|
||||
|
||||
/// <summary>
|
||||
/// This entity will be ignored for considering weather on a tile
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed class IgnoreWeatherComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
@@ -36,7 +36,11 @@ public abstract class SharedWeatherSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanWeatherAffect(MapGridComponent grid, TileRef tileRef, EntityQuery<PhysicsComponent> bodyQuery)
|
||||
public bool CanWeatherAffect(
|
||||
MapGridComponent grid,
|
||||
TileRef tileRef,
|
||||
EntityQuery<IgnoreWeatherComponent> weatherIgnoreQuery,
|
||||
EntityQuery<PhysicsComponent> bodyQuery)
|
||||
{
|
||||
if (tileRef.Tile.IsEmpty)
|
||||
return true;
|
||||
@@ -50,7 +54,10 @@ public abstract class SharedWeatherSystem : EntitySystem
|
||||
|
||||
while (anchoredEnts.MoveNext(out var ent))
|
||||
{
|
||||
if (bodyQuery.TryGetComponent(ent, out var body) && body.CanCollide)
|
||||
if (!weatherIgnoreQuery.HasComponent(ent.Value) &&
|
||||
bodyQuery.TryGetComponent(ent, out var body) &&
|
||||
body.Hard &&
|
||||
body.CanCollide)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user