--***********************************************************
--**                    ROBERT JOHNSON                     **
--***********************************************************

require "TimedActions/ISBaseTimedAction"

ISAddLogsInDrum = ISBaseTimedAction:derive("ISAddLogsInDrum");

function ISAddLogsInDrum:isValid()
	return true;
end

function ISAddLogsInDrum:update()
end

function ISAddLogsInDrum:start()
end

function ISAddLogsInDrum:stop()
	ISBaseTimedAction.stop(self);
end

function ISAddLogsInDrum:perform()
	ISBaseTimedAction.perform(self);
    if self.add then
        for i=0,4 do
            self.character:getInventory():Remove("Log");
        end
        ISMetalDrum.addLogs(self.metalDrum, true);
    else
        for i=0,4 do
            self.character:getInventory():AddItem("Base.Log");
        end
        ISMetalDrum.addLogs(self.metalDrum, false);
    end
end

function ISAddLogsInDrum:new(character, metalDrum, add)
	local o = {}
	setmetatable(o, self)
	self.__index = self
	o.stopOnWalk = true;
	o.stopOnRun = true;
	o.maxTime = 30;
    o.metalDrum = metalDrum;
	o.character  = character;
    o.add = add;
	return o;
end
