@name Mine Turtle
@persist Num Epl
@model models/props/de_tides/vending_turtle.mdl
if(first())
{
    runOnTick(1)
    timer("snd",random(3000,7000))
    timer("j",random(5000,10000))
    entity():propFreeze(0)
    holoCreate(1)
    holoModel(1,"hq_rcylinder")
    holoColor(1,vec(255,0,0))
    holoPos(1,entity():toWorld(vec(0,-1,5)))
    holoScale(1,vec(0.2,0.2,0.25))
    holoParent(1,entity())
    entity():setAng(ang(0,random(1,360),0))
}

if(!Epl)
{
    R = rangerOffset(10,entity():pos(),entity():up())
    if(findCanQuery())
    {
        findByClass("player")
        findSortByDistance(entity():pos())   
    }
    if(R:hit()|find():pos():distance(entity():pos())<35)
    {
        timer("1",750) 
        soundPlay(2,0,"/weapons/smg_clip_in.wav")
        Epl = 1
        holoUnparent(1)
        holoPos(1,entity():toWorld(vec(0,-1,4.5)))
        holoParent(1,entity())
    }
}

if(clk("j"))
{
    stoptimer("j")
    entity():applyForce(vec(0,0,500)+entity():right()*random(-500,500))
    entity():applyAngForce(ang(0,random(-35,35),0))
    timer("j",random(5000,10000))
}

if(clk("1"))
{
    stoptimer("1")
    propSpawn("models/props_phx/mk-82.mdl",entity():pos()+vec(0,0,5),1):propBreak()
    propSpawn("models/props_phx/mk-82.mdl",entity():pos()+vec(0,0,6),1):propBreak()
    propSpawn("models/props_phx/mk-82.mdl",entity():pos()+vec(0,0,7),1):propBreak()
    propSpawn("models/props_phx/mk-82.mdl",entity():pos()+vec(0,0,8),1):propBreak()
    selfDestruct()     
}

if(clk("snd"))
{
    stoptimer("snd")
    timer("snd",random(2000,5000))   
    soundPlay(1,1,"/vo/npc/female01/heydoc0"+round(random(1,2))+".wav")
    soundPitch(1,175)
}
