@name Toasty
@persist [E O]:entity Ac A N W [An]:angle
@model models/hunter/blocks/cube075x1x075.mdl
interval(10)
if(first())
{
    #include "lib/functions"
    
    E = entity()
    
    E:setColor(0,0,0,0)
    E:setMass(50)
    #E:propFreeze(0)
    
    holoCreate(1,E:toWorld(vec(-6,0,10)))
    holoModel(1,"hq_rcube_thick")
    holoColor(1,vec(150))
    holoDisableShading(1,1)
    holoScale(1,vec(2,4,3.5))
    holoParent(1,E)
    
    holoCreate(10,E:toWorld(vec(-6,0,10)))
    holoModel(10,"hq_rcube_thick")
    holoColor(10,vec())
    holoScale(10,vec(2,4,3.5)*-1.05)
    holoParent(10,E)
    
    holoCreate(2,holoEntity(1):toWorld(vec(-4,0,20)))
    holoScale(2,vec(0.35,2.5,0.25))
    holoColor(2,vec())
    holoParent(2,E)
    
    holoCreate(3,holoEntity(1):toWorld(vec(4,0,20)))
    holoScale(3,vec(0.35,2.5,0.25))
    holoColor(3,vec())
    holoParent(3,E)
    
    holoCreate(4,holoEntity(1):toWorld(vec(-2,23.5,3)))
    holoScale(4,vec(0.125,0.125,1.75))
    holoColor(4,vec())
    holoParent(4,E)
    
    holoCreate(5,holoEntity(1):toWorld(vec(2,23.5,3)))
    holoScale(5,vec(0.125,0.125,1.75))
    holoColor(5,vec())
    holoParent(5,E)
    
    holoCreate(6,holoEntity(1):toWorld(vec(0,23.5,-5)))
    holoScale(6,vec(0.5,0.3,0.125))
    holoColor(6,vec(25))
    holoMaterial(6,"models/shiny")
    holoParent(6,E)
    
    holoCreate(7,holoEntity(1):toWorld(vec(-4,0,12.5)))
    holoModel(7,"hq_rcylinder")
    holoAng(7,E:toWorld(ang(90,0,0)))
    holoScale(7,vec(2,2,0.25))
    holoColor(7,vec(229,212,168))
    holoParent(7,E)
    
    holoCreate(8,holoEntity(1):toWorld(vec(4,0,12.5)))
    holoModel(8,"hq_rcylinder")
    holoAng(8,E:toWorld(ang(90,0,0)))
    holoScale(8,vec(2,2,0.25))
    holoColor(8,vec(229,212,168))
    holoParent(8,7)
}

holoPos(6,holoEntity(1):toWorld(vec(0,23.5,(-A*17)+3)))
holoPos(7,holoEntity(1):toWorld(vec(-4,0,(-A*12)+12.5)))

if(Ac)
{
    W = E:pos():distance(O:pos())>125
    if(changed(W))
    {
        if(W)
        {
            timer("j",1000)
        }else
        {
            stoptimer("j")
            soundPlay("heydoc",0.5,"vo/npc/male01/heydoc0"+randint(1,2)+".wav")
        }
    }
    
    if(clk("j"))
    {
        stoptimer("j")
        timer("j",1000)
        E:applyForce(((E:up()*200)-(E:right()*150))*E:mass())
        N+=60
        An = ang(0,(O:pos()-E:pos()):toAngle():yaw()-90,0)
        soundPlay("b",0.1,"garrysmod/balloon_pop_cute.wav")
    }
    
    if(W)
    {
        E:turnTo(An)
    }
    
    if(inrange(N,60,360))
    {
        N+=60
    }elseif(N!=0)
    {
        N = 0
    }
    A = cos(N)/2
}else
{
    findByClass("player")
    findSortByDistance(E:pos())
    if(E:pos():distance(find():pos())<400)
    {
        O = find()
        Ac = 1
    }
}
