Separate destructible component threshold into behaviors (#2818)

* WIP changes, add behaviors

* Fix behavior typing, namespace and test

* NO SPACES
This commit is contained in:
DrSmugleaf
2020-12-23 13:34:57 +01:00
committed by GitHub
parent ce029f461e
commit 764465f60c
57 changed files with 819 additions and 471 deletions

View File

@@ -2,6 +2,8 @@
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Content.Server.GameObjects.Components.Destructible; using Content.Server.GameObjects.Components.Destructible;
using Content.Server.GameObjects.Components.Destructible.Thresholds;
using Content.Server.GameObjects.Components.Destructible.Thresholds.Behavior;
using Content.Shared.Damage; using Content.Shared.Damage;
using Content.Shared.GameObjects.Components.Damage; using Content.Shared.GameObjects.Components.Damage;
using NUnit.Framework; using NUnit.Framework;
@@ -31,13 +33,17 @@ namespace Content.IntegrationTests.Tests.Destructible
20: 20:
triggersOnce: false triggersOnce: false
50: 50:
sound: /Audio/Effects/woodhit.ogg
spawn:
WoodPlank:
min: 1
max: 1
acts: [""Breakage""]
triggersOnce: false triggersOnce: false
behaviors:
- !type:DoActsBehavior
acts: [""Breakage""]
- !type:PlaySoundBehavior
sound: /Audio/Effects/woodhit.ogg
- !type:SpawnEntitiesBehavior
spawn:
WoodPlank:
min: 1
max: 1
- type: TestThresholdListener - type: TestThresholdListener
"; ";
@@ -77,7 +83,7 @@ namespace Content.IntegrationTests.Tests.Destructible
var sEntityManager = server.ResolveDependency<IEntityManager>(); var sEntityManager = server.ResolveDependency<IEntityManager>();
var sMapManager = server.ResolveDependency<IMapManager>(); var sMapManager = server.ResolveDependency<IMapManager>();
IEntity sDestructibleEntity = null; IEntity sDestructibleEntity;
IDamageableComponent sDamageableComponent = null; IDamageableComponent sDamageableComponent = null;
DestructibleComponent sDestructibleComponent = null; DestructibleComponent sDestructibleComponent = null;
TestThresholdListenerComponent sThresholdListenerComponent = null; TestThresholdListenerComponent sThresholdListenerComponent = null;
@@ -121,10 +127,7 @@ namespace Content.IntegrationTests.Tests.Destructible
var threshold = msg.Threshold; var threshold = msg.Threshold;
// Check that it matches the YAML prototype // Check that it matches the YAML prototype
Assert.That(threshold.Acts, Is.EqualTo(0)); Assert.That(threshold.Behaviors, Is.Empty);
Assert.That(threshold.Sound, Is.Null.Or.Empty);
Assert.That(threshold.Spawn, Is.Null);
Assert.That(threshold.SoundCollection, Is.Null.Or.Empty);
Assert.That(threshold.Triggered, Is.True); Assert.That(threshold.Triggered, Is.True);
sThresholdListenerComponent.ThresholdsReached.Clear(); sThresholdListenerComponent.ThresholdsReached.Clear();
@@ -142,14 +145,19 @@ namespace Content.IntegrationTests.Tests.Destructible
threshold = msg.Threshold; threshold = msg.Threshold;
// Check that it matches the YAML prototype // Check that it matches the YAML prototype
Assert.That(threshold.Acts, Is.EqualTo((int) ThresholdActs.Breakage)); Assert.That(threshold.Behaviors, Has.Count.EqualTo(3));
Assert.That(threshold.Sound, Is.EqualTo("/Audio/Effects/woodhit.ogg"));
Assert.That(threshold.Spawn, Is.Not.Null); var actsThreshold = (DoActsBehavior) threshold.Behaviors[0];
Assert.That(threshold.Spawn.Count, Is.EqualTo(1)); var soundThreshold = (PlaySoundBehavior) threshold.Behaviors[1];
Assert.That(threshold.Spawn.Single().Key, Is.EqualTo("WoodPlank")); var spawnThreshold = (SpawnEntitiesBehavior) threshold.Behaviors[2];
Assert.That(threshold.Spawn.Single().Value.Min, Is.EqualTo(1));
Assert.That(threshold.Spawn.Single().Value.Max, Is.EqualTo(1)); Assert.That(actsThreshold.Acts, Is.EqualTo(ThresholdActs.Breakage));
Assert.That(threshold.SoundCollection, Is.Null.Or.Empty); 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().Value.Min, Is.EqualTo(1));
Assert.That(spawnThreshold.Spawn.Single().Value.Max, Is.EqualTo(1));
Assert.That(threshold.Triggered, Is.True); Assert.That(threshold.Triggered, Is.True);
sThresholdListenerComponent.ThresholdsReached.Clear(); sThresholdListenerComponent.ThresholdsReached.Clear();
@@ -192,14 +200,20 @@ namespace Content.IntegrationTests.Tests.Destructible
threshold = msg.Threshold; threshold = msg.Threshold;
// Check that it matches the YAML prototype // Check that it matches the YAML prototype
Assert.That(threshold.Acts, Is.EqualTo((int) ThresholdActs.Breakage)); Assert.That(threshold.Behaviors, Has.Count.EqualTo(3));
Assert.That(threshold.Sound, Is.EqualTo("/Audio/Effects/woodhit.ogg"));
Assert.That(threshold.Spawn, Is.Not.Null); actsThreshold = (DoActsBehavior) threshold.Behaviors[0];
Assert.That(threshold.Spawn.Count, Is.EqualTo(1)); soundThreshold = (PlaySoundBehavior) threshold.Behaviors[1];
Assert.That(threshold.Spawn.Single().Key, Is.EqualTo("WoodPlank")); spawnThreshold = (SpawnEntitiesBehavior) threshold.Behaviors[2];
Assert.That(threshold.Spawn.Single().Value.Min, Is.EqualTo(1));
Assert.That(threshold.Spawn.Single().Value.Max, Is.EqualTo(1)); // Check that it matches the YAML prototype
Assert.That(threshold.SoundCollection, Is.Null.Or.Empty); 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().Value.Min, Is.EqualTo(1));
Assert.That(spawnThreshold.Spawn.Single().Value.Max, Is.EqualTo(1));
Assert.That(threshold.Triggered, Is.True); Assert.That(threshold.Triggered, Is.True);
// Reset thresholds reached // Reset thresholds reached
@@ -227,11 +241,7 @@ namespace Content.IntegrationTests.Tests.Destructible
threshold = msg.Threshold; threshold = msg.Threshold;
// Check that it matches the YAML prototype // Check that it matches the YAML prototype
Assert.That(threshold.Acts, Is.EqualTo(0)); Assert.That(threshold.Behaviors, Is.Empty);
Assert.That(threshold.Sound, Is.Null.Or.Empty);
Assert.That(threshold.Spawn, Is.Null);
Assert.That(threshold.SoundCollection, Is.Null.Or.Empty);
Assert.That(threshold.Triggered, Is.True);
// Verify the second one, should be the highest one (50) // Verify the second one, should be the highest one (50)
msg = sThresholdListenerComponent.ThresholdsReached[1]; msg = sThresholdListenerComponent.ThresholdsReached[1];
@@ -242,15 +252,20 @@ namespace Content.IntegrationTests.Tests.Destructible
threshold = msg.Threshold; threshold = msg.Threshold;
Assert.That(threshold.Behaviors, Has.Count.EqualTo(3));
actsThreshold = (DoActsBehavior) threshold.Behaviors[0];
soundThreshold = (PlaySoundBehavior) threshold.Behaviors[1];
spawnThreshold = (SpawnEntitiesBehavior) threshold.Behaviors[2];
// Check that it matches the YAML prototype // Check that it matches the YAML prototype
Assert.That(threshold.Acts, Is.EqualTo((int) ThresholdActs.Breakage)); Assert.That(actsThreshold.Acts, Is.EqualTo(ThresholdActs.Breakage));
Assert.That(threshold.Sound, Is.EqualTo("/Audio/Effects/woodhit.ogg")); Assert.That(soundThreshold.Sound, Is.EqualTo("/Audio/Effects/woodhit.ogg"));
Assert.That(threshold.Spawn, Is.Not.Null); Assert.That(spawnThreshold.Spawn, Is.Not.Null);
Assert.That(threshold.Spawn.Count, Is.EqualTo(1)); Assert.That(spawnThreshold.Spawn.Count, Is.EqualTo(1));
Assert.That(threshold.Spawn.Single().Key, Is.EqualTo("WoodPlank")); Assert.That(spawnThreshold.Spawn.Single().Key, Is.EqualTo("WoodPlank"));
Assert.That(threshold.Spawn.Single().Value.Min, Is.EqualTo(1)); Assert.That(spawnThreshold.Spawn.Single().Value.Min, Is.EqualTo(1));
Assert.That(threshold.Spawn.Single().Value.Max, Is.EqualTo(1)); Assert.That(spawnThreshold.Spawn.Single().Value.Max, Is.EqualTo(1));
Assert.That(threshold.SoundCollection, Is.Null.Or.Empty);
Assert.That(threshold.Triggered, Is.True); Assert.That(threshold.Triggered, Is.True);
// Reset thresholds reached // Reset thresholds reached

View File

@@ -1,4 +0,0 @@
namespace Content.Server.GameObjects.Components.Destructible
{
public sealed class ActsFlags { }
}

View File

@@ -1,12 +1,11 @@
#nullable enable #nullable enable
using System.Collections.Generic; using System.Collections.Generic;
using Content.Server.GameObjects.Components.Destructible.Thresholds;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Components.Damage; using Content.Shared.GameObjects.Components.Damage;
using Content.Shared.GameObjects.EntitySystems;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems; using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.IoC;
using Robust.Shared.Serialization; using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables; using Robust.Shared.ViewVariables;
@@ -19,9 +18,7 @@ namespace Content.Server.GameObjects.Components.Destructible
[RegisterComponent] [RegisterComponent]
public class DestructibleComponent : Component public class DestructibleComponent : Component
{ {
[Dependency] private readonly IRobustRandom _random = default!; private DestructibleSystem _destructibleSystem = default!;
private ActSystem _actSystem = default!;
public override string Name => "Destructible"; public override string Name => "Destructible";
@@ -47,7 +44,7 @@ namespace Content.Server.GameObjects.Components.Destructible
{ {
base.Initialize(); base.Initialize();
_actSystem = EntitySystem.Get<ActSystem>(); _destructibleSystem = EntitySystem.Get<DestructibleSystem>();
} }
public override void HandleMessage(ComponentMessage message, IComponent? component) public override void HandleMessage(ComponentMessage message, IComponent? component)
@@ -83,7 +80,7 @@ namespace Content.Server.GameObjects.Components.Destructible
var thresholdMessage = new DestructibleThresholdReachedMessage(this, threshold, msg.Damageable.TotalDamage, damage); var thresholdMessage = new DestructibleThresholdReachedMessage(this, threshold, msg.Damageable.TotalDamage, damage);
SendMessage(thresholdMessage); SendMessage(thresholdMessage);
threshold.Trigger(Owner, _random, _actSystem); threshold.Trigger(Owner, _destructibleSystem);
} }
} }

View File

@@ -1,4 +1,5 @@
using Robust.Shared.GameObjects; using Content.Server.GameObjects.Components.Destructible.Thresholds;
using Robust.Shared.GameObjects;
namespace Content.Server.GameObjects.Components.Destructible namespace Content.Server.GameObjects.Components.Destructible
{ {

View File

@@ -1,148 +0,0 @@
#nullable enable
using System.Collections.Generic;
using Content.Server.GameObjects.Components.Stack;
using Content.Shared.Audio;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Utility;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.Interfaces.Serialization;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Destructible
{
public class Threshold : IExposeData
{
/// <summary>
/// Entities spawned on reaching this threshold, from a min to a max.
/// </summary>
[ViewVariables] public Dictionary<string, MinMax>? Spawn;
/// <summary>
/// Sound played upon destruction.
/// </summary>
[ViewVariables] public string Sound = string.Empty;
/// <summary>
/// Used instead of <see cref="Sound"/> if specified.
/// </summary>
[ViewVariables] public string SoundCollection = string.Empty;
/// <summary>
/// What acts this threshold should trigger upon activation.
/// See <see cref="ActSystem"/>.
/// </summary>
[ViewVariables] public int Acts;
/// <summary>
/// Whether or not this threshold has already been triggered.
/// </summary>
[ViewVariables] public bool Triggered;
/// <summary>
/// Whether or not this threshold only triggers once.
/// If false, it will trigger again once the entity is healed
/// and then damaged to reach this threshold once again.
/// It will not repeatedly trigger as damage rises beyond that.
/// </summary>
[ViewVariables] public bool TriggersOnce;
public void ExposeData(ObjectSerializer serializer)
{
serializer.DataField(ref Spawn, "spawn", null);
serializer.DataField(ref Sound, "sound", string.Empty);
serializer.DataField(ref SoundCollection, "soundCollection", string.Empty);
serializer.DataField(ref Acts, "acts", 0, WithFormat.Flags<ActsFlags>());
serializer.DataField(ref Triggered, "triggered", false);
serializer.DataField(ref TriggersOnce, "triggersOnce", false);
}
/// <summary>
/// Triggers this threshold.
/// </summary>
/// <param name="owner">The entity that owns this threshold.</param>
/// <param name="random">
/// An instance of <see cref="IRobustRandom"/> to get randomness from, if relevant.
/// </param>
/// <param name="actSystem">
/// An instance of <see cref="ActSystem"/> to call acts on, if relevant.
/// </param>
public void Trigger(IEntity owner, IRobustRandom random, ActSystem actSystem)
{
Triggered = true;
PlaySound(owner);
DoSpawn(owner, random);
DoActs(owner, actSystem);
}
private void PlaySound(IEntity owner)
{
var pos = owner.Transform.Coordinates;
var actualSound = string.Empty;
if (SoundCollection != string.Empty)
{
actualSound = AudioHelpers.GetRandomFileFromSoundCollection(SoundCollection);
}
else if (Sound != string.Empty)
{
actualSound = Sound;
}
if (actualSound != string.Empty)
{
EntitySystem.Get<AudioSystem>().PlayAtCoords(actualSound, pos, AudioHelpers.WithVariation(0.125f));
}
}
private void DoSpawn(IEntity owner, IRobustRandom random)
{
if (Spawn == null)
{
return;
}
foreach (var (key, value) in Spawn)
{
var count = value.Min >= value.Max
? value.Min
: random.Next(value.Min, value.Max + 1);
if (count == 0) continue;
if (EntityPrototypeHelpers.HasComponent<StackComponent>(key))
{
var spawned = owner.EntityManager.SpawnEntity(key, owner.Transform.Coordinates);
var stack = spawned.GetComponent<StackComponent>();
stack.Count = count;
spawned.RandomOffset(0.5f);
}
else
{
for (var i = 0; i < count; i++)
{
var spawned = owner.EntityManager.SpawnEntity(key, owner.Transform.Coordinates);
spawned.RandomOffset(0.5f);
}
}
}
}
private void DoActs(IEntity owner, ActSystem acts)
{
if ((Acts & (int) ThresholdActs.Breakage) != 0)
{
acts.HandleBreakage(owner);
}
if ((Acts & (int) ThresholdActs.Destruction) != 0)
{
acts.HandleDestruction(owner);
}
}
}
}

View File

@@ -0,0 +1,4 @@
namespace Content.Server.GameObjects.Components.Destructible.Thresholds
{
public sealed class ActsFlags { }
}

View File

@@ -0,0 +1,45 @@
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects.EntitySystems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behavior
{
public class DoActsBehavior : IThresholdBehavior
{
private int _acts;
/// <summary>
/// What acts should be triggered upon activation.
/// See <see cref="ActSystem"/>.
/// </summary>
public ThresholdActs Acts
{
get => (ThresholdActs) _acts;
set => _acts = (int) value;
}
public void ExposeData(ObjectSerializer serializer)
{
serializer.DataField(ref _acts, "acts", 0, WithFormat.Flags<ActsFlags>());
}
public bool HasAct(ThresholdActs act)
{
return (_acts & (int) act) != 0;
}
public void Trigger(IEntity owner, DestructibleSystem system)
{
if (HasAct(ThresholdActs.Breakage))
{
system.ActSystem.HandleBreakage(owner);
}
if (HasAct(ThresholdActs.Destruction))
{
system.ActSystem.HandleDestruction(owner);
}
}
}
}

View File

@@ -0,0 +1,11 @@
using Content.Server.GameObjects.EntitySystems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Serialization;
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behavior
{
public interface IThresholdBehavior : IExposeData
{
void Trigger(IEntity owner, DestructibleSystem system);
}
}

View File

@@ -0,0 +1,32 @@
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.Audio;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behavior
{
public class PlaySoundBehavior : IThresholdBehavior
{
/// <summary>
/// Sound played upon destruction.
/// </summary>
public string Sound { get; set; }
public void ExposeData(ObjectSerializer serializer)
{
serializer.DataField(this, x => x.Sound, "sound", string.Empty);
}
public void Trigger(IEntity owner, DestructibleSystem system)
{
if (string.IsNullOrEmpty(Sound))
{
return;
}
var pos = owner.Transform.Coordinates;
system.AudioSystem.PlayAtCoords(Sound, pos, AudioHelpers.WithVariation(0.125f));
}
}
}

View File

@@ -0,0 +1,33 @@
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.Audio;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behavior
{
public class PlaySoundCollectionBehavior : IThresholdBehavior
{
/// <summary>
/// Sound collection from which to pick a random sound to play.
/// </summary>
private string SoundCollection { get; set; }
public void ExposeData(ObjectSerializer serializer)
{
serializer.DataField(this, x => x.SoundCollection, "soundCollection", string.Empty);
}
public void Trigger(IEntity owner, DestructibleSystem system)
{
if (string.IsNullOrEmpty(SoundCollection))
{
return;
}
var sound = AudioHelpers.GetRandomFileFromSoundCollection(SoundCollection);
var pos = owner.Transform.Coordinates;
system.AudioSystem.PlayAtCoords(sound, pos, AudioHelpers.WithVariation(0.125f));
}
}
}

View File

@@ -0,0 +1,51 @@
#nullable enable
using System.Collections.Generic;
using Content.Server.GameObjects.Components.Stack;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.Utility;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behavior
{
public class SpawnEntitiesBehavior : IThresholdBehavior
{
/// <summary>
/// Entities spawned on reaching this threshold, from a min to a max.
/// </summary>
public Dictionary<string, MinMax> Spawn { get; set; } = new();
public void ExposeData(ObjectSerializer serializer)
{
serializer.DataField(this, x => x.Spawn, "spawn", new Dictionary<string, MinMax>());
}
public void Trigger(IEntity owner, DestructibleSystem system)
{
foreach (var (entityId, minMax) in Spawn)
{
var count = minMax.Min >= minMax.Max
? minMax.Min
: system.Random.Next(minMax.Min, minMax.Max + 1);
if (count == 0) continue;
if (EntityPrototypeHelpers.HasComponent<StackComponent>(entityId))
{
var spawned = owner.EntityManager.SpawnEntity(entityId, owner.Transform.Coordinates);
var stack = spawned.GetComponent<StackComponent>();
stack.Count = count;
spawned.RandomOffset(0.5f);
}
else
{
for (var i = 0; i < count; i++)
{
var spawned = owner.EntityManager.SpawnEntity(entityId, owner.Transform.Coordinates);
spawned.RandomOffset(0.5f);
}
}
}
}
}
}

View File

@@ -2,7 +2,7 @@
using Robust.Shared.Serialization; using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables; using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Destructible namespace Content.Server.GameObjects.Components.Destructible.Thresholds
{ {
public struct MinMax : IExposeData public struct MinMax : IExposeData
{ {

View File

@@ -0,0 +1,57 @@
#nullable enable
using System.Collections.Generic;
using Content.Server.GameObjects.Components.Destructible.Thresholds.Behavior;
using Content.Server.GameObjects.EntitySystems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Serialization;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Destructible.Thresholds
{
public class Threshold : IExposeData
{
/// <summary>
/// Whether or not this threshold has already been triggered.
/// </summary>
[ViewVariables] public bool Triggered;
/// <summary>
/// Whether or not this threshold only triggers once.
/// If false, it will trigger again once the entity is healed
/// and then damaged to reach this threshold once again.
/// It will not repeatedly trigger as damage rises beyond that.
/// </summary>
[ViewVariables] public bool TriggersOnce;
/// <summary>
/// Behaviors to activate once this threshold is triggered.
/// </summary>
[ViewVariables] public List<IThresholdBehavior> Behaviors = new();
public void ExposeData(ObjectSerializer serializer)
{
serializer.DataField(ref Triggered, "triggered", false);
serializer.DataField(ref TriggersOnce, "triggersOnce", false);
serializer.DataField(ref Behaviors, "behaviors", new List<IThresholdBehavior>());
}
/// <summary>
/// Triggers this threshold.
/// </summary>
/// <param name="owner">The entity that owns this threshold.</param>
/// <param name="system">
/// An instance of <see cref="DestructibleSystem"/> to get dependency and
/// system references from, if relevant.
/// </param>
public void Trigger(IEntity owner, DestructibleSystem system)
{
Triggered = true;
foreach (var behavior in Behaviors)
{
behavior.Trigger(owner, system);
}
}
}
}

View File

@@ -1,13 +1,13 @@
using System; using System;
using Robust.Shared.Serialization; using Robust.Shared.Serialization;
namespace Content.Server.GameObjects.Components.Destructible namespace Content.Server.GameObjects.Components.Destructible.Thresholds
{ {
[Flags, FlagsFor(typeof(ActsFlags))] [Flags, FlagsFor(typeof(ActsFlags))]
[Serializable] [Serializable]
public enum ThresholdActs public enum ThresholdActs
{ {
Invalid = 0, None = 0,
Breakage, Breakage,
Destruction Destruction
} }

View File

@@ -0,0 +1,26 @@
using Content.Shared.GameObjects.EntitySystems;
using JetBrains.Annotations;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.IoC;
namespace Content.Server.GameObjects.EntitySystems
{
[UsedImplicitly]
public class DestructibleSystem : EntitySystem
{
[Dependency] public readonly IRobustRandom Random = default!;
public AudioSystem AudioSystem { get; private set; }
public ActSystem ActSystem { get; private set; }
public override void Initialize()
{
base.Initialize();
AudioSystem = Get<AudioSystem>();
ActSystem = Get<ActSystem>();
}
}
}

View File

@@ -61,7 +61,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
500: 500:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
placement: placement:
mode: SnapgridCenter mode: SnapgridCenter

View File

@@ -32,6 +32,8 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
75: 75:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
placement: placement:
mode: SnapgridCenter mode: SnapgridCenter

View File

@@ -24,12 +24,16 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
30: 30:
sound: /Audio/Effects/woodhit.ogg behaviors:
spawn: - !type:DoActsBehavior
WoodPlank: acts: ["Destruction"]
min: 1 - !type:PlaySoundBehavior
max: 1 sound: /Audio/Effects/woodhit.ogg
acts: ["Destruction"] - !type:SpawnEntitiesBehavior
spawn:
WoodPlank:
min: 1
max: 1
- type: Occluder - type: Occluder
sizeX: 32 sizeX: 32
sizeY: 32 sizeY: 32

View File

@@ -25,7 +25,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
50: 50:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: UserInterface - type: UserInterface
interfaces: interfaces:
- key: enum.InstrumentUiKey.Key - key: enum.InstrumentUiKey.Key

View File

@@ -16,7 +16,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
100: 100:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: ShuttleController - type: ShuttleController
- type: Strap - type: Strap
position: Stand position: Stand

View File

@@ -35,7 +35,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
50: 50:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: entity - type: entity
name: chair name: chair

View File

@@ -32,12 +32,16 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
30: 30:
sound: /Audio/Effects/metalbreak.ogg behaviors:
spawn: - !type:DoActsBehavior
SteelSheet1: acts: ["Destruction"]
min: 1 - !type:PlaySoundBehavior
max: 1 sound: /Audio/Effects/metalbreak.ogg
acts: ["Destruction"] - !type:SpawnEntitiesBehavior
spawn:
SteelSheet1:
min: 1
max: 1
- type: entity - type: entity
id: Shelf id: Shelf
@@ -73,9 +77,13 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
30: 30:
sound: /Audio/Effects/metalbreak.ogg behaviors:
spawn: - !type:DoActsBehavior
SteelSheet1: acts: ["Destruction"]
min: 1 - !type:PlaySoundBehavior
max: 1 sound: /Audio/Effects/metalbreak.ogg
acts: ["Destruction"] - !type:SpawnEntitiesBehavior
spawn:
SteelSheet1:
min: 1
max: 1

View File

@@ -40,12 +40,16 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
15: 15:
sound: /Audio/Effects/metalbreak.ogg behaviors:
spawn: - !type:DoActsBehavior
SteelSheet1: acts: ["Destruction"]
min: 1 - !type:PlaySoundBehavior
max: 1 sound: /Audio/Effects/metalbreak.ogg
acts: ["Destruction"] - !type:SpawnEntitiesBehavior
spawn:
SteelSheet1:
min: 1
max: 1
- type: entity - type: entity
id: TableFrame id: TableFrame
@@ -62,12 +66,16 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
1: 1:
sound: /Audio/Effects/metalbreak.ogg behaviors:
spawn: - !type:DoActsBehavior
SteelSheet1: acts: ["Destruction"]
min: 1 - !type:PlaySoundBehavior
max: 1 sound: /Audio/Effects/metalbreak.ogg
acts: ["Destruction"] - !type:SpawnEntitiesBehavior
spawn:
SteelSheet1:
min: 1
max: 1
- type: Construction - type: Construction
graph: Tables graph: Tables
node: TableFrame node: TableFrame
@@ -87,12 +95,16 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
1: 1:
sound: /Audio/Effects/metalbreak.ogg behaviors:
spawn: - !type:DoActsBehavior
SteelSheet1: acts: ["Destruction"]
min: 1 - !type:PlaySoundBehavior
max: 1 sound: /Audio/Effects/metalbreak.ogg
acts: ["Destruction"] - !type:SpawnEntitiesBehavior
spawn:
SteelSheet1:
min: 1
max: 1
- type: entity - type: entity
id: TableMetal id: TableMetal
@@ -109,12 +121,16 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
15: 15:
sound: /Audio/Effects/metalbreak.ogg behaviors:
spawn: - !type:DoActsBehavior
SteelSheet1: acts: ["Destruction"]
min: 1 - !type:PlaySoundBehavior
max: 1 sound: /Audio/Effects/metalbreak.ogg
acts: ["Destruction"] - !type:SpawnEntitiesBehavior
spawn:
SteelSheet1:
min: 1
max: 1
- type: Construction - type: Construction
graph: Tables graph: Tables
node: MetalTable node: MetalTable
@@ -134,12 +150,16 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
75: 75:
sound: /Audio/Effects/metalbreak.ogg behaviors:
spawn: - !type:DoActsBehavior
SteelSheet1: acts: ["Destruction"]
min: 1 - !type:PlaySoundBehavior
max: 1 sound: /Audio/Effects/metalbreak.ogg
acts: ["Destruction"] - !type:SpawnEntitiesBehavior
spawn:
SteelSheet1:
min: 1
max: 1
- type: Construction - type: Construction
graph: Tables graph: Tables
node: ReinforcedTable node: ReinforcedTable
@@ -159,12 +179,16 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
5: 5:
sound: /Audio/Effects/glass_break2.ogg behaviors:
spawn: - !type:DoActsBehavior
ShardGlass: acts: ["Destruction"]
min: 1 - !type:PlaySoundBehavior
max: 1 sound: /Audio/Effects/glass_break2.ogg
acts: ["Destruction"] - !type:SpawnEntitiesBehavior
spawn:
ShardGlass:
min: 1
max: 1
- type: Construction - type: Construction
graph: Tables graph: Tables
node: GlassTable node: GlassTable
@@ -184,12 +208,16 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
20: 20:
sound: /Audio/Effects/glass_break2.ogg behaviors:
spawn: - !type:DoActsBehavior
ShardGlass: acts: ["Destruction"]
min: 1 - !type:PlaySoundBehavior
max: 1 sound: /Audio/Effects/glass_break2.ogg
acts: ["Destruction"] - !type:SpawnEntitiesBehavior
spawn:
ShardGlass:
min: 1
max: 1
- type: Construction - type: Construction
graph: Tables graph: Tables
node: RGlassTable node: RGlassTable
@@ -209,12 +237,16 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
15: 15:
sound: /Audio/Effects/woodhit.ogg behaviors:
spawn: - !type:DoActsBehavior
WoodPlank: acts: ["Destruction"]
min: 1 - !type:PlaySoundBehavior
max: 1 sound: /Audio/Effects/woodhit.ogg
acts: ["Destruction"] - !type:SpawnEntitiesBehavior
spawn:
WoodPlank:
min: 1
max: 1
- type: Construction - type: Construction
graph: Tables graph: Tables
node: WoodTable node: WoodTable
@@ -234,12 +266,16 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
15: 15:
sound: /Audio/Effects/woodhit.ogg behaviors:
spawn: - !type:DoActsBehavior
WoodPlank: acts: ["Destruction"]
min: 1 - !type:PlaySoundBehavior
max: 1 sound: /Audio/Effects/woodhit.ogg
acts: ["Destruction"] - !type:SpawnEntitiesBehavior
spawn:
WoodPlank:
min: 1
max: 1
- type: Construction - type: Construction
graph: Tables graph: Tables
node: PokerTable node: PokerTable
@@ -259,8 +295,11 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
50: 50:
sound: /Audio/Effects/picaxe2.ogg behaviors:
acts: ["Destruction"] - !type:DoActsBehavior
acts: ["Destruction"]
- !type:PlaySoundBehavior
sound: /Audio/Effects/picaxe2.ogg
- type: entity - type: entity
id: TableDebug id: TableDebug
@@ -277,4 +316,6 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
1: 1:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]

View File

@@ -14,7 +14,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
100: 100:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: GasCanisterPort - type: GasCanisterPort
- type: entity - type: entity

View File

@@ -14,7 +14,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
100: 100:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: GasCanister - type: GasCanister
- type: Anchorable - type: Anchorable
- type: Pullable - type: Pullable

View File

@@ -24,5 +24,7 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
50: 50:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: KitchenSpike - type: KitchenSpike

View File

@@ -15,7 +15,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
100: 100:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: Sprite - type: Sprite
- type: Appearance - type: Appearance
visuals: visuals:

View File

@@ -14,7 +14,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
100: 100:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: Sprite - type: Sprite
sprite: Constructible/Atmos/pump.rsi sprite: Constructible/Atmos/pump.rsi
- type: Icon - type: Icon

View File

@@ -24,7 +24,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
100: 100:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: entity - type: entity
parent: ScrubberBase parent: ScrubberBase

View File

@@ -24,7 +24,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
100: 100:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: entity - type: entity
parent: VentBase parent: VentBase

View File

@@ -35,7 +35,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
100: 100:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: Appearance - type: Appearance
visuals: visuals:
- type: CloningPodVisualizer - type: CloningPodVisualizer

View File

@@ -99,7 +99,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
100: 100:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: BreakableConstruction - type: BreakableConstruction
node: monitorBroken node: monitorBroken
- type: Sprite - type: Sprite

View File

@@ -32,7 +32,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
100: 100:
acts: ["Breakage"] behaviors:
- !type:DoActsBehavior
acts: ["Breakage"]
- type: Anchorable - type: Anchorable
- type: entity - type: entity

View File

@@ -36,7 +36,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
100: 100:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: Appearance - type: Appearance
visuals: visuals:
- type: MedicalScannerVisualizer - type: MedicalScannerVisualizer

View File

@@ -239,6 +239,8 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
100: 100:
acts: ["Breakage"] behaviors:
- !type:DoActsBehavior
acts: ["Breakage"]
- type: Anchorable - type: Anchorable
- type: Pullable - type: Pullable

View File

@@ -33,7 +33,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
50: 50:
acts: ["Breakage"] behaviors:
- !type:DoActsBehavior
acts: ["Breakage"]
- type: UserInterface - type: UserInterface
interfaces: interfaces:
- key: enum.VendingMachineUiKey.Key - key: enum.VendingMachineUiKey.Key

View File

@@ -23,7 +23,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
100: 100:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: SubFloorHide - type: SubFloorHide
- type: entity - type: entity
@@ -52,11 +54,14 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
100: 100:
spawn: behaviors:
HVWireStack1: - !type:DoActsBehavior
min: 1 acts: ["Destruction"]
max: 1 - !type:SpawnEntitiesBehavior
acts: ["Destruction"] spawn:
HVWireStack1:
min: 1
max: 1
- type: entity - type: entity
parent: WireBase parent: WireBase
@@ -86,11 +91,14 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
100: 100:
spawn: behaviors:
MVWireStack1: - !type:DoActsBehavior
min: 1 acts: ["Destruction"]
max: 1 - !type:SpawnEntitiesBehavior
acts: ["Destruction"] spawn:
MVWireStack1:
min: 1
max: 1
- type: entity - type: entity
parent: WireBase parent: WireBase
@@ -122,8 +130,11 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
100: 100:
spawn: behaviors:
ApcExtensionCableStack1: - !type:DoActsBehavior
min: 1 acts: ["Destruction"]
max: 1 - !type:SpawnEntitiesBehavior
acts: ["Destruction"] spawn:
ApcExtensionCableStack1:
min: 1
max: 1

View File

@@ -26,7 +26,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
500: 500:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: SnapGrid - type: SnapGrid
offset: Center offset: Center
- type: Anchorable - type: Anchorable

View File

@@ -26,11 +26,14 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
500: 500:
spawn: behaviors:
AMEPart: - !type:SpawnEntitiesBehavior
min: 1 spawn:
max: 1 AMEPart:
acts: ["Destruction"] min: 1
max: 1
- !type:DoActsBehavior
acts: ["Destruction"]
- type: SnapGrid - type: SnapGrid
offset: Center offset: Center
- type: Airtight - type: Airtight

View File

@@ -22,7 +22,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
75: 75:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: Anchorable - type: Anchorable
- type: Pullable - type: Pullable
- type: PowerReceiver - type: PowerReceiver

View File

@@ -36,11 +36,14 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
50: 50:
spawn: behaviors:
chem_master_broken: - !type:DoActsBehavior
min: 1 acts: ["Destruction"]
max: 1 - !type:SpawnEntitiesBehavior
acts: ["Destruction"] spawn:
chem_master_broken:
min: 1
max: 1
- type: UserInterface - type: UserInterface
interfaces: interfaces:
- key: enum.ChemMasterUiKey.Key - key: enum.ChemMasterUiKey.Key
@@ -82,11 +85,14 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
25: 25:
spawn: behaviors:
SteelSheet1: - !type:DoActsBehavior
min: 1 acts: ["Destruction"]
max: 1 - !type:SpawnEntitiesBehavior
acts: ["Destruction"] spawn:
SteelSheet1:
min: 1
max: 1
- type: UserInterface - type: UserInterface
interfaces: interfaces:
- key: enum.ChemMasterUiKey.Key - key: enum.ChemMasterUiKey.Key

View File

@@ -18,7 +18,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
100: 100:
acts: ["Breakage"] behaviors:
- !type:DoActsBehavior
acts: ["Breakage"]
- type: Rotatable - type: Rotatable
- type: Pullable - type: Pullable
@@ -150,7 +152,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
100: 100:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: Appearance - type: Appearance
visuals: visuals:
- type: DisposalUnitVisualizer - type: DisposalUnitVisualizer
@@ -389,7 +393,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
100: 100:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: Appearance - type: Appearance
visuals: visuals:
- type: DisposalUnitVisualizer - type: DisposalUnitVisualizer

View File

@@ -34,7 +34,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
150: 150:
acts: ["Breakage"] behaviors:
- !type:DoActsBehavior
acts: ["Breakage"]
- type: GravityGenerator - type: GravityGenerator
- type: UserInterface - type: UserInterface
interfaces: interfaces:

View File

@@ -28,7 +28,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
50: 50:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: Sprite - type: Sprite
sprite: Constructible/Hydroponics/hydro_tools.rsi sprite: Constructible/Hydroponics/hydro_tools.rsi
state: soil state: soil

View File

@@ -43,7 +43,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
100: 100:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: Appearance - type: Appearance
visuals: visuals:
- type: StorageVisualizer - type: StorageVisualizer

View File

@@ -40,7 +40,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
100: 100:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: Appearance - type: Appearance
visuals: visuals:
- type: StorageVisualizer - type: StorageVisualizer

View File

@@ -28,7 +28,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
10: 10:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: SolutionContainer - type: SolutionContainer
maxVol: 1500 maxVol: 1500
caps: RemoveFrom caps: RemoveFrom

View File

@@ -19,7 +19,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
100: 100:
acts: [ "Destruction" ] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: Occluder - type: Occluder
sizeX: 32 sizeX: 32
sizeY: 32 sizeY: 32

View File

@@ -30,11 +30,14 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
50: 50:
spawn: behaviors:
SteelSheet1: - !type:DoActsBehavior
min: 1 acts: ["Destruction"]
max: 1 - !type:SpawnEntitiesBehavior
acts: ["Destruction"] spawn:
SteelSheet1:
min: 1
max: 1
- type: SnapGrid - type: SnapGrid
offset: Edge offset: Edge
placement: placement:

View File

@@ -41,7 +41,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
50: 50:
acts: [ "Destruction" ] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: entity - type: entity
name: small light name: small light
@@ -68,7 +70,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
25: 25:
acts: [ "Destruction" ] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: entity - type: entity
name: unpowered small light name: unpowered small light
@@ -87,4 +91,6 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
25: 25:
acts: [ "Destruction" ] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]

View File

@@ -30,7 +30,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
100: 100:
acts: [ "Destruction" ] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: BreakableConstruction - type: BreakableConstruction
node: start node: start
- type: SnapGrid - type: SnapGrid

View File

@@ -13,7 +13,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
5: 5:
acts: [ "Destruction" ] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: Sprite - type: Sprite
drawdepth: WallTops drawdepth: WallTops
sprite: Constructible/Misc/decals.rsi sprite: Constructible/Misc/decals.rsi

View File

@@ -49,11 +49,14 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
300: 300:
spawn: behaviors:
Girder: - !type:DoActsBehavior
min: 1 acts: ["Destruction"]
max: 1 - !type:SpawnEntitiesBehavior
acts: [ "Destruction" ] spawn:
Girder:
min: 1
max: 1
- type: IconSmooth - type: IconSmooth
key: walls key: walls
base: brick base: brick
@@ -72,11 +75,14 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
300: 300:
spawn: behaviors:
Girder: - !type:DoActsBehavior
min: 1 acts: ["Destruction"]
max: 1 - !type:SpawnEntitiesBehavior
acts: ["Destruction"] spawn:
Girder:
min: 1
max: 1
- type: IconSmooth - type: IconSmooth
key: walls key: walls
base: clock base: clock
@@ -95,11 +101,14 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
300: 300:
spawn: behaviors:
Girder: - !type:DoActsBehavior
min: 1 acts: ["Destruction"]
max: 1 - !type:SpawnEntitiesBehavior
acts: ["Destruction"] spawn:
Girder:
min: 1
max: 1
- type: IconSmooth - type: IconSmooth
key: walls key: walls
base: clown base: clown
@@ -119,11 +128,14 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
300: 300:
spawn: behaviors:
Girder: - !type:DoActsBehavior
min: 1 acts: ["Destruction"]
max: 1 - !type:SpawnEntitiesBehavior
acts: ["Destruction"] spawn:
Girder:
min: 1
max: 1
- type: IconSmooth - type: IconSmooth
key: walls key: walls
base: cult base: cult
@@ -142,11 +154,14 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
300: 300:
spawn: behaviors:
Girder: - !type:DoActsBehavior
min: 1 acts: ["Destruction"]
max: 1 - !type:SpawnEntitiesBehavior
acts: ["Destruction"] spawn:
Girder:
min: 1
max: 1
- type: IconSmooth - type: IconSmooth
key: walls key: walls
base: debug base: debug
@@ -165,11 +180,14 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
300: 300:
spawn: behaviors:
Girder: - !type:DoActsBehavior
min: 1 acts: ["Destruction"]
max: 1 - !type:SpawnEntitiesBehavior
acts: ["Destruction"] spawn:
Girder:
min: 1
max: 1
- type: IconSmooth - type: IconSmooth
key: walls key: walls
base: diamond base: diamond
@@ -189,11 +207,14 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
300: 300:
spawn: behaviors:
Girder: - !type:DoActsBehavior
min: 1 acts: ["Destruction"]
max: 1 - !type:SpawnEntitiesBehavior
acts: ["Destruction"] spawn:
Girder:
min: 1
max: 1
- type: IconSmooth - type: IconSmooth
key: walls key: walls
base: gold base: gold
@@ -212,11 +233,14 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
300: 300:
spawn: behaviors:
Girder: - !type:DoActsBehavior
min: 1 acts: ["Destruction"]
max: 1 - !type:SpawnEntitiesBehavior
acts: ["Destruction"] spawn:
Girder:
min: 1
max: 1
- type: IconSmooth - type: IconSmooth
key: walls key: walls
base: ice base: ice
@@ -235,11 +259,14 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
300: 300:
spawn: behaviors:
Girder: - !type:DoActsBehavior
min: 1 acts: ["Destruction"]
max: 1 - !type:SpawnEntitiesBehavior
acts: ["Destruction"] spawn:
Girder:
min: 1
max: 1
- type: IconSmooth - type: IconSmooth
key: walls key: walls
base: metal base: metal
@@ -258,11 +285,14 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
300: 300:
spawn: behaviors:
Girder: - !type:DoActsBehavior
min: 1 acts: ["Destruction"]
max: 1 - !type:SpawnEntitiesBehavior
acts: ["Destruction"] spawn:
Girder:
min: 1
max: 1
- type: IconSmooth - type: IconSmooth
key: walls key: walls
base: plasma base: plasma
@@ -281,11 +311,14 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
300: 300:
spawn: behaviors:
Girder: - !type:DoActsBehavior
min: 1 acts: ["Destruction"]
max: 1 - !type:SpawnEntitiesBehavior
acts: ["Destruction"] spawn:
Girder:
min: 1
max: 1
- type: IconSmooth - type: IconSmooth
key: walls key: walls
base: plastic base: plastic
@@ -309,7 +342,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
600: 600:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: BreakableConstruction - type: BreakableConstruction
node: girder node: girder
- type: ReinforcedWall - type: ReinforcedWall
@@ -335,11 +370,14 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
1000: 1000:
spawn: behaviors:
Girder: - !type:DoActsBehavior
min: 1 acts: ["Destruction"]
max: 1 - !type:SpawnEntitiesBehavior
acts: ["Destruction"] spawn:
Girder:
min: 1
max: 1
- type: IconSmooth - type: IconSmooth
key: walls key: walls
base: riveted base: riveted
@@ -358,11 +396,14 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
300: 300:
spawn: behaviors:
Girder: - !type:DoActsBehavior
min: 1 acts: ["Destruction"]
max: 1 - !type:SpawnEntitiesBehavior
acts: ["Destruction"] spawn:
Girder:
min: 1
max: 1
- type: IconSmooth - type: IconSmooth
key: walls key: walls
base: sandstone base: sandstone
@@ -381,11 +422,14 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
300: 300:
spawn: behaviors:
Girder: - !type:DoActsBehavior
min: 1 acts: ["Destruction"]
max: 1 - !type:SpawnEntitiesBehavior
acts: ["Destruction"] spawn:
Girder:
min: 1
max: 1
- type: IconSmooth - type: IconSmooth
key: walls key: walls
base: silver base: silver
@@ -408,7 +452,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
300: 300:
acts: [ "Destruction" ] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: BreakableConstruction - type: BreakableConstruction
node: girder node: girder
destroySound: /Audio/Effects/metalbreak.ogg destroySound: /Audio/Effects/metalbreak.ogg
@@ -430,11 +476,14 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
300: 300:
spawn: behaviors:
Girder: - !type:DoActsBehavior
min: 1 acts: ["Destruction"]
max: 1 - !type:SpawnEntitiesBehavior
acts: ["Destruction"] spawn:
Girder:
min: 1
max: 1
- type: IconSmooth - type: IconSmooth
key: walls key: walls
base: uranium base: uranium
@@ -453,11 +502,14 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
300: 300:
spawn: behaviors:
Girder: - !type:DoActsBehavior
min: 1 acts: ["Destruction"]
max: 1 - !type:SpawnEntitiesBehavior
acts: ["Destruction"] spawn:
Girder:
min: 1
max: 1
- type: IconSmooth - type: IconSmooth
key: walls key: walls
base: wood base: wood

View File

@@ -31,12 +31,16 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
15: 15:
soundCollection: WindowBreak behaviors:
spawn: - !type:DoActsBehavior
ShardGlass: acts: ["Destruction"]
min: 1 - !type:PlaySoundCollectionBehavior
max: 2 soundCollection: WindowBreak
acts: ["Destruction"] - !type:SpawnEntitiesBehavior
spawn:
ShardGlass:
min: 1
max: 2
- type: SnapGrid - type: SnapGrid
offset: Center offset: Center
- type: Airtight - type: Airtight
@@ -65,12 +69,16 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
75: 75:
soundCollection: WindowBreak behaviors:
spawn: - !type:DoActsBehavior
ShardGlassReinforced: acts: ["Destruction"]
min: 1 - !type:PlaySoundCollectionBehavior
max: 2 soundCollection: WindowBreak
acts: ["Destruction"] - !type:SpawnEntitiesBehavior
spawn:
ShardGlassReinforced:
min: 1
max: 2
- type: Window - type: Window
base: rwindow base: rwindow
maxDamage: 75 maxDamage: 75
@@ -93,12 +101,16 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
100: 100:
soundCollection: WindowBreak behaviors:
spawn: - !type:DoActsBehavior
ShardGlassPhoron: acts: ["Destruction"]
min: 1 - !type:PlaySoundCollectionBehavior
max: 2 soundCollection: WindowBreak
acts: ["Destruction"] - !type:SpawnEntitiesBehavior
spawn:
ShardGlassPhoron:
min: 1
max: 2
resistances: metallicResistances resistances: metallicResistances
- type: Window - type: Window
base: pwindow base: pwindow

View File

@@ -28,12 +28,16 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
5: 5:
acts: [ "Destruction" ] behaviors:
soundCollection: WindowBreak - !type:DoActsBehavior
spawn: acts: ["Destruction"]
ShardGlass: - !type:PlaySoundCollectionBehavior
min: 1 soundCollection: WindowBreak
max: 1 - !type:SpawnEntitiesBehavior
spawn:
ShardGlass:
min: 1
max: 1
- type: DamageOnLand - type: DamageOnLand
amount: 5 amount: 5
- type: DamageOtherOnHit - type: DamageOtherOnHit

View File

@@ -132,12 +132,16 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
10: 10:
sound: /Audio/Effects/glass_break1.ogg behaviors:
spawn: - !type:DoActsBehavior
FloodlightBroken: acts: ["Destruction"]
min: 1 - !type:PlaySoundBehavior
max: 1 sound: /Audio/Effects/glass_break1.ogg
acts: ["Destruction"] - !type:SpawnEntitiesBehavior
spawn:
FloodlightBroken:
min: 1
max: 1
- type: Appearance - type: Appearance
visuals: visuals:
- type: FlashLightVisualizer - type: FlashLightVisualizer
@@ -157,12 +161,16 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
20: 20:
spawn: behaviors:
SteelSheet1: - !type:DoActsBehavior
min: 1 acts: ["Destruction"]
max: 1 - !type:PlaySoundBehavior
sound: /Audio/Effects/metalbreak.ogg sound: /Audio/Effects/metalbreak.ogg
acts: ["Destruction"] - !type:SpawnEntitiesBehavior
spawn:
SteelSheet1:
min: 1
max: 1
- type: Physics - type: Physics
shapes: shapes:
- !type:PhysShapeAabb - !type:PhysShapeAabb

View File

@@ -26,7 +26,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
10: 10:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: Appearance - type: Appearance
visuals: visuals:
- type: TimerTriggerVisualizer - type: TimerTriggerVisualizer
@@ -56,7 +58,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
10: 10:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: Appearance - type: Appearance
visuals: visuals:
- type: TimerTriggerVisualizer - type: TimerTriggerVisualizer
@@ -86,7 +90,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
10: 10:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: Appearance - type: Appearance
visuals: visuals:
- type: TimerTriggerVisualizer - type: TimerTriggerVisualizer
@@ -115,7 +121,9 @@
- type: Destructible - type: Destructible
thresholds: thresholds:
50: 50:
acts: ["Destruction"] behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: Appearance - type: Appearance
visuals: visuals:
- type: TimerTriggerVisualizer - type: TimerTriggerVisualizer