Drop items on entering dead or crit states (#1082)

* Drop items on dead or crit
This commit is contained in:
Víctor Aguilera Puerto
2020-06-07 16:48:53 +02:00
committed by GitHub
parent 21c41f28ed
commit 952fa9f7ed
7 changed files with 36 additions and 24 deletions

View File

@@ -38,7 +38,7 @@ namespace Content.Server.Mobs
.PlayFromEntity(AudioHelpers.GetRandomFileFromSoundCollection("bodyfall"), entity, AudioHelpers.WithVariation(0.25f));
if(dropItems)
DropAllItemsInHands(entity);
DropAllItemsInHands(entity, false);
return true;
}
@@ -61,13 +61,13 @@ namespace Content.Server.Mobs
return true;
}
public static void DropAllItemsInHands(IEntity entity)
public static void DropAllItemsInHands(IEntity entity, bool doMobChecks = true)
{
if (!entity.TryGetComponent(out IHandsComponent hands)) return;
foreach (var heldItem in hands.GetAllHeldItems())
{
hands.Drop(heldItem.Owner);
hands.Drop(heldItem.Owner, doMobChecks);
}
}
}