Skip to content

Draft: Custom Item Support Attempt + Add ItemHeldThinker Hook

Jisk requested to merge Jisk/RingRacers:customitem_attempt into master

unfinished, would appreciate feedback since I don't know if i made weird design choices

New things

New helper functions. A few replace older code. All have been exposed to Lua

K_PlayerHasItemOut(player_t *player) : Checks if the player has an item out, EX: Orbinaut spawning.

K_AffectedByHyuduro(player_t *player) : Checks if the player is being affected by an hyuduro item; item being stolen or given.

K_PlayerAttackWasPressed(player_t *player): Checks if the attack/item_use button was pressed on the current frame, but not the last.

K_IsGenericItemUsable(player_t *player): Returns true if item isn't out and not affected by a hyuduro.

Added New "ItemHeldThinker" Hook

this is for overwriting existing item behavior, or making new behavior for a lua defined item

Hook format: addHook("ItemHeldThinker", functionname, KITEM_ITEMTYPE)

Function format: function(player player_t)

Function return value: Boolean (override default behavior?)

Examples

itemusetest.lua ringracers0025

Checklist

  • Expose IF_ constants

  • Open gaps in kartitems_t enum (freeslot gaps)

  • Allow for modders to configurate their item through a function table (K_RegisterItem). another lib_cvRegisterVar copy and paste :]

  • Make game generate luaitem_ constants from identifier when using K_RegisterItem

  • fix give command, and debugitem cvar

  • add support for item tinyicons

  • automatically generate luaitem_ cvars when K_RegisterItem is used. (you cannot register cvars that start with "luaitem_" normally)

  • Fix invalid sprite frame error in battle power ups.

  • support item capsules for custom items (through stringarg1)

  • support item drops

  • add custom items in the item toggle menu as a sub menu (V button to swap menus)

  • allow users to make a progress bar on the item hud for their custom items, much like rocket sneakers and ballhog.

Edited by Jisk

Merge request reports

Loading