motorSound15 = {};

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

function motorSound15:load(xmlFile)
end;

function motorSound15:delete()
end;

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

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

function motorSound15:update(dt)
	if self.isEntered then
		if g_currentMission.driveControl ~= nil and g_currentMission.driveControl.useModules.inDoorSound then
			g_currentMission.driveControl.useModules.inDoorSound = false;
		end;
		
		if self:getIsActiveForSound() then
			if self.sampleMotor ~= nil then
				local samples = {self.sampleMotor};
				for _,sample in pairs(samples) do
					if sample ~= nil then
						local targetVolume = sample.volume;
						local internalSoundFactor = 0.16;
						if self.lastSpeed * 3850 > 5 then
							targetVolume = targetVolume / (self.lastSpeed*3600 * internalSoundFactor);
						end;
						if sample.sample ~= nil then
							setSampleVolume(sample.sample,targetVolume);
						end;
					end;
				end;
			end;
		end;
     end;

	if self:getIsActive() then
		if self.lastSpeed * 3850 > 60 then
				Utils.stopSample(self.sampleMotor, true);
--				Utils.stopSample(self.sampleMotorRun, true);
				Utils.stop3DSample(self.sampleMotor, true);
--				Utils.stop3DSample(self.sampleMotorRun, true);
			else
				if self.isMotorStarted and self.isEntered then
					if not Utils.isSamplePlaying(self.sampleMotorStart) and (not Utils.isSamplePlaying(self.sampleMotor) or not Utils.isSamplePlaying(self.sampleMotorRun)) then
						Utils.playSample(self.sampleMotor, 0, 0, nil);
--						Utils.playSample(self.sampleMotorRun, 0, 0, 0);
					end;
				end;
			end;
       end;
end;

function motorSound15:updateTick(dt)
end;

function motorSound15:draw()
end;