diff --git a/Content.IntegrationTests/Tests/Destructible/DestructibleTests.cs b/Content.IntegrationTests/Tests/Destructible/DestructibleTests.cs index eb8cc0d241..31c5e1f470 100644 --- a/Content.IntegrationTests/Tests/Destructible/DestructibleTests.cs +++ b/Content.IntegrationTests/Tests/Destructible/DestructibleTests.cs @@ -20,9 +20,15 @@ namespace Content.IntegrationTests.Tests.Destructible [TestOf(typeof(Threshold))] public class DestructibleTests : ContentIntegrationTest { + private static readonly string SpawnedEntityId = "DestructibleTestsSpawnedEntity"; private static readonly string DestructibleEntityId = "DestructibleTestsDestructibleEntity"; + private static readonly string DestructibleDestructionEntityId = "DestructibleTestsDestructibleDestructionEntity"; private static readonly string Prototypes = $@" +- type: entity + id: {SpawnedEntityId} + name: {SpawnedEntityId} + - type: entity id: {DestructibleEntityId} name: {DestructibleEntityId} @@ -35,15 +41,35 @@ namespace Content.IntegrationTests.Tests.Destructible 50: triggersOnce: false behaviors: - - !type:DoActsBehavior - acts: [""Breakage""] - !type:PlaySoundBehavior sound: /Audio/Effects/woodhit.ogg - !type:SpawnEntitiesBehavior spawn: - WoodPlank: + {SpawnedEntityId}: min: 1 max: 1 + - !type:DoActsBehavior + acts: [""Breakage""] + - type: TestThresholdListener + +- type: entity + id: {DestructibleDestructionEntityId} + name: {DestructibleDestructionEntityId} + components: + - type: Damageable + - type: Destructible + thresholds: + 50: + behaviors: + - !type:PlaySoundBehavior + sound: /Audio/Effects/woodhit.ogg + - !type:SpawnEntitiesBehavior + spawn: + {SpawnedEntityId}: + min: 1 + max: 1 + - !type:DoActsBehavior # This must come last as it destroys the entity. + acts: [""Destruction""] - type: TestThresholdListener "; @@ -147,15 +173,15 @@ namespace Content.IntegrationTests.Tests.Destructible // Check that it matches the YAML prototype Assert.That(threshold.Behaviors, Has.Count.EqualTo(3)); - var actsThreshold = (DoActsBehavior) threshold.Behaviors[0]; - var soundThreshold = (PlaySoundBehavior) threshold.Behaviors[1]; - var spawnThreshold = (SpawnEntitiesBehavior) threshold.Behaviors[2]; + var soundThreshold = (PlaySoundBehavior) threshold.Behaviors[0]; + var spawnThreshold = (SpawnEntitiesBehavior) threshold.Behaviors[1]; + var actsThreshold = (DoActsBehavior) threshold.Behaviors[2]; Assert.That(actsThreshold.Acts, Is.EqualTo(ThresholdActs.Breakage)); Assert.That(soundThreshold.Sound, Is.EqualTo("/Audio/Effects/woodhit.ogg")); Assert.That(spawnThreshold.Spawn, Is.Not.Null); Assert.That(spawnThreshold.Spawn.Count, Is.EqualTo(1)); - Assert.That(spawnThreshold.Spawn.Single().Key, Is.EqualTo("WoodPlank")); + Assert.That(spawnThreshold.Spawn.Single().Key, Is.EqualTo(SpawnedEntityId)); Assert.That(spawnThreshold.Spawn.Single().Value.Min, Is.EqualTo(1)); Assert.That(spawnThreshold.Spawn.Single().Value.Max, Is.EqualTo(1)); Assert.That(threshold.Triggered, Is.True); @@ -202,16 +228,16 @@ namespace Content.IntegrationTests.Tests.Destructible // Check that it matches the YAML prototype Assert.That(threshold.Behaviors, Has.Count.EqualTo(3)); - actsThreshold = (DoActsBehavior) threshold.Behaviors[0]; - soundThreshold = (PlaySoundBehavior) threshold.Behaviors[1]; - spawnThreshold = (SpawnEntitiesBehavior) threshold.Behaviors[2]; + soundThreshold = (PlaySoundBehavior) threshold.Behaviors[0]; + spawnThreshold = (SpawnEntitiesBehavior) threshold.Behaviors[1]; + actsThreshold = (DoActsBehavior) threshold.Behaviors[2]; // Check that it matches the YAML prototype Assert.That(actsThreshold.Acts, Is.EqualTo(ThresholdActs.Breakage)); Assert.That(soundThreshold.Sound, Is.EqualTo("/Audio/Effects/woodhit.ogg")); Assert.That(spawnThreshold.Spawn, Is.Not.Null); Assert.That(spawnThreshold.Spawn.Count, Is.EqualTo(1)); - Assert.That(spawnThreshold.Spawn.Single().Key, Is.EqualTo("WoodPlank")); + Assert.That(spawnThreshold.Spawn.Single().Key, Is.EqualTo(SpawnedEntityId)); Assert.That(spawnThreshold.Spawn.Single().Value.Min, Is.EqualTo(1)); Assert.That(spawnThreshold.Spawn.Single().Value.Max, Is.EqualTo(1)); Assert.That(threshold.Triggered, Is.True); @@ -254,16 +280,16 @@ namespace Content.IntegrationTests.Tests.Destructible Assert.That(threshold.Behaviors, Has.Count.EqualTo(3)); - actsThreshold = (DoActsBehavior) threshold.Behaviors[0]; - soundThreshold = (PlaySoundBehavior) threshold.Behaviors[1]; - spawnThreshold = (SpawnEntitiesBehavior) threshold.Behaviors[2]; + soundThreshold = (PlaySoundBehavior) threshold.Behaviors[0]; + spawnThreshold = (SpawnEntitiesBehavior) threshold.Behaviors[1]; + actsThreshold = (DoActsBehavior) threshold.Behaviors[2]; // Check that it matches the YAML prototype Assert.That(actsThreshold.Acts, Is.EqualTo(ThresholdActs.Breakage)); Assert.That(soundThreshold.Sound, Is.EqualTo("/Audio/Effects/woodhit.ogg")); Assert.That(spawnThreshold.Spawn, Is.Not.Null); Assert.That(spawnThreshold.Spawn.Count, Is.EqualTo(1)); - Assert.That(spawnThreshold.Spawn.Single().Key, Is.EqualTo("WoodPlank")); + Assert.That(spawnThreshold.Spawn.Single().Key, Is.EqualTo(SpawnedEntityId)); Assert.That(spawnThreshold.Spawn.Single().Value.Min, Is.EqualTo(1)); Assert.That(spawnThreshold.Spawn.Single().Value.Max, Is.EqualTo(1)); Assert.That(threshold.Triggered, Is.True); @@ -305,5 +331,84 @@ namespace Content.IntegrationTests.Tests.Destructible Assert.That(sThresholdListenerComponent.ThresholdsReached, Is.Empty); }); } + + [Test] + public async Task DestructibleDestructionTest() + { + var server = StartServerDummyTicker(new ServerContentIntegrationOption + { + ExtraPrototypes = Prototypes, + ContentBeforeIoC = () => + { + IoCManager.Resolve().Register(); + } + }); + + await server.WaitIdleAsync(); + + var sEntityManager = server.ResolveDependency(); + var sMapManager = server.ResolveDependency(); + + IEntity sDestructibleEntity = null; + IDamageableComponent sDamageableComponent = null; + DestructibleComponent sDestructibleComponent = null; + TestThresholdListenerComponent sThresholdListenerComponent = null; + + await server.WaitPost(() => + { + var mapId = new MapId(1); + var coordinates = new MapCoordinates(0, 0, mapId); + sMapManager.CreateMap(mapId); + + sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleDestructionEntityId, coordinates); + sDamageableComponent = sDestructibleEntity.GetComponent(); + sDestructibleComponent = sDestructibleEntity.GetComponent(); + sThresholdListenerComponent = sDestructibleEntity.GetComponent(); + }); + + await server.WaitAssertion(() => + { + var coordinates = sDestructibleEntity.Transform.Coordinates; + + Assert.DoesNotThrow(() => + { + Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Brute, 50, true)); + }); + + Assert.That(sThresholdListenerComponent.ThresholdsReached.Count, Is.EqualTo(1)); + + var threshold = sThresholdListenerComponent.ThresholdsReached[0].Threshold; + + Assert.That(threshold.Triggered, Is.True); + Assert.That(threshold.Behaviors.Count, Is.EqualTo(3)); + + var spawnEntitiesBehavior = (SpawnEntitiesBehavior) threshold.Behaviors.Single(b => b is SpawnEntitiesBehavior); + + Assert.That(spawnEntitiesBehavior.Spawn.Count, Is.EqualTo(1)); + Assert.That(spawnEntitiesBehavior.Spawn.Keys.Single(), Is.EqualTo(SpawnedEntityId)); + Assert.That(spawnEntitiesBehavior.Spawn.Values.Single(), Is.EqualTo(new MinMax {Min = 1, Max = 1})); + + var entitiesInRange = sEntityManager.GetEntitiesInRange(coordinates, 2); + var found = false; + + foreach (var entity in entitiesInRange) + { + if (entity.Prototype == null) + { + continue; + } + + if (entity.Prototype.Name != SpawnedEntityId) + { + continue; + } + + found = true; + break; + } + + Assert.That(found, Is.True); + }); + } } } diff --git a/Content.Server/GameObjects/Components/Destructible/Thresholds/Behavior/IThresholdBehavior.cs b/Content.Server/GameObjects/Components/Destructible/Thresholds/Behavior/IThresholdBehavior.cs index d857d45bbd..d4a6e86e56 100644 --- a/Content.Server/GameObjects/Components/Destructible/Thresholds/Behavior/IThresholdBehavior.cs +++ b/Content.Server/GameObjects/Components/Destructible/Thresholds/Behavior/IThresholdBehavior.cs @@ -6,6 +6,14 @@ namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behavior { public interface IThresholdBehavior : IExposeData { + /// + /// Triggers this behavior. + /// + /// The entity that owns this behavior. + /// + /// An instance of to pull dependencies + /// and other systems from. + /// void Trigger(IEntity owner, DestructibleSystem system); } } diff --git a/Content.Server/GameObjects/Components/Destructible/Thresholds/Threshold.cs b/Content.Server/GameObjects/Components/Destructible/Thresholds/Threshold.cs index 72bce9159e..e0e402f5df 100644 --- a/Content.Server/GameObjects/Components/Destructible/Thresholds/Threshold.cs +++ b/Content.Server/GameObjects/Components/Destructible/Thresholds/Threshold.cs @@ -11,10 +11,12 @@ namespace Content.Server.GameObjects.Components.Destructible.Thresholds { public class Threshold : IExposeData { + private List _behaviors = new(); + /// /// Whether or not this threshold has already been triggered. /// - [ViewVariables] public bool Triggered; + [ViewVariables] public bool Triggered { get; private set; } /// /// Whether or not this threshold only triggers once. @@ -22,18 +24,18 @@ namespace Content.Server.GameObjects.Components.Destructible.Thresholds /// and then damaged to reach this threshold once again. /// It will not repeatedly trigger as damage rises beyond that. /// - [ViewVariables] public bool TriggersOnce; + [ViewVariables] public bool TriggersOnce { get; set; } /// /// Behaviors to activate once this threshold is triggered. /// - [ViewVariables] public List Behaviors = new(); + [ViewVariables] public IReadOnlyList Behaviors => _behaviors; public void ExposeData(ObjectSerializer serializer) { - serializer.DataField(ref Triggered, "triggered", false); - serializer.DataField(ref TriggersOnce, "triggersOnce", false); - serializer.DataField(ref Behaviors, "behaviors", new List()); + serializer.DataField(this, x => x.Triggered, "triggered", false); + serializer.DataField(this, x => x.TriggersOnce, "triggersOnce", false); + serializer.DataField(ref _behaviors, "behaviors", new List()); } /// @@ -50,6 +52,10 @@ namespace Content.Server.GameObjects.Components.Destructible.Thresholds foreach (var behavior in Behaviors) { + // The owner has been deleted. We stop execution of behaviors here. + if (owner.Deleted) + return; + behavior.Trigger(owner, system); } } diff --git a/Resources/Prototypes/Entities/Constructible/Furniture/bookshelf.yml b/Resources/Prototypes/Entities/Constructible/Furniture/bookshelf.yml index 713433842b..e151c5db20 100644 --- a/Resources/Prototypes/Entities/Constructible/Furniture/bookshelf.yml +++ b/Resources/Prototypes/Entities/Constructible/Furniture/bookshelf.yml @@ -25,8 +25,6 @@ thresholds: 30: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:PlaySoundBehavior sound: /Audio/Effects/woodhit.ogg - !type:SpawnEntitiesBehavior @@ -34,6 +32,9 @@ WoodPlank: min: 1 max: 1 + - !type:DoActsBehavior + acts: ["Destruction"] + - type: Occluder sizeX: 32 sizeY: 32 diff --git a/Resources/Prototypes/Entities/Constructible/Furniture/storage.yml b/Resources/Prototypes/Entities/Constructible/Furniture/storage.yml index 2a25501675..6d960128fa 100644 --- a/Resources/Prototypes/Entities/Constructible/Furniture/storage.yml +++ b/Resources/Prototypes/Entities/Constructible/Furniture/storage.yml @@ -33,8 +33,6 @@ thresholds: 30: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:PlaySoundBehavior sound: /Audio/Effects/metalbreak.ogg - !type:SpawnEntitiesBehavior @@ -42,6 +40,8 @@ SteelSheet1: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: entity id: Shelf @@ -78,8 +78,6 @@ thresholds: 30: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:PlaySoundBehavior sound: /Audio/Effects/metalbreak.ogg - !type:SpawnEntitiesBehavior @@ -87,3 +85,5 @@ SteelSheet1: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] diff --git a/Resources/Prototypes/Entities/Constructible/Furniture/tables.yml b/Resources/Prototypes/Entities/Constructible/Furniture/tables.yml index e003cd0813..1b279f4080 100644 --- a/Resources/Prototypes/Entities/Constructible/Furniture/tables.yml +++ b/Resources/Prototypes/Entities/Constructible/Furniture/tables.yml @@ -41,8 +41,6 @@ thresholds: 15: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:PlaySoundBehavior sound: /Audio/Effects/metalbreak.ogg - !type:SpawnEntitiesBehavior @@ -50,6 +48,8 @@ SteelSheet1: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: entity id: TableFrame @@ -67,8 +67,6 @@ thresholds: 1: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:PlaySoundBehavior sound: /Audio/Effects/metalbreak.ogg - !type:SpawnEntitiesBehavior @@ -76,6 +74,8 @@ SteelSheet1: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: Construction graph: Tables node: TableFrame @@ -96,8 +96,6 @@ thresholds: 1: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:PlaySoundBehavior sound: /Audio/Effects/metalbreak.ogg - !type:SpawnEntitiesBehavior @@ -105,6 +103,8 @@ SteelSheet1: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: entity id: TableMetal @@ -122,8 +122,6 @@ thresholds: 15: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:PlaySoundBehavior sound: /Audio/Effects/metalbreak.ogg - !type:SpawnEntitiesBehavior @@ -131,6 +129,8 @@ SteelSheet1: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: Construction graph: Tables node: MetalTable @@ -151,8 +151,6 @@ thresholds: 75: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:PlaySoundBehavior sound: /Audio/Effects/metalbreak.ogg - !type:SpawnEntitiesBehavior @@ -160,6 +158,8 @@ SteelSheet1: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: Construction graph: Tables node: ReinforcedTable @@ -180,8 +180,6 @@ thresholds: 5: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:PlaySoundBehavior sound: /Audio/Effects/glass_break2.ogg - !type:SpawnEntitiesBehavior @@ -189,6 +187,8 @@ ShardGlass: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: Construction graph: Tables node: GlassTable @@ -209,8 +209,6 @@ thresholds: 20: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:PlaySoundBehavior sound: /Audio/Effects/glass_break2.ogg - !type:SpawnEntitiesBehavior @@ -218,6 +216,8 @@ ShardGlass: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: Construction graph: Tables node: RGlassTable @@ -238,8 +238,6 @@ thresholds: 15: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:PlaySoundBehavior sound: /Audio/Effects/woodhit.ogg - !type:SpawnEntitiesBehavior @@ -247,6 +245,8 @@ WoodPlank: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: Construction graph: Tables node: WoodTable @@ -267,8 +267,6 @@ thresholds: 15: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:PlaySoundBehavior sound: /Audio/Effects/woodhit.ogg - !type:SpawnEntitiesBehavior @@ -276,6 +274,8 @@ WoodPlank: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: Construction graph: Tables node: PokerTable @@ -296,10 +296,10 @@ thresholds: 50: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:PlaySoundBehavior sound: /Audio/Effects/picaxe2.ogg + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: entity id: TableDebug diff --git a/Resources/Prototypes/Entities/Constructible/Power/wires.yml b/Resources/Prototypes/Entities/Constructible/Power/wires.yml index 398712c0e1..eb7698f2e9 100644 --- a/Resources/Prototypes/Entities/Constructible/Power/wires.yml +++ b/Resources/Prototypes/Entities/Constructible/Power/wires.yml @@ -55,13 +55,13 @@ thresholds: 100: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:SpawnEntitiesBehavior spawn: HVWireStack1: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: entity parent: WireBase @@ -92,13 +92,13 @@ thresholds: 100: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:SpawnEntitiesBehavior spawn: MVWireStack1: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: entity parent: WireBase @@ -131,10 +131,10 @@ thresholds: 100: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:SpawnEntitiesBehavior spawn: ApcExtensionCableStack1: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] diff --git a/Resources/Prototypes/Entities/Constructible/Specific/chem_master.yml b/Resources/Prototypes/Entities/Constructible/Specific/chem_master.yml index 056608284e..df75f399ba 100644 --- a/Resources/Prototypes/Entities/Constructible/Specific/chem_master.yml +++ b/Resources/Prototypes/Entities/Constructible/Specific/chem_master.yml @@ -37,13 +37,13 @@ thresholds: 50: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:SpawnEntitiesBehavior spawn: chem_master_broken: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: UserInterface interfaces: - key: enum.ChemMasterUiKey.Key @@ -86,13 +86,13 @@ thresholds: 25: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:SpawnEntitiesBehavior spawn: SteelSheet1: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: UserInterface interfaces: - key: enum.ChemMasterUiKey.Key diff --git a/Resources/Prototypes/Entities/Constructible/Walls/girder.yml b/Resources/Prototypes/Entities/Constructible/Walls/girder.yml index aafac7939d..8960980e53 100644 --- a/Resources/Prototypes/Entities/Constructible/Walls/girder.yml +++ b/Resources/Prototypes/Entities/Constructible/Walls/girder.yml @@ -32,13 +32,13 @@ thresholds: 50: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:SpawnEntitiesBehavior spawn: SteelSheet1: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: SnapGrid offset: Edge placement: diff --git a/Resources/Prototypes/Entities/Constructible/Walls/walls.yml b/Resources/Prototypes/Entities/Constructible/Walls/walls.yml index de9b9a5114..8f8b9cc644 100644 --- a/Resources/Prototypes/Entities/Constructible/Walls/walls.yml +++ b/Resources/Prototypes/Entities/Constructible/Walls/walls.yml @@ -50,13 +50,13 @@ thresholds: 300: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:SpawnEntitiesBehavior spawn: Girder: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: IconSmooth key: walls base: brick @@ -76,13 +76,13 @@ thresholds: 300: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:SpawnEntitiesBehavior spawn: Girder: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: IconSmooth key: walls base: clock @@ -102,13 +102,13 @@ thresholds: 300: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:SpawnEntitiesBehavior spawn: Girder: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: IconSmooth key: walls base: clown @@ -129,13 +129,13 @@ thresholds: 300: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:SpawnEntitiesBehavior spawn: Girder: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: IconSmooth key: walls base: cult @@ -155,13 +155,13 @@ thresholds: 300: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:SpawnEntitiesBehavior spawn: Girder: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: IconSmooth key: walls base: debug @@ -181,13 +181,13 @@ thresholds: 300: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:SpawnEntitiesBehavior spawn: Girder: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: IconSmooth key: walls base: diamond @@ -208,13 +208,13 @@ thresholds: 300: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:SpawnEntitiesBehavior spawn: Girder: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: IconSmooth key: walls base: gold @@ -234,13 +234,13 @@ thresholds: 300: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:SpawnEntitiesBehavior spawn: Girder: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: IconSmooth key: walls base: ice @@ -260,13 +260,13 @@ thresholds: 300: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:SpawnEntitiesBehavior spawn: Girder: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: IconSmooth key: walls base: metal @@ -286,13 +286,13 @@ thresholds: 300: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:SpawnEntitiesBehavior spawn: Girder: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: IconSmooth key: walls base: plasma @@ -312,13 +312,13 @@ thresholds: 300: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:SpawnEntitiesBehavior spawn: Girder: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: IconSmooth key: walls base: plastic @@ -371,13 +371,13 @@ thresholds: 1000: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:SpawnEntitiesBehavior spawn: Girder: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: IconSmooth key: walls base: riveted @@ -397,13 +397,13 @@ thresholds: 300: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:SpawnEntitiesBehavior spawn: Girder: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: IconSmooth key: walls base: sandstone @@ -423,13 +423,13 @@ thresholds: 300: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:SpawnEntitiesBehavior spawn: Girder: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: IconSmooth key: walls base: silver @@ -477,13 +477,13 @@ thresholds: 300: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:SpawnEntitiesBehavior spawn: Girder: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: IconSmooth key: walls base: uranium @@ -503,13 +503,13 @@ thresholds: 300: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:SpawnEntitiesBehavior spawn: Girder: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: IconSmooth key: walls base: wood diff --git a/Resources/Prototypes/Entities/Constructible/Walls/windows.yml b/Resources/Prototypes/Entities/Constructible/Walls/windows.yml index 865aff6339..8c75ec1e95 100644 --- a/Resources/Prototypes/Entities/Constructible/Walls/windows.yml +++ b/Resources/Prototypes/Entities/Constructible/Walls/windows.yml @@ -32,8 +32,6 @@ thresholds: 15: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:PlaySoundCollectionBehavior soundCollection: WindowBreak - !type:SpawnEntitiesBehavior @@ -41,6 +39,8 @@ ShardGlass: min: 1 max: 2 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: SnapGrid offset: Center - type: Airtight @@ -70,8 +70,6 @@ thresholds: 75: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:PlaySoundCollectionBehavior soundCollection: WindowBreak - !type:SpawnEntitiesBehavior @@ -79,6 +77,8 @@ ShardGlassReinforced: min: 1 max: 2 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: Window base: rwindow maxDamage: 75 @@ -102,8 +102,6 @@ thresholds: 100: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:PlaySoundCollectionBehavior soundCollection: WindowBreak - !type:SpawnEntitiesBehavior @@ -111,6 +109,8 @@ ShardGlassPhoron: min: 1 max: 2 + - !type:DoActsBehavior + acts: [ "Destruction" ] resistances: metallicResistances - type: Window base: pwindow diff --git a/Resources/Prototypes/Entities/Objects/Consumable/drinks.yml b/Resources/Prototypes/Entities/Objects/Consumable/drinks.yml index 5b9eaa4c92..b9f5ee51a8 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/drinks.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/drinks.yml @@ -29,8 +29,6 @@ thresholds: 5: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:PlaySoundCollectionBehavior soundCollection: WindowBreak - !type:SpawnEntitiesBehavior @@ -38,6 +36,8 @@ ShardGlass: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: DamageOnLand amount: 5 - type: DamageOtherOnHit diff --git a/Resources/Prototypes/Entities/Objects/Misc/fluff_lights.yml b/Resources/Prototypes/Entities/Objects/Misc/fluff_lights.yml index 54b10a78c9..f4c5420753 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/fluff_lights.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/fluff_lights.yml @@ -133,8 +133,6 @@ thresholds: 10: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:PlaySoundBehavior sound: /Audio/Effects/glass_break1.ogg - !type:SpawnEntitiesBehavior @@ -142,6 +140,8 @@ FloodlightBroken: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: Appearance visuals: - type: FlashLightVisualizer @@ -162,8 +162,6 @@ thresholds: 20: behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - !type:PlaySoundBehavior sound: /Audio/Effects/metalbreak.ogg - !type:SpawnEntitiesBehavior @@ -171,6 +169,8 @@ SteelSheet1: min: 1 max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: Physics shapes: - !type:PhysShapeAabb