GameState: Expose GetPlayerFailType() to Lua

FailType for a given Player can be overriden with respect to preferences, but
Lua has no way to check it. Expose a function to allow doing that, in order to
not accidentally submit invalid scores to GrooveStats.
This commit is contained in:
phantom10111
2025-01-02 13:39:46 +01:00
committed by teejusb
parent 6aa81a9dd2
commit 3266fda819
4 changed files with 13 additions and 0 deletions
+1
View File
@@ -926,6 +926,7 @@
<Function name='GetNumStagesLeft'/>
<Function name='GetPlayMode'/>
<Function name='GetPlayerDisplayName'/>
<Function name='GetPlayerFailType'/>
<Function name='GetPlayerState'/>
<Function name='GetPreferredDifficulty'/>
<Function name='GetPreferredSong'/>
+3
View File
@@ -3151,6 +3151,9 @@ end
<Function name='GetPlayerDisplayName' return='string' arguments='PlayerNumber pn'>
Returns the display name for player <code>pn</code>.
</Function>
<Function name='GetPlayerFailType' return='FailType' arguments='PlayerNumber pn' since='ITGmania 1.0.0'>
Returns the effective <Link class='ENUM' function='FailType' /> for player <code>pn</code>.
</Function>
<Function name='GetPlayerState' return='PlayerState' arguments='PlayerNumber pn'>
Returns the PlayerState for player <code>pn</code>.
</Function>
+8
View File
@@ -3357,6 +3357,13 @@ public:
p->m_autogen_fargs[si]= v;
COMMON_RETURN_SELF;
}
static int GetPlayerFailType(T* p, lua_State* L)
{
Enum::Push(L, p->GetPlayerFailType(Enum::Check<PlayerNumber>(L, 1)));
return 1;
}
static int prepare_song_for_gameplay(T* p, lua_State* L)
{
int result= p->prepare_song_for_gameplay();
@@ -3490,6 +3497,7 @@ public:
ADD_METHOD( SetStepsForEditMode );
ADD_METHOD( GetAutoGenFarg );
ADD_METHOD( SetAutoGenFarg );
ADD_METHOD( GetPlayerFailType );
ADD_METHOD(prepare_song_for_gameplay);
}
};
+1
View File
@@ -336,6 +336,7 @@ public:
bool PlayerIsUsingModifier( PlayerNumber pn, const RString &sModifier );
FailType GetPlayerFailType( const PlayerState *pPlayerState ) const;
FailType GetPlayerFailType( PlayerNumber pn ) const { return GetPlayerFailType( m_pPlayerState[pn] ); }
// character stuff
Character* m_pCurCharacters[NUM_PLAYERS];