@name Noclip
@persist [E Se Dri H]:entity Act
if(first())
{
    E = entity():isConstrainedTo()
    if(!E:isVehicle())
    {
        selfDestruct()
    }
    E:propFreeze(1)
    entity():setColor(0,0,0,0)
    
    runOnTick(1)
    
    H = holoCreate(1)
    
    holoCreate(2)
    holoModel(2,"hq_sphere")
    holoScale(2,vec(3))
    holoColor(2,vec4(255,100,0,100))
}

if(changed(numPlayers()))
{
    holoVisible(2,players(),0)
    holoVisible(2,owner(),1)
}

Dri = E:driver()
Act = Dri:isValid()

if(changed(Act))
{
    if(Act)
    {
        if(Dri!=owner())
        {
            E:killPod()
        }
        
        Se = propSpawn("models/hunter/misc/sphere375x375.mdl",1)
        Se:setColor(0,255,0,25)
        Se:setMaterial("models/debug/debugwhite")
        E:setColor(0,0,0,0)
    }else
    {
        Se:propDelete()
        E:setColor(255,255,255,255)
    }
}

if(Act)
{
    Se:setPos(E:pos())
    Se:setAng(ang())

    local W = Dri:keyForward()
    local A = Dri:keyLeft()
    local S = Dri:keyBack()
    local D = Dri:keyRight()
    local Spc = Dri:keyJump()
    local Alt = Dri:keyWalk()
    local Shift = Dri:keySprint()
    local M1 = Dri:keyAttack1()
    local M2 = Dri:keyAttack2()
    
    E:setAng(ang())
    E:setPos(E:toWorld(Dri:eye()*15*(W-S)))
    
    if(findCanQuery())
    {
        local Rd = rangerOffset(50000,H:shootPos()+Dri:eye()*200,Dri:eye())
        holoPos(2,Rd:pos())
        findByClass("player")
        findSortByDistance(Rd:pos())
        local TE = find()
        if(TE:pos():distance(Rd:pos())<200)
        {
            print(4,TE:name())
        }
        if(changed(M1)&M1&M2&TE!=owner())
        {
            propSpawn("models/props_phx/ww2bomb.mdl",TE:shootPos(),1):propBreak()
        }
    }else
    {
        print(4,"no")
    }
}
