Basic gibbing (#2973)

* Adds gibbing

* Adds adminbused absurd-damage foamblade

* Sane parts

* BaseOrgan -> BaseMechanism

* Do not do random offset on shared, fix killing oneself with click attacks

* BaseMechanism -> BaseHumanOrgan -> *stuff*

* Account for prediction, again

* Add gibbing sound
This commit is contained in:
Vera Aguilera Puerto
2021-01-10 20:12:34 +01:00
committed by GitHub
parent 8def38aed4
commit 12c733654c
18 changed files with 172 additions and 29 deletions

View File

@@ -1,15 +1,20 @@
#nullable enable
using System;
using Content.Server.Commands.Observer;
using Content.Shared.Audio;
using Content.Shared.GameObjects.Components.Body;
using Content.Shared.GameObjects.Components.Body.Part;
using Content.Shared.GameObjects.Components.Damage;
using Content.Shared.GameObjects.Components.Mobs.State;
using Content.Shared.GameObjects.Components.Movement;
using Content.Shared.Utility;
using Robust.Server.GameObjects.Components.Container;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Server.Interfaces.Console;
using Robust.Server.Interfaces.Player;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Players;
@@ -41,6 +46,7 @@ namespace Content.Server.GameObjects.Components.Body
base.OnRemovePart(slot, part);
_partContainer.ForceRemove(part.Owner);
part.Owner.RandomOffset(0.25f);
}
public override void Initialize()
@@ -88,5 +94,29 @@ namespace Content.Server.GameObjects.Components.Body
new Ghost().Execute(shell, (IPlayerSession) session, Array.Empty<string>());
}
}
public override void Gib(bool gibParts = false)
{
base.Gib(gibParts);
EntitySystem.Get<AudioSystem>()
.PlayAtCoords(AudioHelpers.GetRandomFileFromSoundCollection("gib"), Owner.Transform.Coordinates,
AudioHelpers.WithVariation(0.025f));
if (Owner.TryGetComponent(out ContainerManagerComponent? container))
{
foreach (var cont in container.GetAllContainers())
{
foreach (var ent in cont.ContainedEntities)
{
cont.ForceRemove(ent);
ent.Transform.Coordinates = Owner.Transform.Coordinates;
ent.RandomOffset(0.25f);
}
}
}
Owner.Delete();
}
}
}