// (p1) - nazwa, (p2)(p3)(p4) - lokacja, (p5) rotacja, (p6) - symbol semafora
origin (p2) (p3) (p4)
rotate 0 (p5) 0
node -1 0 (p1) model 0 0 0 0 PKP/SK1krat.t3d tabl/ksztaltowe/(p6) Lights 0 endmodel
node 1200 0 none lines 90 90 95 2.0                                          
-0.3 0.0 0.1	 -0.3 7.5 0.1 
endline
rotate 0 0 0
endorigin

// stoj:
event (p1)_Sr1 multiple 0 none (p1)_sem_anim11 (p1)_sem_anim11p  (p1)_sem_info_stop (p1)_ligh02  endevent

// wolna droga:
event (p1)_Sr2 multiple 0 none (p1)_sem_anim12  (p1)_sem_anim12p (p1)_sem_info_vmax endevent
// wolna droga ze zmniejszona do 40 km/h predkoscia
event (p1)_sz1 multiple 0 none (p1)_sem_anim11 (p1)_sem_anim11p (p1)_sem_info_v40 (p1)_ligh01 endevent

// wazne dla AI maszynisty!
// ponizsze zdarzenie jest wyzwalane z toru przy semaforze 
event (p1)_sem_info getvalues 1.0 (p1)_sem_mem endevent


// komorka pamietajaca predkosci oraz nazwy odpowiednich torow
node -1 0 (p1)_sem_mem memcell (p2) (p3) (p4) SetVelocity 0.0 0.0 none endmemcell

// animacja semafora
event (p1)_sem_anim11 animation 0 (p1) rotate ramie_gora 0 0 0 40 endevent
event (p1)_sem_anim12 animation 0 (p1) rotate ramie_gora 0 37 0 40 endevent
event (p1)_sem_anim11p animation 0 (p1) rotate przeslona_01 0 0 0 40 endevent
event (p1)_sem_anim12p animation 0 (p1) rotate przeslona_01 0 38 0 40 endevent



// wpisanie informacji do komorki
event (p1)_sem_info_stop updatevalues 0.0 (p1)_sem_mem SetVelocity 0.0 0.0 endevent
event (p1)_sem_info_vmax updatevalues 1.0 (p1)_sem_mem SetVelocity -1 -1 endevent
event (p1)_sem_info_v40 updatevalues 1.0 (p1)_sem_mem SetVelocity 40.0 -1 endevent

//zapalanie/gaszenie oswietlenia:
event (p1)_dzienny lights 1.0 (p1) 0 endevent
event (p1)_nocny lights 1.0 (p1) 1 endevent
event (p1)_ligh01 lights 1.0 (p7) 2 endevent
event (p1)_ligh02 lights 1.0 (p7) 0 endevent