Downloads containing mixSharedVisibility.asc

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Characters Cranky Mutator N/A Download file

File preview

namespace mixSharedVisibility
{
	const int REASON_MIX_HIDE = 1;
	const int REASON_CHAR_SCALE = 2;
	const int REASON_CHAR_DEVAN = 4;

	array<int> reasons(32, 0);
	bool characterSystemHandlesHide = false;
	int characterSystemHandlesHideTick = -1;

	void SetReason(int playerID, int reason, bool active)
	{
		if(playerID < 0 || playerID >= int(reasons.length)) return;
		if(active)
			reasons[playerID] |= reason;
		else
			reasons[playerID] &= ~reason;
	}

	bool IsHidden(int playerID)
	{
		if(playerID < 0 || playerID >= int(reasons.length)) return false;
		return reasons[playerID] != 0;
	}

	bool HasReason(int playerID, int reason)
	{
		if(playerID < 0 || playerID >= int(reasons.length)) return false;
		return (reasons[playerID] & reason) != 0;
	}

	void SetCharacterSystemHandlesHide(bool active)
	{
		characterSystemHandlesHide = active;
		characterSystemHandlesHideTick = jjGameTicks;
	}

	bool CharacterSystemHandlesHide()
	{
		return characterSystemHandlesHide && jjGameTicks <= characterSystemHandlesHideTick + 1;
	}

	void Apply(jjPLAYER@ play)
	{
		play.invisibility = IsHidden(play.playerID);
	}
}