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

@@ -3,10 +3,10 @@ using Robust.Shared.GameStates;
namespace Content.Shared.Weather; namespace Content.Shared.Weather;
/// <summary> /// <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> /// </summary>
[RegisterComponent, NetworkedComponent] [RegisterComponent, NetworkedComponent]
public sealed partial class IgnoreWeatherComponent : Component public sealed partial class BlockWeatherComponent : Component
{ {
} }

View File

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

View File

@@ -38,7 +38,6 @@
description: Yep, it's a tree. description: Yep, it's a tree.
abstract: true abstract: true
components: components:
- type: IgnoreWeather
- type: SpriteFade - type: SpriteFade
- type: Clickable - type: Clickable
- type: Sprite - type: Sprite

View File

@@ -147,6 +147,7 @@
- Airlock - Airlock
# This tag is used to nagivate the Airlock construction graph. It's needed because the construction graph is shared between Airlock, AirlockGlass, and HighSecDoor # This tag is used to nagivate the Airlock construction graph. It's needed because the construction graph is shared between Airlock, AirlockGlass, and HighSecDoor
- type: PryUnpowered - type: PryUnpowered
- type: BlockWeather
placement: placement:
mode: SnapgridCenter mode: SnapgridCenter

View File

@@ -56,6 +56,7 @@
key: walls key: walls
mode: NoSprite mode: NoSprite
- type: Occluder - type: Occluder
- type: BlockWeather
- type: entity - type: entity
parent: BaseMaterialDoor parent: BaseMaterialDoor

View File

@@ -64,6 +64,7 @@
- type: ContainerContainer - type: ContainerContainer
containers: containers:
battery-container: !type:Container battery-container: !type:Container
- type: BlockWeather
- type: entity - type: entity
id: BaseSecretDoorAssembly id: BaseSecretDoorAssembly

View File

@@ -97,6 +97,7 @@
messagePerceivedByOthers: comp-window-knock messagePerceivedByOthers: comp-window-knock
interactSuccessSound: interactSuccessSound:
path: /Audio/Effects/glass_knock.ogg path: /Audio/Effects/glass_knock.ogg
- type: BlockWeather
- type: entity - type: entity
id: ShuttersNormal id: ShuttersNormal

View File

@@ -68,3 +68,4 @@
- type: Construction - type: Construction
graph: Bookshelf graph: Bookshelf
node: bookshelf node: bookshelf
- type: BlockWeather

View File

@@ -49,6 +49,7 @@
price: 75 price: 75
- type: RadiationBlocker - type: RadiationBlocker
resistance: 2 resistance: 2
- type: BlockWeather
- type: entity - type: entity
parent: BaseWall parent: BaseWall

View File

@@ -88,6 +88,7 @@
sprite: Structures/Windows/cracks.rsi sprite: Structures/Windows/cracks.rsi
- type: StaticPrice - type: StaticPrice
price: 100 price: 100
- type: BlockWeather
- type: entity - type: entity
id: WindowDirectional id: WindowDirectional