Jump to content

Here lacks a sanity check of FindWalkableOffset in powdermonkeybrain


Littlefat1213
  • Fixed

 

[00:20:13]: [string "scripts/vector3.lua"]:10: attempt to index local 'rhs' (a nil value)
LUA ERROR stack traceback:
    scripts/brains/powdermonkeybrain.lua:622 in (field) getactionfn (Lua) <603-632>
    scripts/behaviours/doaction.lua:22 in (method) Visit (Lua) <19-58>
    scripts/behaviours/chattynode.lua:25 in (method) Visit (Lua) <23-90>
    scripts/behaviourtree.lua:606 in (method) Visit (Lua) <582-638>
    scripts/behaviourtree.lua:22 in (method) Update (Lua) <20-27>
    scripts/brain.lua:227 in (method) OnUpdate (Lua) <220-229>
    scripts/brain.lua:146 in (method) Update (Lua) <106-157>
    scripts/update.lua:292 in () ? (Lua) <224-298>
    

local function firecannon(inst)
    if inst.components.crewmember then
        return nil
    end
    local pos = Vector3(inst.Transform:GetWorldPosition())

    local cannon = inst.cannon
    if cannon and cannon:IsValid() then
        local targetboats = TheSim:FindEntities(pos.x, pos.y, pos.z, 25, BOAT_MUST)
        if #targetboats > 0 then
            for i, boat in ipairs(targetboats) do
                if not cannon.components.timer:TimerExists("monkey_biz") then
                    local boatpos = Vector3(boat.Transform:GetWorldPosition())
                    local angle =cannon:GetAngleToPoint(boatpos.x,boatpos.y,boatpos.z)
                    if math.abs( DiffAngle(angle, cannon.Transform:GetRotation()) ) < 45 then
                        local cannonpos = Vector3(cannon.Transform:GetWorldPosition())
                        local angle = (cannon.Transform:GetRotation() -180) * DEGREES
                        local offset = FindWalkableOffset(cannonpos, angle, 2, 12, true, false, nil, true)
            					-- HERE NEED CHECK OFFSET IS NIL --

                        if inst:GetDistanceSqToPoint(cannonpos+offset) <= (0.25*0.25) then
                            return BufferedAction(inst, cannon, ACTIONS.BOAT_CANNON_SHOOT)
                        end
                    end
                end
            end
        end
    else
        inst.cannon = nil
    end
end

Steps to Reproduce

AS ABOVE




User Feedback


A developer has marked this issue as fixed. This means that the issue has been addressed in the current development build and will likely be in the next update.


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...