local function FuckGlobalUsingMetatable()
	GLOBAL.setmetatable(env, {
		__index = function(t, k)
			return GLOBAL.rawget(GLOBAL, k)
		end,
	})
end
FuckGlobalUsingMetatable()

local DINE = Action({ mount_valid=true })
DINE.id = "DINE"
DINE.str = STRINGS.DINE
DINE.fn = function(act)
	if act.doer and act.target and act.target.components.dining and act.target.foodname then
		act.doer.components.eater:Eat(act.target.components.dining:GetFood(), act.doer)
		return true
	end
	return false
end
AddAction(DINE)
AddComponentAction("SCENE", "dining", function(inst, doer, actions, right)
	if right then
		table.insert(actions, GLOBAL.ACTIONS.DINE)
	end
end)
AddStategraphActionHandler("wilson",GLOBAL.ActionHandler(ACTIONS.DINE, "doshortaction"))
AddStategraphActionHandler("wilson_client",GLOBAL.ActionHandler(ACTIONS.DINE, "doshortaction"))

AddComponentPostInit("trader",function(Trader)
	local oldAcceptGift = Trader.AcceptGift
	function Trader:AcceptGift(giver, item, count)
		if self.inst:HasTag("stacktrader") and item.components.stackable and count == nil then
			count = item.components.stackable.stacksize
		end
		return oldAcceptGift(self,giver,item,count)
	end
end)
