--=================================== Do Action ====================================--
--Sử dụng để Player làm hành động, và trả về VLF.var.doAction[self.actionKey] = true khi hoàn thành action này
--Xem ví dụ cụ thể: local function DoInjectAntiserum(player, zNPC, qStep)
--==================================================================================--

require "TimedActions/ISBaseTimedAction"
require "vl_quest_utils"

VL_ISDoAction = ISBaseTimedAction:derive("VL_ISDoAction")

function VL_ISDoAction:isValid()
	return true
end

function VL_ISDoAction:waitToStart()
	self.character:faceThisObject(self.zombie)
	return self.character:shouldBeTurning()
end

function VL_ISDoAction:update()
	self.character:faceThisObject(self.zombie)
	self.character:setMetabolicTarget(Metabolics.MediumWork)
end

function VL_ISDoAction:start()
	self:setActionAnim("Loot")
	if self.isLow == true then
		self.character:SetVariable("LootPosition", "Low")
	else
		self.character:SetVariable("LootPosition", "High")
	end
	self.character:reportEvent("VL_DoAction")
end

function VL_ISDoAction:stop()
	ISBaseTimedAction.stop(self)
end

function VL_ISDoAction:perform()
	ISBaseTimedAction.perform(self)
end

function VL_ISDoAction:complete()
	VLF.var.doAction[self.actionKey] = true
    return true
end

function VL_ISDoAction:new(character, zombie, time, qStep, actionKey, isLow)
    local o = {}
    setmetatable(o, self)
    self.__index = self
	o.character = character
	o.zombie = zombie
	o.qStep = qStep
	o.actionKey = actionKey
	o.isLow = isLow
    o.stopOnWalk = true
    o.stopOnRun = true
    o.caloriesModifier = 8
    o.maxTime = time
	o.forceProgressBar = true;
	if character:isTimedActionInstant() then
        o.maxTime = 1
    end
    return o
end

