I am trying to get the player to rest as part of a larger action (specifically I'm trying to make a player AI). I clearly don't understand the resting pathway in the code.
Actual question: How do you initiate player resting from the code?So far I found engine.interface.PlayerRest, which seems to be what I want. However, if I call PlayerRest.initRest() it calls PlayerRest.checkRest(), which is defined as:
Code:
function _M:restCheck()
return false, "player:restCheck() method not defined"
end
Which is clearly wrong (and provides a misleading error message). I am in the process of trying to superload it with a call to mod.class.Player:restCheck(), but I can't seem to effect PlayerRest at all. Is it impossible to superload/overload engine files?
Actual question: How do you initiate player resting from the code?If it helps, here is the current contents of my superload/engine/interface/PlayerRest.lua:
Code:
local Player = require "mod.class.Player"
local _M = loadPrevious(...)
function _M:restCheck()
game.log("#RED#overload functional") -- Just so I can see an effect in the console
return Player.restCheck()
end
return _M
_________________
Currently developing the
Player AI addon. You can get it from the
T-Engine Addon Hub or
SteamYou can also
view the source code.