I made the following simplistic load hook:
local KeyBind = require "engine.KeyBind"
local Player = require "mod.class.Player"
class:bindHook("ToME:run", function(self, data)
TOGGLE_PLAYER_AI = function()
game.log("#GOLD#Player AI Toggle requested!")
game.log("#GOLD#Player AI is: %s", Player:ai_active and "#LIGHT_GREEN#enabled" or "#LIGHT_RED#disabled")
If I don't comment out the "require Player" line, the mod crashes between character selection and loading the first level. It gets to 100% and then just doesn't start the game. I have otherwise tested the mod and I can get the keybind to toggle a local boolean, but I'd like to have access to the Player class so I can activate a sort of "autoexplore"-like function.
The Player:ai_active boolean and the Player:player_ai_start() functions are things I added in a superload. Is that confusing the load order and trying to parse functions that don't exist yet? How can I work around that?
I can post the superload/mod/class/Player.lua too if that's relevant.
Currently developing the Player AI addon
. You can get it from the T-Engine Addon Hub
You can also view the source code