Lua: new hooks and some additions
Additions:
-
"KartHyudoro", prototypefunction(player_t player, player_t target [may be nil], boolean sink). return valuesint (player ID), boolean (force sink).- Allows coders to change Hyudoro's stealing and sink behaviours.
- Usage examples: return
-1to prevent stealing. return-1, trueto force a sink. return#targetto steal fromtarget.
-
"KartStealBumper", prototypefunction(player_t player, player_t target, boolean force). return valuesboolean (override behavior), boolean (set force).- Allows coders to change
K_StealBumper's behaviour in Battle, namely how bumper stealing should behave by Sneakers, Karma Bombs and the like. - Usage examples: return
trueto prevent stealing. returnfalse, trueto force bumpers to be stolen despite ofplayer's bumper count being zero.
- Allows coders to change
-
"KartSneaker", prototypefunction(player_t player, int type), return valueboolean (override behavior).- Allows coders to change
K_DoSneaker's behaviour. Can be used to prevent certain types of Sneaker usage, or be used as a way to make Sneakers stronger, weaker, etc., without the need of elaborate hacks. - Usage example: return
trueto prevent Sneaker usage.
- Allows coders to change
-
"PlayerItemUse", prototypefunction(player_t player, kartitems_t itemType, boolean wasHoldingItem), return valuesboolean (override behaviour), boolean (force item use).- Allows coders to know which item was used by which player, and if it's being dragged/orbited vs. being thrown or used (through checking
wasHoldingItem). Also allows coders to override item behavior. - Usage examples: return
false, trueto allow items such as Springs to be used in mid-air.
- Allows coders to know which item was used by which player, and if it's being dragged/orbited vs. being thrown or used (through checking
-
"MobjScaleChange", prototypefunction(mobj_t mobj, fixed_t newscale, fixed_t oldscale), return valueboolean (override behavior)- Allows coders to override
P_SetScaleby letting them stop scaling effects or do things according to scaling differences. This hook acts on a per-frame basis and fires every framemobj's size changes.
- Allows coders to override
Changes:
-
"MobjCollide"and"MobjMoveCollide"now includefixed_t desx, fixed_t desy, thus their prototypes now arefunction(thing, tmthing, desx, desy).- This was done because the results of collision calculations does not always reflect the mobj's current position + momentum. This allows for better handling of collisions without having the coder doing the blunt of calculations themself.
Build: srb2kart_morehooksjug.exe (32-bit)
Lua example: newhookstest.lua (remove the comment in the Mobj(Move)Collide hooks to see the prints).
Let me know if anything could be changed.
Edited by JugadorXEI