//semafor czterostawnej samoczynnej blokady liniowej (sbl), trzykomorowy na słupie odchylonym + wskaznik W18 + obsluga przez semafor wjazdowy
//parametr 7 we wpisie należy podać nazwę poprzedniego semafora sbl.
//parametr 8 we wpisie nalezy podac nazwe przypisanego odcinka izolowanego
//autorzy: kudłacz, ziomalcl, Transkei

origin (p2) (p3) (p4)
rotate 0 (p5) 0
//model semafora 3komorowego blokady liniowej:
node 1000 0 (p1) model 0.415 0 0 0 sem/glowice/s3ypzcp_dd.t3d tabl/(p6) lights 0 0 1 endmodel                 //glowica 
node 1000 0 none model 1.82 -1.1 -7.7 0 pkp/post-p.t3d none endmodel 			 //slup
node 500 0 none model 0 0.45 0 180 ip/pkp/w18.t3d none endmodel				//wskaznik w18

// pas rewers
node 400 0 none triangle_strip material ambient: 150.0 150.0 150.0 diffuse: 220.0 220.0 220.0 specular: 154.0 154.0 154.0 endmaterial pkp/wskazniki2
0.1 9.3 0.32 	0.0 0.0 -1.0  0.00269513 0.756031 end
0.1 7.8 0.32 	0.0 0.0 -1.0  0.00269479 0.3411 end
-0.1 9.3 0.32 	0.0 0.0 -1.0  0.180528 0.75603 end
-0.1 7.8 0.32 	0.0 0.0 -1.0  0.182 0.3411 
endtri

// pas awers
node 400 0 none triangle_strip material ambient: 150.0 150.0 150.0 diffuse: 185.0 185.0 185.0 specular: 154.0 154.0 154.0 endmaterial detal/biale
-0.1 9.3 0.32 	0 0 1.0  0.0 0.7 end
-0.1 7.8 0.32 	0 0 1.0  0.0 0.6 end
0.1 9.3 0.32 	0 0 1.0  1.0 0.7 end
0.1 7.8 0.32 	0 0 1.0  1.0 0.6 
endtri


rotate 0 0 0
endorigin

//Pamiec semafora i sterowanie AI
node -1 0 (p1)_sem_mem memcell (p2) (p3) (p4) SetVelocity -1 -1  none endmemcell
event (p1)_sem_info getvalues 0 (p1)_sem_mem endevent

event (p1)_sem_info_stop updatevalues 0 (p1)_sem_mem SetVelocity 0 20 endevent
event (p1)_sem_info_slow updatevalues 0 (p1)_sem_mem SetVelocity -1 0 endevent
event (p1)_sem_info_vmax updatevalues 0 (p1)_sem_mem SetVelocity -1 -1 endevent

event (p1)_shp putvalues 0 none (p2) (p3) (p4) CabSignal -1 -1 endevent

//Komendy do wywolywanie z zewnatrz
event (p1)_s1 multiple 0 none (p1)_zeruj_s1 (p1)_sem_ligh1 (p1)_sem_info_stop (p7)_s5 endevent
event (p1)_os1 multiple 0 (p8) (p1)_sem_ligh5 (p1)_sem_info_slow (p7)_s3 condition memcompare * * 0 endevent
event (p1)_os4 multiple 0 (p8) (p1)_sem_ligh4 (p1)_sem_info_slow (p7)_s3 condition memcompare * * 0 endevent
event (p1)_os3 multiple 0 (p8) (p1)_sem_ligh3 (p1)_sem_info_vmax (p7)_s2 condition memcompare * * 0 endevent
event (p1)_os2 multiple 0 (p8) (p1)_sem_ligh2 (p1)_sem_info_vmax condition memcompare * * 0 endevent

//Komendy wewnetrzne - nie uzywac z poziomu scenariusza!
event (p1)_zeruj_s1 lights 0 (p1) 0 -1 0 endevent
event (p1)_sem_ligh1 lights 1 (p1) 0 1 0 endevent
event (p1)_sem_ligh2 lights 0 (p1) 1 0 0 endevent
event (p1)_sem_ligh3 lights 0 (p1) 2 0 0 endevent
event (p1)_sem_ligh4 lights 0 (p1) 0 0 2 endevent
event (p1)_sem_ligh5 lights 0 (p1) 0 0 1 endevent

//dodatkowo mozliwosc wygaszenia tego i poprzednich semaforow:
event (p1)_ciemny multiple 0 none (p1)_sem_ligh0 (p1)_sem_info_stop (p7)_ciemny endevent
event (p1)_sem_ligh0 lights 0 (p1) 0 0 0 endevent

// uszkodzony semafor - nieoswietlony:
event (p1)_uszk multiple 0 none (p1)_sem_ligh0 (p7)_s1 (p1)_sem_info_stop endevent
