Jump to content

Recommended Posts

I have a second hand slot that has an item permanently equipped to it. The main item slot action is always chosen first and the secondary if the main can't do the action.

I have gotten this working by replacing the functions directly in the playeractionpicker file. I don't want this though as i am replacing that file...not a good thing.

I have tried following the werebeaver code using the left/right override to no success. It also isn't exactly what i want as the werebeaver prevents the use of equipped items and it only applies to one character, not to all.

I have also tried replacing the code through modmain with code along the lines of

AddComponentPostInit("playeractionpicker", function(inst)
    local old_glca = GetLeftClickActions
    GetLeftClickActions = function(position,target) 
          --original code with edits
    end
end

I'm still new to modding (this being first mod) and lua, so i am not sure what i am doing wrong. Once this is working I will need to find where and how actions are managed when automatic actions on key presses such as spacebar.

 

for reference, the code that adds the extra slot in mod main

Spoiler

GLOBAL.EQUIPSLOTS=
{
    HANDS = "hands",
    HEAD = "head",
    BODY = "body",
    HIDDEN = "hidden", 
}


GLOBAL.EQUIPSLOT_IDS = {}
local slot = 0
for k, v in pairs(GLOBAL.EQUIPSLOTS) do
    slot = slot + 1
    GLOBAL.EQUIPSLOT_IDS[v] = slot
end
slot = nil

function itempostinit(inst)
    if IsServer then
        inst.components.equippable.equipslot = GLOBAL.EQUIPSLOTS.HIDDEN
    end
end

AddPrefabPostInit("item", itempostinit)

 

 

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