mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Expose K_ForcedSPB and K_DenyShieldOdds to Lua
This commit is contained in:
parent
303df563c3
commit
a6c34c4ff2
3 changed files with 60 additions and 22 deletions
|
|
@ -566,19 +566,11 @@ UINT32 K_GetItemRouletteDistance(const player_t *player, UINT8 numPlayers)
|
|||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
static boolean K_DenyShieldOdds(kartitems_t item)
|
||||
boolean K_DenyShieldOdds(kartitems_t item)
|
||||
|
||||
Checks if this type of shield already exists in
|
||||
another player's inventory.
|
||||
|
||||
Input Arguments:-
|
||||
item - The item type of the shield.
|
||||
|
||||
Return:-
|
||||
Whether this item is a shield and may not be awarded
|
||||
at this time.
|
||||
See header file for description.
|
||||
--------------------------------------------------*/
|
||||
static boolean K_DenyShieldOdds(kartitems_t item)
|
||||
boolean K_DenyShieldOdds(kartitems_t item)
|
||||
{
|
||||
const INT32 shieldType = K_GetShieldFromItem(item);
|
||||
size_t i;
|
||||
|
|
@ -691,18 +683,9 @@ INT32 K_KartGetBattleOdds(const player_t *player, UINT8 pos, kartitems_t item)
|
|||
/*--------------------------------------------------
|
||||
static boolean K_ForcedSPB(const player_t *player, itemroulette_t *const roulette)
|
||||
|
||||
Determines special conditions where we want
|
||||
to forcefully give the player an SPB.
|
||||
|
||||
Input Arguments:-
|
||||
player - The player the roulette is for.
|
||||
roulette - The item roulette data.
|
||||
|
||||
Return:-
|
||||
true if we want to give the player a forced SPB,
|
||||
otherwise false.
|
||||
See header file for description.
|
||||
--------------------------------------------------*/
|
||||
static boolean K_ForcedSPB(const player_t *player, itemroulette_t *const roulette)
|
||||
boolean K_ForcedSPB(const player_t *player, itemroulette_t *const roulette)
|
||||
{
|
||||
if (K_ItemEnabled(KITEM_SPB) == false)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -278,6 +278,39 @@ void K_KartGetItemResult(player_t *const player, kartitems_t getitem);
|
|||
|
||||
UINT32 K_GetItemRouletteDistance(const player_t *player, UINT8 numPlayers);
|
||||
|
||||
/*--------------------------------------------------
|
||||
boolean K_DenyShieldOdds(kartitems_t item)
|
||||
|
||||
Checks if this type of shield already exists in
|
||||
another player's inventory.
|
||||
|
||||
Input Arguments:-
|
||||
item - The item type of the shield.
|
||||
|
||||
Return:-
|
||||
Whether this item is a shield and may not be awarded
|
||||
at this time.
|
||||
--------------------------------------------------*/
|
||||
|
||||
boolean K_DenyShieldOdds(kartitems_t item);
|
||||
|
||||
/*--------------------------------------------------
|
||||
boolean K_ForcedSPB(const player_t *player, itemroulette_t *const roulette)
|
||||
|
||||
Determines special conditions where we want
|
||||
to forcefully give the player an SPB.
|
||||
|
||||
Input Arguments:-
|
||||
player - The player the roulette is for.
|
||||
roulette - The item roulette data.
|
||||
|
||||
Return:-
|
||||
true if we want to give the player a forced SPB,
|
||||
otherwise false.
|
||||
--------------------------------------------------*/
|
||||
|
||||
boolean K_ForcedSPB(const player_t *player, itemroulette_t *const roulette);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -4350,6 +4350,26 @@ static int lib_kFillItemRouletteData(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kForcedSPB(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
INLEVEL
|
||||
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
|
||||
lua_pushboolean(L, K_ForcedSPB(player, &player->itemRoulette));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_kDenyShieldOdds(lua_State *L)
|
||||
{
|
||||
kartitems_t item = luaL_checkinteger(L, 1);
|
||||
INLEVEL
|
||||
lua_pushboolean(L, K_DenyShieldOdds(item));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_kWipeItemsInReel(lua_State *L)
|
||||
{
|
||||
player_t *player = NULL;
|
||||
|
|
@ -4798,6 +4818,8 @@ static luaL_Reg lib[] = {
|
|||
{"K_KartGetItemResult", lib_kKartGetItemResult},
|
||||
{"K_GetItemRouletteDistance", lib_kGetItemRouletteDistance},
|
||||
{"K_FillItemRouletteData", lib_kFillItemRouletteData},
|
||||
{"K_ForcedSPB", lib_kForcedSPB},
|
||||
{"K_DenyShieldOdds", lib_kDenyShieldOdds},
|
||||
// These are not real functions in k_roulette, but they allow
|
||||
// encapsulation on how the scripter interacts with the item reel.
|
||||
{"K_WipeItemsInReel", lib_kWipeItemsInReel},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue