//semafor półsamoczynny, czterokomorowy na słupie prostym.
//autorzy: kudłacz, ziomalcl
//Ra 2f95: dodany W24 i współpraca z To/Sp

origin (p2) (p3) (p4)
rotate 0 (p5) 0
//model semafora 4komorowego:
node 1000 0 (p1) model 0 0 0 0 sem/glowice/s4izczb_dd.t3d tabl/(p6) lights 0 1 0 0 endmodel //glowica 
node 200 0 none model 0 0 0 0 sem/slupy/s4iml.t3d sem/slupy endmodel //slup
node 400 0 (p1)w24 model 0 0 0 0 sem/wskazniki/w24v1.t3d none lights 0 endmodel 
node 100 0 none model 0 0 0 0 sem/drabinki/d4i.t3d sem/slupy endmodel //drabinka
node 700 100 none lines 100 50 20 100.0 //linia zeby byl maszt widoczny z daleka
0.0 0.0 0.0	0.0 4.5 0.0 
endline
rotate 0 0 0
endorigin

//zdarzenia:

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

//podswietlanie wskaznika w24:
event (p1)_w24 lights 0.0 (p1)w24 1 endevent

//gaszenie wskaznika w24
event (p1)_w24off lights 0.0 (p1)w24 0 endevent

//zdarzenia okreslajace predkosc przy tym semaforze
event (p1)_sem_info_stop updatevalues 0.0 (p1)_sem_mem SetVelocity 0.0 0 endevent
event (p1)_sem_info_vmax updatevalues 1.0 (p1)_sem_mem SetVelocity -1 -1 endevent
event (p1)_sem_info_v160 updatevalues 1.0 (p1)_sem_mem SetVelocity 160 100 endevent
event (p1)_sem_info_v40 updatevalues 1.0 (p1)_sem_mem SetVelocity 40 * endevent
event (p1)_sem_info_v20 updatevalues 1.0 (p1)_sem_mem SetVelocity 20 0 endevent
// dziala tylko na pojazdy w trybie manewrowym:
event (p1)_sem_info_Shunt25 updatevalues 1.0 (p1)_sem_mem ShuntVelocity 25 0 endevent
event (p1)_sem_info_Shunt40 updatevalues 1.0 (p1)_sem_mem ShuntVelocity 40 0 endevent

event (p1)_s1 multiple 0 none (p1)_sem_ligh1 (p1)_w24off (p1)_sem_info_stop (p7)_os1 endevent
event (p1)_sem_ligh1 lights 0.0 (p1) 0 1 0 endevent

event (p1)_s2 multiple 0 none (p1)_sem_ligh2 (p1)_sem_info_vmax (p7)_os2 endevent
event (p1)_sem_ligh2 lights 0.0 (p1) 0 0 1 endevent

event (p1)_s3 multiple 0 none (p1)_sem_ligh3 (p1)_sem_info_v160 (p7)_os3 endevent
event (p1)_sem_ligh3 lights 0.0 (p1) 0 0 2 endevent

event (p1)_s10 multiple 0 none (p1)_sem_ligh10 (p1)_sem_info_v40 (p7)_os2 endevent
event (p1)_sem_ligh10 lights 0.0 (p1) 1 0 1 endevent

event (p1)_ms2 multiple 0 none (p1)_sem_lighs2 (p1)_sem_info_Shunt25 endevent
event (p1)_m40 multiple 0 none (p1)_sem_lighs2 (p1)_sem_info_Shunt40 endevent
event (p1)_sem_lighs2 lights 0.0 (p1) 0 0 0 1 endevent

event (p1)_sz1 multiple 0 none (p1)_sem_lighz1 (p1)_sem_info_v40 (p1)_wyg_sz endevent
event (p1)_wyg_sz multiple 90 (p1)_sem_mem (p1)_s1 (p1)_w24off condition memcompare SetVelocity 40 0 endevent
event (p1)_sem_lighz1 lights 0.0 (p1) 0 1 0 2 endevent

//odczyt z pamieci:
event (p1)_sem_info getvalues 1.0 (p1)_sem_mem endevent

// uszkodzony semafor - nieoswietlony:
event (p1)_uszk multiple 0 none (p1)_sem_ligh0 (p1)_w24off (p1)_sem_info_stop endevent
event (p1)_sem_ligh0 lights 0.0 (p1) 0 0 0 0 endevent
