Code:
@name Insta dashboard V2
@inputs WL:wirelink SteeringPlate:entity Gear
@outputs [InGear Speed GearSpeed ClutchA GearMode]
@persist [Dash Dash2 Visor Cupholder Milk]
@persist [Wheelbase Wheelbasebar Wheelbasebar2 Wheel]
@persist [Console1 Console2 Backboard Floorboard Floorboard2]
@persist [Gas GasB GasB2 Brake BrakeB BrakeB2 Clutch ClutchB ClutchB2 PB]
@persist [H HL HM HR] [Shifter Knob] [SB SP Radio]
@persist [DR DL DRF DLF] [Mirrorbar MirrorB Mirror]
@persist American SpeedUnit:string [Speeds Gears]:array
runOnTick(1)
E=entity()
Speed=toUnit(SpeedUnit, E:vel():length())
GearSpeed=toUnit("km/h", E:vel():length())
#if you have the "gear" input wired, use it, if not use the cars own system
GearMode=(->Gear ? 1 : 0)
#####################
#Made by postman,####
#With ideas from#####
#Eternal flame#######
#And many others#####
#Do not redistribute#
#####################
W=WL["W",number]
S=WL["S",number]
M1=WL["Mouse1",number]
M2=WL["Mouse2",number]
Space=WL["Space",number]
Shift=WL["Shift",number]
Alt=WL["Alt",number]
Active=WL["Active",number]
Seat=WL["Entity",entity]
if(first())
{
#1 for american, -1 for british
American=-1
hint("you must have 'wire_holograms_burst_amount' set to: 40",5)
Speeds=array(15,30,45,60,75)
Gears=array(
vec(-2.6,-2.68,0),
vec(2.6,-2.68,0),
vec(-2.6,0,0),
vec(2.6,0,0),
vec(-2.6,2.68,0),
vec(2,2.68,0),
vec(2.6,2.68,0),
vec(0,0,0))
InGear=1
Dash=0
Dash2=1
Visor=2
Cupholder=3
Milk=4
PB=5
Wheelbase=6
Wheelbasebar=7
Wheelbasebar2=8
Wheel=9
Console1=10
Console2=11
Backboard=12
Floorboard=13
Floorboard2=14
Gas=15
GasB=16
GasB2=17
Brake=18
BrakeB=19
BrakeB2=20
Clutch=21
ClutchB=22
ClutchB2=23
H=24 #its the shifter's H
HL=25
HM=26
HR=27
Shifter=28
Knob=29
SB=30
SP=31
Radio=32
DR=33
DRF=34
DL=35
DLF=36
Mirrorbar=37
MirrorB=38
Mirror=39
holoCreate(Dash)
holoCreate(Dash2)
holoCreate(Visor)
holoCreate(Cupholder)
holoCreate(Milk)
holoCreate(PB)
holoCreate(Wheelbase)
holoCreate(Wheelbasebar)
holoCreate(Wheelbasebar2)
holoCreate(Wheel)
holoCreate(Console1)
holoCreate(Console2)
holoCreate(Backboard)
holoCreate(Floorboard)
holoCreate(Floorboard2)
holoCreate(Gas)
holoCreate(GasB)
holoCreate(GasB2)
holoCreate(Brake)
holoCreate(BrakeB)
holoCreate(BrakeB2)
holoCreate(Clutch)
holoCreate(ClutchB)
holoCreate(ClutchB2)
holoCreate(H)
holoCreate(HL)
holoCreate(HM)
holoCreate(HR)
holoCreate(Shifter)
holoCreate(Knob)
holoCreate(SB)
holoCreate(SP)
holoCreate(Radio)
holoCreate(DR)
holoCreate(DRF)
holoCreate(DL)
holoCreate(DLF)
holoCreate(Mirrorbar)
holoCreate(MirrorB)
holoCreate(Mirror)
holoModel(Dash,"hq_rcube_thin")
holoModel(Dash2,"hq_rcube_thin")
holoModel(Visor,"hq_rcube_thin")
holoModel(Cupholder,"models/props_junk/CinderBlock01a.mdl")
holoModel(Milk,"models/props_junk/garbage_glassbottle002a.mdl") #models/props_junk/garbage_milkcarton002a.mdl
holoModel(Console1,"hq_rcube_thin")
holoModel(Console2,"hq_rcube_thin")
holoModel(Wheelbase,"hq_cylinder")
holoModel(Wheelbasebar,"hq_rcube")
holoModel(Wheelbasebar2,"hq_rcube")
holoModel(Wheel,"hq_torus_thin")
holoModel(Gas,"hq_rcube")
holoModel(Brake,"hq_rcube_thin")
holoModel(Clutch,"hq_rcube_thin")
holoModel(H,"hq_rcube_thin")
holoModel(HL,"hq_rcube_thin")
holoModel(HM,"hq_rcube_thin")
holoModel(HR,"hq_rcube_thin")
holoModel(Shifter,"hq_cylinder")
holoModel(Knob,"models/Gibs/HGIBS.mdl")
holoModel(SB,"hq_rcube_thin")
holoModel(SP,"hq_rcube_thin")
holoModel(Radio,"models/props_lab/reciever01b.mdl")
holoModel(DR,"hq_rcube_thin")
holoModel(DRF,"right_prism")
holoModel(DL,"hq_rcube_thin")
holoModel(DLF,"right_prism")
holoModel(Mirrorbar,"hq_rcube_thin")
holoModel(MirrorB,"hq_rcube")
holoModel(Mirror,"hq_rcube_thin")
holoColor(Console1,vec(110,110,110))
holoColor(Console2,vec(110,110,110))
holoColor(Cupholder,vec(240,240,240))
holoColor(Backboard,vec(110,110,110))
holoColor(Floorboard,vec(110,110,110))
holoColor(Floorboard2,vec(110,110,110))
holoColor(Wheelbase,vec(110,110,110))
holoColor(Wheelbasebar,vec(120,120,120))
holoColor(Wheelbasebar2,vec(120,120,120))
holoColor(Wheel,vec(110,110,110))
holoColor(Gas,vec(30,30,30))
holoColor(Brake,vec(30,30,30))
holoColor(Clutch,vec(30,30,30))
holoColor(H,vec(0,0,0))
holoColor(HL,vec(0,0,0))
holoColor(HM,vec(0,0,0))
holoColor(HR,vec(0,0,0))
holoColor(Knob,vec(200,10,10))
holoColor(SB,vec(10,10,10))
holoColor(SP,vec(10,180,10))
holoColor(DR,vec(110,110,110))
holoColor(DRF,vec(110,110,110))
holoColor(DL,vec(110,110,110))
holoColor(DLF,vec(110,110,110))
holoColor(Mirrorbar,vec(110,110,110))
holoColor(MirrorB,vec(110,110,110))
holoAlpha(Visor,110)
holoAlpha(PB,0)
holoAlpha(GasB,0)
holoAlpha(BrakeB,0)
holoAlpha(ClutchB,0)
holoMaterial(Dash,"models/props_badlands/temptile")
holoMaterial(Dash2,"models/props_badlands/temptile")
holoMaterial(Cupholder,"models/props_badlands/temptile")
holoMaterial(Console1,"phoenix_storms/mrref2")
holoMaterial(Console2,"phoenix_storms/mrref2")
holoMaterial(Backboard,"phoenix_storms/mrref2")
holoMaterial(Floorboard,"phoenix_storms/mrref2")
holoMaterial(Floorboard2,"phoenix_storms/mrref2")
holoMaterial(Wheelbasebar,"phoenix_storms/grey_chrome")
holoMaterial(Wheelbasebar2,"phoenix_storms/grey_chrome")
holoMaterial(Wheelbase,"models/props_pipes/guttermetal01a")
holoMaterial(Wheel,"models/props_pipes/guttermetal01a")
holoMaterial(Gas,"phoenix_storms/grey_chrome")
holoMaterial(GasB2,"phoenix_storms/grey_chrome")
holoMaterial(Brake,"phoenix_storms/grey_chrome")
holoMaterial(BrakeB2,"phoenix_storms/grey_chrome")
holoMaterial(Clutch,"phoenix_storms/grey_chrome")
holoMaterial(ClutchB2,"phoenix_storms/grey_chrome")
holoMaterial(ClutchB2,"phoenix_storms/grey_chrome")
holoMaterial(ClutchB2,"phoenix_storms/grey_chrome")
holoMaterial(ClutchB2,"phoenix_storms/grey_chrome")
holoMaterial(Shifter,"phoenix_storms/fender_chrome")
holoMaterial(Knob,"phoenix_storms/grey_chrome")
holoMaterial(SB,"phoenix_storms/grey_chrome")
holoMaterial(SP,"phoenix_storms/grey_chrome")
holoMaterial(DR,"phoenix_storms/mrref2")
holoMaterial(DRF,"phoenix_storms/mrref2")
holoMaterial(DL,"phoenix_storms/mrref2")
holoMaterial(DLF,"phoenix_storms/mrref2")
holoMaterial(Mirrorbar,"phoenix_storms/mrref2")
holoMaterial(MirrorB,"phoenix_storms/mrref2")
holoMaterial(Mirror,"debug/env_cubemap_model")
holoScale(Dash,vec(2,8,1.5))
holoScale(Dash2,vec(2,8,2))
holoScale(Visor,vec(0.1,8,1.8))
holoScale(PB,vec(0.2,0.2,0.2))
holoScale(Wheelbase,vec(0.3,0.3,0.8))
holoScale(Wheelbasebar,vec(0.1,1.4,0.05))
holoScale(Wheelbasebar2,vec(0.72,0.1,0.05))
holoScale(Wheel,vec(1.5,1.5,1))
holoScale(Console1,vec(3,2,1.5))
holoScale(Console2,vec(4.8,2,1.5))
holoScale(Backboard,vec(2,8,0.1))
holoScale(Floorboard,vec(1,8,0.1))
holoScale(Floorboard2,vec(8,8,0.1))
holoScale(Gas,vec(0.9,0.25,0.15))
holoScale(GasB,vec(0.1,0.1,0.1))
holoScale(GasB2,vec(0.1,0.1,0.6))
holoScale(Brake,vec(0.7,0.35,0.15))
holoScale(BrakeB,vec(0.1,0.1,0.1))
holoScale(BrakeB2,vec(0.1,0.1,0.6))
holoScale(Clutch,vec(0.7,0.35,0.15))
holoScale(ClutchB,vec(0.1,0.1,0.1))
holoScale(ClutchB2,vec(0.1,0.1,0.6))
holoScale(H,vec(0.08,0.45,0.1))
holoScale(HL,vec(0.5,0.08,0.1))
holoScale(HM,vec(0.5,0.08,0.1))
holoScale(HR,vec(0.5,0.08,0.1))
holoScale(Shifter,vec(0.08,0.08,0.85))
holoScale(Knob,vec(0.5,0.5,0.5))
holoScale(SB,vec(0.3,1.5,0.2))
holoScale(SP,vec(0.3,0.1,0.25))
holoScale(DR,vec(8.8,0.1,3))
holoScale(DRF,vec(2,0.1,3))
holoScale(DL,vec(8.8,0.1,3))
holoScale(DLF,vec(2,0.1,3))
holoScale(Mirrorbar,vec(0.4,0.1,0.1))
holoScale(MirrorB,vec(0.05,0.72,0.32))
holoScale(Mirror,vec(0.06,0.6,0.3))
holoPos(Dash,E:toWorld(vec(-10,0,30)))
holoPos(Dash2,E:toWorld(vec(-16.25,0,31.8)))
holoPos(Visor,E:toWorld(vec(-6,0,53.5)))
holoPos(Cupholder,holoEntity(Console2):toWorld(vec(25,6*American,11)))
holoPos(Milk,holoEntity(Cupholder):toWorld(vec(-5,0,10)))
holoPos(PB,E:toWorld(vec(3,-30*American,5)))
holoPos(Wheelbase,holoEntity(Dash):toWorld(vec(12,-30*American,5)))
holoPos(Wheelbasebar,holoEntity(Wheelbase):toWorld(vec(3.8,0,0.5)))
holoPos(Wheelbasebar2,holoEntity(Wheelbasebar):toWorld(vec(0.6,0,-3.4)))
holoPos(Wheel,holoEntity(Wheelbase):toWorld(vec(3.9,0,1.2)))
holoPos(Console1,E:toWorld(vec(-1,0,14)))
holoPos(Console2,E:toWorld(vec(34.2,0,6)))
holoPos(Backboard,E:toWorld(vec(-9,0,10)))
holoPos(Floorboard,E:toWorld(vec(2.2,0,-1.5)))
holoPos(Floorboard2,E:toWorld(vec(56,0,-2.5)))
holoPos(Gas,holoEntity(PB):toWorld(vec(0,10,-2)))
holoPos(GasB,holoEntity(PB):toWorld(vec(0,10,-4)))
holoPos(GasB2,holoEntity(PB):toWorld(vec(-3.5,10,-2.2)))
holoPos(Brake,holoEntity(PB):toWorld(vec(0,0,-2)))
holoPos(BrakeB,holoEntity(PB):toWorld(vec(0,0,-4)))
holoPos(BrakeB2,holoEntity(PB):toWorld(vec(-3.5,0,-2.2)))
holoPos(Clutch,holoEntity(PB):toWorld(vec(0,-10,-2)))
holoPos(ClutchB,holoEntity(PB):toWorld(vec(0,-10,-4)))
holoPos(ClutchB2,holoEntity(PB):toWorld(vec(-3.5,-10,-2.2)))
holoPos(H,holoEntity(Console2):toWorld(vec(-15,-6*American,8.6)))
holoPos(HL,holoEntity(H):toWorld(vec(0,-2.7,0)))
holoPos(HM,holoEntity(H):toWorld(vec(0,0,0)))
holoPos(HR,holoEntity(H):toWorld(vec(0,2.7,0)))
holoPos(Knob,holoEntity(Shifter):toWorld(vec(0,0,5)))
holoPos(SB,holoEntity(Dash):toWorld(vec(5.5,-30*American,10.5)))
holoPos(SP,holoEntity(SB):toWorld(vec(0.2,-8,0)))
holoPos(Radio,holoEntity(Dash):toWorld(vec(3.3,0,6.8)))
holoPos(DR,E:toWorld(vec(51,47.5,15)))
holoPos(DRF,E:toWorld(vec(-13,47.5,15)))
holoPos(DL,E:toWorld(vec(51,-47.5,15)))
holoPos(DLF,E:toWorld(vec(-13,-47.5,15)))
holoPos(Mirrorbar,holoEntity(Visor):toWorld(vec(5,0,6)))
holoPos(MirrorB,holoEntity(Mirrorbar):toWorld(vec(2,0,0)))
holoPos(Mirror,holoEntity(MirrorB):toWorld(vec(0.2,0,0)))
holoAng(Dash,E:toWorld(ang(75,0,0)))
holoAng(Visor,E:toWorld(ang(20,0,0)))
holoAng(Cupholder,E:toWorld(ang(90,0,0)))
holoAng(Wheelbase,holoEntity(Dash):toWorld(ang(10,0,0)))
holoAng(Wheelbasebar,holoEntity(Wheelbase):angles())
holoAng(Wheelbasebar2,holoEntity(Wheelbase):angles())
holoAng(Wheel,holoEntity(Wheelbase):angles())
holoAng(Console1,E:toWorld(ang(60,0,0)))
holoAng(Backboard,E:toWorld(ang(60,0,0)))
holoAng(Floorboard,E:toWorld(ang(10,0,0)))
holoAng(Gas,E:toWorld(ang(60,0,0)))
holoAng(GasB,E:toWorld(ang(60,0,0)))
holoAng(GasB2,E:toWorld(ang(60,0,0)))
holoAng(Brake,E:toWorld(ang(60,0,0)))
holoAng(BrakeB,E:toWorld(ang(60,0,0)))
holoAng(BrakeB2,E:toWorld(ang(60,0,0)))
holoAng(Clutch,E:toWorld(ang(60,0,0)))
holoAng(ClutchB,E:toWorld(ang(60,0,0)))
holoAng(ClutchB2,E:toWorld(ang(60,0,0)))
holoAng(SB,E:toWorld(ang(75,0,0)))
holoAng(SP,E:toWorld(ang(75,0,0)))
holoAng(Radio,E:toWorld(ang(0,0,0)))
holoAng(DRF,E:toWorld(ang(180,0,0)))
holoAng(DLF,E:toWorld(ang(180,0,0)))
holoParent(Dash,E)
holoParent(Dash2,E)
holoParent(Visor,E)
holoParent(Cupholder,E)
holoParent(Milk,Cupholder)
holoParent(PB,E)
holoParent(Wheelbase,Dash)
holoParent(Wheelbasebar,Wheelbase)
holoParent(Wheelbasebar2,Wheelbase)
holoParent(Wheel,Wheelbase)
holoParent(Console1,E)
holoParent(Console2,E)
holoParent(Backboard,E)
holoParent(Floorboard,E)
holoParent(Floorboard2,E)
holoParent(Gas,GasB)
holoParent(GasB,E)
holoParent(GasB2,Gas)
holoParent(Brake,BrakeB)
holoParent(BrakeB,E)
holoParent(BrakeB2,Brake)
holoParent(Clutch,ClutchB)
holoParent(ClutchB,E)
holoParent(ClutchB2,Clutch)
holoParent(H,Console1)
holoParent(HL,H)
holoParent(HM,H)
holoParent(HR,H)
holoParent(Shifter,E)
holoParent(Knob,Shifter)
holoParent(SB,Dash)
holoParent(SP,SB)
holoParent(Radio,Dash)
holoParent(DR,E)
holoParent(DRF,E)
holoParent(DL,E)
holoParent(DLF,E)
holoParent(Mirrorbar,Visor)
holoParent(MirrorB,Visor)
holoParent(Mirror,Visor)
}
if(American==1)
{
SpeedUnit="mph"
}
elseif(American==-1)
{
SpeedUnit="km/h"
}
#various angle codes
holoAng(Wheelbase,holoEntity(Dash):toWorld(ang(0,SteeringPlate:angles():yaw()*4,0)))
holoAng(GasB,E:toWorld(ang(60-(W*20),0,0)))
holoAng(BrakeB,E:toWorld(ang(60-(Space*20),0,0)))
holoAng(ClutchB,E:toWorld(ang(60-(ClutchA*20),0,0)))
#holoAng(Knob,(Seat:driver():shootPos()-holoEntity(Knob):pos()):toAngle())
if(GearMode==0)
{
#gears
if(GearSpeed>Speeds[InGear,number]){if(InGear<Speeds:count()){InGear++}}
if(GearSpeed<Speeds[InGear-1,number]){if(InGear>0){InGear--}}
if(GearSpeed<=Speeds[InGear,number]+5&GearSpeed>=Speeds[InGear,number]-5){ClutchA=1}else{ClutchA=0}
}
elseif(GearMode==1)
{
if(Gear==-1){InGear=6}
if(Gear==-2){InGear=7}
if(Gear==0){InGear=8}
if(Gear>=1){InGear=Gear}
if(M1|M2){ClutchA=1}else{ClutchA=0}
}
#position the shifter
holoPos(Shifter,holoEntity(H):toWorld(Gears[InGear,vector]+vec(0,0,5)))
#speedometer thing
holoPos(SP,holoEntity(SB):toWorld(vec(0.2,-8+(toUnit("mph", E:vel():length())/10)*2,0)))
#turbo light
holoColor(Knob, (Shift ? vec(20,120,20) : vec(120,10,10)))
Code:
@name Poltergeist By Postman
@inputs WL:wirelink
@outputs Angle:angle Position:vector Ghost AG
@outputs Mass AllowJump Stable Zoom
@persist [Props BoomSounds Players Explosives]:array [Old E Target]:entity [M V OVec]:vector [OMod OM]:string [OMass]
@outputs AllowHide IsExplosive
runOnTick(1)
propSpawnEffect(0)
cameraPos(1,holoEntity(1):pos())
cameraAng(1,(Target:pos()-holoEntity(1):pos()):toAngle()-ang(20,0,0))
W=WL["W",number]
A=WL["A",number]
S=WL["S",number]
D=WL["D",number]
Shift=WL["Shift",number]
Space=WL["Space",number]
R=WL["R",number]
F=WL["Light",number]
Alt=WL["Alt",number]
Active=WL["Active",number]
M1=WL["Mouse1",number]
M2=WL["Mouse2",number]
Down=WL["PrevWeapon", number]
Up=WL["NextWeapon", number]
Seat=WL["Entity",entity]
Ply=Seat:driver()
if(first())
{
E=propSpawn("models/props_interiors/Furniture_Lamp01a.mdl",entity():pos()+vec(0,0,40),ang(),0)
#store old info
OMod=E:model()
OMass=E:mass()
OVec=E:getColor()
OM=E:getMaterial()
cameraCreate(1)
holoCreate(1)
holoCreate(2)
holoAlpha(1,0)
holoAlpha(2,0)
AG=1
MI=1
Zoom=1.5
Mass=60
AllowJump=1
AllowHide=1
BoomSounds=array(
"npc/advisor/advisorheadvx01.wav",
"npc/advisor/advisorheadvx02.wav",
"npc/advisor/advisorheadvx03.wav",
"npc/advisor/advisorheadvx04.wav",
"npc/advisor/advisorheadvx05.wav",
"npc/advisor/advisorheadvx06.wav")
Explosives=array(
"models/props_c17/oildrum001_explosive.mdl",
"models/props_junk/gascan001a.mdl",
"models/props_junk/propane_tank001a.mdl",
"models/props_phx/amraam.mdl",
"models/props_phx/cannonball.mdl",
"models/props_phx/facepunch_barrel.mdl",
"models/props_phx/mk-82.mdl",
"models/props_phx/torpedo.mdl",
"models/props_phx/ww2bomb.mdl",
"models/props_phx/misc/flakshell_big.mdl",
"models/props_explosive/explosive_butane_can.mdl",
"models/props_explosive/explosive_butane_can02.mdl",
"models/props_outland/pumpkin01.mdl",
"models/props_junk/watermelon01.mdl",
"models/magnusson_device.mdl")
}
#<---zooming--->
if(Up&Zoom<=10){Zoom+=0.1}
if(Down&Zoom>=1.5){Zoom-=0.1}
#<---hints--->
if(changed(Active)&Active)
{
cameraToggle(1,1,Seat)
if(E:isFrozen()){E:propFreeze(0)}
Seat:hintDriver("Poltergiest, made by postman",7)
Seat:hintDriver("W,A,S,D, Space",7)
Seat:hintDriver("Right click is steady prop",7)
Seat:hintDriver("Left click is cloak",7)
Seat:hintDriver("F is ghosting/teleport",7)
Seat:hintDriver("Alt changes your model to the closest prop",7)
}
elseif(!Active)
{
cameraToggle(1,0,Seat)
rangerFilter(E)
Rng=rangerOffset(10,E:pos(),vec(0,0,-1))
if(!E:isFrozen())
{
if(Rng:hitWorld())
{
E:propFreeze(1)
}
}
}
#<---camera--->
if(E&!Ghost){Target=E}
elseif(!E){Target=entity()}
elseif(Ghost){Target=holoEntity(3)}
holoPos(2,Target:massCenter())
holoAng(2,holoEntity(1):angles():setPitch(0))
X=sin(Ply:eyeAngles():yaw())*Mass*Zoom
Y=cos(Ply:eyeAngles():yaw())*Mass*Zoom
Z=(Ply:eyeAngles():pitch()>=50 ? sin(Ply:eyeAngles():pitch())*Mass*2 : 50)
holoPos(1,Target:pos()+vec(Y,X,Z))
holoAng(1,(Target:pos()-holoEntity(1):pos()):toAngle())
#<---Non ghosted movement--->
if(!Ghost)
{
#<---movement--->
if(W){E:applyForce((holoEntity(1):pos():setZ(E:pos():z())-E:pos())*-E:mass()/8)}
if(W&Shift){E:applyForce((holoEntity(1):pos():setZ(E:pos():z())-E:pos())*-E:mass()/6)}
if(S){E:applyForce((holoEntity(1):pos():setZ(E:pos():z())-E:pos())*E:mass()/8)}
if(A){E:applyForce(holoEntity(2):right()*-E:mass()*10)}
if(D){E:applyForce(holoEntity(2):right()*E:mass()*10)}
#jumping
if(changed(Space)&Space&AllowJump){E:applyForce(holoEntity(2):up()*E:mass()*300),AllowJump=0,timer("AJ",120)}
#stablization
if(M2){E:applyTorque(( 150 * E:toLocalAxis(rotationVector(quat( (E:pos() - E:pos()):toAngle():setYaw(Ply:eyeAngles():yaw()) - ang(90,180,0) ) / quat(E) ) ) - 12 * E:angVelVector()) * E:inertia())}
}
#jumping clk
if(clk("AJ")){AllowJump=1}
#<---switching props--->
if(changed(Alt)&Alt&!Ghost&!Shift)
{
#turn explosive off
IsExplosive=0
#search for props
findExcludeEntity(E)
findIncludeClass("prop_physics")
findInSphere(E:pos(),100)
findSortByDistance(E:pos())
#find the nearest one
Props=findToArray()
N=Props[1,entity]
if(N)
{
#save the old poltergiest pos
M=E:pos()
#delete the old poltergiest
E:propDelete()
#spawn a new one
E=propSpawn(N:model(),M+vec(0,0,20),ang(),0)
E:setColor(N:getColor())
E:setMaterial(N:getMaterial())
E:setMass( (E:mass()>10 ? E:mass() : 10) )
#store old info
OMod=E:model()
OMass=E:mass()
OVec=E:getColor()
OM=E:getMaterial()
}
if(changed(E:model())|first())
{
for(I=1,Explosives:count())
{
if(E:model()==Explosives[I,string])
{
IsExplosive=1
}
}
}
}
#<---remaking the prop if its broken/teleport--->
if(changed(E:isValid())&!E&!first()){
Seat:hintDriver("Press R to respawn.",5)
Seat:hintDriver("Press R AND shift to respawn with lamp model.",5)
}
if(!E&changed(R)&R)
{
Ghost=0
entity():soundPlay(1,0,"items/suitchargeok1.wav")
#spawn a new one
E=propSpawn(OMod,entity():pos()+vec(0,0,40),ang(),0)
E:setColor(OVec)
E:setMaterial(OM)
E:setMass(OMass)
}
elseif(!E&changed(R)&R&Shift)
{
Ghost=0
IsExplosive=0
entity():soundPlay(1,0,"items/suitchargeok1.wav")
E=propSpawn("models/props_interiors/Furniture_Lamp01a.mdl",entity():pos()+vec(0,0,40),ang(),0)
}
elseif(E&changed(R)&R&!Ghost)
{
entity():soundPlay(1,0,"items/suitchargeok1.wav")
#store old info
OMod=E:model()
OMass=E:mass()
OVec=E:getColor()
OM=E:getMaterial()
#delete old prop
E:propDelete()
#spawn a new one
E=propSpawn(OMod,entity():pos()+vec(0,0,40),ang(),0)
E:setColor(OVec)
E:setMaterial(OM)
E:setMass(OMass)
}
elseif(E&changed(R)&R&Shift)
{
Ghost=0
IsExplosive=0
E:propDelete()
entity():soundPlay(1,0,"items/suitchargeok1.wav")
E=propSpawn("models/props_interiors/Furniture_Lamp01a.mdl",entity():pos()+vec(0,0,40),ang(),0)
}
#<---Detecting if prop is explosive--->
if(changed(E:model())|first())
{
for(I=1,Explosives:count())
{
if(E:model()==Explosives[I,string])
{
IsExplosive=1
}
}
}
#<---Cloaking/Exploding--->
if(changed(M1)&M1&AllowHide&!Ghost&!IsExplosive)
{
E:setAlpha(10)
E:soundPlay(2,soundDuration("buttons/combine_button3.wav"),"buttons/combine_button3.wav")
timer("unHide",10000)
timer("ah",200)
}
elseif(changed(M1)&M1&!AllowHide&E:getAlpha()>=255&!IsExplosive)
{
E:soundPlay(3,soundDuration("buttons/combine_button2.wav"),"buttons/combine_button2.wav")
}
elseif(changed(M1)&M1&!AllowHide&E:getAlpha()<=10&!IsExplosive)
{
stoptimer("unHide")
timer("unHide",200)
}
elseif(changed(M1)&M1&!Ghost&IsExplosive)
{
E:soundPlay(4,soundDuration("weapons/strider_buster/strider_buster_stick1.wav"),"weapons/strider_buster/strider_buster_stick1.wav")
timer("AllahUAhkbar",1700)
}
if(clk("ah")){AllowHide=0}
if(clk("AllahUAhkbar"))
{
E:soundPlay(5,soundDuration("/weapons/strider_buster/strider_buster_detonate.wav"),"/weapons/strider_buster/strider_buster_detonate.wav")
E:propBreak()
}
if(clk("unHide"))
{
E:setAlpha(255)
E:soundPlay(3,soundDuration("buttons/combine_button2.wav"),"buttons/combine_button2.wav")
timer("cooldown",5000)
}
if(clk("cooldown")){AllowHide=1,E:soundPlay(4,soundDuration("items/nvg_off.wav"),"items/nvg_off.wav")}
#<---Teleporting--->
if(changed(F)&F&!Ghost)
{
Ghost=1
holoCreate(3)
holoModel(3,E:model())
holoPos(3,E:pos())
findExcludeEntity(Ply)
findByClass("player")
Players=findToArray()
holoAlpha(3,160)
E:propFreeze(1)
Seat:hintDriver("F again will teleport to the ghosted prop",6)
Seat:hintDriver("Left click cancels ghosting",6)
AG=0
timer("AG",500)
}
elseif(changed(F)&F&Ghost&AG)
{
Ghost=0
if(E:isFrozen()){E:propFreeze(0)}
E:setPos(holoEntity(3):pos())
E:soundPlay(6,soundDuration("npc/combine_gunship/ping_search.wav"),"npc/combine_gunship/ping_search.wav")
holoDelete(3)
}
elseif(changed(M1)&M1&Ghost)
{
Ghost=0
if(E:isFrozen()){E:propFreeze(0)}
holoDelete(3)
}
if(clk("AG")){AG=1}
#<---Ghosting--->
if(Ghost)
{
GP=holoEntity(3)
holoVisible(3,Players,0)
holoVisible(3,Ply,1)
holoAng(3,ang(0,Ply:eyeAngles():yaw(),0))
if(W){holoPos(3,GP:pos()+GP:forward()*-Mass/15)}
if(A){holoPos(3,GP:pos()+GP:right()*Mass/15)}
if(S){holoPos(3,GP:pos()+GP:forward()*Mass/15)}
if(D){holoPos(3,GP:pos()+GP:right()*-Mass/15)}
if(W&Shift){holoPos(3,GP:pos()+GP:forward()*-Mass/10)}
Rng = rangerOffset(50,GP:pos(),-GP:up())
if(Rng:hit()&!Space)
{
Diff = GP:boxSize():z()/2-Rng:distance()
holoPos(3,GP:pos()+vec(0,0,Diff))
}
elseif(!Rng:hit()&!first()&!Space)
{
holoPos(3,GP:pos()+vec(0,0,-11.7))
}
elseif(Space)
{
holoPos(3,GP:pos()+vec(0,0,5))
}
}
Code:
@name Stargate V3
@inputs
@outputs [Holos Holos2 Props]:array [Gate Gate2]:entity Vec
@outputs T L H On Dir StartUp SetUp SetUp2 Extend Ready G2P Fix
#pointless variables
@persist [InOffColor InOnColor OutOffColor OutOnColor DarkBlue]:vector Metal:string
runOnTick(1)
O=owner()
E=entity()
CanClick=changed(owner():keyUse())&owner():keyUse()&owner():pos():distance(holoEntity(1000):pos())<=100
CanClick2=(changed(owner():keyUse())&owner():keyUse()&owner():pos():distance(holoEntity(1001):pos())<=100)
findIncludePlayerProps(owner())
findExcludeClass("gmod_wire_hologram")
findExcludeClass("player")
propSpawnEffect(0)
if(first())
{
#Various variables for colors and such
InOffColor=vec(71,41,9)
InOnColor=vec(186,114,82)
OutOffColor=vec(15,18,66)
OutOnColor=vec(0,70,200)
DarkBlue=vec(35,35,38)
Metal="phoenix_storms/gear"
H=100
#gate holos
holoCreate(1000)
holoPos(1000,holoEntity(1000):pos()+vec(0,0,55))
holoModel(1000,"models/props_canal/canal_cap001.mdl")
holoColor(1000,DarkBlue)
holoAng(1000,(owner():pos()-holoEntity(1000):pos()):toAngle():setPitch(0))
Gate=holoEntity(1000)
#spinny bit
holoCreate(298)
holoPos(298,Gate:pos())
holoAng(298,Gate:angles())
holoAlpha(298,0)
holoParent(298,Gate)
#ring holo
holoCreate(1003)
holoPos(1003,Gate:pos()+Gate:forward()*2.2)
holoModel(1003,"hq_tube")
holoColor(1003,DarkBlue)
holoAng(1003,Gate:angles()+ang(90,0,0))
holoMaterial(1003,Metal)
holoScale(1003,vec(12.4,12.4,1))
holoParent(1003,298)
Gate:soundPlay(12,0,"weapons/portalgun/portal_open1.wav")
soundPitch(12,80)
hint("Press E to spawn the second stargate where you're looking",5)
SetUp=1
timer("ssu",300)
timer("search",1000)
}
#place the second gate
if(!Gate2&changed(owner():keyUse())&owner():keyUse())
{
#gate2pos
G2P=owner():aimPos():z()+55
#gate2
holoCreate(1001)
holoPos(1001,vec(owner():aimPos():x(),owner():aimPos():y(),G2P))
holoAlpha(1001,0)
holoAng(1001,(owner():pos()-holoEntity(1001):pos()):toAngle():setPitch(0)+ang(0,180,0))
holoModel(1001,"models/props_canal/canal_cap001.mdl")
holoColor(1001,DarkBlue)
Gate2=holoEntity(1001)
#dummy gate 2 (for angle reasons)
holoCreate(1002)
holoPos(1002,vec(owner():aimPos():x(),owner():aimPos():y(),G2P))
holoAng(1002,Gate2:angles()+ang(0,180,0))
holoModel(1002,"models/props_canal/canal_cap001.mdl")
holoColor(1002,DarkBlue)
#spiny bit
holoCreate(299)
holoPos(299,Gate2:pos())
holoAng(299,Gate2:angles())
holoAlpha(299,0)
holoParent(299,Gate2)
#gate 2 ring
holoCreate(1004)
holoPos(1004,Gate2:pos()+Gate2:forward()*-2.2)
holoModel(1004,"hq_tube")
holoColor(1004,DarkBlue)
holoAng(1004,Gate2:angles()+ang(90,0,0))
holoMaterial(1004,Metal)
holoScale(1004,vec(12.4,12.4,1))
holoParent(1004,299)
Gate2:soundPlay(10,0,"doors/doormove7.wav")
soundPitch(10,90)
hint("Stargate 2 setting up, 10 seconds.",5)
timer("five",5000)
timer("ss2",10000)
}
#rise from the ground.
if(Gate2&!Ready)
{
holoPos(1001,vec(Gate2:pos():x(),Gate2:pos():y(),G2P-H))
holoPos(1002,vec(Gate2:pos():x(),Gate2:pos():y(),G2P-H))
if(H>0){H-=0.25}elseif(changed(H)&H<=0){soundStop(10),Gate2:soundPlay(11,0,"doors/garage_stop1.wav"),soundPitch(11,90)}
}
#start a wait for the second ring, as holos can only be made so fast.
if(clk("ss2")){SetUp2=1,Ready=1,timer("ssu2",1000),hint("Stargate:set-up complete, hit E on a gate to dial.",5)}
if(clk("five")){hint("Stargate 2:5 seconds.",5)}
#creating the chevron indicators
if(SetUp)
{
for(C=1,8)
{
A=(360/8)*C
X=sin(A)*78
Y=cos(A)*78
###The input indicators###
#fix the top and bottom markers from breaking
Rotate=(C==2|C==6)*90
#base gate1
holoCreate(1010+C)
holoModel(1010+C,"right_prism")
holoPos(1010+C,Gate:toWorld(vec(0,Y,X))+Gate:forward()*2.5)
holoScale(1010+C,vec(1.1,1.8,1.1))
holoMaterial(1010+C,Metal)
holoColor(1010+C,DarkBlue)
holoAng(1010+C,(holoEntity(1010+C):pos()-Gate:pos()-Gate:forward()):toAngle()+ang(45,Rotate,0))
#Chevron indicator gate1
holoCreate(1030+C)
holoModel(1030+C,"right_prism")
holoPos(1030+C,Gate:toWorld(vec(0,Y/1.024,X/1.024))+Gate:forward()*2.5)
holoScale(1030+C,vec(0.6,2,0.6))
holoDisableShading(1030+C,1)
holoColor(1030+C,InOffColor)
holoAng(1030+C,holoEntity(1010+C):angles())
}
}
if(SetUp2)
{
for(C=1,8)
{
A=(360/8)*C
X=sin(A)*78
Y=cos(A)*78
###The input indicators###
#fix the top and bottom markers from breaking
Rotate=(C==2|C==6)*90
#base gate2
holoCreate(1050+C)
holoModel(1050+C,"right_prism")
holoPos(1050+C,Gate2:toWorld(vec(0,Y,X))+Gate2:forward()*-2.5)
holoScale(1050+C,vec(1.1,1.8,1.1))
holoMaterial(1050+C,Metal)
holoColor(1050+C,DarkBlue)
holoAng(1050+C,(holoEntity(1050+C):pos()-Gate2:pos()-Gate2:forward()):toAngle()+ang(45,Rotate,0))
#Chevron indicator gate2
holoCreate(1070+C)
holoModel(1070+C,"right_prism")
holoPos(1070+C,Gate2:toWorld(vec(0,Y/1.024,X/1.024))+Gate2:forward()*-2.5)
holoScale(1070+C,vec(0.6,2,0.6))
holoDisableShading(1070+C,1)
holoColor(1070+C,OutOffColor)
holoAng(1070+C,holoEntity(1050+C):angles())
}
}
#stop the set up
#2 set ups due to to many holos being made at once
if(clk("ssu")){SetUp=0}
if(clk("ssu2")){SetUp2=0,Gate2:soundPlay(12,0,"weapons/portalgun/portal_open2.wav"),soundPitch(12,80)}
#timers for the markers
if(changed(StartUp)&StartUp)
{
for(H=1,8)
{
timer("tk"+H,1200*H)
}
}
#spin the markers, make the portal
if(StartUp)
{
for(C=1,8)
{
if(clk("tk"+C))
{
holoColor(C+1030,InOnColor)
holoColor(C+1070,OutOnColor)
#the holo underground wont play the sound, so if its that holo, the sound is moved to another indicator
Fix=(C==6 ? 1 : C)
holoEntity(1010+Fix):soundPlay(1,2,"doors/door_metal_large_chamber_close1.wav")
holoEntity(1050+Fix):soundPlay(2,2,"doors/door_metal_large_chamber_close1.wav")
soundPitch(1,55)
soundPitch(2,55)
T+=1
}
}
if(T<8){if(Dir==1){holoAng(298,Gate:toWorld(ang(0,0,curtime()*-30)))}elseif(Dir==-1){holoAng(299,Gate:toWorld(ang(0,0,curtime()*30)))}}
elseif(T>=8)
{
soundPlay(3,0,"ambient/machines/teleport3.wav")
Gate2:soundPlay(4,0,"ambient/machines/teleport3.wav")
soundPitch(3,50)
soundPitch(4,50)
#the water layer (for the actual wormhole)
holoCreate(2004)
holoPos(2004,Gate:pos()+Gate:forward()*2)
holoModel(2004,"hqcylinder")
holoMaterial(2004,"models/shadertest/predator")
holoAng(2004,Gate:angles()+ang(90,0,0))
holoScale(2004,vec(12,12,0.3))
holoParent(2004,Gate)
holoCreate(2005)
holoPos(2005,Gate2:pos()+Gate2:forward()*2)
holoModel(2005,"hqcylinder")
holoMaterial(2005,"models/shadertest/predator")
holoAng(2005,Gate2:angles()+ang(90,0,0))
holoScale(2005,vec(12,12,0.3))
holoParent(2005,Gate2)
#the extending water thing
holoCreate(2006)
holoPos(2006,Gate:pos()+Gate:forward()*6*Dir)
holoModel(2006,"hq_cubinder")
holoMaterial(2006,"models/shadertest/predator")
holoClipEnabled(2006,1)
holoAng(2006,Gate:angles()+ang(90*Dir,0,0))
holoClip(2006,Gate:pos(),Gate:forward()*Dir,1)
holoParent(2006,Gate)
holoCreate(2007)
holoPos(2007,Gate2:pos()+Gate2:forward()*6*Dir)
holoModel(2007,"hq_cubinder")
holoMaterial(2007,"models/shadertest/predator")
holoAng(2007,Gate2:angles()+ang(90*Dir,180,0))
holoClipEnabled(2007,1)
holoClip(2007,Gate2:pos(),-Gate2:forward()*Dir,1)
holoParent(2007,Gate2)
StartUp=0
Extend=1
timer("stopE",1300)
}
}
#water extension
if(Extend)
{
if(clk("stopE")){Extend=0,On=1}
L+=0.4
holoScale(2006,vec(8,8,L))
}
elseif(!Extend&L>0)
{
L-=0.5
if(L<=0){holoDelete(2006),holoDelete(2007)}
holoScale(2006,vec(8,8,L))
holoScale(2007,vec(8,8,L))
}
#turning it on or off
if(CanClick&!On&Ready&Gate2)
{Gate=holoEntity(1000),Gate2=holoEntity(1001),holoColor(1006,InOnColor),StartUp=1,Dir=1}
if(CanClick2&!On&Ready&Gate2)
{Gate=holoEntity(1001),Gate2=holoEntity(1000),holoColor(1008,OutOnColor),StartUp=1,Dir=-1}
if(changed(owner():keyUse())&owner():keyUse()&owner():pos():distance(Gate:pos())<=100&On&Gate2)
{
T=0
On=0
Dir=0
StartUp=0
holoDelete(2004)
holoDelete(2005)
Gate:soundPlay(5,0,"ambient/machines/spindown.wav")
Gate2:soundPlay(6,0,"ambient/machines/spindown.wav")
soundPitch(5,50)
soundPitch(6,50)
for(I=1,Holos:count()){holoClipEnabled(I,0),holoDelete(I),holoClipEnabled(I*100,0),holoDelete(I*100)}
for(G=1,Holos2:count()){holoClipEnabled(G,0),holoDelete(G),holoClipEnabled(I*200,0),holoDelete(G*200)}
for(N=1,Props:count()){Props[N,entity]:setAlpha(255)}
Holos:clear()
Props:clear()
for(C=1,10)
{
holoColor(C+1030,InOffColor)
holoColor(C+1070,OutOffColor)
}
}
###########searching################
if(findCanQuery()&clk("search"))
{
timer("search",1000)
timer("Hsearch",500)
timer("H2search",600)
findByClass("prop_*")
Props=findToArray()
}
if(findCanQuery()&clk("Hsearch"))
{
findExcludeEntity(Gate)
findInSphere(Gate:pos(),Gate:boxSize():x())
Holos=findToArray()
}
if(findCanQuery()&clk("H2search"))
{
findExcludeEntity(Gate2)
findInSphere(Gate2:pos(),Gate2:boxSize():x())
Holos2=findToArray()
}
#main statement
if(On)
{
#creates holos over props, alpha's the props
for(I=1,Props:count())
{
Prop=Props[I,entity]
Prop:setAlpha(0)
if(!Holos[I,entity])
{
holoDelete(I*100)
}
if(!Holos2[I,entity])
{
holoDelete(I*200)
}
if(Prop:id()>=1000){Prop:id()==10+I}
holoCreate(Prop:id())
holoModel(Prop:id(),Prop:model())
holoPos(Prop:id(),Prop:pos())
holoAng(Prop:id(),Prop:angles())
holoColor(Prop:id(),Prop:getColor())
holoMaterial(Prop:id(),Prop:getMaterial())
holoSkin(Prop:id(),Prop:getSkin())
holoClipEnabled(Prop:id(),0)
holoParent(Prop:id(),Prop)
#Prop teleporting
if(Holos[I,entity]&owner():aimEntity()==Prop&owner():keyAttack2()&owner():pos():distance(Gate:pos())<=100)
{
Prop:soundPlay(9,0,"doors/doormove4.wav")
soundPitch(9,50)
if(Prop:type()!="prop_vehicle_prisoner_pod")
{
LocalG=Gate:toLocal(Prop:pos())
LocalGA=Gate:toLocal(Prop:angles())
TempProp=propSpawn(Prop:model(),Gate2:toWorld(LocalG),Gate2:toWorld(LocalGA),Prop:isFrozen())
TempProp:applyForce(Prop:vel()*Prop:vel():length()/2)
TempProp:setAlpha(255)
holoDelete(Prop:id())
Prop:propDelete()
}
else
{
LocalGA=Gate:toLocal(Prop:angles())
Prop:setAng(Gate2:toWorld(LocalGA))
LocalG=Gate:toLocal(Prop:pos())
Prop:setPos(Gate2:toWorld(LocalG))
}
}
elseif(Holos2[I,entity]&owner():aimEntity()==Prop&owner():keyAttack2()&owner():pos():distance(Gate2:pos())<=100)
{
Prop:soundPlay(9,0,"doors/doormove4.wav")
soundPitch(9,50)
if(Prop:type()!="prop_vehicle_prisoner_pod")
{
LocalG=Gate2:toLocal(Prop:pos())
LocalGA=Gate2:toLocal(Prop:angles())
TempProp=propSpawn(Prop:model(),Gate:toWorld(LocalG),Gate:toWorld(LocalGA),Prop:isFrozen())
TempProp:applyForce(Prop:vel()*Prop:vel():length()/2)
TempProp:setAlpha(255)
holoDelete(Prop:id())
Prop:propDelete()
}
else
{
LocalGA=Gate2:toLocal(Prop:angles())
Prop:setAng(Gate:toWorld(LocalGA))
LocalG=Gate2:toLocal(Prop:pos())
Prop:setPos(Gate:toWorld(LocalG))
}
}
}
#clips the holos and make the secondary holos (gate 1)
for(H=1,Holos:count())
{
Holo=Holos[H,entity]
holoClipEnabled(Holo:id(),1)
holoClip(Holo:id(),Gate:pos(),Gate:forward()*Dir,1)
#second dummy holos
holoCreate(H*100)
holoModel(H*100,Holo:model())
holoColor(H*100,Holo:getColor())
holoSkin(H*100,Holo:getSkin())
holoMaterial(H*100,Holo:getMaterial())
Local=Gate:toLocal(Holo:pos())
LocalA=Gate:toLocal(Holo:angles())
holoPos(H*100, Gate2:toWorld(Local))
holoAng(H*100,Gate2:toWorld(LocalA))
holoClipEnabled(H*100,1)
#if gate1 is the gate above the e2, then Dir needs to be 1
#the opposite is true as well.
holoClip(H*100,Gate2:pos(),Gate2:forward()*Dir*-1,1)
}
#clips the holos and make the secondary holos (gate2)
for(H2=1,Holos2:count())
{
Holo2=Holos2[H2,entity]
holoClipEnabled(Holo2:id(),1)
holoClip(Holo2:id(),Gate2:pos(),Gate2:forward()*Dir*-1,1)
#second dummy holos2
holoCreate(H2*200)
holoModel(H2*200,Holo2:model())
holoColor(H2*200,Holo2:getColor())
holoSkin(H2*200,Holo2:getSkin())
holoMaterial(H2*200,Holo2:getMaterial())
Local2=Gate2:toLocal(Holo2:pos())
Local2A=Gate2:toLocal(Holo2:angles())
holoPos(H2*200, Gate:toWorld(Local2))
holoAng(H2*200,Gate:toWorld(Local2A))
holoClipEnabled(H2*200,1)
#if gate1 is the gate above the e2, then Dir needs to be 1
#the opposite is true as well.
holoClip(H2*200,Gate:pos(),Gate:forward()*Dir,1)
}
}
Bookmarks