local ____exports = __module.env ____exports.BTCondition = __TS__DefineClass("BTCondition", __module) local BTCondition = ____exports.BTCondition BTCondition.name = "BTCondition" function BTCondition.prototype.____constructor(self, check) self.check = check end function BTCondition.prototype.Tick(self, ctx) return self.check(ctx) and 0 or 1 end function BTCondition.prototype.Reset(self) end ____exports.BTAction = __TS__DefineClass("BTAction", __module) local BTAction = ____exports.BTAction BTAction.name = "BTAction" function BTAction.prototype.____constructor(self, action) self.action = action end function BTAction.prototype.Tick(self, ctx) return self.action(ctx) end function BTAction.prototype.Reset(self) end ____exports.BTSequence = __TS__DefineClass("BTSequence", __module) local BTSequence = ____exports.BTSequence BTSequence.name = "BTSequence" function BTSequence.prototype.____constructor(self, children) self.runningIndex = 0 self.children = children end function BTSequence.prototype.Tick(self, ctx) while self.runningIndex < #self.children do local status = self.children[self.runningIndex + 1]:Tick(ctx) if status == 2 then return 2 end if status == 1 then self:Reset() return 1 end self.runningIndex = self.runningIndex + 1 end self:Reset() return 0 end function BTSequence.prototype.Reset(self) self.runningIndex = 0 do local i = 0 while i < #self.children do self.children[i + 1]:Reset() i = i + 1 end end end ____exports.BTSelector = __TS__DefineClass("BTSelector", __module) local BTSelector = ____exports.BTSelector BTSelector.name = "BTSelector" function BTSelector.prototype.____constructor(self, children) self.runningIndex = 0 self.children = children end function BTSelector.prototype.Tick(self, ctx) while self.runningIndex < #self.children do local status = self.children[self.runningIndex + 1]:Tick(ctx) if status == 2 then return 2 end if status == 0 then self:Reset() return 0 end self.runningIndex = self.runningIndex + 1 end self:Reset() return 1 end function BTSelector.prototype.Reset(self) self.runningIndex = 0 do local i = 0 while i < #self.children do self.children[i + 1]:Reset() i = i + 1 end end end ____exports.BTInverter = __TS__DefineClass("BTInverter", __module) local BTInverter = ____exports.BTInverter BTInverter.name = "BTInverter" function BTInverter.prototype.____constructor(self, child) self.child = child end function BTInverter.prototype.Tick(self, ctx) local st = self.child:Tick(ctx) if st == 0 then return 1 end if st == 1 then return 0 end return 2 end function BTInverter.prototype.Reset(self) self.child:Reset() end ____exports.BTCooldown = __TS__DefineClass("BTCooldown", __module) local BTCooldown = ____exports.BTCooldown BTCooldown.name = "BTCooldown" function BTCooldown.prototype.____constructor(self, child, cooldownSeconds) self.lastSuccessTime = -9999 self.child = child self.cooldownSeconds = cooldownSeconds end function BTCooldown.prototype.Tick(self, ctx) if ctx.time - self.lastSuccessTime < self.cooldownSeconds then return 1 end local st = self.child:Tick(ctx) if st == 0 then self.lastSuccessTime = ctx.time end return st end function BTCooldown.prototype.Reset(self) self.child:Reset() end function __module.UpdateImports() end