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

require "TimedActions/ISBaseTimedAction"

ISAddPetrolAction = ISBaseTimedAction:derive("ISAddPetrolAction");

function ISAddPetrolAction:isValid()
	return true;
end

function ISAddPetrolAction:update()
	self.item:setJobDelta(self:getJobDelta());
end

function ISAddPetrolAction:start()
	self.item:setJobType(campingText.addPetrol);
	self.item:setJobDelta(0.0);
end

function ISAddPetrolAction:stop()
	ISBaseTimedAction.stop(self);
    self.item:setJobDelta(0.0);
end

function ISAddPetrolAction:perform()
	self.item:getContainer():setDrawDirty(true);
    self.item:setJobDelta(0.0);
	camping.addPetrol(self.campfire, self.character);
    -- needed to remove from queue / start next.
	ISBaseTimedAction.perform(self);
end

function ISAddPetrolAction:new(character, campfire, item, time)
	local o = {}
	setmetatable(o, self)
	self.__index = self
	o.character = character;
	o.stopOnWalk = true;
	o.stopOnRun = true;
	o.maxTime = time;
	-- custom fields
	o.campfire = campfire
	o.item = item;
	return o;
end
