Fix aspects (#500)

This commit is contained in:
Aviu00
2023-10-20 04:40:43 +09:00
committed by Aviu00
parent ecf3ecad81
commit e33472745f
7 changed files with 22 additions and 11 deletions

View File

@@ -37,7 +37,7 @@ public sealed class CatEarsAspect : AspectSystem<CatEarsAspectComponent>
private void HandleLateJoin(PlayerSpawnCompleteEvent ev) private void HandleLateJoin(PlayerSpawnCompleteEvent ev)
{ {
var query = EntityQueryEnumerator<RandomAppearanceAspectComponent, GameRuleComponent>(); var query = EntityQueryEnumerator<CatEarsAspectComponent, GameRuleComponent>();
while (query.MoveNext(out var ruleEntity, out _, out var gameRule)) while (query.MoveNext(out var ruleEntity, out _, out var gameRule))
{ {
if (!GameTicker.IsGameRuleAdded(ruleEntity, gameRule)) if (!GameTicker.IsGameRuleAdded(ruleEntity, gameRule))

View File

@@ -46,7 +46,7 @@ public sealed class SkeletonAspect : AspectSystem<SkeletonAspectComponent>
private void HandleLateJoin(PlayerSpawnCompleteEvent ev) private void HandleLateJoin(PlayerSpawnCompleteEvent ev)
{ {
var query = EntityQueryEnumerator<RandomAccentAspectComponent, GameRuleComponent>(); var query = EntityQueryEnumerator<SkeletonAspectComponent, GameRuleComponent>();
while (query.MoveNext(out var ruleEntity, out _, out var gameRule)) while (query.MoveNext(out var ruleEntity, out _, out var gameRule))
{ {
if (!GameTicker.IsGameRuleAdded(ruleEntity, gameRule)) if (!GameTicker.IsGameRuleAdded(ruleEntity, gameRule))

View File

@@ -3,12 +3,15 @@ using Content.Server.White.AspectsSystem.Aspects.Components;
using Content.Server.White.AspectsSystem.Base; using Content.Server.White.AspectsSystem.Base;
using Content.Server.White.Other; using Content.Server.White.Other;
using Content.Shared.Coordinates.Helpers; using Content.Shared.Coordinates.Helpers;
using Content.Shared.Tag;
using Robust.Shared.Map; using Robust.Shared.Map;
namespace Content.Server.White.AspectsSystem.Aspects; namespace Content.Server.White.AspectsSystem.Aspects;
public sealed class WindowLeakAspect : AspectSystem<WindowLeakAspectComponent> public sealed class WindowLeakAspect : AspectSystem<WindowLeakAspectComponent>
{ {
[Dependency] private readonly TagSystem _tag = default!;
protected override void Started(EntityUid uid, WindowLeakAspectComponent component, GameRuleComponent gameRule, protected override void Started(EntityUid uid, WindowLeakAspectComponent component, GameRuleComponent gameRule,
GameRuleStartedEvent args) GameRuleStartedEvent args)
{ {
@@ -16,23 +19,20 @@ public sealed class WindowLeakAspect : AspectSystem<WindowLeakAspectComponent>
HashSet<EntityCoordinates> coordinatesSet = new(); HashSet<EntityCoordinates> coordinatesSet = new();
var query = EntityQuery<WindowMarkComponent, TransformComponent>(); var query = EntityQueryEnumerator<WindowMarkComponent, TransformComponent>();
foreach (var (window, windowXform) in query) while (query.MoveNext(out var ent, out var window, out var windowXform))
{ {
var coords = windowXform.Coordinates; var coords = windowXform.Coordinates;
coordinatesSet.Add(coords); coordinatesSet.Add(coords);
var wall = EntityManager.SpawnEntity(window.ReplacementProto, coords.SnapToGrid(EntityManager)); EntityManager.DeleteEntity(ent);
EnsureComp<WallMarkComponent>(wall); EntityManager.SpawnEntity(window.ReplacementProto, coords.SnapToGrid(EntityManager));
} }
var xformQuery = EntityQueryEnumerator<TransformComponent>(); var xformQuery = EntityQueryEnumerator<TransformComponent>();
while (xformQuery.MoveNext(out var tileEnt, out var xform)) while (xformQuery.MoveNext(out var tileEnt, out var xform))
{ {
if (HasComp<WallMarkComponent>(tileEnt)) if (coordinatesSet.Contains(xform.Coordinates) && _tag.HasTag(tileEnt, "DeleteWithWindows"))
continue;
if (coordinatesSet.Contains(xform.Coordinates))
EntityManager.DeleteEntity(tileEnt); EntityManager.DeleteEntity(tileEnt);
} }
} }

View File

@@ -1,4 +1,4 @@
- type: entity - type: entity
id: HospitalCurtains id: HospitalCurtains
parent: BaseStructure parent: BaseStructure
name: curtains name: curtains
@@ -56,6 +56,9 @@
MaterialCloth1: MaterialCloth1:
min: 1 min: 1
max: 2 max: 2
- type: Tag
tags:
- DeleteWithWindows
placement: placement:
mode: SnapgridCenter mode: SnapgridCenter

View File

@@ -96,6 +96,9 @@
interactSuccessSound: interactSuccessSound:
path: /Audio/Effects/glass_knock.ogg path: /Audio/Effects/glass_knock.ogg
- type: ReflectAspectMark - type: ReflectAspectMark
- type: Tag
tags:
- DeleteWithWindows
- type: entity - type: entity
id: ShuttersNormal id: ShuttersNormal

View File

@@ -12,6 +12,7 @@
- type: Tag - type: Tag
tags: tags:
- RCDDeconstructWhitelist - RCDDeconstructWhitelist
- DeleteWithWindows
- type: CanBuildWindowOnTop - type: CanBuildWindowOnTop
- type: Sprite - type: Sprite
drawdepth: Walls drawdepth: Walls
@@ -103,6 +104,7 @@
- type: Tag - type: Tag
tags: tags:
- RCDDeconstructWhitelist - RCDDeconstructWhitelist
- DeleteWithWindows
- type: Construction - type: Construction
graph: Grille graph: Grille
node: grilleBroken node: grilleBroken

View File

@@ -36,3 +36,6 @@
- type: Tag - type: Tag
id: Plushie id: Plushie
- type: Tag
id: DeleteWithWindows