Notes
Notes - notes.io |
@inputs
@outputs S
@persist E:entity T P Y S Prop:entity H Mul Break
#Written by Raveo.
#Small Changes by Dvc_Gamer
if(first()|dupefinished())
{
runOnTick(1)
E=entity():isWeldedTo()
E:setMass(20000)
function holoC(N:number,Pos:vector,Scale:vector,Ang:angle,Colour:vector,Model:string,Parent:entity)
{
holoCreate(N,Pos,Scale,Ang,Colour)
holoModel(N,Model)
holoParent(N,Parent)
}
Colour=randvec(vec(0,0,0),vec(255,255,255))
holoC(1,E:toWorld(vec(0,0,0)),vec(2,7,2),E:toWorld(ang(0,0,0)),Colour,"cube",E)
holoC(2,E:toWorld(vec(0,48,0)),vec(2,2,1),E:toWorld(ang(0,0,-90)),Colour,"hq_cubinder",E)
holoC(3,E:toWorld(vec(0,66,0)),vec(2,2,2),E:toWorld(ang(0,0,-90)),Colour,"hq_cone",E)
holoC(4,E:toWorld(vec(0,66,0)),vec(0.5,0.01,5),E:toWorld(ang(randint(1,360),0,0)),vec(0,0,0),"cube",E)
holoC(5,E:toWorld(vec(0,-90,0)),vec(2,2,8),E:toWorld(ang(0,0,90)),Colour,"pyramid",E)
holoC(6,E:toWorld(vec(0,0,0)),vec(0.2,20,3),E:toWorld(ang(90,0,90)),Colour,"prism",E)
holoC(7,E:toWorld(vec(0,-120,0)),vec(0.2,10,3),E:toWorld(ang(90,0,-90)),Colour,"tetra",E)
holoC(8,E:toWorld(vec(0,-129,10)),vec(0.1,1.5,1.5),E:toWorld(ang(0,0,90)),Colour,"prism",E)
holoC(9,E:toWorld(vec(-12,25,-20)),vec(0.2,0.2,1.8),E:toWorld(ang(45,0,0)),Colour,"hq_cylinder",E)
holoC(10,E:toWorld(vec(12,25,-20)),vec(0.2,0.2,1.8),E:toWorld(ang(-45,0,0)),Colour,"hq_cylinder",E)
holoC(11,E:toWorld(vec(18,25,-27)),vec(1,1,0.2),E:toWorld(ang(90,0,0)),vec(0,0,0),"hq_cylinder",E)
holoC(12,E:toWorld(vec(-18,25,-27)),vec(1,1,0.2),E:toWorld(ang(90,0,0)),vec(0,0,0),"hq_cylinder",E)
holoC(13,E:toWorld(vec(-0,-45,-17)),vec(0.5,0.2,2),E:toWorld(ang(0,0,-30)),Colour,"hq_cylinder",E)
holoC(14,E:toWorld(vec(-0,-50,-27)),vec(1,1,0.2),E:toWorld(ang(90,0,0)),vec(0,0,0),"hq_cylinder",E)
#filters players from the ranger so it doesnt lift up in the air when some scrub walks under.
R=players()
R:insertEntity(1,E)
rangerPersist(1)
rangerFilter(R)
}
#Creates the ranger
R1=rangerOffset(999999,E:pos(),vec(0,0,-1))
#Checking aircraft height
H=R1:distance()
#Who the driver is/if there is a driver
V=E:driver():isValid()
D=E:driver()
#the propeller
holoAng(4,holoEntity(4):toWorld(ang((10*V)+T/10,0,0)))
#This gets rid of the chairs angular velocity making it more stable.
if(H<32&!V|V){E:applyAngForce(-ang(-E:angVel()[3],E:angVel()[2],E:angVel()[1])*E:mass())}
#This is the code that runs when the plane is on the ground
if(H<=32)
{
#this sets the planes ground height.
E:applyForce((-E:vel()+vec(0,0,abs(H-32)*20))*E:mass())
#this makes sure the planes angles are level on the ground and allows A-D yawing.
E:applyAngForce((ang(E:angles():roll()*50,0,-E:angles():pitch()*50)-(ang(0,D:keyRight()-D:keyLeft(),0)*20))*E:mass())
}
#This is the code that is ran when the plane is ready for take off / in the air.
if(H>32&V|T>800&V)
{
#Y&P are the drivers yaw and pitch eye positions for steering.
Y=vec(D:eye():dot(E:right()),D:eye():dot(E:right()),0):y()
P=vec(0,D:eye():dot(E:up()),D:eye():dot(E:up())):z()
#This negates the angular force in the air EXCEPT on the Z axis so the plane will fall if it moves too slowly and not stop in the air.
E:applyForce(E:toWorld(vec(-E:velL():x(),-E:velL():y(),-E:velL():z()/(1010-T))*E:mass()))
#This stabilises the plane in the air as well as controls pitch, yaw , roll from the driver.
E:applyAngForce((ang(E:angles():roll(),0,-E:angles():pitch())+(ang(-P,-Y,Y)*100))*E:mass())
}
#This chunk sets the speed of the plane
if(D:keyForward()&S&T<980){if(H<64){T+=7}else{T+=30}}
if(D:keyBack()|!V&T>0){if(H<32){T-=6}else{T-=2}}
if(D:keyJump()&H<32&T>-1){T-=30}
if(H>32){if(T<0){T=0}}else{if(T<-80){T=-80}}
if(T>980){T=980}
if(D:keyJump()){if(T<0){T=0}}else{T=T}
if(changed(D:keyJump()) & D:keyJump()&H<34&T>200){Break=!Break,soundPlay(3,Break ? 0.874 : 1.13, Break ? "vehicles/v8/skid_highfriction.wav" : "vehicles/v8/skid_highfriction.wav")}
#This makes the plane move forward
E:applyForce(E:forward()*E:mass()*(T+Mul)*2*V)
#Mul slows or speeds the plane based on its pitch.
Mul-=E:angles()[3]/10
if(Mul<-400){Mul=-400}
if(Mul>980){Mul=980}
if(Mul<0&E:angles()[3]>-35){Mul+=3}
if(Mul>0&E:angles()[3]<35){Mul-=0.1}
#Checks if a driver just entered the plane to start the engine.
if(changed(D)&D)
{
holoEntity(2):soundPlay(2,0,"vehicles/airboat/fan_motor_start1.wav")
soundPitch(2,50)
timer("engine",2000)
}
#Engine sound
if(clk("engine")&V)
{
entity():soundPlay(1,0,"vehicles/airboat/fan_blade_idle_loop1.wav")
S=1
}
#sets the pitch of the engine
soundPitch(1,clamp(E:vel():length()/10,50,250))
#Turns off the engine and resets the variables.
if(changed(V)&!V)
{
S=0
E:soundPlay(1,0,"vehicles/airboat/fan_motor_shut_off1.wav")
Mul=0
T=0
}
|
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team