void PlaySoundAndSleep(Asset srcAsset,
string soundFile,
float volume,
float minDistance,
float maxDistance,
GameObject srcObject,
string att){
World.PlaySound(srcAsset, soundFile, volume, minDistance, maxDistance, srcObject, att);
Sleep(SoundSoup.GetNamedTagAsFloat(soundFile));
}
thread void Disel(Asset MyAsset) // ðàáîòà äèçåëÿ - çâóêè
{
int i, currTr, sndTr;//currTr - òåêóùàÿ ïîçèöèÿ êîíòðîëëåðà, sndTr - ïîçèöèÿ, çâóê êîòîðîé ïðîèãðûâàåòñÿ
float dt;
string sndFile;
bool k1=false,k7=false;
int qw=0;
int ti;
if(!Disel1)
{
Disel1=true;
process="disel_is_going.tga";
PostMessage(null,"RefreshBrowser","",0.0);
PlaySoundAndSleep(MyAsset,"sound/oil_pump_start.wav",0.5f,8.0f,100.0f,me,"a.disel") ;
for (ti=0; ti<=10; ti++){
PlaySoundAndSleep(MyAsset,"sound/oil_pump_idle.wav",0.5f,8.0f,100.0f,me,"a.disel");
}
World.PlaySound(MyAsset,"sound/oil_pump_stop.wav",0.5f,8.0f,100.0f,me,"a.disel");
PlaySoundAndSleep(MyAsset,"sound/pusk-kontaktors.wav", 1, 5.0f, 10.0f,me,"a.disel");
PostMessage(me,"pfx","+0",smoke_wait);
PlaySoundAndSleep(MyAsset,"sound/engine_start_0.wav",soundkoef,15.0f,1000.0f,me,"a. disel");
PostMessage(me,"pfx","-0",0.6);
process="disel_is_on.tga";
powerState = true;
cab.rabota_1 = true;
sndTr = 1;
PowerLoop(fuelQ);
PostMessage(null,"RefreshBrowser","",0.0);
while(powerState and !DeRailed)
{
if(mr_press<780) Compressor();
currTr = (int)(GetEngineSetting("throttle")*nmb_pos);
if(sndTr < 2 and currTr < 2){
sndTr = 1;
sndFile = "idle "+(string)sndTr;
}
else if (currTr == sndTr){
sndFile = "idle "+(string)sndTr;
}
else if (currTr > sndTr){ //êîíòðîëëåð íà áîëåå âûñîêîé ïîçèöèè
sndTr++;
sndFile = "up "+(string)(sndTr-1)+" - "+(string)sndTr;
}
else if (currTr < sndTr) { //êîíòðîëëåð íà áîëåå íèçêîé ïîçèöèè
sndTr--;
sndFile = "down "+(string)(sndTr+1)+" - "+(string)sndTr;
}
PlaySoundAndSleep(MyAsset,"sound/"+sndFile+".wav",soundkoef,15.0f,1000.0f,me,"a.dis el");
}
PlaySoundAndSleep(MyAsset,"sound/engine_stop_0.wav",soundkoef,15.0f,1000.0f,me,"a.d isel");
SetMaximumTractiveEffort(0);
SetWheelslipTractionMultiplier(1);
process="disel_is_off.tga";
PostMessage(null,"RefreshBrowser","",0.0);
Disel1=false;
cab.rabota_1=false;
}
}