@name ConseptCar
@inputs [Pod EGP EGP2]:wirelink 
@outputs User:entity 
@persist I M A State HoloCount 
@persist CanDrive CanDive CanFly Lights
@trigger 
interval(100)

local Seat = Pod["Entity",entity]
local Driver = Seat:driver()
local W = Driver:keyForward()
local A = Driver:keyLeft()
local S = Driver:keyBack()
local D = Driver:keyRight()
local R = Driver:keyReload()
local Mouse1 = Driver:keyAttack1()
local Mouse2 = Driver:keyAttack2()
local Space = Driver:keyJump()
local Shift = Driver:keySprint()
local Active = Driver:isPlayer()

User = Driver

Cursor = EGP:egpCursor(User)
Cursor2 = EGP2:egpCursor(User)

E = entity():isWeldedTo()

if (dupefinished()) {reset()}

if (first()) {
    HoloCount = 38
    M = HoloCount
    
    CanDrive = 1
    
    EGP:egpClear()
    EGP2:egpClear()
    
    EGP:egpText(1,"Submerge",vec2(256,472))
    EGP:egpText(2,"Drive",vec2(256,486))
    EGP:egpText(3,"Fly",vec2(256,500))
    
    for (Text = 1,3) {EGP:egpAlign(Text,1,1)}
    
    EGP:egpBox(4,vec2(255,474),vec2(70,10))
    EGP:egpBox(5,vec2(255,487),vec2(36,10))
    EGP:egpBox(6,vec2(255,500),vec2(20,10))
    
    for (Box = 4,6) {EGP:egpAlpha(Box,0)}
    
    EGP2:egpText(7,"Lights",vec2(256,472))
    EGP2:egpText(8,"...",vec2(256,486))
    EGP2:egpText(9,"...",vec2(256,500))
    
    for (Text2 = 7,9) {EGP2:egpAlign(Text2,1,1)}
    
    EGP2:egpBox(10,vec2(255,472),vec2(37,10))
    
    for (Box2 = 10,13) {EGP2:egpAlpha(Box2,0)}
}

if (inrange(Cursor,EGP:egpPos(4)-EGP:egpSize(4)/2,EGP:egpPos(4)+EGP:egpSize(4)/2) & Mouse1) {CanDive = 1}
elseif (CanDrive == 1 | CanFly == 1) {CanDive = 0}

if (inrange(Cursor,EGP:egpPos(5)-EGP:egpSize(5)/2,EGP:egpPos(5)+EGP:egpSize(5)/2) & Mouse1) {CanDrive = 1}
elseif (CanDive == 1 | CanFly == 1) {CanDrive = 0}

if (inrange(Cursor,EGP:egpPos(6)-EGP:egpSize(6)/2,EGP:egpPos(6)+EGP:egpSize(6)/2) & Mouse1) {CanFly = 1}
elseif (CanDrive == 1 | CanDive == 1) {CanFly = 0}

if (inrange(Cursor2,EGP2:egpPos(10)-EGP2:egpSize(10)/2,EGP2:egpPos(10)+EGP2:egpSize(10)/2) & Mouse1) {if(Lights == 0) {Lights = 1} else {Lights = 0}}

if (CanDive == 1) {EGP:egpColor(1,vec(0,255,0))} else {EGP:egpColor(1,vec(255,0,0))}
if (CanDrive == 1) {EGP:egpColor(2,vec(0,255,0))} else {EGP:egpColor(2,vec(255,0,0))}
if (CanFly == 1) {EGP:egpColor(3,vec(0,255,0))} else {EGP:egpColor(3,vec(255,0,0))}

if (Lights == 1) {EGP2:egpColor(7,vec(0,255,0))} else {EGP2:egpColor(7,vec(255,0,0))}

if (I < M & holoCanCreate()) {
    I++
    
    holoCreate(I)
    holoParent(I,E)
    holoMaterial(I,"models/gibs/metalgibs/metal_gibs")
    
    holoModel(1,"models/sprops/misc/domes/size_4/dome_48x108.mdl")
    holoPos(1,E:toWorld(vec(60,0,4)))
    holoAng(1,E:toWorld(ang(0,-90,90)))
    holoScale(1,vec(1.4,1,1.4))
    
    holoClipEnabled(1,1,1)
    holoClip(1,1,vec(0,0,60),vec(0,0,1),0)
    
    holoClipEnabled(1,2,1)
    holoClip(1,2,vec(0,0,140),vec(0,0,-1),0)
    
    holoClipEnabled(1,3,1)
    holoClip(1,3,vec(0,17,0),vec(0,-1,0),0)
    
    holoClipEnabled(1,4,1)
    holoClip(1,4,vec(0,-9,0),vec(0,1,0),0)
    
    holoModel(2,"models/sprops/misc/domes/size_4/dome_48x108.mdl")
    holoPos(2,E:toWorld(vec(60,0,4)))
    holoAng(2,E:toWorld(ang(0,90,90)))
    holoScale(2,vec(-1.4,-1,-1.4))
    
    holoClipEnabled(2,1,1)
    holoClip(2,1,vec(0,0,-60),vec(0,0,-1),0)
    
    holoClipEnabled(2,2,1)
    holoClip(2,2,vec(0,0,-140),vec(0,0,1),0)
    
    holoClipEnabled(2,3,1)
    holoClip(2,3,vec(0,17,0),vec(0,-1,0),0)
    
    holoClipEnabled(2,4,1)
    holoClip(2,4,vec(0,-9,0),vec(0,1,0),0)
    
    holoModel(3,"models/sprops/misc/domes/size_4/dome_48x108.mdl")
    holoPos(3,E:toWorld(vec(-60,0,4)))
    holoAng(3,E:toWorld(ang(0,90,90)))
    holoScale(3,vec(1.4,1,1.4))
    
    holoClipEnabled(3,1,1)
    holoClip(3,1,vec(0,0,60),vec(0,0,1),0)
    
    holoClipEnabled(3,2,1)
    holoClip(3,2,vec(0,0,140),vec(0,0,-1),0)
    
    holoClipEnabled(3,3,1)
    holoClip(3,3,vec(0,17,0),vec(0,-1,0),0)
    
    holoClipEnabled(3,4,1)
    holoClip(3,4,vec(0,-9,0),vec(0,1,0),0)
    
    holoModel(4,"models/sprops/misc/domes/size_4/dome_48x108.mdl")
    holoPos(4,E:toWorld(vec(-60,0,4)))
    holoAng(4,E:toWorld(ang(0,-90,90)))
    holoScale(4,vec(-1.4,-1,-1.4))
    
    holoClipEnabled(4,1,1)
    holoClip(4,1,vec(0,0,-60),vec(0,0,-1),0)
    
    holoClipEnabled(4,2,1)
    holoClip(4,2,vec(0,0,-140),vec(0,0,1),0)
    
    holoClipEnabled(4,3,1)
    holoClip(4,3,vec(0,17,0),vec(0,-1,0),0)
    
    holoClipEnabled(4,4,1)
    holoClip(4,4,vec(0,-9,0),vec(0,1,0),0)
    
    holoModel(5,"models/sprops/misc/domes/size_1/dome_12x30.mdl")
    holoPos(5,E:toWorld(vec(55,-25,0)))
    holoAng(5,E:toWorld(ang(40,-90,90)))
    holoScale(5,vec(2,0.8,3))
    
    holoModel(6,"models/sprops/misc/domes/size_1/dome_12x30.mdl")
    holoPos(6,E:toWorld(vec(55,-23,-3.5)))
    holoAng(6,E:toWorld(ang(20,-90,90)))
    holoScale(6,vec(2,0.8,3))
    
    holoModel(7,"models/sprops/misc/domes/size_1/dome_12x30.mdl")
    holoPos(7,E:toWorld(vec(55,25,0)))
    holoAng(7,E:toWorld(ang(-40,-90,90)))
    holoScale(7,vec(2,0.8,3))
    
    holoModel(8,"models/sprops/misc/domes/size_1/dome_12x30.mdl")
    holoPos(8,E:toWorld(vec(55,23,-3.5)))
    holoAng(8,E:toWorld(ang(-20,-90,90)))
    holoScale(8,vec(2,0.8,3))
    
    holoModel(9,"models/props_junk/metal_paintcan001a.mdl")
    holoPos(9,E:toWorld(vec(67,0,4)))
    holoAng(9,E:toWorld(ang(0,90,90)))
    holoScale(9,vec(2.2,1.6,2))
    
    holoModel(10,"models/props_junk/metal_paintcan001a.mdl")
    holoMaterial(10,"WTP/carbonfibre_2")
    holoPos(10,E:toWorld(vec(-67,0,4)))
    holoAng(10,E:toWorld(ang(0,-90,90)))
    holoScale(10,vec(2.2,1.6,2))
    
    holoModel(11,"models/props_junk/metal_paintcan001a.mdl")
    holoPos(11,E:toWorld(vec(0,0,-4)))
    holoAng(11,E:toWorld(ang(0,0,0)))
    holoScale(11,vec(15,5,0.1))
    
    holoModel(12,"models/sprops/misc/domes/size_4/dome_48x108.mdl")
    holoPos(12,E:toWorld(vec(60,0,20)))
    holoAng(12,E:toWorld(ang(0,-90,90)))
    holoScale(12,vec(1,0.8,1))
    
    holoClipEnabled(12,1,1)
    holoClip(12,1,vec(0,0,60),vec(0,0,1),0)
    
    holoClipEnabled(12,2,1)
    holoClip(12,2,vec(0,-0.1,0),vec(0,1,0),0)
    
    holoModel(13,"models/sprops/misc/domes/size_4/dome_48x108.mdl")
    holoPos(13,E:toWorld(vec(-60,0,20)))
    holoAng(13,E:toWorld(ang(0,90,90)))
    holoScale(13,vec(1,0.8,1))
    
    holoClipEnabled(13,1,1)
    holoClip(13,1,vec(0,0,60),vec(0,0,1),0)
    
    holoClipEnabled(13,2,1)
    holoClip(13,2,vec(0,-0.1,0),vec(0,1,0),0)
    
    holoModel(14,"models/sprops/misc/domes/size_4/dome_48x108.mdl")
    holoPos(14,E:toWorld(vec(60,0,20)))
    holoAng(14,E:toWorld(ang(0,90,90)))
    holoScale(14,vec(-1,-0.8,-1))
    
    holoClipEnabled(14,1,1)
    holoClip(14,1,vec(0,0,-60),vec(0,0,-1),0)
    
    holoClipEnabled(14,2,1)
    holoClip(14,2,vec(0,-0.1,0),vec(0,1,0),0)
    
    holoModel(15,"models/sprops/misc/domes/size_4/dome_48x108.mdl")
    holoPos(15,E:toWorld(vec(-60,0,20)))
    holoAng(15,E:toWorld(ang(0,-90,90)))
    holoScale(15,vec(-1,-0.8,-1))
    
    holoClipEnabled(15,1,1)
    holoClip(15,1,vec(0,0,-60),vec(0,0,-1),0)
    
    holoClipEnabled(15,2,1)
    holoClip(15,2,vec(0,-0.1,0),vec(0,1,0),0)
    
    for (Windows = 12,13) {holoMaterial(Windows,"phoenix_storms/fender_white") holoColor(Windows,vec4(60,60,60,250))}
    for (WindowsOut = 14,15) {holoMaterial(WindowsOut,"phoenix_storms/fender_white") holoColor(WindowsOut,vec4(0,0,0,200))}
    
    holoModel(16,"models/sprops/misc/domes/size_1/dome_12x30.mdl")
    holoPos(16,E:toWorld(vec(-75,-16,0)))
    holoAng(16,E:toWorld(ang(0,90,90)))
    holoScale(16,vec(0.8,0.8,1))
    
    holoModel(17,"models/sprops/misc/domes/size_1/dome_12x30.mdl")
    holoPos(17,E:toWorld(vec(-70,-16,0)))
    holoAng(17,E:toWorld(ang(0,75,90)))
    holoScale(17,vec(0.8,0.8,1))
    
    holoModel(18,"models/sprops/misc/domes/size_1/dome_12x30.mdl")
    holoPos(18,E:toWorld(vec(-75,16,0)))
    holoAng(18,E:toWorld(ang(0,90,90)))
    holoScale(18,vec(0.8,0.8,1))
    
    holoModel(19,"models/sprops/misc/domes/size_1/dome_12x30.mdl")
    holoPos(19,E:toWorld(vec(-70,16,0)))
    holoAng(19,E:toWorld(ang(0,105,90)))
    holoScale(19,vec(0.8,0.8,1))
    
    holoModel(20,"models/sprops/geometry/sphere_9.mdl")
    holoMaterial(20,"models/props_debris/metalwall001a")
    holoPos(20,E:toWorld(vec(-74,-16,0)))
    holoAng(20,E:toWorld(ang(0,0,0)))
    holoScale(20,vec(0.9,0.9,0.9))
    holoColor(20,vec(255,0,0))
    
    holoModel(21,"models/sprops/geometry/sphere_9.mdl")
    holoMaterial(21,"models/props_debris/metalwall001a")
    holoPos(21,E:toWorld(vec(-74,16,0)))
    holoAng(21,E:toWorld(ang(0,0,0)))
    holoScale(21,vec(0.9,0.9,0.9))
    holoColor(21,vec(255,0,0))
    
    holoModel(22,"models/sprops/misc/tubes/size_3/h_tube_36x6.mdl")
    holoPos(22,E:toWorld(vec(-12,0,14)))
    holoAng(22,E:toWorld(ang(0,90,-90)))
    holoScale(22,vec(1.2,2,4))
    
    holoClipEnabled(22,1,1)
    holoClip(22,vec(0,0,-13),vec(0,0,1),0)
    
    holoModel(23,"models/sprops/misc/tubes/size_3/h_tube_36x6.mdl")
    holoPos(23,E:toWorld(vec(12,0,14)))
    holoAng(23,E:toWorld(ang(0,-90,-90)))
    holoScale(23,vec(1.2,2,4))
    
    holoClipEnabled(23,1,1)
    holoClip(23,vec(0,0,-13),vec(0,0,1),0)
    
    holoModel(24,"models/sprops/geometry/hdisc_36.mdl")
    holoPos(24,E:toWorld(vec(12,0,14)))
    holoAng(24,E:toWorld(ang(0,-90,-90)))
    holoScale(24,vec(1.2,2,4))
    
    holoClipEnabled(24,1,1)
    holoClip(24,vec(0,0,1),vec(0,0,1),0)
    
    holoPos(25,E:toWorld(vec(10,0,13)))
    holoAng(25,E:toWorld(ang(-45,0,0)))
    holoScale(25,vec(1,3,0.1))
    
    holoPos(26,E:toWorld(vec(6,0,4.5)))
    holoAng(26,E:toWorld(ang(90,0,0)))
    holoScale(26,vec(0.8,3,0.1))
    
    holoPos(27,E:toWorld(vec(-10,-12,4.5)))
    holoAng(27,E:toWorld(ang(90,0,0)))
    holoScale(27,vec(0.8,0.7,3))
    
    holoPos(28,E:toWorld(vec(-10,12,4.5)))
    holoAng(28,E:toWorld(ang(90,0,0)))
    holoScale(28,vec(0.8,0.7,3))
    
    holoModel(29,"hq_rcube_thick")
    holoMaterial(29,"WTP/leather_1b")
    holoPos(29,E:toWorld(vec(-4,0,0)))
    holoAng(29,E:toWorld(ang(0,0,0)))
    holoScale(29,vec(1.8,1.4,0.5))
    holoColor(29,vec(86,65,7))
    
    holoModel(30,"hq_rcube_thick")
    holoMaterial(30,"WTP/leather_1b")
    holoPos(30,E:toWorld(vec(8,0,10)))
    holoAng(30,E:toWorld(ang(-60,0,0)))
    holoScale(30,vec(1.8,1.4,0.5))
    holoColor(30,vec(86,65,7))
    
    #Window Hinges
    holoPos(31,E:toWorld(vec(48,0,20)))
    holoAng(31,E:toWorld(ang(0,0,0)))
    holoAlpha(31,0)
    
    holoParent(13,31)
    holoParent(15,31)
    
    holoPos(32,E:toWorld(vec(-48,0,20)))
    holoAng(32,E:toWorld(ang(0,0,0)))
    holoAlpha(32,0)
    
    holoParent(12,32)
    holoParent(14,32)
    
    holoMaterial(33,"models/XQM/PoleX1_diffuse")
    holoPos(33,E:toWorld(vec(30,-8,15.5)))
    holoAng(33,E:toWorld(ang(-80,0,0)))
    holoScale(33,vec(1,0.5,2))
    holoColor(33,vec(150,0,0))
    
    holoMaterial(34,"models/XQM/PoleX1_diffuse")
    holoPos(34,E:toWorld(vec(30,8,15.5)))
    holoAng(34,E:toWorld(ang(-80,0,0)))
    holoScale(34,vec(1,0.5,2))
    holoColor(34,vec(150,0,0))
    
    holoModel(35,"models/cheeze/wires/speaker.mdl")
    holoMaterial(35,"")
    holoPos(35,E:toWorld(vec(19,-8,20)))
    holoAng(35,E:toWorld(ang(-80,0,0)))
    holoScale(35,vec(0.4))
    holoColor(35,vec(100))
    holoParent(35,33)
    
    holoModel(36,"models/cheeze/wires/speaker.mdl")
    holoMaterial(36,"")
    holoPos(36,E:toWorld(vec(19,8,20)))
    holoAng(36,E:toWorld(ang(-80,0,0)))
    holoScale(36,vec(0.4))
    holoColor(36,vec(100))
    holoParent(36,34)
    
    holoModel(37,"hq_torus")
    holoMaterial(37,"")
    holoPos(37,E:toWorld(vec(18.5,-8,20)))
    holoAng(37,E:toWorld(ang(-80,0,0)))
    holoScale(37,vec(0.45,0.45,0.8))
    holoColor(37,vec(0))
    holoParent(37,33)
    
    holoModel(38,"hq_torus")
    holoMaterial(38,"")
    holoPos(38,E:toWorld(vec(18.5,8,20)))
    holoAng(38,E:toWorld(ang(-80,0,0)))
    holoScale(38,vec(0.45,0.45,0.8))
    holoColor(38,vec(0))
    holoParent(38,34)
}

if (changed(I == HoloCount) & I == HoloCount) {hint("All holos spawned.",5)}

EGP:egpCircle(100,vec2(0,0),vec2(2,2))
EGP:egpColor(100,vec4(0,0,0,100))
EGP:egpParentToCursor(100)

EGP2:egpCircle(101,vec2(0,0),vec2(2,2))
EGP2:egpColor(101,vec4(0,0,0,100))
EGP2:egpParentToCursor(101)

#######################
#   To Do List:       #
# 1. Speeker Movement #
# 2. Window Opening   #
# 3. Air Thrusters    #
#######################

#[

#Air Thrusters
    holoModel(30,"models/sprops/misc/tubes/size_1/tube_12x6.mdl")
    holoMaterial(30,"models/props_debris/metalwall001a")
    holoPos(30,E:toWorld(vec(78,-5,4)))
    holoAng(30,E:toWorld(ang(0,90,0)))
    holoScale(30,vec(1,1,1))
    holoColor(30,vec(255,0,0))
    
    holoModel(31,"models/sprops/misc/tubes/size_1/tube_12x6.mdl")
    holoMaterial(31,"models/props_debris/metalwall001a")
    holoPos(31,E:toWorld(vec(78,5,4)))
    holoAng(31,E:toWorld(ang(0,90,0)))
    holoScale(31,vec(1,1,1))
    holoColor(31,vec(255,0,0))
