A listener based API for use with Shotgun King: The Final Checkmate by PUNKCAKE Delicieux. This allows easier creation of mods, as well as adding a few nice to haves.
As a note, doing this will require knowledge in both lua and SGK's base functions
- Copy the template mod into your mod folder.
- Rename the folder to your mod's name.
- Start Using JP_API!
- Copy the code from api.lua and mod.lua into your mode's lua file, outside of any functions.
- If you have custom logic in
get_weapons_list
orinitialize
, combine that with the copies in theJP_API CODE
. - Add the line
mod_setup()
into your mode'sstart
function. - Start using JP_API!
In the folder modules
in your mod (create it if it does not exist), create a file for your code.
In that file, create a function named start()
.
In that function, write your code!
To update the API, simply replace the JP_API CODE
section in your mode's code with the newest version at api.lua.
Here is an example that simply logs each time a few event occurs
...
-- logging.lua
function start()
add_listener("shot", function()
_log("PLAYER SHOT")
end)
add_listener("after_black", function()
_log("BLACK MOVE")
end)
add_listener("after_white", function()
_log("WHITE MOVE")
end)
end
...
For some more complete examples, check out the example mods.
Check out the docs for a much more complete explaination!
If you have any questions, feel free to ask in the Discord, or message me directily (JP12#1148)
Have fun!
- PUNKCAKE Delicieux for making SGK
- Glacies#5786 on discord for the fixes to the base game as well as various code for the API