Jump to content

Werebeaver + actions


Recommended Posts

A long time ago I tried to get the werebeaver to have more actions such as, shaving beefalo and pitchforking but the problem is that they're not inside the action picker and rather in componentactions.lua

local function RightClickPicker(inst, target)
    if target ~= nil and target ~= inst then
        for i, v in ipairs(BEAVER_DIET) do
            if target:HasTag("edible_"..v) then
                return inst.components.playeractionpicker:SortActionList({ ACTIONS.EAT }, target, nil)
            end
        end



        return (target:HasTag("HAMMER_workable") and
                inst.components.playeractionpicker:SortActionList({ ACTIONS.HAMMER }, target, nil))
            or (target:HasTag("DIG_workable") and
                target:HasTag("sign") and
                inst.components.playeractionpicker:SortActionList({ ACTIONS.DIG }, target, nil))
						  or (target:HasTag("hat") and
                inst.components.playeractionpicker:SortActionList({ ACTIONS.PICKUP }, target, nil)) 
										  or (target:HasTag("groundtile") and
                inst.components.playeractionpicker:SortActionList({ ACTIONS.TERRAFORM }, target, nil)) 
														  or (target:HasTag("beefalo") and
                inst.components.playeractionpicker:SortActionList({ACTIONS.SHAVE)}, target, nil)) 
        or nil

here's the code for terraforming in componenactions.lua for terraform

        terraformer = function(inst, doer, pos, actions, right)
            if right and TheWorld.Map:CanTerraformAtPoint(pos:Get()) then
                table.insert(actions, ACTIONS.TERRAFORM)
            end
        end,

        shaver = function(inst, doer, target, actions)
            if target:HasTag("bearded") and
                not (doer.replica.rider ~= nil and doer.replica.rider:IsRiding()) then
                table.insert(actions, ACTIONS.SHAVE)
            end
        end,

so um, can anyone help me please? In game what ends up happening is that the beaver has the option to shave but he doesn't complete the action, he sort of just stutters and as for the terraformer, he doesn't even bother to detect turfs.

Edited by ColombianCam
+ info
Link to comment
Share on other sites

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
 Share

×
  • Create New...