This branch exposes botvars_t
, botcontroller_t
and bot functions to Lua. It changes the following:
botvars_t
as part of player_t
(as botvars
, get/noset):
style
, difficulty
, diffincrease
, rival
, rubberband
, itemdelay
, itemconfirm
, turnconfirm
, spindashconfirm
, respawnconfirm
, roulettepriority
, roulettetimeout
valid
botcontroller_t
as part of sector_t
(as botcontroller
, get/noset):
valid
, trick
, flags
, forceangle
k_bot.h
constants: MAXBOTDIFFICULTY
, DIFFICULTBOT
, BOTTURNCONFIRM
, BOTSPINDASHCONFIRM
, BOTRESPAWNCONFIRM
and BOT_ITEM_DECISION_TIME
botStyle_e
: BOT_STYLE_NORMAL
, BOT_STYLE_STAY
and BOT_STYLE__MAX
botItemPriority_e
: BOT_ITEM_PR__FALLBACK
, BOT_ITEM_PR_NEUTRAL
, BOT_ITEM_PR_FRONTRUNNER
, BOT_ITEM_PR_SPEED
, BOT_ITEM_PR__OVERRIDES
, BOT_ITEM_PR_RINGDEBT
, BOT_ITEM_PR_POWER
, BOT_ITEM_PR_SPB
and BOT_ITEM_PR__MAX
textmapbotcontroller_t
: TMBOT_NORUBBERBAND
, TMBOT_NOCONTROL
, TMBOT_FORCEDIR
and TMBOT_FASTFALL
textmapbottrick_t
: TMBOTTR_NONE
, TMBOTTR_LEFT
, TMBOTTR_RIGHT
, TMBOTTR_UP
and TMBOTTR_DOWN
boolean K_PlayerUsesBotMovement(player_t player)
boolean K_BotCanTakeCut(player_t player)
botcontroller_t K_GetBotController(mobj_t mobj)
fixed_t K_BotMapModifier()
fixed_t K_BotRubberband(player_t player)
fixed_t K_UpdateRubberband(player_t player)
fixed_t K_DistanceOfLineFromPoint(fixed_t v1x, fixed_t v1y, fixed_t v2x, fixed_t v2y, fixed_t cx, fixed_t cy)
boolean, player_t K_AddBot(int/string skin, int difficulty, botStyle_e style)
(boolean indicates whether the bot was created successfully. If true, the second returned value will be the bot player_t, otherwise it is nil).void K_SetNameForBot(player_t player, string name)
void K_RemoveBot(player_t player)
"PlayerUsesBotMovement"
: function(player_t player)
. Controls whether the given player will be using bot movement or not. return true
for forced bot movement, return false
to force remove bot movement. The podium sequence's bot movement cannot be overriden. player
is read-only."BotJoin"
: function(player_t player)
. Triggers when a bot joins the game (GP, Match Race, Lua...), as well as when a bot gets replaced during GP.botvars.style
not being part of G_PlayerReborn
, as well as not being archived and unarchived before.Testing environment: ringracers_botVarsLib.exe -console -skipintro -warp RR_TESTRUN +addfile botvars.lua
A script was used, botvars.lua, to test the following additions:
botvars_t
values, and if in a sector with a bot controller, then all of the applicable botcontroller_t
values (from K_GetBotController
), as well as the values from K_PlayerUsesBotMovement
, K_BotCanTakeCut
, K_BotRubberband
and K_UpdateRubberband
. Can by controlled by the botvarshuddebug
cvar.MapLoad
that prints the complexity of the level using K_BotMapModifier
addbot [skin] [difficulty] [style] [customname]
that allows to create a bot with the specified parameters, with customname
as an optional parameter.removebot [node]
that removes a bot by node.changebotname [node] [name]
to change a bot's name.lethargicplay
that enables bot movement on the toggling player.setbotvalue [node] [variable] [value]
to set a specific value on a bot's botvars variables.setallbotsvalue [variable] [value]
to set a value to a variable in all bots' botvars.v1finish
that disables bot movement on all players at the end of a race. (Note: it's likely just better to set the bot style to BOT_STYLE_STAY
here - this is just a demonstration of the "PlayerUsesBotMovement" hook).botvars
member from player_t
, as well as various functions related to bots.botcontroller
member from sector_t
(as well as being used as part of K_GetBotController(mobj_t mobj)
)PlayerUsesBotMovement
: function(player_t player)
. Return true to force bot movement, return false to force disable bot movement.BotJoin
: function(player_t player)
. Triggers when a bot joins the game or gets replaced in Grand Prix.