Adds ISuicideAct and support for Held Item and Environmental suicides (#1010)

This commit is contained in:
Leo
2020-05-27 20:05:12 -03:00
committed by GitHub
parent a77c1125ce
commit 312ec5760c
6 changed files with 166 additions and 9 deletions

View File

@@ -189,12 +189,13 @@ namespace Content.Server.BodySystem {
}
/// <summary>
/// Disconnects the given BodyPart reference, potentially dropping other BodyParts if they were hanging off it.
/// Disconnects the given BodyPart reference, potentially dropping other BodyParts if they were hanging off it.
/// </summary>
public void DisconnectBodyPart(BodyPart part, bool dropEntity)
/// <returns>Returns the dropped entity, or null if no part is dropped</returns>
public IEntity DisconnectBodyPart(BodyPart part, bool dropEntity)
{
if (!_partDictionary.ContainsValue(part))
return;
return null;
if (part != null)
{
string slotName = _partDictionary.FirstOrDefault(x => x.Value == part).Key;
@@ -213,8 +214,10 @@ namespace Content.Server.BodySystem {
{
var partEntity = Owner.EntityManager.SpawnEntity("BaseDroppedBodyPart", Owner.Transform.GridPosition);
partEntity.GetComponent<DroppedBodyPartComponent>().TransferBodyPartData(part);
return partEntity;
}
}
return null;
}
/// <summary>