require "TimedActions/ISBaseTimedAction"
ISFUninstallTurretAction = ISBaseTimedAction:derive("ISFUninstallTurretAction");

function ISFUninstallTurretAction:isValid()
    return true
end

function ISFUninstallTurretAction:update()
end

function ISFUninstallTurretAction:start()
    self:setActionAnim("RemoveGrass")
    self:setOverrideHandModels(nil, nil)
end

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

function ISFUninstallTurretAction:perform()
    ISBaseTimedAction.perform(self);
    sendClientCommand(self.character, "vehicle", "remove", {
        vehicle = self.vehicle:getId()
    })
    local ThisTurret = AutoTurretList[self.vehicle:getScriptName()]
    self.character:getInventory():AddItem(ThisTurret.Uninstall)
end

function ISFUninstallTurretAction:new(character, vehicle)
    local o = {}
    setmetatable(o, self)
    self.__index = self
    o.character = character;
    o.vehicle = vehicle;
    o.stopOnWalk = true;
    o.stopOnRun = true;
    o.maxTime = 300;

    return o;
end

