object break sounds (#477)

This commit is contained in:
L.E.D
2019-11-28 08:37:03 -05:00
committed by Pieter-Jan Briers
parent 45567c7acc
commit c213fa8cdf
3 changed files with 10 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
using Content.Server.GameObjects.EntitySystems; using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces; using Content.Server.Interfaces;
using Content.Shared.GameObjects; using Content.Shared.GameObjects;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Random; using Robust.Shared.Interfaces.Random;
@@ -35,6 +36,7 @@ namespace Content.Server.GameObjects.Components.Destructible
public DamageType damageType = DamageType.Total; public DamageType damageType = DamageType.Total;
public int damageValue = 0; public int damageValue = 0;
public string spawnOnDestroy = ""; public string spawnOnDestroy = "";
public string destroySound = "";
public bool destroyed = false; public bool destroyed = false;
ActSystem _actSystem; ActSystem _actSystem;
@@ -46,6 +48,7 @@ namespace Content.Server.GameObjects.Components.Destructible
serializer.DataField(ref damageValue, "thresholdvalue", 100); serializer.DataField(ref damageValue, "thresholdvalue", 100);
serializer.DataField(ref damageType, "thresholdtype", DamageType.Total); serializer.DataField(ref damageType, "thresholdtype", DamageType.Total);
serializer.DataField(ref spawnOnDestroy, "spawnondestroy", ""); serializer.DataField(ref spawnOnDestroy, "spawnondestroy", "");
serializer.DataField(ref destroySound, "destroysound", "");
} }
public override void Initialize() public override void Initialize()
@@ -68,6 +71,12 @@ namespace Content.Server.GameObjects.Components.Destructible
{ {
destroyed = true; destroyed = true;
_actSystem.HandleDestruction(Owner, true); _actSystem.HandleDestruction(Owner, true);
if(destroySound != string.Empty)
{
_entitySystemManager.GetEntitySystem<AudioSystem>().Play(destroySound, Owner);
}
} }
} }

Binary file not shown.

View File

@@ -286,6 +286,7 @@
- type: Destructible - type: Destructible
thresholdvalue: 100 thresholdvalue: 100
spawnondestroy: girder spawnondestroy: girder
destroysound: /Audio/effects/metalbreak.ogg
- type: IconSmooth - type: IconSmooth
key: walls key: walls
base: solid base: solid