--[[
BY
 _____   _____   __   _  
|  _  \ /  _  \ |  \ | | 
| | | | | | | | |   \| | 
| | | | | | | | | |\   | 
| |_| | | |_| | | | \  | 
|_____/ \_____/ |_|  \_| 

]]

AddAction("CONTAINERDON", GLOBAL.STRINGS.DONBTN_USEACTIONDON, function(act)
local targ = act.target or act.invobject
local container = targ.components.container
    if targ ~= nil and targ.components.container_don ~= nil and container ~= nil and container:IsFull() and container:IsOpen() then
        targ.components.container_don:SetOnMagicCook()
		return true
	else
		return false	
    end	
end)


AddComponentAction("SCENE", "container_don", function(inst, doer, actions)
	if right and inst.replica.container ~= nil and #inst.replica.container:IsFull() and inst:HasTag("isopen") then 
		
		if inst.prefab == "donforge_workbench" then 
			table.insert(actions, GLOBAL.ACTIONS.CONTAINERDON)
		end
		if inst.prefab == "donfurnace_potions" then 
			table.insert(actions, GLOBAL.ACTIONS.CONTAINERDON)
		end	
		
	end
end)

AddStategraphActionHandler("wilson", GLOBAL.ActionHandler(GLOBAL.ACTIONS.CONTAINERDON, "dolongaction"))
AddStategraphActionHandler("wilson_client", GLOBAL.ActionHandler(GLOBAL.ACTIONS.CONTAINERDON, "dolongaction"))
