Skip to content

More Lua stuff + PlayerCmd hook

Latapostrophe requested to merge expose-more-lua-stuff into next

Hey now I guess Lua has some more neat thingies:

  • "freeplay" and "battlerankingsbumpers" are now part of the hud library. They respectively can toggle the FREE PLAY text and the bumpers in the rankings HUD in battle mode.
  • the K_Play(action goes here)Taunt functions have been exposed to Lua.
  • v.drawKartString is now avaiable in Lua. (Though there is no alignment option)

Most important of all is the addition of the "PlayerCmd" hook. This Hook functions similar to BotTicCmd, taking player and cmd as args. Within this Hook, only 'cmd' may be altered and trying to alter anything else (or call certain functions) will error in a similar way as HUD rendering. This Hook in particular needs testing and thoughts to make sure that nothing will break from using it.

Here's a sample code for the Hook:

	cmd.forwardmove = 50<<FRACBITS>>16	-- forces the player to always accelerate
	P_Random()	-- this errors.
end)```
Edited by Latapostrophe

Merge request reports