diff --git a/Content.Client/Weather/WeatherOverlay.cs b/Content.Client/Weather/WeatherOverlay.cs index cfa745bf1e..1c5fe4230a 100644 --- a/Content.Client/Weather/WeatherOverlay.cs +++ b/Content.Client/Weather/WeatherOverlay.cs @@ -95,6 +95,7 @@ public sealed class WeatherOverlay : Overlay { var bodyQuery = _entManager.GetEntityQuery(); var xformQuery = _entManager.GetEntityQuery(); + var weatherIgnoreQuery = _entManager.GetEntityQuery(); foreach (var grid in _mapManager.FindGridsIntersecting(mapId, worldAABB)) { @@ -105,7 +106,7 @@ public sealed class WeatherOverlay : Overlay foreach (var tile in grid.GetTilesIntersecting(worldAABB)) { // Ignored tiles for stencil - if (_weather.CanWeatherAffect(grid, tile, bodyQuery)) + if (_weather.CanWeatherAffect(grid, tile, weatherIgnoreQuery, bodyQuery)) { continue; } diff --git a/Content.Client/Weather/WeatherSystem.cs b/Content.Client/Weather/WeatherSystem.cs index b94cad6253..54e53e1293 100644 --- a/Content.Client/Weather/WeatherSystem.cs +++ b/Content.Client/Weather/WeatherSystem.cs @@ -82,6 +82,7 @@ public sealed class WeatherSystem : SharedWeatherSystem // If we don't have a nearest node don't play any sound. EntityCoordinates? nearestNode = null; var bodyQuery = GetEntityQuery(); + var weatherIgnoreQuery = GetEntityQuery(); var visited = new HashSet(); while (frontier.TryDequeue(out var node)) @@ -89,7 +90,7 @@ public sealed class WeatherSystem : SharedWeatherSystem if (!visited.Add(node.GridIndices)) continue; - if (!CanWeatherAffect(grid, node, bodyQuery)) + if (!CanWeatherAffect(grid, node, weatherIgnoreQuery, bodyQuery)) { // Add neighbors // TODO: Ideally we pick some deterministically random direction and use that diff --git a/Content.Shared/Weather/IgnoreWeatherComponent.cs b/Content.Shared/Weather/IgnoreWeatherComponent.cs new file mode 100644 index 0000000000..d3660f4b4d --- /dev/null +++ b/Content.Shared/Weather/IgnoreWeatherComponent.cs @@ -0,0 +1,12 @@ +using Robust.Shared.GameStates; + +namespace Content.Shared.Weather; + +/// +/// This entity will be ignored for considering weather on a tile +/// +[RegisterComponent, NetworkedComponent] +public sealed class IgnoreWeatherComponent : Component +{ + +} diff --git a/Content.Shared/Weather/SharedWeatherSystem.cs b/Content.Shared/Weather/SharedWeatherSystem.cs index d0985961b5..3aba97e92d 100644 --- a/Content.Shared/Weather/SharedWeatherSystem.cs +++ b/Content.Shared/Weather/SharedWeatherSystem.cs @@ -36,7 +36,11 @@ public abstract class SharedWeatherSystem : EntitySystem } } - public bool CanWeatherAffect(MapGridComponent grid, TileRef tileRef, EntityQuery bodyQuery) + public bool CanWeatherAffect( + MapGridComponent grid, + TileRef tileRef, + EntityQuery weatherIgnoreQuery, + EntityQuery 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; } diff --git a/Resources/Prototypes/Entities/Objects/Decoration/flora.yml b/Resources/Prototypes/Entities/Objects/Decoration/flora.yml index 66b6d693e0..44652af955 100644 --- a/Resources/Prototypes/Entities/Objects/Decoration/flora.yml +++ b/Resources/Prototypes/Entities/Objects/Decoration/flora.yml @@ -37,6 +37,7 @@ description: Yep, it's a tree. abstract: true components: + - type: IgnoreWeather - type: SpriteFade - type: Clickable - type: Sprite