Allow ai to understand if its handcuffed. (#30402)
* allow ai to understand if its handcuffed. * rerun tests they worky on local * Contained here in, a string of expletives about flaky tests. * on retrospect, default true is probably smorter. * do reviews * I forgor xml * more xml
This commit is contained in:
@@ -521,6 +521,25 @@ namespace Content.Shared.Cuffs
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the target is handcuffed.
|
||||
/// </summary>
|
||||
/// <param name="requireFullyCuffed">when true, return false if the target is only partially cuffed (for things with more than 2 hands)</param>
|
||||
/// <returns></returns>
|
||||
public bool IsCuffed(Entity<CuffableComponent> target, bool requireFullyCuffed = true)
|
||||
{
|
||||
if (!TryComp<HandsComponent>(target, out var hands))
|
||||
return false;
|
||||
|
||||
if (target.Comp.CuffedHandCount <= 0)
|
||||
return false;
|
||||
|
||||
if (requireFullyCuffed && hands.Count > target.Comp.CuffedHandCount)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempt to uncuff a cuffed entity. Can be called by the cuffed entity, or another entity trying to help uncuff them.
|
||||
/// If the uncuffing succeeds, the cuffs will drop on the floor.
|
||||
|
||||
Reference in New Issue
Block a user