

-- by Schnulla-817


ParticleSystem = {};

function ParticleSystem.prerequisitesPresent(specializations)
    return SpecializationUtil.hasSpecialization(Motorized, specializations);
end;

function ParticleSystem:load(xmlFile)
	
-- Dynamischer Auspuffqualm
    self.exhaustParticleSystems2 = {};
    local psName = "vehicle.exhaustParticleSystemExtra1";
    Utils.loadParticleSystem(xmlFile, self.exhaustParticleSystems2, psName, self.rootNode, false)

	self.exhaustParticleSystems3 = {};
    local psName = "vehicle.exhaustParticleSystemExtra2";
    Utils.loadParticleSystem(xmlFile, self.exhaustParticleSystems3, psName, self.rootNode, false)

	self.exhaustParticleSystems4 = {};
    local psName = "vehicle.exhaustParticleSystemExtra3";
    Utils.loadParticleSystem(xmlFile, self.exhaustParticleSystems4, psName, self.rootNode, false)

	self.exhaustParticleSystems5 = {};
    local psName = "vehicle.exhaustParticleSystemExtra4";
    Utils.loadParticleSystem(xmlFile, self.exhaustParticleSystems5, psName, self.rootNode, false)


    self.exhaustParticleSystems12 = {};
    local psName = "vehicle.exhaustParticleSystemExtra11";
    Utils.loadParticleSystem(xmlFile, self.exhaustParticleSystems12, psName, self.rootNode, false)

	self.exhaustParticleSystems13 = {};
    local psName = "vehicle.exhaustParticleSystemExtra21";
    Utils.loadParticleSystem(xmlFile, self.exhaustParticleSystems13, psName, self.rootNode, false)

	self.exhaustParticleSystems14 = {};
    local psName = "vehicle.exhaustParticleSystemExtra31";
    Utils.loadParticleSystem(xmlFile, self.exhaustParticleSystems14, psName, self.rootNode, false)

	self.exhaustParticleSystems15 = {};
    local psName = "vehicle.exhaustParticleSystemExtra41";
    Utils.loadParticleSystem(xmlFile, self.exhaustParticleSystems15, psName, self.rootNode, false)
-- Dynamischer Auspuffqualm Ende

end;

function ParticleSystem:keyEvent(unicode, sym, modifier, isDown)

end;
--end;

function ParticleSystem:update(dt)

	if self.isEntered or self.isHired then
		if self.attachedImplement and self.lastSpeed*3600 > 2 and self.lastSpeed*3600 < 20 then
			Utils.setEmittingState(self.exhaustParticleSystems2, true);
		end;
		if not self.attachedImplement or not self.motor.speedLevel == 0 or self.lastSpeed*3600 < 2 or self.lastSpeed*3600 > 20 then
			Utils.setEmittingState(self.exhaustParticleSystems2, false);
		end;
		if self.attachedImplement and self.lastSpeed*3600 > 20 then
			Utils.setEmittingState(self.exhaustParticleSystems3, true);
		end;
		if not self.attachedImplement or self.lastSpeed*3600 < 20 then
			Utils.setEmittingState(self.exhaustParticleSystems3, false);
		end;
		if not self.attachedImplement and self.lastSpeed*3600 > 2 and self.lastSpeed*3600 < 20 then
			Utils.setEmittingState(self.exhaustParticleSystems4, true);
		end;
		if not self.attachedImplement and self.lastSpeed*3600 < 2 or self.lastSpeed*3600 > 20 then
			Utils.setEmittingState(self.exhaustParticleSystems4, false);
		end;

		if not self.attachedImplement and self.lastSpeed*3600 > 20 then
			Utils.setEmittingState(self.exhaustParticleSystems5, true);
		end;
		if not self.attachedImplement and self.lastSpeed*3600 < 20 then
			Utils.setEmittingState(self.exhaustParticleSystems5, false);
		end;


		if self.attachedTrailer and self.lastSpeed*3600 > 2 and self.lastSpeed*3600 < 20 then
			Utils.setEmittingState(self.exhaustParticleSystems12, true);
		end;
		if not self.attachedTrailer or not self.motor.speedLevel == 0 or self.lastSpeed*3600 < 2 or self.lastSpeed*3600 > 20 then
			Utils.setEmittingState(self.exhaustParticleSystems12, false);
		end;
		if self.attachedTrailer and self.lastSpeed*3600 > 20 then
			Utils.setEmittingState(self.exhaustParticleSystems13, true);
		end;
		if not self.attachedTrailer or self.lastSpeed*3600 < 20 then
			Utils.setEmittingState(self.exhaustParticleSystems13, false);
		end;
		if not self.attachedTrailer and self.lastSpeed*3600 > 2 and self.lastSpeed*3600 < 20 then
			Utils.setEmittingState(self.exhaustParticleSystems14, true);
		end;
		if not self.attachedTrailer and self.lastSpeed*3600 < 2 or self.lastSpeed*3600 > 20 then
			Utils.setEmittingState(self.exhaustParticleSystems14, false);
		end;

		if not self.attachedTrailer and self.lastSpeed*3600 > 20 then
			Utils.setEmittingState(self.exhaustParticleSystems15, true);
		end;
		if not self.attachedTrailer and self.lastSpeed*3600 < 20 then
			Utils.setEmittingState(self.exhaustParticleSystems15, false);
		end;
	end;
end;

function ParticleSystem:draw()
end;

function ParticleSystem:onEnter()
end;

function ParticleSystem:onLeave()

	Utils.setEmittingState(self.exhaustParticleSystems2, false);
	Utils.setEmittingState(self.exhaustParticleSystems3, false);
	Utils.setEmittingState(self.exhaustParticleSystems4, false);
	Utils.setEmittingState(self.exhaustParticleSystems5, false);

	Utils.setEmittingState(self.exhaustParticleSystems12, false);
	Utils.setEmittingState(self.exhaustParticleSystems13, false);
	Utils.setEmittingState(self.exhaustParticleSystems14, false);
	Utils.setEmittingState(self.exhaustParticleSystems15, false);
end;

function ParticleSystem:delete()
end;

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

