Add unbuckling entities that are moved away from their straps (#1437)

* Add unbuckling entities that move away from their straps

* Remove range constraint from movement unbuckling check

* Fix setting the wrong positions when buckling

* Fix beds making you sleep for the rest of your life
This commit is contained in:
DrSmugleaf
2020-07-24 14:22:28 +02:00
committed by GitHub
parent be3db34d1c
commit 5e2109a2d6
3 changed files with 59 additions and 10 deletions

View File

@@ -17,11 +17,16 @@ namespace Content.Server.Mobs
/// <param name="entity">The mob in question</param>
/// <param name="playSound">Whether to play a sound when falling down or not</param>
/// <param name="dropItems">Whether to make the mob drop all the items on his hands</param>
/// <param name="force">Whether or not to check if the entity can fall.</param>
/// <returns>False if the mob was already downed or couldn't set the state</returns>
public static bool Down(IEntity entity, bool playSound = true, bool dropItems = true)
public static bool Down(IEntity entity, bool playSound = true, bool dropItems = true, bool force = false)
{
if (!EffectBlockerSystem.CanFall(entity) ||
!entity.TryGetComponent(out AppearanceComponent appearance))
if (!force && !EffectBlockerSystem.CanFall(entity))
{
return false;
}
if (!entity.TryGetComponent(out AppearanceComponent appearance))
{
return false;
}