---@type Tinkr local Tinkr, ---@class Bastion Bastion = ... -- Create an APL trait for the APL class ---@class Bastion.APLTrait ---@field cb fun(actor?: Bastion.APLActor.Table):boolean ---@field lastcall number local APLTrait = {} APLTrait.__index = APLTrait -- Constructor ---@param cb fun(actor?: Bastion.APLActor.Table):boolean ---@return Bastion.APLTrait function APLTrait:New(cb) local self = setmetatable({}, APLTrait) self.cb = cb self.lastcall = 0 return self end -- Evaulate the APL trait ---@param actor? Bastion.APLActor.Table ---@return boolean function APLTrait:Evaluate(actor) if GetTime() - self.lastcall > 0.1 then self.lastresult = self.cb(actor) self.lastcall = GetTime() return self.lastresult end return self.lastresult end -- tostring ---@return string function APLTrait:__tostring() return "Bastion.__APLTrait" end Bastion.APLTrait = APLTrait