Entities/Player.ActionInput.cs

Partial Player class handling action/ability input state. It defines flags for suppressing actions, computes derived properties (Ability1Held, Ability1Just, Ability1InputSuppressed, Ability2Just) based on internal suppression flags and an underlying _input and InputState, and provides methods to begin input ticks and suppress actions during control switches.

namespace BlockParty;

// Compiled by the game and control-switch regression tests.
public sealed partial class Player
{
	private bool _actionsSuppressed, _ability1NeedsRelease;
	internal bool Ability1Held => !_actionsSuppressed && !_ability1NeedsRelease && _input.Ability1Held;
	internal bool Ability1Just => !_actionsSuppressed && !_ability1NeedsRelease && _input.Ability1Just;
	internal bool Ability1InputSuppressed => _actionsSuppressed || _ability1NeedsRelease
		|| ReferenceEquals( _input, NullPlayerInput.Instance );
	internal bool Ability2Just => !_actionsSuppressed && _input.Ability2Just;

	internal void BeginControlInputTick()
	{
		_actionsSuppressed = false;
		// Check the pair's recorded source even while this body is inactive or death-handoff suppressed.
		if ( !InputState.Ability1Held && !InputState.Ability1Just ) _ability1NeedsRelease = false;
	}

	internal void SuppressActionsForControlSwitch()
	{
		_actionsSuppressed = true;
		_jumpBufferCounter = 0;
		_ability1NeedsRelease = InputState.Ability1Held || InputState.Ability1Just;
	}
}