

-- by Schnulla-817


ParticleSystem = {};

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

function ParticleSystem:load(xmlFile)
	
-- Dynamischer Auspuffqualm

    self.exhaustParticleSystems2 = {};
    Utils.loadParticleSystem(xmlFile, self.exhaustParticleSystems2,"vehicle.exhaustParticleSystemExtra1", self.rootNode, false, nil, self.baseDirectory)

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

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

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


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

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

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

	self.exhaustParticleSystems15 = {};
    Utils.loadParticleSystem(xmlFile, self.exhaustParticleSystems15, "vehicle.exhaustParticleSystemExtra41", self.rootNode, false, nil, self.baseDirectory)
-- 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 > 3 and self.lastSpeed*3600 < 28 then
			Utils.setEmittingState(self.exhaustParticleSystems2, true);
		end;
		if not self.attachedImplement or not self.motor.speedLevel == 0 or self.lastSpeed*3600 < 3 or self.lastSpeed*3600 > 45 then
			Utils.setEmittingState(self.exhaustParticleSystems2, false);
		end;
		if self.attachedImplement and self.lastSpeed*3600 > 12 then
			Utils.setEmittingState(self.exhaustParticleSystems3, true);
		end;
		if not self.attachedImplement or self.lastSpeed*3600 < 28 then
			Utils.setEmittingState(self.exhaustParticleSystems3, false);
		end;
		if not self.attachedImplement and self.lastSpeed*3600 > 3 and self.lastSpeed*3600 < 11 then
			Utils.setEmittingState(self.exhaustParticleSystems5, true);
		end;
		if not self.attachedImplement and self.lastSpeed*3600 < 3 or self.lastSpeed*3600 > 11 then
			Utils.setEmittingState(self.exhaustParticleSystems5, false);
		end;

		if not self.attachedImplement and self.lastSpeed*3600 > 11 then
			Utils.setEmittingState(self.exhaustParticleSystems4, true);
		end;
		if not self.attachedImplement and self.lastSpeed*3600 < 11 then
			Utils.setEmittingState(self.exhaustParticleSystems4, 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;

