// blokada SBL 3-stawna - semafor przed wjazdowym (dorobic teksture W18!!!)
// (p1) - nazwa, (p2)(p3)(p4) - lokacja, (p5) rotacja, (p6) symbol (p7) sterowanie poprzednim semaforem sbl (jego nazwa)
// uwaga - do toru za semaforem musi byc przypisane zdarzenie NAZWASEMAFORA_s1
// a do toru przy semaforze oczywiscie zdarzenie NAZWASEMAFORA_sem_info
// semafor ten jest kompatybilny z tarcza ostzegawcza (moze byc stosowany jako 7my parametr SS5zpcpbY.inc)

origin (p2) (p3) (p4)
rotate 0 (p5) 0
//model semafora 3komorowego blokady liniowej:
node -1 0 (p1) model 0 0 0 0 PKP/head3-gry.t3d (p6) Lights 0 0 1 endmodel                  //glowica 
node -1 0 none model 0 0 0 0 PKP/post-straight.t3d PKP/pkplight_sblpost.tga endmodel       //slup
node -1 0 none model 0 0 0 0 PKP/post-ladder-h34.t3d PKP/#pkplight_board.tga endmodel      //drabinka

node 800 150 none lines 110 110 110  100.0                                      //linia zeby byl maszt widoczny z daleka
0.0 0.0 0.0	0.0 4.0 0.0 
endline

// W18
// awers
node 200 0 none triangle_strip material ambient: 80.0 80.0 80.0 diffuse: 210.0 205.0 200.0 specular: 220.0 220.0 220.0  endmaterial PKP/wskazniki2.BMP
-0.134063 2.75265 0.083136 	0.0 0.0 1.0  0.657005 0.350242 end
-0.134063 2.45265 0.083136 	0.0 0.0 1.0  0.657005 0.00724638 end
0.165937 2.75265 0.083136 	0.0 0.0 1.0  0.995169 0.350242 end
0.165937 2.45265 0.083136 	0.0 0.0 1.0  0.995169 0.00724638 
endtri

// rewers
node 100 0 none triangle_strip material ambient: 80.0 80.0 80.0 diffuse: 210.0 205.0 200.0 specular: 220.0 220.0 220.0  endmaterial PKP/wskazniki2.BMP
0.165937 2.75265 0.083136 	0.0 0.0 -1.0  0.987923 0.350242 end
0.165937 2.45265 0.083136 	0.0 0.0 -1.0  0.987923 0.00724638 end
-0.134063 2.75265 0.083136 	0.0 0.0 -1.0  0.995169 0.350242 end
-0.134063 2.45265 0.083136 	0.0 0.0 -1.0  0.995169 0.00724638 
endtri

// SHP
node -1 0 none triangle_strip material ambient: 150.0 150.0 150.0 diffuse: 150.0 150.0 150.0 specular: 229.5 229.5 229.5  endmaterial metal/MetalFrictionPattern1.tga
-1.0 0.3 1.5 	0.0 1.0 0.0  0.0 2.0 end
-1.0 0.3 0.5 	0.0 1.0 0.0  0.0 0.0 end
-1.2 0.3 1.5 	0.0 1.0 0.0  0.5 2.0 end
-1.0 0.3 0.5 	0.0 1.0 0.0  0.0 0.0 
endtri

rotate 0 0 0
endorigin

//sygnalizacja SHP:
event (p1)_SHP putvalues 1.0 none (p2) (p3) (p4) CabSignal -1 -1 endevent

node -1 0 (p1)_sem_mem memcell (p2) (p3) (p4) SetVelocity -1 0  none endmemcell

//zdarzenia okreslajace predkosc przy tym semaforze
event (p1)_sem_info_stop updatevalues 10.0 (p1)_sem_mem SetVelocity 0.0 20 endevent
event (p1)_sem_info_vmax updatevalues 1.0 (p1)_sem_mem SetVelocity -1 -1 endevent
event (p1)_sem_info_nextstop updatevalues 1.0 (p1)_sem_mem SetVelocity -1 0 endevent

event (p1)_s1 multiple 1 (p1)_sem_mem (p1)_sem_ligh1 (p1)_sem_info_stop (p7)_s5 condition memcompare * -1 * endevent
event (p1)_sem_ligh1 lights 0.0 (p1) 0 1 0 endevent

event (p1)_os1 multiple 1 none (p1)_sem_ligh1o (p1)_sem_info_nextstop (p7)_s2 endevent
event (p1)_sem_ligh1o lights 0.0 (p1) 0 0 1 endevent

//ponizsze zdarzenia os2...os4 wyzwalane sa tylko gdy nie bylo S1:

event (p1)_os2 multiple 1 (p1)_sem_mem (p1)_sem_ligh2o (p1)_sem_info_vmax (p7)_s2 condition memcompare * -1 * endevent
event (p1)_sem_ligh2o lights 0.0 (p1) 1 0 0 endevent

event (p1)_os3 multiple 1 (p1)_sem_mem (p1)_sem_ligh3o (p1)_sem_info_vmax (p7)_s2 condition memcompare * -1 * endevent
event (p1)_sem_ligh3o lights 0.0 (p1) 2 0 0 endevent

event (p1)_os4 multiple 1 (p1)_sem_mem (p1)_sem_ligh4o (p1)_sem_info_nextstop (p7)_s2 condition memcompare * -1 * endevent
event (p1)_sem_ligh4o lights 0.0 (p1) 0 0 2 endevent


//odczyt z pamieci (zdarzenie przypisane do toru przy semaforze):
event (p1)_sem_info getvalues 5.0 (p1)_sem_mem endevent

