@name Key
@inputs 
@outputs BA:array 
@persist R:ranger [H Prop]:entity HS:vector Active 
@autoupdate
interval(50)

if (first()) {    
    H = holoCreate(1)
    holoPos(1,entity():toWorld(vec(0,0,16)))
    holoMaterial(1,"models/props_interiors/metalfence007a")
    #holoParent(1,entity():isWeldedTo())
    HS = H:boxSize()
    
    holoCreate(2)
    holoModel(2,"models/hunter/plates/plate025.mdl")
    holoAng(2,ang(0,0,90))
    holoPos(2,entity():toWorld(vec(0,1.5,5)))
}

if(dupefinished()){
    reset()
}

R = rangerOffsetHull(5,H:pos(),entity():up(),HS)

if (R:entity():model() == "models/hunter/misc/sphere025x025.mdl") {
    BA:pushEntity(R:entity())
    Prop=BA[1,entity]
    Prop:propFreeze(1)
    Prop:setPos(holoEntity(1):toWorld(vec(0,0,0)))
    Prop:setAng(ang(110,50,0))
    holoColor(1,vec(0,255,0))
} else {
    holoColor(1,vec(255,255,255),0)
}

if (owner():aimEntity() == Prop & owner():keyWalk()) {
    Prop:propFreeze(0)
    BA:clear()
    Prop:setPos(holoEntity(1):pos()+vec(0,-10,0))
    reset()
}

if (changed(R:entity():model() == "models/hunter/misc/sphere025x025.mdl")) {
    entity():soundPlay("Down",1,"acf_other/penetratingshots/00000294.wav")
    Active = 1
} else {
    Active = 0
}

if (Active == 1) {
    findPlayerByName(findClosest(entity():pos()):name())
} elseif (Active == 0) {
    
}
