Jump to content

Recommended Posts

It's applied using this code:

if inst.components.playercontroller ~= nil then
    inst.components.playercontroller.actionbuttonoverride = BeaverActionButton
end
if inst.components.playeractionpicker ~= nil then
    inst.components.playeractionpicker.leftclickoverride = BeaverLeftClickPicker
    inst.components.playeractionpicker.rightclickoverride = BeaverRightClickPicker
    inst.components.playeractionpicker.pointspecialactionsfn = nil
end
EnableReticule(inst, false)

You need to put something like that in your character file, after renaming and modifying the beaver code.

I think you also need this code, too:

inst:AddComponent("worker")
inst.components.worker:SetAction(ACTIONS.CHOP, 1)
inst.components.worker:SetAction(ACTIONS.MINE, 1)

1 is the standard rate for tools. You could use 2 or 0.5 to make it twice or half as effective.

Beaver also includes ACTIONS.DIG and ACTIONS.HAMMER. (You probably don't want hammer.)

Edited by Bumber64
11 hours ago, Bumber64 said:

It's applied using this code:


if inst.components.playercontroller ~= nil then
    inst.components.playercontroller.actionbuttonoverride = BeaverActionButton
end
if inst.components.playeractionpicker ~= nil then
    inst.components.playeractionpicker.leftclickoverride = BeaverLeftClickPicker
    inst.components.playeractionpicker.rightclickoverride = BeaverRightClickPicker
    inst.components.playeractionpicker.pointspecialactionsfn = nil
end
EnableReticule(inst, false)

You need to put something like that in your character file, after renaming and modifying the beaver code.

I think you also need this code, too:


inst:AddComponent("worker")
inst.components.worker:SetAction(ACTIONS.CHOP, 1)
inst.components.worker:SetAction(ACTIONS.MINE, 1)

1 is the standard rate for tools. You could use 2 or 0.5 to make it twice or half as effective.

Beaver also includes ACTIONS.DIG and ACTIONS.HAMMER. (You probably don't want hammer.)

how much of the beaver  code do i have to rename and modify??

Commented code is for if you want to be able to dig (considering you'll be leaving stumps):

local function LeftClickPicker(inst, target)
    if target and target ~= inst then
        for i, v in ipairs({"CHOP", "MINE"}) do
            if target:HasTag(v.."_workable") then
                return inst.components.playeractionpicker:SortActionList({ ACTIONS[v] }, target, nil)
                    or nil, true
            end
        end
    end
    return nil, true
end
--[[
local function RightClickPicker(inst, target)
    return target and target ~= inst and
        (
            target:HasTag("DIG_workable") and
            inst.components.playeractionpicker:SortActionList({ ACTIONS.DIG }, target, nil)
        )
        or nil, true
end
--]]
local function setPickers(inst)
    if inst.components.playeractionpicker then
        inst.components.playeractionpicker.leftclickoverride = LeftClickPicker
        --inst.components.playeractionpicker.rightclickoverride = RightClickPicker
    end
end

This goes inside your player fn:

inst:AddComponent("worker")
inst.components.worker:SetAction(ACTIONS.CHOP, 1)
inst.components.worker:SetAction(ACTIONS.MINE, 1)
--inst.components.worker:SetAction(ACTIONS.DIG, 1)

inst:ListenForEvent("setowner", setPickers)

 

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