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