Quantcast
Channel: [Don't Starve Together] Suggestions and Feedback Latest Topics
Viewing all articles
Browse latest Browse all 7901

How to fix mobs doing nothing after embarking

$
0
0

Mobs neither continue or abort buffered actions upon embarking, which leads to them standing idle until interrupted. For example, Sea Striders will be idle for 15 seconds after jumping off a platform to eat a fish. I assume this timeout was added specifically for that issue.

This can be fixed by adding this to behaviours/doaction:

Quote

function DoAction:Visit()
    if self.status == RUNNING and self.inst.sg:HasStateTag("idle") then
        self.status = READY --try again if we're idle for some reason...
    end

    
    if self.status == READY then
        local action = self.getactionfn(self.inst)
    
        if action then
            action:AddFailAction(function() self:OnFail() end)
            action:AddSuccessAction(function() self:OnSucceed() end)
            self.pendingstatus = nil
            self.inst.components.locomotor:PushAction(action, self.shouldrun)
            self.action = action
            self.time = GetTime()
            self.status = RUNNING
        else
            self.status = FAILED
        end
    end
    
    if self.status == RUNNING then
        if self.timeout and (GetTime() - self.time > self.timeout) then
            self.status = FAILED
            --print("Action timed out, failing")
        end
    
        if self.pendingstatus then
            self.status = self.pendingstatus
        elseif not self.action:IsValid() then
            self.status = FAILED
        end
    end    
end

 


Viewing all articles
Browse latest Browse all 7901

Trending Articles