Skip to content

Draft: Add Lua conditions for custom unlockable systems and expose 'info panel' at escape (pause) menu.

Skydusk requested to merge Acelite/SRB2:conditionslua into next

This merge was mainly designed only for map pack makers with Lua experience (This would help MRCE). Currently, it is entirely possible to circumvent the lack of Lua support with executors, which in my opinion is silly and unnecessary. So instead of hacky ways, I offer this "unintrusive" method. While I don't think 128 IDs will be used in most cases, having more IDs could give "None" type more value by signalling custom unlockables made outside of the vanilla system without involving another menu in "game" hud space.

I understand that the team doesn't want to deal with menu modification, however, based on recently merged 'player setup' and 'continue' hooks, similarly inspired I decided to add 'escpanel' hud space to info panel you can find in escape pause menu to allow signalization of custom unlockables found in the level mainly. Also to fill the gap that disabling "tabemblems" hud item does, I took liberty to add emblems, numemblems, numextraemblems.

SOC/MainCFG/Conditions:

  • LUA [id (1 - 128)]: Used in tandem with the G_UnlockCondition to fulfill these conditions.

Lua:

Function Return value(s) Description
G_UnlockCondition(int id, bool global) nil Unlocks one lua condition indexed by id (1 - 128) that might trigger unlock based on already defined condition sets. global is boolean that unlocks the condition in gamedata of server-side (like levels in level select).
Name Variable type Accessibility Description
emblems number Read-only Returns current number of collected emblems
numemblems number Read-only Returns total amount of normal emblems
numextraemblems number Read-only Returns total amount of extra emblems

Lua hud:

Hook name Function format Description
"escpanel" function(drawer v, int x, int y, int width, int height) The function is run when "pause" menu's panel exists. Returning true in this function causes the game not to render level information found in the panel.

- x, y, width, height are all parameters of info panel's fill.

Lua test - luatestgamedatalua.pk3

info panel Test condition unlock test
srb20881 srb21550

Temp draft right now, to see what should I remove/change/fix/add.

Merge request reports