@name RangerTrip
@outputs D
@persist E:entity EN:string EC DO EO:entity
interval(10)
if(first()){
    holoCreate(0, entity():pos())
    holoParent(0, entity())
    holoPos(0, entity():pos()+entity():up()*180)
    holoModel(0, "cylinder")
    holoColor(0, vec(255,20,20),255)
    holoScaleUnits(0, vec(0.5,0.5,375))
    holoMaterial(0, "models/props_combine/stasisfield_beam")
    holoCreate(1, entity():pos())
    holoParent(1, entity())
    holoPos(1, entity():pos()+entity():up())
    holoModel(1, "icosphere")
    holoScale(1, vec(1.1,1.1,0.4))
    holoColor(1, vec(0,0,0))
    holoMaterial(1, "phoenix_storms/black_chrome")
    
}
    DO=300
    R=ranger(DO)
    D=round(R:distance())
    E=R:entity()
    EN=E:name()
    
    holoPos(0, entity():pos()+entity():up()*D/2)
    holoScaleUnits(0, vec(0.5,0.5,D*1.0415))
if (E!=EO&E:isPlayer()) {
    hint(EN + " has tripped the laser!", 5)
    holoColor(0, vec(20,20,255), 255)
    entity():soundPlay(0, 2.9, "ambient/alarms/siren.wav")
    timer("SO", 2900)
    soundVolume(0, 1)
    timer("AO", 2000)
    EO = E
}
if (clk("AO")) {
    EO = noentity()
    holoColor(0, vec(255,20,20),255)
}
if (clk("SO")) {
    soundPurge()    
}
