Jump to content

Recommended Posts

When you hover over an inventory item and hold shift, the Drop action is forced to be there. It seems to be handled by this function over here:

function PlayerActionPicker:GetInventoryActions(useitem, right)
    local actions = {}

	if not self.inst.components.playercontroller:IsControlPressed(CONTROL_FORCE_TRADE) then
		useitem:CollectActions("INVENTORY", self.inst, actions, right)
	else
		actions = {ACTIONS.DROP}
	end

    local sorted_acts = self:SortActionList(actions, nil, useitem)

    if not self.inst.components.playercontroller:IsControlPressed(CONTROL_FORCE_STACK) then
        for i, v in ipairs(sorted_acts) do
            if v.action == ACTIONS.DROP then
                v.options.wholestack = true
                break
            end
        end
    end

    return sorted_acts
end

I'm trying to figure out how to override it for my own mod for specific items with a tag (and eventually add my own action to it), but whatever I try, even returning an empty table, seems to do absolutely nothing.

AddComponentPostInit("playeractionpicker", function(self)
	local _old_getinventoryactions = self.GetInventoryActions
	function self:GetInventoryActions(useitem, right, ...)
		if useitem:HasTag("mlb_miraculous") and self.inst.components.playercontroller:IsControlPressed(GLOBAL.CONTROL_FORCE_TRADE) then
			return {}
		end
		
		return _old_getinventoryactions(self, useitem, right, ...)
	end
end)

I've been at this for a few hours, trying so many different solutions, but nothing seems to ever change, the Drop action won't go away. I'm making sure my function is running with prints too, and it's definitely running. Any ideas? Is there something I'm missing?

EDIT: NEVER MIND IT WAS A CLIENT MOD MESSING WITH THIS, DISREGARD. Thank you zhuyifei1999 from the Klei Discord for help

Edited by ClumsyPenny
solved

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