behaviours/leash.lua
12345678910
Leash = Class(BehaviourNode, function(self, inst, homelocation, max_dist, inner_return_dist)
BehaviourNode._ctor(self, "Leash")
self.homepos = homelocation
self.maxdist = max_dist
self.inst = inst
self.returndist = inner_return_dist
self.walking = false
end)
12345678910
Leash = Class(BehaviourNode, function(self, inst, homelocation, max_dist, inner_return_dist, running)
BehaviourNode._ctor(self, "Leash")
self.homepos = homelocation
self.maxdist = max_dist
self.inst = inst
self.returndist = inner_return_dist
self.running = running or false
end)
24252627282930
end
elseif self.status == RUNNING then
if self:IsOutsideReturnDist() then
self.inst.components.locomotor:GoToPoint(self:GetHomePos())
else
self.status = SUCCESS
end
24252627282930
end
elseif self.status == RUNNING then
if self:IsOutsideReturnDist() then
self.inst.components.locomotor:GoToPoint(self:GetHomePos(), nil, self.running)
else
self.status = SUCCESS
end