Add destructible component threshold triggers (#3080)
* WIP changes * Fix tests, merge conflict and trigger once behavior * Update yml * Change test strings to be consts * Fix total damage types and classes triggers * Simplify damage trigger logic, move state to Threshold * Update outdated code and docs * Change the name of IBehavior back to IThresholdBehavior * Change human gibbing to trigger at 400 brute damage * Change gibbing from brute to blunt damage * Fix one (1) typo * Add damage class trigger test * Add missing nullable enable to thresholds
This commit is contained in:
@@ -0,0 +1,170 @@
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.GameObjects.Components.Destructible.Thresholds.Triggers;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.GameObjects.Components.Damage;
|
||||
using NUnit.Framework;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using static Content.IntegrationTests.Tests.Destructible.DestructibleTestPrototypes;
|
||||
|
||||
namespace Content.IntegrationTests.Tests.Destructible
|
||||
{
|
||||
[TestFixture]
|
||||
[TestOf(typeof(TotalDamageClassesTrigger))]
|
||||
public class DestructibleDamageClassTest : ContentIntegrationTest
|
||||
{
|
||||
[Test]
|
||||
public async Task Test()
|
||||
{
|
||||
var server = StartServerDummyTicker(new ServerContentIntegrationOption
|
||||
{
|
||||
ExtraPrototypes = Prototypes,
|
||||
ContentBeforeIoC = () =>
|
||||
{
|
||||
IoCManager.Resolve<IComponentFactory>().Register<TestThresholdListenerComponent>();
|
||||
}
|
||||
});
|
||||
|
||||
await server.WaitIdleAsync();
|
||||
|
||||
var sEntityManager = server.ResolveDependency<IEntityManager>();
|
||||
var sMapManager = server.ResolveDependency<IMapManager>();
|
||||
|
||||
IEntity sDestructibleEntity;
|
||||
IDamageableComponent sDamageableComponent = 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(DestructibleDamageClassEntityId, coordinates);
|
||||
sDamageableComponent = sDestructibleEntity.GetComponent<IDamageableComponent>();
|
||||
sThresholdListenerComponent = sDestructibleEntity.GetComponent<TestThresholdListenerComponent>();
|
||||
});
|
||||
|
||||
await server.WaitRunTicks(5);
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
|
||||
});
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
// Raise brute damage to 5
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Brute, 5, true));
|
||||
|
||||
// No thresholds reached yet, the earliest one is at 10 damage
|
||||
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
|
||||
|
||||
// Raise brute damage to 10
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Brute, 5, true));
|
||||
|
||||
// No threshold reached, burn needs to be 10 as well
|
||||
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
|
||||
|
||||
// Raise burn damage to 10
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Burn, 10, true));
|
||||
|
||||
// One threshold reached, brute 10 + burn 10
|
||||
Assert.That(sThresholdListenerComponent.ThresholdsReached.Count, Is.EqualTo(1));
|
||||
|
||||
// Threshold brute 10 + burn 10
|
||||
var msg = sThresholdListenerComponent.ThresholdsReached[0];
|
||||
var threshold = msg.Threshold;
|
||||
|
||||
// Check that it matches the YAML prototype
|
||||
Assert.That(threshold.Behaviors, Is.Empty);
|
||||
Assert.NotNull(threshold.Trigger);
|
||||
Assert.That(threshold.Triggered, Is.True);
|
||||
Assert.IsInstanceOf<TotalDamageClassesTrigger>(threshold.Trigger);
|
||||
|
||||
sThresholdListenerComponent.ThresholdsReached.Clear();
|
||||
|
||||
// Raise brute damage to 20
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Brute, 10, true));
|
||||
|
||||
// No new thresholds reached
|
||||
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
|
||||
|
||||
// Raise burn damage to 20
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Burn, 10, true));
|
||||
|
||||
// No new thresholds reached
|
||||
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
|
||||
|
||||
// Lower brute damage to 0
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Brute, -20, true));
|
||||
|
||||
// No new thresholds reached, healing should not trigger it
|
||||
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
|
||||
|
||||
// Raise brute damage back up to 10
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Brute, 10, true));
|
||||
|
||||
// 10 brute + 10 burn threshold reached, brute was healed and brought back to its threshold amount and slash stayed the same
|
||||
Assert.That(sThresholdListenerComponent.ThresholdsReached.Count, Is.EqualTo(1));
|
||||
|
||||
sThresholdListenerComponent.ThresholdsReached.Clear();
|
||||
|
||||
// Heal both classes of damage to 0
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Brute, -10, true));
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Burn, -20, true));
|
||||
|
||||
// No new thresholds reached, healing should not trigger it
|
||||
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
|
||||
|
||||
// Raise brute damage to 10
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Brute, 10, true));
|
||||
|
||||
// No new thresholds reached
|
||||
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
|
||||
|
||||
// Raise burn damage to 10
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Burn, 10, true));
|
||||
|
||||
// Both classes of damage were healed and then raised again, the threshold should have been reached as triggers once is default false
|
||||
Assert.That(sThresholdListenerComponent.ThresholdsReached.Count, Is.EqualTo(1));
|
||||
|
||||
// Threshold brute 10 + burn 10
|
||||
msg = sThresholdListenerComponent.ThresholdsReached[0];
|
||||
threshold = msg.Threshold;
|
||||
|
||||
// Check that it matches the YAML prototype
|
||||
Assert.That(threshold.Behaviors, Is.Empty);
|
||||
Assert.NotNull(threshold.Trigger);
|
||||
Assert.That(threshold.Triggered, Is.True);
|
||||
Assert.IsInstanceOf<TotalDamageClassesTrigger>(threshold.Trigger);
|
||||
|
||||
sThresholdListenerComponent.ThresholdsReached.Clear();
|
||||
|
||||
// Change triggers once to true
|
||||
threshold.TriggersOnce = true;
|
||||
|
||||
// Heal brute and burn back to 0
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Brute, -10, true));
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Burn, -10, true));
|
||||
|
||||
// No new thresholds reached from healing
|
||||
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
|
||||
|
||||
// Raise brute damage to 10
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Brute, 10, true));
|
||||
|
||||
// No new thresholds reached
|
||||
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
|
||||
|
||||
// Raise burn damage to 10
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Burn, 10, true));
|
||||
|
||||
// No new thresholds reached as triggers once is set to true and it already triggered before
|
||||
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.GameObjects.Components.Destructible.Thresholds.Triggers;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.GameObjects.Components.Damage;
|
||||
using NUnit.Framework;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using static Content.IntegrationTests.Tests.Destructible.DestructibleTestPrototypes;
|
||||
|
||||
namespace Content.IntegrationTests.Tests.Destructible
|
||||
{
|
||||
[TestFixture]
|
||||
[TestOf(typeof(TotalDamageTypesTrigger))]
|
||||
public class DestructibleDamageTypeTest : ContentIntegrationTest
|
||||
{
|
||||
[Test]
|
||||
public async Task Test()
|
||||
{
|
||||
var server = StartServerDummyTicker(new ServerContentIntegrationOption
|
||||
{
|
||||
ExtraPrototypes = Prototypes,
|
||||
ContentBeforeIoC = () =>
|
||||
{
|
||||
IoCManager.Resolve<IComponentFactory>().Register<TestThresholdListenerComponent>();
|
||||
}
|
||||
});
|
||||
|
||||
await server.WaitIdleAsync();
|
||||
|
||||
var sEntityManager = server.ResolveDependency<IEntityManager>();
|
||||
var sMapManager = server.ResolveDependency<IMapManager>();
|
||||
|
||||
IEntity sDestructibleEntity;
|
||||
IDamageableComponent sDamageableComponent = 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(DestructibleDamageTypeEntityId, coordinates);
|
||||
sDamageableComponent = sDestructibleEntity.GetComponent<IDamageableComponent>();
|
||||
sThresholdListenerComponent = sDestructibleEntity.GetComponent<TestThresholdListenerComponent>();
|
||||
});
|
||||
|
||||
await server.WaitRunTicks(5);
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
|
||||
});
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
// Raise blunt damage to 5
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Blunt, 5, true));
|
||||
|
||||
// No thresholds reached yet, the earliest one is at 10 damage
|
||||
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
|
||||
|
||||
// Raise blunt damage to 10
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Blunt, 5, true));
|
||||
|
||||
// No threshold reached, slash needs to be 10 as well
|
||||
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
|
||||
|
||||
// Raise slash damage to 10
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Slash, 10, true));
|
||||
|
||||
// One threshold reached, blunt 10 + slash 10
|
||||
Assert.That(sThresholdListenerComponent.ThresholdsReached.Count, Is.EqualTo(1));
|
||||
|
||||
// Threshold blunt 10 + slash 10
|
||||
var msg = sThresholdListenerComponent.ThresholdsReached[0];
|
||||
var threshold = msg.Threshold;
|
||||
|
||||
// Check that it matches the YAML prototype
|
||||
Assert.That(threshold.Behaviors, Is.Empty);
|
||||
Assert.NotNull(threshold.Trigger);
|
||||
Assert.That(threshold.Triggered, Is.True);
|
||||
Assert.IsInstanceOf<TotalDamageTypesTrigger>(threshold.Trigger);
|
||||
|
||||
sThresholdListenerComponent.ThresholdsReached.Clear();
|
||||
|
||||
// Raise blunt damage to 20
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Blunt, 10, true));
|
||||
|
||||
// No new thresholds reached
|
||||
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
|
||||
|
||||
// Raise slash damage to 20
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Slash, 10, true));
|
||||
|
||||
// No new thresholds reached
|
||||
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
|
||||
|
||||
// Lower blunt damage to 0
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Blunt, -20, true));
|
||||
|
||||
// No new thresholds reached, healing should not trigger it
|
||||
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
|
||||
|
||||
// Raise blunt damage back up to 10
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Blunt, 10, true));
|
||||
|
||||
// 10 blunt + 10 slash threshold reached, blunt was healed and brought back to its threshold amount and slash stayed the same
|
||||
Assert.That(sThresholdListenerComponent.ThresholdsReached.Count, Is.EqualTo(1));
|
||||
|
||||
sThresholdListenerComponent.ThresholdsReached.Clear();
|
||||
|
||||
// Heal both types of damage to 0
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Blunt, -10, true));
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Slash, -20, true));
|
||||
|
||||
// No new thresholds reached, healing should not trigger it
|
||||
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
|
||||
|
||||
// Raise blunt damage to 10
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Blunt, 10, true));
|
||||
|
||||
// No new thresholds reached
|
||||
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
|
||||
|
||||
// Raise slash damage to 10
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Slash, 10, true));
|
||||
|
||||
// Both types of damage were healed and then raised again, the threshold should have been reached as triggers once is default false
|
||||
Assert.That(sThresholdListenerComponent.ThresholdsReached.Count, Is.EqualTo(1));
|
||||
|
||||
// Threshold blunt 10 + slash 10
|
||||
msg = sThresholdListenerComponent.ThresholdsReached[0];
|
||||
threshold = msg.Threshold;
|
||||
|
||||
// Check that it matches the YAML prototype
|
||||
Assert.That(threshold.Behaviors, Is.Empty);
|
||||
Assert.NotNull(threshold.Trigger);
|
||||
Assert.That(threshold.Triggered, Is.True);
|
||||
Assert.IsInstanceOf<TotalDamageTypesTrigger>(threshold.Trigger);
|
||||
|
||||
sThresholdListenerComponent.ThresholdsReached.Clear();
|
||||
|
||||
// Change triggers once to true
|
||||
threshold.TriggersOnce = true;
|
||||
|
||||
// Heal blunt and slash back to 0
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Blunt, -10, true));
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Slash, -10, true));
|
||||
|
||||
// No new thresholds reached from healing
|
||||
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
|
||||
|
||||
// Raise blunt damage to 10
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Blunt, 10, true));
|
||||
|
||||
// No new thresholds reached
|
||||
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
|
||||
|
||||
// Raise slash damage to 10
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Slash, 10, true));
|
||||
|
||||
// No new thresholds reached as triggers once is set to true and it already triggered before
|
||||
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.GameObjects.Components.Destructible.Thresholds;
|
||||
using Content.Server.GameObjects.Components.Destructible.Thresholds.Behaviors;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.GameObjects.Components.Damage;
|
||||
using NUnit.Framework;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using static Content.IntegrationTests.Tests.Destructible.DestructibleTestPrototypes;
|
||||
|
||||
namespace Content.IntegrationTests.Tests.Destructible
|
||||
{
|
||||
public class DestructibleDestructionTest : ContentIntegrationTest
|
||||
{
|
||||
[Test]
|
||||
public async Task Test()
|
||||
{
|
||||
var server = StartServerDummyTicker(new ServerContentIntegrationOption
|
||||
{
|
||||
ExtraPrototypes = Prototypes,
|
||||
ContentBeforeIoC = () =>
|
||||
{
|
||||
IoCManager.Resolve<IComponentFactory>().Register<TestThresholdListenerComponent>();
|
||||
}
|
||||
});
|
||||
|
||||
await server.WaitIdleAsync();
|
||||
|
||||
var sEntityManager = server.ResolveDependency<IEntityManager>();
|
||||
var sMapManager = server.ResolveDependency<IMapManager>();
|
||||
|
||||
IEntity sDestructibleEntity = null;
|
||||
IDamageableComponent sDamageableComponent = 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<IDamageableComponent>();
|
||||
sThresholdListenerComponent = sDestructibleEntity.GetComponent<TestThresholdListenerComponent>();
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
namespace Content.IntegrationTests.Tests.Destructible
|
||||
{
|
||||
public static class DestructibleTestPrototypes
|
||||
{
|
||||
public const string SpawnedEntityId = "DestructibleTestsSpawnedEntity";
|
||||
public const string DestructibleEntityId = "DestructibleTestsDestructibleEntity";
|
||||
public const string DestructibleDestructionEntityId = "DestructibleTestsDestructibleDestructionEntity";
|
||||
public const string DestructibleDamageTypeEntityId = "DestructibleTestsDestructibleDamageTypeEntity";
|
||||
public const string DestructibleDamageClassEntityId = "DestructibleTestsDestructibleDamageClassEntity";
|
||||
|
||||
public static readonly string Prototypes = $@"
|
||||
- type: entity
|
||||
id: {SpawnedEntityId}
|
||||
name: {SpawnedEntityId}
|
||||
|
||||
- type: entity
|
||||
id: {DestructibleEntityId}
|
||||
name: {DestructibleEntityId}
|
||||
components:
|
||||
- type: Damageable
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 20
|
||||
triggersOnce: false
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 50
|
||||
triggersOnce: false
|
||||
behaviors:
|
||||
- !type:PlaySoundBehavior
|
||||
sound: /Audio/Effects/woodhit.ogg
|
||||
- !type:SpawnEntitiesBehavior
|
||||
spawn:
|
||||
{SpawnedEntityId}:
|
||||
min: 1
|
||||
max: 1
|
||||
- !type:DoActsBehavior
|
||||
acts: [""Breakage""]
|
||||
- type: TestThresholdListener
|
||||
|
||||
- type: entity
|
||||
id: {DestructibleDestructionEntityId}
|
||||
name: {DestructibleDestructionEntityId}
|
||||
components:
|
||||
- type: Damageable
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 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
|
||||
|
||||
- type: entity
|
||||
id: {DestructibleDamageTypeEntityId}
|
||||
name: {DestructibleDamageTypeEntityId}
|
||||
components:
|
||||
- type: Damageable
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
- trigger:
|
||||
!type:TotalDamageTypesTrigger
|
||||
damage:
|
||||
Blunt: 10
|
||||
Slash: 10
|
||||
- type: TestThresholdListener
|
||||
|
||||
|
||||
- type: entity
|
||||
id: {DestructibleDamageClassEntityId}
|
||||
name: {DestructibleDamageClassEntityId}
|
||||
components:
|
||||
- type: Damageable
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
- trigger:
|
||||
!type:TotalDamageClassesTrigger
|
||||
damage:
|
||||
Brute: 10
|
||||
Burn: 10
|
||||
- type: TestThresholdListener";
|
||||
}
|
||||
}
|
||||
@@ -1,99 +1,27 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.GameObjects.Components.Destructible;
|
||||
using Content.Server.GameObjects.Components.Destructible.Thresholds;
|
||||
using Content.Server.GameObjects.Components.Destructible.Thresholds.Behavior;
|
||||
using Content.Server.GameObjects.Components.Destructible.Thresholds.Behaviors;
|
||||
using Content.Server.GameObjects.Components.Destructible.Thresholds.Triggers;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.GameObjects.Components.Damage;
|
||||
using NUnit.Framework;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using static Content.IntegrationTests.Tests.Destructible.DestructibleTestPrototypes;
|
||||
|
||||
namespace Content.IntegrationTests.Tests.Destructible
|
||||
{
|
||||
[TestFixture]
|
||||
[TestOf(typeof(DestructibleComponent))]
|
||||
[TestOf(typeof(Threshold))]
|
||||
public class DestructibleTests : ContentIntegrationTest
|
||||
public class DestructibleThresholdActivationTest : 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}
|
||||
components:
|
||||
- type: Damageable
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
20:
|
||||
triggersOnce: false
|
||||
50:
|
||||
triggersOnce: false
|
||||
behaviors:
|
||||
- !type:PlaySoundBehavior
|
||||
sound: /Audio/Effects/woodhit.ogg
|
||||
- !type:SpawnEntitiesBehavior
|
||||
spawn:
|
||||
{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
|
||||
";
|
||||
|
||||
private class TestThresholdListenerComponent : Component
|
||||
{
|
||||
public override string Name => "TestThresholdListener";
|
||||
|
||||
public List<DestructibleThresholdReachedMessage> ThresholdsReached { get; } = new();
|
||||
|
||||
public override void HandleMessage(ComponentMessage message, IComponent component)
|
||||
{
|
||||
base.HandleMessage(message, component);
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case DestructibleThresholdReachedMessage msg:
|
||||
ThresholdsReached.Add(msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TestThresholdActivation()
|
||||
public async Task Test()
|
||||
{
|
||||
var server = StartServerDummyTicker(new ServerContentIntegrationOption
|
||||
{
|
||||
@@ -130,7 +58,7 @@ namespace Content.IntegrationTests.Tests.Destructible
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
Assert.That(sThresholdListenerComponent.ThresholdsReached.Count, Is.Zero);
|
||||
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
|
||||
});
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
@@ -138,36 +66,31 @@ namespace Content.IntegrationTests.Tests.Destructible
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Blunt, 10, true));
|
||||
|
||||
// No thresholds reached yet, the earliest one is at 20 damage
|
||||
Assert.That(sThresholdListenerComponent.ThresholdsReached.Count, Is.Zero);
|
||||
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
|
||||
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Blunt, 10, true));
|
||||
|
||||
// Only one threshold reached, 20
|
||||
Assert.That(sThresholdListenerComponent.ThresholdsReached.Count, Is.EqualTo(1));
|
||||
|
||||
// Threshold 20
|
||||
var msg = sThresholdListenerComponent.ThresholdsReached[0];
|
||||
|
||||
// Check that it matches the total damage dealt
|
||||
Assert.That(msg.TotalDamage, Is.EqualTo(20));
|
||||
|
||||
var threshold = msg.Threshold;
|
||||
|
||||
// Check that it matches the YAML prototype
|
||||
Assert.That(threshold.Behaviors, Is.Empty);
|
||||
Assert.NotNull(threshold.Trigger);
|
||||
Assert.That(threshold.Triggered, Is.True);
|
||||
|
||||
sThresholdListenerComponent.ThresholdsReached.Clear();
|
||||
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Blunt, 30, true));
|
||||
|
||||
// Only one threshold reached, 50, since 20 was already reached before
|
||||
// One threshold reached, 50, since 20 already triggered before and it has not been healed below that amount
|
||||
Assert.That(sThresholdListenerComponent.ThresholdsReached.Count, Is.EqualTo(1));
|
||||
|
||||
// Threshold 50
|
||||
msg = sThresholdListenerComponent.ThresholdsReached[0];
|
||||
|
||||
// Check that it matches the total damage dealt
|
||||
Assert.That(msg.TotalDamage, Is.EqualTo(50));
|
||||
|
||||
threshold = msg.Threshold;
|
||||
|
||||
// Check that it matches the YAML prototype
|
||||
@@ -184,6 +107,7 @@ namespace Content.IntegrationTests.Tests.Destructible
|
||||
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.NotNull(threshold.Trigger);
|
||||
Assert.That(threshold.Triggered, Is.True);
|
||||
|
||||
sThresholdListenerComponent.ThresholdsReached.Clear();
|
||||
@@ -191,8 +115,19 @@ namespace Content.IntegrationTests.Tests.Destructible
|
||||
// Damage for 50 again, up to 100 now
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Blunt, 50, true));
|
||||
|
||||
// No new thresholds reached as even though they don't only trigger once, the entity was not healed below the threshold
|
||||
Assert.That(sThresholdListenerComponent.ThresholdsReached, Is.Empty);
|
||||
// No thresholds reached as they weren't healed below the trigger amount
|
||||
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
|
||||
|
||||
// Heal down to 0
|
||||
sDamageableComponent.Heal();
|
||||
|
||||
// Damage for 100, up to 100
|
||||
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Blunt, 100, true));
|
||||
|
||||
// Two thresholds reached as damage increased past the previous, 20 and 50
|
||||
Assert.That(sThresholdListenerComponent.ThresholdsReached.Count, Is.EqualTo(2));
|
||||
|
||||
sThresholdListenerComponent.ThresholdsReached.Clear();
|
||||
|
||||
// Heal the entity for 40 damage, down to 60
|
||||
sDamageableComponent.ChangeDamage(DamageType.Blunt, -40, true);
|
||||
@@ -219,10 +154,6 @@ namespace Content.IntegrationTests.Tests.Destructible
|
||||
Assert.That(sThresholdListenerComponent.ThresholdsReached.Count, Is.EqualTo(1));
|
||||
|
||||
msg = sThresholdListenerComponent.ThresholdsReached[0];
|
||||
|
||||
// Check that it matches the total damage dealt
|
||||
Assert.That(msg.TotalDamage, Is.EqualTo(50));
|
||||
|
||||
threshold = msg.Threshold;
|
||||
|
||||
// Check that it matches the YAML prototype
|
||||
@@ -240,6 +171,7 @@ namespace Content.IntegrationTests.Tests.Destructible
|
||||
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.NotNull(threshold.Trigger);
|
||||
Assert.That(threshold.Triggered, Is.True);
|
||||
|
||||
// Reset thresholds reached
|
||||
@@ -259,10 +191,9 @@ namespace Content.IntegrationTests.Tests.Destructible
|
||||
|
||||
// Verify the first one, should be the lowest one (20)
|
||||
msg = sThresholdListenerComponent.ThresholdsReached[0];
|
||||
Assert.That(msg.ThresholdAmount, Is.EqualTo(20));
|
||||
|
||||
// The total damage should be 50
|
||||
Assert.That(msg.TotalDamage, Is.EqualTo(50));
|
||||
var trigger = (TotalDamageTrigger) msg.Threshold.Trigger;
|
||||
Assert.NotNull(trigger);
|
||||
Assert.That(trigger.Damage, Is.EqualTo(20));
|
||||
|
||||
threshold = msg.Threshold;
|
||||
|
||||
@@ -271,10 +202,9 @@ namespace Content.IntegrationTests.Tests.Destructible
|
||||
|
||||
// Verify the second one, should be the highest one (50)
|
||||
msg = sThresholdListenerComponent.ThresholdsReached[1];
|
||||
Assert.That(msg.ThresholdAmount, Is.EqualTo(50));
|
||||
|
||||
// Check that it matches the total damage dealt
|
||||
Assert.That(msg.TotalDamage, Is.EqualTo(50));
|
||||
trigger = (TotalDamageTrigger) msg.Threshold.Trigger;
|
||||
Assert.NotNull(trigger);
|
||||
Assert.That(trigger.Damage, Is.EqualTo(50));
|
||||
|
||||
threshold = msg.Threshold;
|
||||
|
||||
@@ -292,6 +222,7 @@ namespace Content.IntegrationTests.Tests.Destructible
|
||||
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.NotNull(threshold.Trigger);
|
||||
Assert.That(threshold.Triggered, Is.True);
|
||||
|
||||
// Reset thresholds reached
|
||||
@@ -304,8 +235,9 @@ namespace Content.IntegrationTests.Tests.Destructible
|
||||
Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(0));
|
||||
|
||||
// Set both thresholds to only trigger once
|
||||
foreach (var destructibleThreshold in sDestructibleComponent.LowestToHighestThresholds.Values)
|
||||
foreach (var destructibleThreshold in sDestructibleComponent.Thresholds)
|
||||
{
|
||||
Assert.NotNull(destructibleThreshold.Trigger);
|
||||
destructibleThreshold.TriggersOnce = true;
|
||||
}
|
||||
|
||||
@@ -319,8 +251,9 @@ namespace Content.IntegrationTests.Tests.Destructible
|
||||
Assert.That(sThresholdListenerComponent.ThresholdsReached, Is.Empty);
|
||||
|
||||
// Set both thresholds to trigger multiple times
|
||||
foreach (var destructibleThreshold in sDestructibleComponent.LowestToHighestThresholds.Values)
|
||||
foreach (var destructibleThreshold in sDestructibleComponent.Thresholds)
|
||||
{
|
||||
Assert.NotNull(destructibleThreshold.Trigger);
|
||||
destructibleThreshold.TriggersOnce = false;
|
||||
}
|
||||
|
||||
@@ -331,84 +264,5 @@ 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<IComponentFactory>().Register<TestThresholdListenerComponent>();
|
||||
}
|
||||
});
|
||||
|
||||
await server.WaitIdleAsync();
|
||||
|
||||
var sEntityManager = server.ResolveDependency<IEntityManager>();
|
||||
var sMapManager = server.ResolveDependency<IMapManager>();
|
||||
|
||||
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<IDamageableComponent>();
|
||||
sDestructibleComponent = sDestructibleEntity.GetComponent<DestructibleComponent>();
|
||||
sThresholdListenerComponent = sDestructibleEntity.GetComponent<TestThresholdListenerComponent>();
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.GameObjects.Components.Destructible;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
|
||||
namespace Content.IntegrationTests.Tests.Destructible
|
||||
{
|
||||
public class TestThresholdListenerComponent : Component
|
||||
{
|
||||
public override string Name => "TestThresholdListener";
|
||||
|
||||
public List<DestructibleThresholdReachedMessage> ThresholdsReached { get; } = new();
|
||||
|
||||
public override void HandleMessage(ComponentMessage message, IComponent component)
|
||||
{
|
||||
base.HandleMessage(message, component);
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case DestructibleThresholdReachedMessage msg:
|
||||
ThresholdsReached.Add(msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,22 +22,15 @@ namespace Content.Server.GameObjects.Components.Destructible
|
||||
|
||||
public override string Name => "Destructible";
|
||||
|
||||
[ViewVariables]
|
||||
private SortedDictionary<int, Threshold> _lowestToHighestThresholds = new();
|
||||
[ViewVariables] private List<Threshold> _thresholds = new();
|
||||
|
||||
[ViewVariables] private int PreviousTotalDamage { get; set; }
|
||||
|
||||
public IReadOnlyDictionary<int, Threshold> LowestToHighestThresholds => _lowestToHighestThresholds;
|
||||
public IReadOnlyList<Threshold> Thresholds => _thresholds;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataReadWriteFunction(
|
||||
"thresholds",
|
||||
new Dictionary<int, Threshold>(),
|
||||
thresholds => _lowestToHighestThresholds = new SortedDictionary<int, Threshold>(thresholds),
|
||||
() => new Dictionary<int, Threshold>(_lowestToHighestThresholds));
|
||||
serializer.DataField(ref _thresholds, "thresholds", new List<Threshold>());
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
@@ -60,32 +53,17 @@ namespace Content.Server.GameObjects.Components.Destructible
|
||||
break;
|
||||
}
|
||||
|
||||
foreach (var (damage, threshold) in _lowestToHighestThresholds)
|
||||
foreach (var threshold in _thresholds)
|
||||
{
|
||||
if (threshold.Triggered)
|
||||
if (threshold.Reached(msg.Damageable, _destructibleSystem))
|
||||
{
|
||||
if (threshold.TriggersOnce)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (PreviousTotalDamage >= damage)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (msg.Damageable.TotalDamage >= damage)
|
||||
{
|
||||
var thresholdMessage = new DestructibleThresholdReachedMessage(this, threshold, msg.Damageable.TotalDamage, damage);
|
||||
var thresholdMessage = new DestructibleThresholdReachedMessage(this, threshold);
|
||||
SendMessage(thresholdMessage);
|
||||
|
||||
threshold.Trigger(Owner, _destructibleSystem);
|
||||
threshold.Execute(Owner, _destructibleSystem);
|
||||
}
|
||||
}
|
||||
|
||||
PreviousTotalDamage = msg.Damageable.TotalDamage;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,26 +5,14 @@ namespace Content.Server.GameObjects.Components.Destructible
|
||||
{
|
||||
public class DestructibleThresholdReachedMessage : ComponentMessage
|
||||
{
|
||||
public DestructibleThresholdReachedMessage(DestructibleComponent parent, Threshold threshold, int totalDamage, int thresholdAmount)
|
||||
public DestructibleThresholdReachedMessage(DestructibleComponent parent, Threshold threshold)
|
||||
{
|
||||
Parent = parent;
|
||||
Threshold = threshold;
|
||||
TotalDamage = totalDamage;
|
||||
ThresholdAmount = thresholdAmount;
|
||||
}
|
||||
|
||||
public DestructibleComponent Parent { get; }
|
||||
|
||||
public Threshold Threshold { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The amount of total damage currently had that triggered this threshold.
|
||||
/// </summary>
|
||||
public int TotalDamage { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The amount of damage at which this threshold triggers.
|
||||
/// </summary>
|
||||
public int ThresholdAmount { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using System;
|
||||
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
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behaviors
|
||||
{
|
||||
[Serializable]
|
||||
public class DoActsBehavior : IThresholdBehavior
|
||||
{
|
||||
private int _acts;
|
||||
@@ -29,7 +31,7 @@ namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behavior
|
||||
return (_acts & (int) act) != 0;
|
||||
}
|
||||
|
||||
public void Trigger(IEntity owner, DestructibleSystem system)
|
||||
public void Execute(IEntity owner, DestructibleSystem system)
|
||||
{
|
||||
if (HasAct(ThresholdActs.Breakage))
|
||||
{
|
||||
@@ -4,7 +4,7 @@ using JetBrains.Annotations;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behavior
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behaviors
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public class GibBehavior : IThresholdBehavior
|
||||
@@ -16,7 +16,7 @@ namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behavior
|
||||
serializer.DataField(ref _recursive, "recursive", true);
|
||||
}
|
||||
|
||||
public void Trigger(IEntity owner, DestructibleSystem system)
|
||||
public void Execute(IEntity owner, DestructibleSystem system)
|
||||
{
|
||||
if (owner.TryGetComponent(out IBody body))
|
||||
{
|
||||
@@ -2,18 +2,18 @@
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Serialization;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behavior
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behaviors
|
||||
{
|
||||
public interface IThresholdBehavior : IExposeData
|
||||
{
|
||||
/// <summary>
|
||||
/// Triggers this behavior.
|
||||
/// Executes this behavior.
|
||||
/// </summary>
|
||||
/// <param name="owner">The entity that owns this behavior.</param>
|
||||
/// <param name="system">
|
||||
/// An instance of <see cref="DestructibleSystem"/> to pull dependencies
|
||||
/// and other systems from.
|
||||
/// </param>
|
||||
void Trigger(IEntity owner, DestructibleSystem system);
|
||||
void Execute(IEntity owner, DestructibleSystem system);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using System;
|
||||
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
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behaviors
|
||||
{
|
||||
[Serializable]
|
||||
public class PlaySoundBehavior : IThresholdBehavior
|
||||
{
|
||||
/// <summary>
|
||||
@@ -17,7 +19,7 @@ namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behavior
|
||||
serializer.DataField(this, x => x.Sound, "sound", string.Empty);
|
||||
}
|
||||
|
||||
public void Trigger(IEntity owner, DestructibleSystem system)
|
||||
public void Execute(IEntity owner, DestructibleSystem system)
|
||||
{
|
||||
if (string.IsNullOrEmpty(Sound))
|
||||
{
|
||||
@@ -1,10 +1,12 @@
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using System;
|
||||
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
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behaviors
|
||||
{
|
||||
[Serializable]
|
||||
public class PlaySoundCollectionBehavior : IThresholdBehavior
|
||||
{
|
||||
/// <summary>
|
||||
@@ -17,7 +19,7 @@ namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behavior
|
||||
serializer.DataField(this, x => x.SoundCollection, "soundCollection", string.Empty);
|
||||
}
|
||||
|
||||
public void Trigger(IEntity owner, DestructibleSystem system)
|
||||
public void Execute(IEntity owner, DestructibleSystem system)
|
||||
{
|
||||
if (string.IsNullOrEmpty(SoundCollection))
|
||||
{
|
||||
@@ -1,4 +1,5 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.GameObjects.Components.Stack;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
@@ -6,8 +7,9 @@ using Content.Shared.Utility;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behavior
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behaviors
|
||||
{
|
||||
[Serializable]
|
||||
public class SpawnEntitiesBehavior : IThresholdBehavior
|
||||
{
|
||||
/// <summary>
|
||||
@@ -20,7 +22,7 @@ namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behavior
|
||||
serializer.DataField(this, x => x.Spawn, "spawn", new Dictionary<string, MinMax>());
|
||||
}
|
||||
|
||||
public void Trigger(IEntity owner, DestructibleSystem system)
|
||||
public void Execute(IEntity owner, DestructibleSystem system)
|
||||
{
|
||||
foreach (var (entityId, minMax) in Spawn)
|
||||
{
|
||||
@@ -6,14 +6,14 @@ using JetBrains.Annotations;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behavior
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behaviors
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public class SpillBehavior : IThresholdBehavior
|
||||
{
|
||||
public void ExposeData(ObjectSerializer serializer) { }
|
||||
|
||||
public void Trigger(IEntity owner, DestructibleSystem system)
|
||||
public void Execute(IEntity owner, DestructibleSystem system)
|
||||
{
|
||||
if (!owner.TryGetComponent(out SolutionContainerComponent? solutionContainer))
|
||||
return;
|
||||
@@ -1,9 +1,11 @@
|
||||
using Robust.Shared.Interfaces.Serialization;
|
||||
using System;
|
||||
using Robust.Shared.Interfaces.Serialization;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds
|
||||
{
|
||||
[Serializable]
|
||||
public struct MinMax : IExposeData
|
||||
{
|
||||
[ViewVariables]
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.GameObjects.Components.Destructible.Thresholds.Behavior;
|
||||
using Content.Server.GameObjects.Components.Destructible.Thresholds.Behaviors;
|
||||
using Content.Server.GameObjects.Components.Destructible.Thresholds.Triggers;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.GameObjects.Components.Damage;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Serialization;
|
||||
using Robust.Shared.Serialization;
|
||||
@@ -13,6 +15,12 @@ namespace Content.Server.GameObjects.Components.Destructible.Thresholds
|
||||
{
|
||||
private List<IThresholdBehavior> _behaviors = new();
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not this threshold was triggered in the previous call to
|
||||
/// <see cref="Reached"/>.
|
||||
/// </summary>
|
||||
[ViewVariables] public bool OldTriggered { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not this threshold has already been triggered.
|
||||
/// </summary>
|
||||
@@ -26,6 +34,11 @@ namespace Content.Server.GameObjects.Components.Destructible.Thresholds
|
||||
/// </summary>
|
||||
[ViewVariables] public bool TriggersOnce { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The trigger that decides if this threshold has been reached.
|
||||
/// </summary>
|
||||
[ViewVariables] public IThresholdTrigger? Trigger { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Behaviors to activate once this threshold is triggered.
|
||||
/// </summary>
|
||||
@@ -35,9 +48,37 @@ namespace Content.Server.GameObjects.Components.Destructible.Thresholds
|
||||
{
|
||||
serializer.DataField(this, x => x.Triggered, "triggered", false);
|
||||
serializer.DataField(this, x => x.TriggersOnce, "triggersOnce", false);
|
||||
serializer.DataField(this, x => x.Trigger, "trigger", null);
|
||||
serializer.DataField(ref _behaviors, "behaviors", new List<IThresholdBehavior>());
|
||||
}
|
||||
|
||||
public bool Reached(IDamageableComponent damageable, DestructibleSystem system)
|
||||
{
|
||||
if (Trigger == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Triggered && TriggersOnce)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (OldTriggered)
|
||||
{
|
||||
OldTriggered = Trigger.Reached(damageable, system);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Trigger.Reached(damageable, system))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OldTriggered = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Triggers this threshold.
|
||||
/// </summary>
|
||||
@@ -46,7 +87,7 @@ namespace Content.Server.GameObjects.Components.Destructible.Thresholds
|
||||
/// An instance of <see cref="DestructibleSystem"/> to get dependency and
|
||||
/// system references from, if relevant.
|
||||
/// </param>
|
||||
public void Trigger(IEntity owner, DestructibleSystem system)
|
||||
public void Execute(IEntity owner, DestructibleSystem system)
|
||||
{
|
||||
Triggered = true;
|
||||
|
||||
@@ -56,7 +97,7 @@ namespace Content.Server.GameObjects.Components.Destructible.Thresholds
|
||||
if (owner.Deleted)
|
||||
return;
|
||||
|
||||
behavior.Trigger(owner, system);
|
||||
behavior.Execute(owner, system);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#nullable enable
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.GameObjects.Components.Damage;
|
||||
using Robust.Shared.Interfaces.Serialization;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Triggers
|
||||
{
|
||||
public interface IThresholdTrigger : IExposeData
|
||||
{
|
||||
/// <summary>
|
||||
/// Checks if this trigger has been reached.
|
||||
/// </summary>
|
||||
/// <param name="damageable">The damageable component to check with.</param>
|
||||
/// <param name="system">
|
||||
/// An instance of <see cref="DestructibleSystem"/> to pull
|
||||
/// dependencies from, if any.
|
||||
/// </param>
|
||||
/// <returns>true if this trigger has been reached, false otherwise.</returns>
|
||||
bool Reached(IDamageableComponent damageable, DestructibleSystem system);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.GameObjects.Components.Damage;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Triggers
|
||||
{
|
||||
/// <summary>
|
||||
/// A trigger that will activate when all of the damage classes received
|
||||
/// are above the specified threshold.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TotalDamageClassesTrigger : IThresholdTrigger
|
||||
{
|
||||
/// <summary>
|
||||
/// The amount of damage at which this threshold will trigger.
|
||||
/// The damage requirements of all <see cref="DamageClass"/> must be met.
|
||||
/// </summary>
|
||||
private Dictionary<DamageClass, int> Damage { get; set; } = new();
|
||||
|
||||
public void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
serializer.DataField(this, x => x.Damage, "damage", new Dictionary<DamageClass, int>());
|
||||
}
|
||||
|
||||
public bool Reached(IDamageableComponent damageable, DestructibleSystem system)
|
||||
{
|
||||
foreach (var (type, damageRequired) in Damage)
|
||||
{
|
||||
if (!damageable.TryGetDamage(type, out var damageReceived))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (damageReceived < damageRequired)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.GameObjects.Components.Damage;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Triggers
|
||||
{
|
||||
/// <summary>
|
||||
/// A trigger that will activate when the amount of total damage received
|
||||
/// is above the specified threshold.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TotalDamageTrigger : IThresholdTrigger
|
||||
{
|
||||
/// <summary>
|
||||
/// The amount of total damage at which this threshold will trigger.
|
||||
/// </summary>
|
||||
public int Damage { get; private set; }
|
||||
|
||||
public void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
serializer.DataField(this, x => x.Damage, "damage", 0);
|
||||
}
|
||||
|
||||
public bool Reached(IDamageableComponent damageable, DestructibleSystem system)
|
||||
{
|
||||
return damageable.TotalDamage >= Damage;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.GameObjects.Components.Damage;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Triggers
|
||||
{
|
||||
/// <summary>
|
||||
/// A trigger that will activate when all of the damage types received
|
||||
/// are above the specified threshold.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TotalDamageTypesTrigger : IThresholdTrigger
|
||||
{
|
||||
/// <summary>
|
||||
/// The amount of damage at which this threshold will trigger.
|
||||
/// The damage requirements of all <see cref="DamageType"/> must be met.
|
||||
/// </summary>
|
||||
private Dictionary<DamageType, int> Damage { get; set; } = new();
|
||||
|
||||
public void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
serializer.DataField(this, x => x.Damage, "damage", new Dictionary<DamageType, int>());
|
||||
}
|
||||
|
||||
public bool Reached(IDamageableComponent damageable, DestructibleSystem system)
|
||||
{
|
||||
foreach (var (type, damageRequired) in Damage)
|
||||
{
|
||||
if (!damageable.TryGetDamage(type, out var damageReceived))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (damageReceived < damageRequired)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.GameObjects.Components;
|
||||
@@ -7,6 +8,7 @@ using Content.Shared.GameObjects.Components.Damage;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Content.Server.GameObjects.Components.Destructible;
|
||||
using Content.Server.GameObjects.Components.Destructible.Thresholds.Triggers;
|
||||
using Content.Shared.Utility;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
@@ -22,7 +24,6 @@ namespace Content.Server.GameObjects.Components
|
||||
[ComponentReference(typeof(SharedWindowComponent))]
|
||||
public class WindowComponent : SharedWindowComponent, IExamine, IInteractHand
|
||||
{
|
||||
|
||||
public override void HandleMessage(ComponentMessage message, IComponent? component)
|
||||
{
|
||||
base.HandleMessage(message, component);
|
||||
@@ -40,26 +41,52 @@ namespace Content.Server.GameObjects.Components
|
||||
|
||||
private void UpdateVisuals(int currentDamage)
|
||||
{
|
||||
if (Owner.TryGetComponent(out AppearanceComponent? appearance))
|
||||
if (Owner.TryGetComponent(out AppearanceComponent? appearance) &&
|
||||
Owner.TryGetComponent(out DestructibleComponent? destructible))
|
||||
{
|
||||
if (Owner.TryGetComponent(out DestructibleComponent? destructible))
|
||||
foreach (var threshold in destructible.Thresholds)
|
||||
{
|
||||
var damageThreshold = destructible.LowestToHighestThresholds.FirstOrNull()?.Key;
|
||||
if (damageThreshold == null) return;
|
||||
appearance.SetData(WindowVisuals.Damage, (float) currentDamage / damageThreshold);
|
||||
if (threshold.Trigger is not TotalDamageTrigger trigger)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
appearance.SetData(WindowVisuals.Damage, (float) currentDamage / trigger.Damage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
|
||||
{
|
||||
var damage = Owner.GetComponentOrNull<IDamageableComponent>()?.TotalDamage;
|
||||
var damageThreshold = Owner.GetComponentOrNull<DestructibleComponent>()?.LowestToHighestThresholds.FirstOrNull()?.Key;
|
||||
if (damage == null || damageThreshold == null) return;
|
||||
var fraction = ((damage == 0 || damageThreshold == 0)
|
||||
if (!Owner.TryGetComponent(out IDamageableComponent? damageable) ||
|
||||
!Owner.TryGetComponent(out DestructibleComponent? destructible))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var damage = damageable.TotalDamage;
|
||||
TotalDamageTrigger? trigger = null;
|
||||
|
||||
// TODO: Pretend this does not exist until https://github.com/space-wizards/space-station-14/pull/2783 is merged
|
||||
foreach (var threshold in destructible.Thresholds)
|
||||
{
|
||||
if ((trigger = threshold.Trigger as TotalDamageTrigger) != null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (trigger == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var damageThreshold = trigger.Damage;
|
||||
var fraction = damage == 0 || damageThreshold == 0
|
||||
? 0f
|
||||
: (float) damage / damageThreshold);
|
||||
: (float) damage / damageThreshold;
|
||||
var level = Math.Min(ContentHelpers.RoundToLevels((double) fraction, 1, 7), 5);
|
||||
|
||||
switch (level)
|
||||
{
|
||||
case 0:
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
[Dependency] public readonly IRobustRandom Random = default!;
|
||||
|
||||
public AudioSystem AudioSystem { get; private set; }
|
||||
|
||||
public ActSystem ActSystem { get; private set; }
|
||||
|
||||
public override void Initialize()
|
||||
|
||||
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Damage
|
||||
|
||||
@@ -60,7 +60,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
500:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 500
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
|
||||
@@ -25,7 +25,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
75:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 75
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
|
||||
@@ -23,7 +23,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
30:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 30
|
||||
behaviors:
|
||||
- !type:PlaySoundBehavior
|
||||
sound: /Audio/Effects/woodhit.ogg
|
||||
|
||||
@@ -24,7 +24,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
50:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 50
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
|
||||
@@ -15,7 +15,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
100:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
|
||||
@@ -34,7 +34,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
50:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 50
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
|
||||
@@ -31,7 +31,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
30:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 30
|
||||
behaviors:
|
||||
- !type:PlaySoundBehavior
|
||||
sound: /Audio/Effects/metalbreak.ogg
|
||||
@@ -76,7 +78,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
30:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 30
|
||||
behaviors:
|
||||
- !type:PlaySoundBehavior
|
||||
sound: /Audio/Effects/metalbreak.ogg
|
||||
|
||||
@@ -39,7 +39,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
15:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 15
|
||||
behaviors:
|
||||
- !type:PlaySoundBehavior
|
||||
sound: /Audio/Effects/metalbreak.ogg
|
||||
@@ -65,7 +67,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
1:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 1
|
||||
behaviors:
|
||||
- !type:PlaySoundBehavior
|
||||
sound: /Audio/Effects/metalbreak.ogg
|
||||
@@ -94,7 +98,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
1:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 1
|
||||
behaviors:
|
||||
- !type:PlaySoundBehavior
|
||||
sound: /Audio/Effects/metalbreak.ogg
|
||||
@@ -120,7 +126,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
15:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 15
|
||||
behaviors:
|
||||
- !type:PlaySoundBehavior
|
||||
sound: /Audio/Effects/metalbreak.ogg
|
||||
@@ -149,7 +157,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
75:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 75
|
||||
behaviors:
|
||||
- !type:PlaySoundBehavior
|
||||
sound: /Audio/Effects/metalbreak.ogg
|
||||
@@ -178,7 +188,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
5:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 5
|
||||
behaviors:
|
||||
- !type:PlaySoundBehavior
|
||||
sound: /Audio/Effects/glass_break2.ogg
|
||||
@@ -207,7 +219,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
20:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 20
|
||||
behaviors:
|
||||
- !type:PlaySoundBehavior
|
||||
sound: /Audio/Effects/glass_break2.ogg
|
||||
@@ -236,7 +250,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
15:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 15
|
||||
behaviors:
|
||||
- !type:PlaySoundBehavior
|
||||
sound: /Audio/Effects/woodhit.ogg
|
||||
@@ -265,7 +281,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
15:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 15
|
||||
behaviors:
|
||||
- !type:PlaySoundBehavior
|
||||
sound: /Audio/Effects/woodhit.ogg
|
||||
@@ -294,7 +312,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
50:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 50
|
||||
behaviors:
|
||||
- !type:PlaySoundBehavior
|
||||
sound: /Audio/Effects/picaxe2.ogg
|
||||
@@ -315,7 +335,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
1:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 1
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
- type: Damageable
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
100:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
|
||||
@@ -13,7 +13,9 @@
|
||||
- type: Damageable
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
100:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
|
||||
@@ -13,7 +13,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
100:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
|
||||
@@ -23,7 +23,9 @@
|
||||
- type: Damageable
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
50:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 50
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
- type: entity
|
||||
- type: entity
|
||||
abstract: true
|
||||
id: PipeBase
|
||||
name: Pipe
|
||||
@@ -14,7 +14,9 @@
|
||||
- type: Damageable
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
100:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
|
||||
@@ -13,7 +13,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
100:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
@@ -44,4 +46,3 @@
|
||||
- type: PressurePump
|
||||
inletDirection: West
|
||||
outletDirection: East
|
||||
|
||||
@@ -13,7 +13,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
100:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
|
||||
@@ -13,7 +13,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
100:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
|
||||
@@ -98,7 +98,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
100:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
|
||||
@@ -31,7 +31,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
100:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Breakage"]
|
||||
|
||||
@@ -257,7 +257,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
100:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Breakage"]
|
||||
|
||||
@@ -32,7 +32,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
50:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 50
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Breakage"]
|
||||
|
||||
@@ -22,7 +22,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
100:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
@@ -53,7 +55,9 @@
|
||||
wireType: HighVoltage
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
100:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:SpawnEntitiesBehavior
|
||||
spawn:
|
||||
@@ -90,7 +94,9 @@
|
||||
wireType: MediumVoltage
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
100:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:SpawnEntitiesBehavior
|
||||
spawn:
|
||||
@@ -129,7 +135,9 @@
|
||||
wireType: Apc
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
100:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:SpawnEntitiesBehavior
|
||||
spawn:
|
||||
|
||||
@@ -25,7 +25,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
500:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 500
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
|
||||
@@ -25,7 +25,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
500:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 500
|
||||
behaviors:
|
||||
- !type:SpawnEntitiesBehavior
|
||||
spawn:
|
||||
|
||||
@@ -34,7 +34,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
100:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
|
||||
@@ -34,7 +34,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
100:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
|
||||
@@ -21,7 +21,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
75:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 75
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
|
||||
@@ -35,7 +35,9 @@
|
||||
- type: Damageable
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
50:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 50
|
||||
behaviors:
|
||||
- !type:SpawnEntitiesBehavior
|
||||
spawn:
|
||||
@@ -84,7 +86,9 @@
|
||||
- type: Damageable
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
25:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 25
|
||||
behaviors:
|
||||
- !type:SpawnEntitiesBehavior
|
||||
spawn:
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
100:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Breakage"]
|
||||
@@ -151,7 +153,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
100:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
@@ -392,7 +396,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
100:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
|
||||
@@ -33,7 +33,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
150:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 150
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Breakage"]
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
50:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 50
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
|
||||
@@ -43,7 +43,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
100:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
|
||||
@@ -39,7 +39,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
100:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
10:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 10
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
|
||||
@@ -18,7 +18,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
100:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
|
||||
@@ -30,7 +30,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
50:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 50
|
||||
behaviors:
|
||||
- !type:SpawnEntitiesBehavior
|
||||
spawn:
|
||||
|
||||
@@ -40,7 +40,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
50:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 50
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
@@ -69,7 +71,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
25:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 25
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
@@ -90,7 +94,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
25:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 25
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
|
||||
@@ -29,7 +29,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
100:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
|
||||
@@ -12,7 +12,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
5:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 5
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
|
||||
@@ -48,7 +48,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
300:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 300
|
||||
behaviors:
|
||||
- !type:SpawnEntitiesBehavior
|
||||
spawn:
|
||||
@@ -74,7 +76,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
300:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 300
|
||||
behaviors:
|
||||
- !type:SpawnEntitiesBehavior
|
||||
spawn:
|
||||
@@ -100,7 +104,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
300:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 300
|
||||
behaviors:
|
||||
- !type:SpawnEntitiesBehavior
|
||||
spawn:
|
||||
@@ -127,7 +133,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
300:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 300
|
||||
behaviors:
|
||||
- !type:SpawnEntitiesBehavior
|
||||
spawn:
|
||||
@@ -153,7 +161,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
300:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 300
|
||||
behaviors:
|
||||
- !type:SpawnEntitiesBehavior
|
||||
spawn:
|
||||
@@ -179,7 +189,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
300:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 300
|
||||
behaviors:
|
||||
- !type:SpawnEntitiesBehavior
|
||||
spawn:
|
||||
@@ -206,7 +218,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
300:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 300
|
||||
behaviors:
|
||||
- !type:SpawnEntitiesBehavior
|
||||
spawn:
|
||||
@@ -232,7 +246,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
300:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 300
|
||||
behaviors:
|
||||
- !type:SpawnEntitiesBehavior
|
||||
spawn:
|
||||
@@ -258,7 +274,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
300:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 300
|
||||
behaviors:
|
||||
- !type:SpawnEntitiesBehavior
|
||||
spawn:
|
||||
@@ -284,7 +302,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
300:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 300
|
||||
behaviors:
|
||||
- !type:SpawnEntitiesBehavior
|
||||
spawn:
|
||||
@@ -310,7 +330,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
300:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 300
|
||||
behaviors:
|
||||
- !type:SpawnEntitiesBehavior
|
||||
spawn:
|
||||
@@ -341,7 +363,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
600:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 600
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
@@ -369,7 +393,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
1000:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 1000
|
||||
behaviors:
|
||||
- !type:SpawnEntitiesBehavior
|
||||
spawn:
|
||||
@@ -395,7 +421,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
300:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 300
|
||||
behaviors:
|
||||
- !type:SpawnEntitiesBehavior
|
||||
spawn:
|
||||
@@ -421,7 +449,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
300:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 300
|
||||
behaviors:
|
||||
- !type:SpawnEntitiesBehavior
|
||||
spawn:
|
||||
@@ -451,7 +481,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
300:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 300
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
@@ -475,7 +507,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
300:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 300
|
||||
behaviors:
|
||||
- !type:SpawnEntitiesBehavior
|
||||
spawn:
|
||||
@@ -501,7 +535,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
300:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 300
|
||||
behaviors:
|
||||
- !type:SpawnEntitiesBehavior
|
||||
spawn:
|
||||
|
||||
@@ -30,7 +30,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
15:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 15
|
||||
behaviors:
|
||||
- !type:PlaySoundCollectionBehavior
|
||||
soundCollection: GlassBreak
|
||||
@@ -67,7 +69,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
75:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 75
|
||||
behaviors:
|
||||
- !type:PlaySoundCollectionBehavior
|
||||
soundCollection: GlassBreak
|
||||
@@ -98,7 +102,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
100:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:PlaySoundCollectionBehavior
|
||||
soundCollection: GlassBreak
|
||||
|
||||
@@ -125,7 +125,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
50:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 50
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: [ "Destruction" ]
|
||||
|
||||
@@ -164,7 +164,10 @@
|
||||
200: !type:DeadMobState {}
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
400:
|
||||
- trigger:
|
||||
!type:TotalDamageTypesTrigger
|
||||
damage:
|
||||
Blunt: 400
|
||||
behaviors:
|
||||
- !type:GibBehavior { }
|
||||
- type: HeatResistance
|
||||
|
||||
@@ -26,7 +26,9 @@
|
||||
- type: Damageable
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
5:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 5
|
||||
behaviors:
|
||||
- !type:PlaySoundCollectionBehavior
|
||||
soundCollection: GlassBreak
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
- type: Damageable
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
5:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 5
|
||||
behaviors:
|
||||
- !type:PlaySoundCollectionBehavior
|
||||
soundCollection: GlassBreak
|
||||
|
||||
@@ -131,7 +131,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
10:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 10
|
||||
behaviors:
|
||||
- !type:PlaySoundBehavior
|
||||
sound: /Audio/Effects/glass_break1.ogg
|
||||
@@ -160,7 +162,9 @@
|
||||
resistances: metallicResistances
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
20:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 20
|
||||
behaviors:
|
||||
- !type:PlaySoundBehavior
|
||||
sound: /Audio/Effects/metalbreak.ogg
|
||||
|
||||
@@ -11,13 +11,17 @@
|
||||
amount: 5
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
5:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 5
|
||||
behaviors:
|
||||
- !type:PlaySoundCollectionBehavior
|
||||
soundCollection: GlassBreak
|
||||
- !type:DoActsBehavior
|
||||
acts: [ "Breakage" ]
|
||||
10:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 10
|
||||
behaviors:
|
||||
- !type:PlaySoundCollectionBehavior
|
||||
soundCollection: GlassBreak
|
||||
|
||||
@@ -25,7 +25,9 @@
|
||||
- type: Damageable
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
10:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 10
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
@@ -57,7 +59,9 @@
|
||||
- type: Damageable
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
10:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 10
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
@@ -89,7 +93,9 @@
|
||||
- type: Damageable
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
10:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 10
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
@@ -120,7 +126,9 @@
|
||||
- type: Damageable
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
50:
|
||||
- trigger:
|
||||
!type:TotalDamageTrigger
|
||||
damage: 50
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
|
||||
Reference in New Issue
Block a user