rotation = {};

function rotation.prerequisitesPresent(specializations)
    return true;
end;

function rotation:load(savegame)
    self.trommel = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.trommel#index"));
    self.auspuffklappe = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.auspuffklappe#index"));

    IdleSound = Utils.getFilename("sounds/idle.wav", self.baseDirectory);
    self.IdleSound = createSample("IdleSound");
    loadSample(self.IdleSound, IdleSound, false);
    self.IdleSound3D = createAudioSource("IdleSound3D", IdleSound, 25, 25, 0.6, 0);
    link(self.components[1].node, self.IdleSound3D);
    setVisibility(self.IdleSound3D, false);
end;

function rotation:delete()
    if self.IdleSound ~= nil then
        delete(self.IdleSound);
    end;
end;

function rotation:update(dt)
    if self:getFillLevel() > 0 then
        rotate(self.trommel, 0, 0, -1/80 );
		if not getVisibility(self.IdleSound3D) then
			setRotation(self.auspuffklappe, 120, 0, 0);
			Utils.setEmittingState(self.exhaustParticleSystems, true);
			setVisibility(self.IdleSound3D, true);
		end;
    elseif getVisibility(self.IdleSound3D) then
        setRotation(self.auspuffklappe, 0, 0, 0);
        Utils.setEmittingState(self.exhaustParticleSystems, false);
        setVisibility(self.IdleSound3D, false);
    end;
end;

function rotation:mouseEvent(posX, posY, isDown, isUp, button)
end;

function rotation:keyEvent(unicode, sym, modifier, isDown)
end;

function rotation:draw()
end;

function rotation:onEnter()
end;

function rotation:onLeave()
end;
