@name TardisDrone
@inputs
@outputs Mode:string Target:entity
@persist E:entity Conraption:array Sounds:table Target:entity [Task Mode]:string
@persist MinHeight TraverseRate TraverseYaw TraversePitch Speed
@persist ScannerPitch Drag Mass On TargetDistance RangerLength GuardPosition:vector GuardRange

@inputs Seat:entity Cam:wirelink 
@outputs Flash FlashAnim FlashAlpha Open Doors Base:entity Doors2 Open2
@persist Rotation MoveC Scale Fade 
@inputs EGP:wirelink
@persist [Players Colors]:array Count Sx Sy W H Simplified
timer("runTardis",10)

Sounds["startup",string] = "buttons/button8.wav"
Sounds["warning",string] = "acf_engines/b4_petrollarge.wav"
Sounds["muhhh",string] = "npc/strider/striderx_alert2.wav"
Sounds["engine1",string] = "acf_extra/airfx/usag.wav"
Sounds["engine2",string] = "acf_extra/airfx/orca02.wav"
Sounds["positive",string] = "buttons/blip2.wav"
Sounds["negative",string] = "buttons/weapon_cant_buy.wav"
Sounds["scanningStart",string] = "ambient/energy/ion_cannon_shot3.wav"
Sounds["scanning",string] = "ambient/machines/combine_shield_touch_loop1.wav"
Sounds["ascend",string] = "weapons/stinger_fire1.wav"
Sounds["accelerate",string] = "weapons/mortar/mortar_shell_incomming1.wav"

function holoTardis (Index,Model:string,Scale:vector,Pos:vector,Ang:angle,Mat:string,Color:vector,Parent:entity){
    holoCreate(Index)
    holoModel(Index,Model)
    holoScale(Index,Scale)
    holoPos(Index,Pos)
    holoAng(Index,Ang)
    holoMaterial(Index,Mat)
    holoColor(Index,Color)
    holoParent(Index,Parent)
}

if(first()|dupefinished()){
timer("load1",500)


    Speed           = 150
    Drag            = 0.15
    TraverseRate    = 5
    TraverseYaw     = 55
    TraversePitch   = 55
    MinHeight       = 65
    TargetDistance  = 450
   
    E = entity()
    E:propGravity(1)
   
    Mass += E:mass()
    Contraption = E:getConstraints()
   
    for(I=1, Contraption:count()){
        Prop = Contraption[I,entity]
        Mass += Prop:mass()  
        Prop:propGravity(0)    
    }
   
    rangerHitWater(1)
    rangerFilter(E)
    rangerFilter(Contraption)
    rangerPersist(1)
   
    holoCreate(105, E:toWorld(vec(E:boxSize():x()*0.5,0,0)), vec(1,1,1), E:angles()), holoParent(105, E), holoAlpha(105, 0)    
    holoCreate(106, holoEntity(105):toWorld(vec(0,0,0)), vec(4,4,0.1), holoEntity(105):toWorld(ang(0,135,0))), holoParent(106, 105)
    holoModel(106, "models/hunter/tubes/circle2x2d.mdl"), holoMaterial(106, "models/effects/comball_tape")
    holoColor(106, vec4(255,0,255,0))
       
    On = 0
}
 
runOnChat(1)
interval(50)
 
##CHAT COMMANDS##
if(chatClk(owner())){
    LS = owner():lastSaid():lower():explode(" ")
   
    if(LS[1,string] == "drone"){
        hideChat(1)
       
        if(On == 0){
            if(LS[2,string] == "on"){
                On = 0.5
                Task = "follow"
                Target = owner()
                TargetDistance  = 450
                RangerLength = 500
            }
        }
        if(On == 1){
            if(LS[2,string] == "off"){
                On = 0    
            }
            if(LS[2,string] == "standby"){
                Task = "standby"
                Mode = ""    
            }
            elseif(LS[2,string] == "follow"){
                TempTarget = findPlayerByName(LS[3,string])
                if(TempTarget:isValid()){
                    Target = TempTarget
                    TargetDistance = 450
                    RangerLength = 500
                    Task = "follow"
                    timer("positive",100)
                }
                else{
                    timer("negative",100)    
                }  
            }
            elseif(LS[2,string] == "attack" | LS[2,string] == "scan"){
                TempTarget = findPlayerByName(LS[3,string])
                if(TempTarget:isValid()){
                    Target = TempTarget
                    TargetDistance  = 450
                    RangerLength = 500
                    Mode = ""
                    Task = LS[2,string]
                    timer("positive",100)
                    timer("muhhh",1500)    
                }
                else{
                    timer("negative",100)    
                }    
            }
            elseif(LS[2,string] == "idle"){
                RangerCeiling = rangerOffset(2000,E:massCenter() + vec(0,0,E:boxSize():z()*0.6),vec(0,0,1)):distance()  
                if(RangerCeiling < 2000){
                    timer("negative",100)
                }
                else{
                    timer("positive",100)
                    Task = "idle"
                    Mode = "align"
                }
            }
            elseif(LS[2,string] == "guard"){
                GuardPosition = owner():aimPos()
                GuardRange = clamp(LS[3,string]:toNumber(),1000,5000)
                Task = "guard"
                Mode = "approach"
                timer("positive",100)    
            }
            else{
                timer("negative",100)
            }
        }
        else{
            timer("negative",100)    
        }  
    }
}
 
##STARTUP AND SOUNDS##
if(changed(On)){
    if(On == 0){
        E:propGravity(1)
        soundStop(1,1)
        soundStop(2,1)
       
        timer("muhhh",500)
    }
    if(On == 0.5){
        E:soundPlay(1,1,Sounds["startup",string])
        soundPitch(1,80)
        timer("startup1",1500)  
    }
    if(On == 1){
        Mode = "starting"
        timer("resetMode",2000)
        E:applyForce(vec(0,0,1) * Mass * 10)    
    }
}
if(clk("resetMode")){
    Mode = ""
}
if(clk("startup1")){
    E:soundPlay(1,0,Sounds["engine1",string])
    E:soundPlay(2,0,Sounds["engine2",string])
    E:soundPlay(3,0.8,Sounds["muhhh",string])
    soundPitch(3, 80)
    timer("startup2",1000)  
}
if(clk("startup2")){
    E:propGravity(0)  
    On = 1
    timer("warning",1000)
}
if(clk("muhhh")){
    if(On == 1){  
        E:soundPlay(3,1,Sounds["muhhh",string])
    }
}
if(clk("warning")){
    E:soundPlay(3,1,Sounds["warning",string])
}
if(clk("positive")){
    E:soundPlay(3,1,Sounds["positive",string])
}
if(clk("negative")){
    E:soundPlay(3,0.9,Sounds["negative",string])
    timer("muhhh",1000)
}
if(clk("ascend")){
    E:soundPlay(3,1,Sounds["ascend",string])    
}
if(clk("accelerate")){
    E:soundPlay(3,1,Sounds["accelerate",string])    
}
 
##APPLYFORCE, APPLYTORQUE AND OBSTACLE AVOIDANCE##
if(On == 1){
    TargetPos = Target:boxCenterW()
    Distance = TargetPos:distance(E:pos())
   
    rangerHitEntities(0)
    RangerAlt = rangerOffset(1000, E:massCenter(), vec(0,0,-1)):distance()
   
    rangerHitEntities(1)
    RR = RangerLength/rangerOffset(RangerLength, E:massCenter() + (E:forward()+E:right())*100, E:forward()+E:right()/2):distance()
    RL = RangerLength/rangerOffset(RangerLength, E:massCenter() + (E:forward()-E:right())*100, E:forward()-E:right()/2):distance()
    RU = RangerLength/rangerOffset(RangerLength, E:massCenter() + E:forward() * 100, E:forward()+E:up()):distance()
    RD = RangerLength/2/rangerOffset(RangerLength/2, E:massCenter() + E:forward() * 100, E:forward()-E:up()/2):distance()
    RF = (Speed*2)-rangerOffset((Speed*2), E:toWorld(vec(E:boxSize():x()*0.5,0,0)), E:forward()):distance()
   
    if(changed(Mode)){  
        if(Mode == "scan"){
            holoAlpha(106, 255)
            E:soundPlay(3,1,Sounds["scanningStart",string])
            E:soundPlay(4,0,Sounds["scanning",string])
        }
        if(Mode != "scan"){  
            holoAlpha(106, 0)
            soundStop(4)
        }
        if(Mode == "align"){
            timer("muhhh",1000)
            timer("elevation",2000)    
        }
        if(Mode == "elevation"){
            timer("ascend",100)  
        }
        if(Mode == "idle"){
            RangerLength = 2000
        }
    }
   
    if(Task == "follow" | Task == "attack" | Task == "scan"){
        if(Mode == "starting"){
            A = ang(-E:angles():pitch(),0,-E:angles():roll())    
        }
        else{
            if(Distance > TargetDistance){
                ObPi = clamp((RU-RD)*30,-100,100)
                ObYa = clamp((RR-RL)*30,-100,100)
               
                if(Mode != "scan"){
                    Ac = E:forward() * (Speed - RF*2)    
                }
            }
           
            RangerAct = rangerOffset(100, E:massCenter(), (TargetPos - E:pos()):toAngle():forward()):position()    
            Ya  = clamp(angnorm(-E:bearing(RangerAct))*TraverseRate,-TraverseYaw,TraverseYaw)
            Pi  = clamp(angnorm(-E:elevation(RangerAct))*TraverseRate,-TraversePitch,TraversePitch)
               
            A = ang(Pi + ObPi, Ya + ObYa ,-E:angles():roll() - Ya/3)
           
            if((Task == "attack" & Mode != "attack")|Task == "scan"){
                if(changed(Distance < TargetDistance) & Distance < TargetDistance){
                    Mode = "scan"
                    timer("negative",100)
                    timer("stopScan",5000)        
                }
            }
            if(!Target:isValid()){
                Task = "standby"
            }  
            if(Task == "attack"){
                if(!Target:isAlive()){
                    Task = "standby"
                    Mode = ""
                    Target = noentity()
                }
            }
        }
    }
    if(Task == "standby"){
        A       = ang(-E:angles():pitch(), 0 ,-E:angles():roll())
    }
    if(Task == "idle"){  
        if(Mode == "align"){
            A = ang(-E:angles():pitch(), 0 ,-E:angles():roll())
            if(clk("elevation")){
                if(RangerAlt == 1000){
                    Mode = "idle"
                }
                else{
                    Mode = "elevation"
                }
            }
        }
       
        if(Mode == "elevation"){
            A = ang(-E:angles():pitch(), 0 ,-E:angles():roll())  
            Ac = vec(0,0,1) * (Speed * 2)
           
            if(RangerAlt == 1000){
                Mode = "idle"
            }
        }
        if(Mode == "idle"){
            ObPi = clamp((RU-RD)*30,-100,100)
            ObYa = clamp((RR-RL)*30,-100,100)
            Ac = E:forward() * (Speed - RF*2) * 2
            A = ang(ObPi+1,ObYa ,-E:angles():roll() - ObYa)  
        }    
    }
    if(Task == "guard"){
        if(Mode == "approach"){
            RangerAct   = rangerOffset(100, E:massCenter(), (GuardPosition - E:pos()):toAngle():forward()):position()
            Ya          = clamp(angnorm(-E:bearing(RangerAct))*TraverseRate,-TraverseYaw,TraverseYaw)
            Pi          = clamp(angnorm(-E:elevation(RangerAct))*TraverseRate,-TraversePitch,TraversePitch)
            ObPi        = clamp((RU-RD)*30,-100,100)
            ObYa        = clamp((RR-RL)*30,-100,100)
            A           = ang(ObPi+Pi,ObYa+Ya ,-E:angles():roll() - Ya/3)  
            Ac          = E:forward() * (Speed - RF*2)
           
            DistanceGuard = E:pos():distance(GuardPosition)
           
            if(DistanceGuard < GuardRange){
                Mode = "guard"
            }
        }
        if(Mode == "guard"){
           
            findExcludePlayer(owner())
            findIncludeClass("player")
            findIncludeClass("npc*")  
            findInSphere(GuardPosition, GuardRange)
           
            Target = findClosest(GuardPosition)
            TargetPos = Target:boxCenterW()
            Distance = E:pos():distance(TargetPos)
 
            if(Target:isValid()){
                timer("stopScan",5000)
                Mode = "scan"
            }
            else{
                A = ang(-E:angles():pitch(),0 ,-E:angles():roll())
            }
        }
        if(Mode == "scan"){
            RangerAct = rangerOffset(100, E:massCenter(), (TargetPos - E:pos()):toAngle():forward()):position()    
            Ya        = clamp(angnorm(-E:bearing(RangerAct))*TraverseRate,-TraverseYaw,TraverseYaw)
            Pi        = clamp(angnorm(-E:elevation(RangerAct))*TraverseRate,-TraversePitch,TraversePitch)
            A         = ang(Pi, Ya ,-E:angles():roll() - Ya/3)            
        }
        if(Mode == "attack"){
            if(Distance > TargetDistance){
                ObPi = clamp((RU-RD)*30,-100,100)
                ObYa = clamp((RR-RL)*30,-100,100)
                Ac = E:forward() * (Speed - RF*2)
            }
           
            RangerAct = rangerOffset(100, E:massCenter(), (TargetPos - E:pos()):toAngle():forward()):position()    
            Ya  = clamp(angnorm(-E:bearing(RangerAct))*TraverseRate,-TraverseYaw,TraverseYaw)
            Pi  = clamp(angnorm(-E:elevation(RangerAct))*TraverseRate,-TraversePitch,TraversePitch)  
            A = ang(Pi + ObPi, Ya + ObYa ,-E:angles():roll() - Ya/3)
           
            if(!Target:isAlive()|!Target:isValid()){
                Mode = "approach"
                Target = noentity()
            }
        }
    }    
    if(Mode == "scan"){
        ScannerPitch = (ScannerPitch+6)%360
        holoAng(105, E:toWorld(ang(sin(ScannerPitch)*20,0,0)))
       
        if(clk("stopScan")){
            if(Task == "attack" | Task == "guard"){
                timer("warning",100)
                Mode = "attack"
                TargetDistance = 700  
            }
            elseif(Task == "scan"){
                timer("muhhh",100)
                Task   = "follow"
                Mode   = ""
               
                Name   = Target:name()
                Weapon = Target:weapon()
                Health = Target:health()
                Armor  = Target:armor()
               
                #chatPrint(array("NM: ",Name,", ",Weapon,", HP: ",Health,", AR: ",Armor):concat())    
            }
        }
    }
   
    if(RangerAlt < MinHeight){
        PaHeight = vec(0,0,MinHeight - RangerAlt)*1.5
    }
   
    Pa = -E:vel() * Drag + PaHeight
   
    V = rotationVector(quat(A))
    E:applyTorque(((20*V - 10*E:angVelVector())*E:inertia()))
    E:applyForce((Ac + Pa) * Mass)
}


#Model#
#[Settings]#
Base = entity()
Scale = 0.10
TardisMaterial = "phoenix_storms/grey_chrome"
Shiny = "models/shiny"
Debug = "models/debug/debugwhite"
Blue = vec(0.25,0.25,0.75)*255
Red = vec(0.75,0.25,0.25)*255
Fade = 10  

    #[Base]#
if(clk("load1")){
Base:soundPlay("Blip", 0, "@^garrysmod/content_downloaded.wav", 0.212) 
holoTardis(1,"models/hunter/plates/plate2x2.mdl",vec(1,1,1)*1*Scale,Base:toWorld(vec()*Scale),Base:toWorld(ang()),TardisMaterial,Blue,Base)
holoTardis(1,"models/hunter/plates/plate2x2.mdl",vec(1,1,1)*1*Scale,Base:toWorld(vec()*Scale),Base:toWorld(ang()),TardisMaterial,Blue,Base)
holoTardis(2,"models/hunter/plates/plate2x2.mdl",vec(1,1,1)*0.98*Scale,Base:toWorld(vec(0,0,1)*Scale),Base:toWorld(ang()),TardisMaterial,Blue,Base)

    #[4 Main Beams]#
    
holoTardis(3,"cube",vec(10,0.8,1.2)*1*Scale,Base:toWorld(vec(36.5,38,62)*Scale),Base:toWorld(ang(90,0,0)),TardisMaterial,Blue,Base)
holoTardis(4,"cube",vec(10,0.8,1.2)*1*Scale,Base:toWorld(vec(36.5,-38,62)*Scale),Base:toWorld(ang(90,0,0)),TardisMaterial,Blue,Base)
holoTardis(5,"cube",vec(10,0.8,1.2)*1*Scale,Base:toWorld(vec(-36.5,38,62)*Scale),Base:toWorld(ang(90,0,0)),TardisMaterial,Blue,Base)
holoTardis(6,"cube",vec(10,0.8,1.2)*1*Scale,Base:toWorld(vec(-36.5,-38,62)*Scale),Base:toWorld(ang(90,0,0)),TardisMaterial,Blue,Base)


holoTardis(9,"models/hunter/plates/plate2x2.mdl",vec(0.95,0.95,3)*0.98*Scale,Base:toWorld(vec(0,0,116)*Scale),Base:toWorld(ang()),TardisMaterial,Blue,Base)
holoTardis(10,"models/hunter/plates/plate2x2.mdl",vec(0.975,0.975,2)*0.98*Scale,Base:toWorld(vec(0,0,123)*Scale),Base:toWorld(ang()),TardisMaterial,Blue,Base)
holoTardis(11,"models/hunter/plates/plate2x2.mdl",vec(0.95,0.95,3)*0.98*Scale,Base:toWorld(vec(0,0,128)*Scale),Base:toWorld(ang()),TardisMaterial,Blue,Base)
holoTardis(12,"models/hunter/triangles/trapezium3x3x1.mdl",vec(0.95,0.95,0.25)*0.98*0.66*Scale,Base:toWorld(vec(0,0,136)*Scale),Base:toWorld(ang()),TardisMaterial,Blue,Base)
holoTardis(13,"models/hunter/triangles/trapezium3x3x1.mdl",vec(0.22,0.22,0.05)*1*Scale,holoEntity(12):toWorld(vec(0,0,5)*Scale),Base:toWorld(ang()),TardisMaterial,Blue,Base)
holoTardis(14,"models/props_c17/oildrum001.mdl",vec(1,1,1)*0.25*Scale,holoEntity(12):toWorld(vec(0,0,8)*Scale),Base:toWorld(ang()),TardisMaterial,vec(255,179,0),Base)
holoTardis(15,"models/props_c17/pottery01a.mdl",vec(1,1,0.5)*0.9*Scale,holoEntity(12):toWorld(vec(0,0,21)*Scale),Base:toWorld(ang(0,0,180)),TardisMaterial,Blue,Base)
holoTardis(16,"models/props_c17/pottery01a.mdl",vec(1,1,0.5)*1.2*Scale,holoEntity(12):toWorld(vec(0,0,12)*Scale),Base:toWorld(ang(0,0,180)),TardisMaterial,Blue,Base)
holoTardis(17,"cube",vec(1,1,0.5)*1*Scale,holoEntity(12):toWorld(vec(0,0,6)*Scale),Base:toWorld(ang(0,0,180)),TardisMaterial,Blue,Base)
holoDisableShading(14,1)
holoAlpha(14,100)
timer("load2",500) 
}
#[Door Right]#
if(clk("load2")){ 
Base:soundPlay("Blip", 0, "@^garrysmod/content_downloaded.wav", 0.212) 
holoTardis(30,"cube",vec(1,1,1)*0*Scale,Base:toWorld(vec(40,34,0)*Scale),Base:toWorld(ang()),TardisMaterial,Blue,Base)
holoTardis(31,"models/hunter/plates/plate1x3.mdl",vec(1,0.945,1)*0.9*Scale,holoEntity(30):toWorld(vec(0,-16.5,64)*Scale),holoEntity(30):toWorld(ang(0,90,90)),TardisMaterial,Blue*0.75,holoEntity(30))
    
holoTardis(32,"models/sprops/rectangles/size_1/rect_3x120x3.mdl",vec(1,1,2.5)*1*Scale,holoEntity(30):toWorld(vec(0,-31,62)*Scale),holoEntity(30):toWorld(ang(90,0,0)),TardisMaterial,Blue,holoEntity(30))
holoTardis(33,"models/sprops/rectangles/size_1/rect_3x120x3.mdl",vec(1,1,2.5)*1*Scale,holoEntity(30):toWorld(vec(0,0,62)*Scale),holoEntity(30):toWorld(ang(90,0,0)),TardisMaterial,Blue,holoEntity(30))
    
holoTardis(34,"models/sprops/rectangles/size_1_5/rect_6x30x3.mdl",vec(1.2,1.15,1.75)*1*Scale,holoEntity(30):toWorld(vec(0,-17,5)*Scale),holoEntity(30):toWorld(ang(0,90,0)),TardisMaterial,Blue,holoEntity(30))
holoTardis(35,"models/sprops/rectangles/size_1_5/rect_6x30x3.mdl",vec(1,1.15,1.75)*1*Scale,holoEntity(30):toWorld(vec(0,-14.7,30)*Scale),holoEntity(30):toWorld(ang(0,90,0)),TardisMaterial,Blue,holoEntity(30))
holoTardis(36,"models/sprops/rectangles/size_1_5/rect_6x30x3.mdl",vec(1.1,1.15,1.75)*1*Scale,holoEntity(30):toWorld(vec(0,-14.7,55)*Scale),holoEntity(30):toWorld(ang(0,90,0)),TardisMaterial,Blue,holoEntity(30))
holoTardis(37,"models/sprops/rectangles/size_1_5/rect_6x30x3.mdl",vec(1,1.15,1.75)*1*Scale,holoEntity(30):toWorld(vec(0,-16,80)*Scale),holoEntity(30):toWorld(ang(0,90,0)),TardisMaterial,Blue,holoEntity(30))
holoTardis(38,"models/sprops/rectangles/size_1_5/rect_6x30x3.mdl",vec(1,1.15,1.75)*1*Scale,holoEntity(30):toWorld(vec(0,-16,110)*Scale),holoEntity(30):toWorld(ang(0,90,0)),TardisMaterial,Blue,holoEntity(30))
holoTardis(39,"models/props_coalmines/window2.mdl",vec(1,1.07,1)*0.5*Scale,holoEntity(30):toWorld(vec(2,-15.5,95)*Scale),holoEntity(30):toWorld(ang(0,0,0)),"",vec(1,1,1)*255,holoEntity(30))

#[Door Left]#

holoTardis(20,"cube",vec(1,1,1)*0*Scale,Base:toWorld(vec(40,-34,0)*Scale),Base:toWorld(ang()),TardisMaterial,Blue,Base)
holoTardis(21,"models/hunter/plates/plate1x3.mdl",vec(1,0.375,1)*0.9*Scale,holoEntity(20):toWorld(vec(0,16.5,28.4)*Scale),holoEntity(20):toWorld(ang(0,90,90)),TardisMaterial,Blue*0.85,holoEntity(20))
    
holoTardis(22,"models/sprops/rectangles/size_1/rect_3x120x3.mdl",vec(1,1,2.5)*1*Scale,holoEntity(20):toWorld(vec(0,31,62)*Scale),holoEntity(20):toWorld(ang(90,0,0)),TardisMaterial,Blue,holoEntity(20))
holoTardis(23,"models/sprops/rectangles/size_1/rect_3x120x3.mdl",vec(1,1,2.5)*1*Scale,holoEntity(20):toWorld(vec(0,0,62)*Scale),holoEntity(20):toWorld(ang(90,0,0)),TardisMaterial,Blue,holoEntity(20))
    
holoTardis(24,"models/sprops/rectangles/size_1_5/rect_6x30x3.mdl",vec(1.5,1.15,1.75)*1*Scale,holoEntity(20):toWorld(vec(0,17,5)*Scale),holoEntity(20):toWorld(ang(0,90,0)),TardisMaterial,Blue,holoEntity(20))
holoTardis(25,"models/sprops/rectangles/size_1_5/rect_6x30x3.mdl",vec(1,1.15,1.75)*1*Scale,holoEntity(20):toWorld(vec(0,14.7,30)*Scale),holoEntity(20):toWorld(ang(0,90,0)),TardisMaterial,Blue,holoEntity(20))
holoTardis(26,"models/sprops/rectangles/size_1_5/rect_6x30x3.mdl",vec(1,1.15,1.75)*1*Scale,holoEntity(20):toWorld(vec(0,16,55)*Scale),holoEntity(20):toWorld(ang(0,90,0)),TardisMaterial,Blue,holoEntity(20))
holoTardis(27,"models/sprops/rectangles/size_1_5/rect_6x30x3.mdl",vec(1,1.15,1.75)*1*Scale,holoEntity(20):toWorld(vec(0,16,80)*Scale),holoEntity(20):toWorld(ang(0,90,0)),TardisMaterial,Blue,holoEntity(20))
holoTardis(28,"models/sprops/rectangles/size_1_5/rect_6x30x3.mdl",vec(1,1.15,1.75)*1*Scale,holoEntity(20):toWorld(vec(0,16,110)*Scale),holoEntity(20):toWorld(ang(0,90,0)),TardisMaterial,Blue,holoEntity(20))
holoTardis(29,"models/props_coalmines/window2.mdl",vec(1,1.07,1)*0.5*Scale,holoEntity(20):toWorld(vec(2,15.5,95)*Scale),holoEntity(20):toWorld(ang(0,0,0)),"",vec(1,1,1)*255,holoEntity(20))

#[Phone]#

holoTardis(40,"models/props/cs_office/phone_p2.mdl",vec(1,1,1)*0.5*Scale,holoEntity(30):toWorld(vec(3,-30,50)*Scale),holoEntity(30):toWorld(ang(-90,180,0)),Shiny,vec(1,1,1)*255,holoEntity(30))   

timer("load3",500) 
}
#[Walls]#

if(clk("load3")){
Base:soundPlay("Blip", 0, "@^garrysmod/content_downloaded.wav", 0.212)  
holoTardis(50,"models/hunter/plates/plate2x3.mdl",vec(1,0.955,1)*0.9*Scale,Base:toWorld(vec(0,40,64)*Scale),Base:toWorld(ang(0,0,90)),TardisMaterial,Blue*0.75,Base)
holoTardis(51,"models/sprops/rectangles/size_1/rect_3x120x3.mdl",vec(1,1,2.5)*1*Scale,holoEntity(50):toWorld(vec(0,-3,0)*Scale),holoEntity(50):toWorld(ang(0,90,0)),TardisMaterial,Blue,holoEntity(50))
holoTardis(52,"models/sprops/rectangles/size_1/rect_3x120x3.mdl",vec(1,1,2.5)*1*Scale,holoEntity(50):toWorld(vec(33,-3,0)*Scale),holoEntity(50):toWorld(ang(0,90,0)),TardisMaterial,Blue,holoEntity(50))
holoTardis(53,"models/sprops/rectangles/size_1/rect_3x120x3.mdl",vec(1,1,2.5)*1*Scale,holoEntity(50):toWorld(vec(-33,-3,0)*Scale),holoEntity(50):toWorld(ang(0,90,0)),TardisMaterial,Blue,holoEntity(50))
holoTardis(54,"models/sprops/rectangles/size_1/rect_3x60x3.mdl",vec(1,1,2)*1*Scale,holoEntity(50):toWorld(vec(0,-60,0)*Scale),holoEntity(50):toWorld(ang(0,0,0)),TardisMaterial,Blue,holoEntity(50))
holoTardis(55,"models/sprops/rectangles/size_1/rect_3x60x3.mdl",vec(1,1,2)*1*Scale,holoEntity(50):toWorld(vec(0,47.5,0)*Scale),holoEntity(50):toWorld(ang(0,0,0)),TardisMaterial,Blue,holoEntity(50))
holoTardis(56,"models/sprops/rectangles/size_1/rect_3x60x3.mdl",vec(1,1,2)*1*Scale,holoEntity(50):toWorld(vec(0,-34.5,0)*Scale),holoEntity(50):toWorld(ang(0,0,0)),TardisMaterial,Blue,holoEntity(50))
holoTardis(57,"models/sprops/rectangles/size_1/rect_3x60x3.mdl",vec(1,1,2)*1*Scale,holoEntity(50):toWorld(vec(0,-9.5,0)*Scale),holoEntity(50):toWorld(ang(0,0,0)),TardisMaterial,Blue,holoEntity(50))
holoTardis(58,"models/sprops/rectangles/size_1/rect_3x60x3.mdl",vec(1,1,2)*1*Scale,holoEntity(50):toWorld(vec(0,16.5,0)*Scale),holoEntity(50):toWorld(ang(0,0,0)),TardisMaterial,Blue,holoEntity(50))

holoTardis(60,"models/hunter/plates/plate2x3.mdl",vec(1,0.955,1)*0.9*Scale,Base:toWorld(vec(0,-40,64)*Scale),Base:toWorld(ang(0,180,90)),TardisMaterial,Blue*0.75,Base)
holoTardis(61,"models/sprops/rectangles/size_1/rect_3x120x3.mdl",vec(1,1,2.5)*1*Scale,holoEntity(60):toWorld(vec(0,-3,0)*Scale),holoEntity(60):toWorld(ang(0,90,0)),TardisMaterial,Blue,holoEntity(60))
holoTardis(62,"models/sprops/rectangles/size_1/rect_3x120x3.mdl",vec(1,1,2.5)*1*Scale,holoEntity(60):toWorld(vec(33,-3,0)*Scale),holoEntity(60):toWorld(ang(0,90,0)),TardisMaterial,Blue,holoEntity(60))
holoTardis(63,"models/sprops/rectangles/size_1/rect_3x120x3.mdl",vec(1,1,2.5)*1*Scale,holoEntity(60):toWorld(vec(-33,-3,0)*Scale),holoEntity(60):toWorld(ang(0,90,0)),TardisMaterial,Blue,holoEntity(60))
holoTardis(64,"models/sprops/rectangles/size_1/rect_3x60x3.mdl",vec(1,2,2)*1*Scale,holoEntity(60):toWorld(vec(0,-60,0)*Scale),holoEntity(60):toWorld(ang(0,0,0)),TardisMaterial,Blue,holoEntity(60))
holoTardis(65,"models/sprops/rectangles/size_1/rect_3x60x3.mdl",vec(1,2,2)*1*Scale,holoEntity(60):toWorld(vec(0,47.5,0)*Scale),holoEntity(60):toWorld(ang(0,0,0)),TardisMaterial,Blue,holoEntity(60))
holoTardis(66,"models/sprops/rectangles/size_1/rect_3x60x3.mdl",vec(1,2,2)*1*Scale,holoEntity(60):toWorld(vec(0,-34.5,0)*Scale),holoEntity(60):toWorld(ang(0,0,0)),TardisMaterial,Blue,holoEntity(60))
holoTardis(67,"models/sprops/rectangles/size_1/rect_3x60x3.mdl",vec(1,2,2)*1*Scale,holoEntity(60):toWorld(vec(0,-9.5,0)*Scale),holoEntity(60):toWorld(ang(0,0,0)),TardisMaterial,Blue,holoEntity(60))
holoTardis(68,"models/sprops/rectangles/size_1/rect_3x60x3.mdl",vec(1,2,2)*1*Scale,holoEntity(60):toWorld(vec(0,16.5,0)*Scale),holoEntity(60):toWorld(ang(0,0,0)),TardisMaterial,Blue,holoEntity(60))
  
holoTardis(70,"models/hunter/plates/plate2x3.mdl",vec(1,0.955,1)*0.9*Scale,Base:toWorld(vec(-40,0,64)*Scale),Base:toWorld(ang(0,90,90)),TardisMaterial,Blue*0.75,Base)
holoTardis(71,"models/sprops/rectangles/size_1/rect_3x120x3.mdl",vec(1,1,2.5)*1*Scale,holoEntity(70):toWorld(vec(0,-3,0)*Scale),holoEntity(70):toWorld(ang(0,90,0)),TardisMaterial,Blue,holoEntity(70))
holoTardis(72,"models/sprops/rectangles/size_1/rect_3x120x3.mdl",vec(1,1,2.5)*1*Scale,holoEntity(70):toWorld(vec(33,-3,0)*Scale),holoEntity(70):toWorld(ang(0,90,0)),TardisMaterial,Blue,holoEntity(70))
holoTardis(73,"models/sprops/rectangles/size_1/rect_3x120x3.mdl",vec(1,1,2.5)*1*Scale,holoEntity(70):toWorld(vec(-33,-3,0)*Scale),holoEntity(70):toWorld(ang(0,90,0)),TardisMaterial,Blue,holoEntity(70))
holoTardis(74,"models/sprops/rectangles/size_1/rect_3x60x3.mdl",vec(1,2,2)*1*Scale,holoEntity(70):toWorld(vec(0,-60,0)*Scale),holoEntity(70):toWorld(ang(0,0,0)),TardisMaterial,Blue,holoEntity(70))
holoTardis(75,"models/sprops/rectangles/size_1/rect_3x60x3.mdl",vec(1,2,2)*1*Scale,holoEntity(70):toWorld(vec(0,47.5,0)*Scale),holoEntity(70):toWorld(ang(0,0,0)),TardisMaterial,Blue,holoEntity(70))
holoTardis(76,"models/sprops/rectangles/size_1/rect_3x60x3.mdl",vec(1,2,2)*1*Scale,holoEntity(70):toWorld(vec(0,-34.5,0)*Scale),holoEntity(70):toWorld(ang(0,0,0)),TardisMaterial,Blue,holoEntity(70))
holoTardis(77,"models/sprops/rectangles/size_1/rect_3x60x3.mdl",vec(1,2,2)*1*Scale,holoEntity(70):toWorld(vec(0,-9.5,0)*Scale),holoEntity(70):toWorld(ang(0,0,0)),TardisMaterial,Blue,holoEntity(70))
holoTardis(78,"models/sprops/rectangles/size_1/rect_3x60x3.mdl",vec(1,2,2)*1*Scale,holoEntity(70):toWorld(vec(0,16.5,0)*Scale),holoEntity(70):toWorld(ang(0,0,0)),TardisMaterial,Blue,holoEntity(70))

holoTardis(79,"models/props_coalmines/window2.mdl",vec(1,1,1)*0.5*Scale,holoEntity(70):toWorld(vec(16,32,-2)*Scale),holoEntity(70):toWorld(ang(90,90,0)),"",vec(1,1,1)*255,holoEntity(70))
holoTardis(82,"models/props_coalmines/window2.mdl",vec(1,1,1)*0.5*Scale,holoEntity(70):toWorld(vec(-16,32,-2)*Scale),holoEntity(70):toWorld(ang(90,90,0)),"",vec(1,1,1)*255,holoEntity(70))

holoTardis(79,"models/props_coalmines/window2.mdl",vec(1,1,1)*0.5*Scale,holoEntity(70):toWorld(vec(16,32,-2)*Scale),holoEntity(70):toWorld(ang(90,90,0)),"",vec(1,1,1)*255,holoEntity(70))
holoTardis(82,"models/props_coalmines/window2.mdl",vec(1,1,1)*0.5*Scale,holoEntity(70):toWorld(vec(-16,32,-2)*Scale),holoEntity(70):toWorld(ang(90,90,0)),"",vec(1,1,1)*255,holoEntity(70))

holoTardis(59,"models/props_coalmines/window2.mdl",vec(1,1,1)*0.5*Scale,holoEntity(50):toWorld(vec(16,32,-2)*Scale),holoEntity(50):toWorld(ang(90,90,0)),"",vec(1,1,1)*255,holoEntity(50))
holoTardis(80,"models/props_coalmines/window2.mdl",vec(1,1,1)*0.5*Scale,holoEntity(50):toWorld(vec(-16,32,-2)*Scale),holoEntity(50):toWorld(ang(90,90,0)),"",vec(1,1,1)*255,holoEntity(50))

holoTardis(69,"models/props_coalmines/window2.mdl",vec(1,1,1)*0.5*Scale,holoEntity(60):toWorld(vec(16,32,-2)*Scale),holoEntity(60):toWorld(ang(90,90,0)),"",vec(1,1,1)*255,holoEntity(60))
holoTardis(81,"models/props_coalmines/window2.mdl",vec(1,1,1)*0.5*Scale,holoEntity(60):toWorld(vec(-16,32,-2)*Scale),holoEntity(60):toWorld(ang(90,90,0)),"",vec(1,1,1)*255,holoEntity(60))

holoTardis(79,"models/props_coalmines/window2.mdl",vec(1,1,1)*0.5*Scale,holoEntity(70):toWorld(vec(16,32,-2)*Scale),holoEntity(70):toWorld(ang(90,90,0)),"",vec(1,1,1)*255,holoEntity(70))
holoTardis(82,"models/props_coalmines/window2.mdl",vec(1,1,1)*0.5*Scale,holoEntity(70):toWorld(vec(-16,32,-2)*Scale),holoEntity(70):toWorld(ang(90,90,0)),"",vec(1,1,1)*255,holoEntity(70))
    
#holoTardis(90,"cube",vec(3,3,3)*0.25*Scale,holoEntity(12):toWorld(vec(1,0,-90)*Scale),Base:toWorld(ang()),TardisMaterial,vec(255,179,0),Base)
#holoAng(90,ang(90,90,90))
HoloMatrix = holoEntity(86)
print("TARDIS has been created")
}
#[Phone Box]#
holoTardis(91,"cube",vec(0.1,2.5,3.3)*0.5*Scale,holoEntity(20):toWorld(vec(2.5,15.5,67.7)*Scale),holoEntity(20):toWorld(ang(0,0,0)),"",vec(1,1,1)*255,holoEntity(20))

holoTardis(93,"cube",vec(0.1,5.4,3.3)*0.5*Scale,holoEntity(20):toWorld(vec(2,15.5,67.7)*Scale),holoEntity(20):toWorld(ang(0,0,0)),TardisMaterial,Blue,holoEntity(20))

#[Axiss]#
holoTardis(94,"cube",vec(0.01,0.01,0.01)*0.5*Scale,holoEntity(20):toWorld(vec(2,4.5,60.7)*Scale),holoEntity(20):toWorld(ang(0,0,0)),TardisMaterial,Blue,holoEntity(20))

holoTardis(92,"models/props/cs_office/phone_p2.mdl",vec(1,1,1)*0.5*Scale,holoEntity(30):toWorld(vec(0.7,-42,67.7)*Scale),holoEntity(30):toWorld(ang(-90,180,0)),Shiny,vec(74,68,68)*255,holoEntity(30))   

#[CallPhone]#

#holoTardis(95,"models/props_2fort/telephone001.mdl",vec(1,1,1)*0.5*Scale,holoEntity(20):toWorld(vec(-3.3,15.5,58.7)*Scale),holoEntity(20):toWorld(ang(0,0,0)),TardisMaterial,vec(0,0,0),holoEntity(20))



#Made to look like phone is in Box

holoTardis(96,"cube",vec(0.1,4.7,3.3)*0.5*Scale,holoEntity(20):toWorld(vec(-7,15.5,57.7)*Scale),holoEntity(20):toWorld(ang(90,0,0)),TardisMaterial,Blue,holoEntity(20))

holoTardis(97,"cube",vec(0.1,4.7,3.3)*0.5*Scale,holoEntity(20):toWorld(vec(-7,15.5,77.1)*Scale),holoEntity(20):toWorld(ang(90,0,0)),TardisMaterial,Blue,holoEntity(20))

holoTardis(98,"cube",vec(0.1,4.69,3.3)*0.5*Scale,holoEntity(20):toWorld(vec(-17,15.5,67.7)*Scale),holoEntity(20):toWorld(ang(0,0,0)),TardisMaterial,Blue,holoEntity(20))

holoTardis(99,"cube",vec(0.1,2.5,3.3)*0.5*Scale,holoEntity(20):toWorld(vec(-10,29.8,67.7)*Scale),holoEntity(20):toWorld(ang(0,90,0)),TardisMaterial,Blue,holoEntity(20))

holoTardis(100,"cube",vec(0.1,2.5,3.3)*0.5*Scale,holoEntity(20):toWorld(vec(-10,1.4,67.7)*Scale),holoEntity(20):toWorld(ang(0,90,0)),TardisMaterial,Blue,holoEntity(20))

#DoorOpenPhone
holoParent(91,93)
holoParent(92,93)
holoParent(93,94)


