Code: Select all
local KeyBind = require "engine.KeyBind"
local Player = require "mod.class.Player"
class:bindHook("ToME:run", function(self, data)
KeyBind:load("toggle-player-ai")
game.key:addBinds {
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")
Player:player_ai_start()
end
}
end)
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.