Jump to content

Gnat's brain handles failing ACTIONS.INFEST in a fugly way


_zwb
  • DLC VERSION - IMPORTANT!: Hamlet Pending

In brains/gnatbrain.lua:

-- THIS IS GROSS.. why does the "infest" DoAction not get it's OnFail event?!
brain:Stop()
brain:Start()

This is indeed gross, all that needs to be done is add a validfn to the BufferedAction:

      local ba = BufferedAction(inst, target, ACTIONS.INFEST)
      ba.validfn = function()
          local AGRO_STOP_DIST = 7
          return ba.doer:GetDistanceSqToInst(ba.target) <= AGRO_STOP_DIST * AGRO_STOP_DIST
      end
      return ba

This way, BufferedAction:IsValid would return false, causing LocoMotor component to reset action, no need to reset brain.


Steps to Reproduce

The above




User Feedback


There are no comments to display.



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...