1
Introduce Yourself / Re: Hello everyone
« on: June 19, 2022, 06:31:52 am »
Welcome Meep!
2023-11-04: Broken verification on some registration form fields has been fixed
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
@name Blox_Orbiting_e2_v1.0
# Created by KevinMinion
@inputs Gyro:wirelink EGP:wirelink
@outputs
@persist Closest:entity ClosestPos:vector ClosestRad
@persist X1 Y1 Z1
@persist XYLock ZLock StartOrbit
@trigger
# Weld this E2 to the gyropod
# The EGP input is not required
if (first() | dupefinished()) {
EGP:egpClear()
GyroPod = entity():isWeldedTo()
Gyro = GyroPod:wirelink()
findByClass("logic_case*")
findSortByDistance( entity():pos() )
Closest = find()
ClosestPos = floor( Closest:pos() )
ClosestRad = getPlanetRadius(Closest)
hint("Orbiting: " + getPlanetName(Closest),10)
K=1
EGP:egpText(K,"[X0: " + ClosestPos:x() + "]", vec2(220,300) )
K++
EGP:egpText(K,"[Y0: " + ClosestPos:y() + "]", vec2(220,320) )
K++
EGP:egpText(K,"[Z0: " + ClosestPos:z() + "]", vec2(220,340) )
K++
EGP:egpText(K,"[R0: " + ClosestRad + "]", vec2(220,360) )
K++
X1 = ClosestPos:x() + ClosestRad
EGP:egpText(K,"[X1: " + X1 + "]", vec2(220,400) )
K++
Y1 = ClosestPos:y() + ClosestRad
EGP:egpText(K,"[Y1: " + Y1 + "]", vec2(220,420) )
K++
Z1 = ClosestPos:z() + (ClosestRad * 0.75)
EGP:egpText(K,"[Z1: " + Z1 + "]", vec2(220,440) )
Gyro["MPH Limit",number] = 5
XYLock = 0
ZLock = 0
StartOrbit = 0
}
K=20
K++
EGP:egpText(K,"[EX: " + floor(entity():pos():x()) + "]", vec2(220,500) )
K++
EGP:egpText(K,"[EY: " + floor(entity():pos():y()) + "]", vec2(220,520) )
K++
EGP:egpText(K,"[EZ: " + floor(entity():pos():z()) + "]", vec2(220,540) )
K++
ED = floor(vec2(X1,Y1):distance2(vec2(entity():pos():x(), entity():pos():y())))
EGP:egpText(K,"[ED: " + ED + "]", vec2(220,560) )
if ( (ED > 5000) & (!XYLock) ) {
Gyro["AimVec",vector] = vec(X1,Y1,Z1)
Gyro["AimMode",number] = 1
Gyro["Forward",number] = 1
K++
EGP:egpText(K,"XY: Locking", vec2(220,600) )
EGP:egpColor(K,vec(255,0,0))
XYLock = 0
} else {
Gyro["AimMode",number] = 0
Gyro["Forward",number] = 0
K++
EGP:egpText(K,"XY: Locked", vec2(220,600) )
EGP:egpColor(K,vec(0,255,0))
XYLock = 1
}
if (entity():pos():z() < (Z1 - 50)) {
Gyro["MoveUp",number] = 1
Gyro["MoveDown",number] = 0
Gyro["Level",number] = 1
K++
EGP:egpText(K,"Z: Locking", vec2(220,620) )
EGP:egpColor(K,vec(255,0,0))
ZLock = 0
} elseif (entity():pos():z() > (Z1 + 50)) {
Gyro["MoveDown",number] = 1
Gyro["MoveUp",number] = 0
Gyro["Level",number] = 1
K++
EGP:egpText(K,"Z: Locking", vec2(220,620) )
EGP:egpColor(K,vec(255,0,0))
ZLock = 0
} else {
Gyro["MoveUp",number] = 0
Gyro["MoveDown",number] = 0
Gyro["Level",number] = 0
K++
EGP:egpText(K,"Z: Locked", vec2(220,620) )
EGP:egpColor(K,vec(0,255,0))
ZLock = 1
}
if (XYLock & ZLock) {
StartOrbit = 1
Gyro["Level",number] = 1
}
Bearing = entity():bearing(vec(ClosestPos:x(),ClosestPos:y(),entity():pos():z()))
Distance = entity():pos():distance(vec(ClosestPos:x(),ClosestPos:y(),entity():pos():z()))
K++
EGP:egpText(K,"Bearing to planet center: " + floor(Bearing), vec2(220,660) )
K++
EGP:egpText(K,"Distance to planet center: " + floor(Distance), vec2(220,680) )
if (StartOrbit) {
interval(100)
Gyro["Forward",number] = 1
Gyro["YawMult",number] = 0.2
if (Bearing >= 0) {
if (Bearing < 90) {
Gyro["YawLeft",number] = 0
Gyro["YawRight",number] = 1
} else {
Gyro["YawLeft",number] = 1
Gyro["YawRight",number] = 0
}
if (Distance > (ClosestRad + 500)) {
Gyro["MoveLeft", number] = 0
Gyro["MoveRight", number] = 1
} elseif (Distance < (ClosestRad - 500)) {
Gyro["MoveLeft", number] = 1
Gyro["MoveRight", number] = 0
} else {
Gyro["MoveLeft", number] = 0
Gyro["MoveRight", number] = 0
}
} else {
if (Bearing > -90) {
Gyro["YawLeft",number] = 0
Gyro["YawRight",number] = 1
} else {
Gyro["YawLeft",number] = 1
Gyro["YawRight",number] = 0
}
}
} else {
interval(2000)
}