Crawling Part 1: The Knockdownening (#36881)
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com> Co-authored-by: ScarKy0 <scarky0@onet.eu>
This commit is contained in:
committed by
GitHub
parent
cfb0a95035
commit
dec2d42a1d
@@ -36,6 +36,7 @@ public abstract partial class SharedHandsSystem
|
||||
InitializeDrop();
|
||||
InitializePickup();
|
||||
InitializeRelay();
|
||||
InitializeEventListeners();
|
||||
|
||||
SubscribeLocalEvent<HandsComponent, ComponentInit>(OnInit);
|
||||
SubscribeLocalEvent<HandsComponent, MapInitEvent>(OnMapInit);
|
||||
@@ -166,6 +167,26 @@ public abstract partial class SharedHandsSystem
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Does this entity have any empty hands, and how many?
|
||||
/// </summary>
|
||||
public int GetEmptyHandCount(Entity<HandsComponent?> entity)
|
||||
{
|
||||
if (!Resolve(entity, ref entity.Comp, false) || entity.Comp.Count == 0)
|
||||
return 0;
|
||||
|
||||
var hands = 0;
|
||||
|
||||
foreach (var hand in EnumerateHands(entity))
|
||||
{
|
||||
if (!HandIsEmpty(entity, hand))
|
||||
continue;
|
||||
hands++;
|
||||
}
|
||||
|
||||
return hands;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to retrieve the item held in the entity's active hand.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user