The Newest Furry Race [Skeletons] (#7825)
Co-authored-by: Moony <moonheart08@users.noreply.github.com> Co-authored-by: Kara <lunarautomaton6@gmail.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -83,11 +83,20 @@ namespace Content.Server.Body.Components
|
||||
}
|
||||
}
|
||||
|
||||
public override void Gib(bool gibParts = false)
|
||||
public override HashSet<EntityUid> Gib(bool gibParts = false)
|
||||
{
|
||||
base.Gib(gibParts);
|
||||
var gibs = base.Gib(gibParts);
|
||||
|
||||
SoundSystem.Play(Filter.Pvs(Owner), _gibSound.GetSound(), _entMan.GetComponent<TransformComponent>(Owner).Coordinates, AudioHelpers.WithVariation(0.025f));
|
||||
var xform = _entMan.GetComponent<TransformComponent>(Owner);
|
||||
var coordinates = xform.Coordinates;
|
||||
|
||||
// These have already been forcefully removed from containers so run it here.
|
||||
foreach (var part in gibs)
|
||||
{
|
||||
_entMan.EventBus.RaiseLocalEvent(part, new PartGibbedEvent(Owner, gibs));
|
||||
}
|
||||
|
||||
SoundSystem.Play(Filter.Pvs(Owner, entityManager: _entMan), _gibSound.GetSound(), coordinates, AudioHelpers.WithVariation(0.025f));
|
||||
|
||||
if (_entMan.TryGetComponent(Owner, out ContainerManagerComponent? container))
|
||||
{
|
||||
@@ -96,18 +105,41 @@ namespace Content.Server.Body.Components
|
||||
foreach (var ent in cont.ContainedEntities)
|
||||
{
|
||||
cont.ForceRemove(ent);
|
||||
_entMan.GetComponent<TransformComponent>(ent).Coordinates = _entMan.GetComponent<TransformComponent>(Owner).Coordinates;
|
||||
_entMan.GetComponent<TransformComponent>(ent).Coordinates = coordinates;
|
||||
ent.RandomOffset(0.25f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_entMan.EventBus.RaiseLocalEvent(Owner, new BeingGibbedEvent(), false);
|
||||
_entMan.EventBus.RaiseLocalEvent(Owner, new BeingGibbedEvent(gibs), false);
|
||||
_entMan.QueueDeleteEntity(Owner);
|
||||
|
||||
return gibs;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class BeingGibbedEvent : EntityEventArgs
|
||||
{
|
||||
public readonly HashSet<EntityUid> GibbedParts;
|
||||
|
||||
public BeingGibbedEvent(HashSet<EntityUid> gibbedParts)
|
||||
{
|
||||
GibbedParts = gibbedParts;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An event raised on all the parts of an entity when it's gibbed
|
||||
/// </summary>
|
||||
public sealed class PartGibbedEvent : EntityEventArgs
|
||||
{
|
||||
public EntityUid EntityToGib;
|
||||
public readonly HashSet<EntityUid> GibbedParts;
|
||||
|
||||
public PartGibbedEvent(EntityUid entityToGib, HashSet<EntityUid> gibbedParts)
|
||||
{
|
||||
EntityToGib = entityToGib;
|
||||
GibbedParts = gibbedParts;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
35
Content.Server/Body/Components/BodyReassembleComponent.cs
Normal file
35
Content.Server/Body/Components/BodyReassembleComponent.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System.Threading;
|
||||
using Content.Server.Cloning;
|
||||
using Content.Shared.Actions.ActionTypes;
|
||||
|
||||
namespace Content.Server.Body.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
public sealed class BodyReassembleComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The dna entry used for reassembling the skeleton
|
||||
/// updated before the entity is gibbed.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public ClonerDNAEntry? DNA = null;
|
||||
|
||||
/// <summary>
|
||||
/// The default time it takes to reassemble itself
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("delay")]
|
||||
public float DoAfterTime = 5f;
|
||||
|
||||
/// <summary>
|
||||
/// The list of body parts that are needed for reassembly
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public HashSet<EntityUid>? BodyParts = null;
|
||||
|
||||
[DataField("action")]
|
||||
public InstantAction? ReassembleAction = null;
|
||||
|
||||
public CancellationTokenSource? CancelToken = null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user