From 00090c32acae9b72db1ae1995e4cf573ae68db02 Mon Sep 17 00:00:00 2001 From: Archaegeo Date: Fri, 2 Apr 2021 15:49:41 -0400 Subject: [PATCH] Fix visual errors --- ArchHUD.conf | 6 +++--- ArchHUD.conf.version | 2 +- ChangeLog.md | 3 +++ src/ArchHUD.lua | 10 +++++----- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/ArchHUD.conf b/ArchHUD.conf index 97bf30a5..4ed54e99 100644 --- a/ArchHUD.conf +++ b/ArchHUD.conf @@ -1,4 +1,4 @@ -name: ArchHud - Archaegeo v1.143 (Minified) +name: ArchHud - Archaegeo v1.144 (Minified) slots: core: class: CoreUnit @@ -186,7 +186,7 @@ handlers: ExtraLongitudeTags = "none" --export: (Default: "none") ExtraLateralTags = "none" --export: (Default: "none") ExtraVerticalTags = "none" --export: (Default: "none") - local a=Navigator.new(system,core,unit)script={}VERSION_NUMBER=1.143;SetWaypointOnExit=true;BrakeToggleStatus=BrakeToggleDefault;VertTakeOffEngine=false;BrakeIsOn=false;RetrogradeIsOn=false;ProgradeIsOn=false;Autopilot=false;TurnBurn=false;AltitudeHold=false;BrakeLanding=false;AutoTakeoff=false;Reentry=false;VertTakeOff=false;HoldAltitude=1000;AutopilotAccelerating=false;AutopilotRealigned=false;AutopilotBraking=false;AutopilotCruising=false;AutopilotEndSpeed=0;AutopilotStatus="Aligning"AutopilotPlanetGravity=0;PrevViewLock=1;AutopilotTargetName="None"AutopilotTargetCoords=nil;AutopilotTargetIndex=0;GearExtended=nil;TotalDistanceTravelled=0.0;TotalFlightTime=0;SavedLocations={}VectorToTarget=false;LocationIndex=0;LastMaxBrake=0;LockPitch=nil;LastMaxBrakeInAtmo=0;AntigravTargetAltitude=1000;LastStartTime=0;SpaceTarget=false;LeftAmount=0;IntoOrbit=false;showHelp=true;local b={"showHelp","VertTakeOff","VertTakeOffEngine","SpaceTarget","BrakeToggleStatus","BrakeIsOn","RetrogradeIsOn","ProgradeIsOn","Autopilot","TurnBurn","AltitudeHold","BrakeLanding","Reentry","AutoTakeoff","HoldAltitude","AutopilotAccelerating","AutopilotBraking","AutopilotCruising","AutopilotRealigned","AutopilotEndSpeed","AutopilotStatus","AutopilotPlanetGravity","PrevViewLock","AutopilotTargetName","AutopilotTargetCoords","AutopilotTargetIndex","TotalDistanceTravelled","TotalFlightTime","SavedLocations","VectorToTarget","LocationIndex","LastMaxBrake","LockPitch","LastMaxBrakeInAtmo","AntigravTargetAltitude","LastStartTime"}local c=math.abs;local d=math.floor;local e=string.format;local f=json.decode;local g=json.encode;local h=core.getElementMaxHitPointsById;local j=unit.getAtmosphereDensity;local k=core.getElementMassById;local l=core.getConstructMass;local m=a.control.isRemoteControlled;local n=math.atan;local o=string.match;local tostring=tostring;local p=utils.round;local q=system.getTime;local vec3=vec3;local r=utils.clamp;local s=a.axisCommandManager;local t=system.destroyWidgetPanel;local u=system.updateData;local v=system.addDataToWidget;local w=system.lockView;local x=system.isViewLocked;local function y(z,A)local B=10^(A or 0)return d(z*B+0.5)/B end;local C=SafeR;local D=SafeB;local E=SafeG;local F=false;local G=0;local H=0;local I=0;local J=false;local K=0;local L=false;local M=y(ResolutionX/2,0)local N=y(ResolutionY/2,0)local O=false;local P=55;local Q=false;local R=false;local S=0;local T=0;local U=0;local V=0;local W=0;local X=0;local Y=0;local Z=false;local a0=false;local a1="empty"local a2=5;local a3=5;local a4=a2;local a5=a3;local a6=false;local a7,a8=0;local a9,aa=0;local ab=nil;local ac=0;local ad=0;local ae=false;local af=0;local ag=0;local ah=0;local ai=3;local aj=0;local ak=""local al=""local am=0;local an=false;local ao=false;local ap=false;local aq=-1;local ar=false;local as=""local at=j()>0;local au=j()local av=core.getAltitude()local aw=core.getElementIdList()local ax=q()local ay=nil;local az=false;local aA=[[rgb(]]..d(C+0.5)..","..d(E+0.5)..","..d(D+0.5)..[[)]]local aB=[[rgb(]]..d(C*0.9+0.5)..","..d(E*0.9+0.5)..","..d(D*0.9+0.5)..[[)]]local aC={}local aD=0;local aE=0;local aF=""local aG=true;local aH={}local aI={}local aJ={}local aK=ResolutionX;local aL=ResolutionY;local aM=false;local aN=false;local aO=0;local aP=nil;local aQ={}local aR={}local aS={}local aT=0;local aU=false;local aV={}local aW={}local aX=d(1/apTickRate)*2;local aY={}local aZ={}local a_={}local b0={}local b1=false;local b2=16;local b3=0;local b4=nil;local b5=""local b6=nil;local b7=nil;local b8=nil;local b9=nil;local ba=nil;local bb=nil;local bc=nil;local bd=nil;local be=nil;local bf=false;local bg=false;local bh=autoRollPreference;local bi=LandingGearGroundHeight;local bj=false;local bk=q()local bl=0;local bm=0;local bn=0;local bo=AtmoSpeedLimit;local bp=0;local bq=nil;local br=0;local bs=0;local bt=false;local bu=false;local bv={VectorToTarget=false}local bw=false;local bx=0;local by=nil;local bz=false;local bA=false;local bB=false;local bC=false;local bD=0;local bE=q()local bF=vec3(core.getConstructWorldOrientationUp())local bG=vec3(core.getConstructWorldOrientationForward())local bH=vec3(core.getConstructWorldOrientationRight())local bI=vec3(core.getWorldVelocity())local bJ=vec3(bI):len()local bK=vec3(core.getWorldVertical())local bL=-bK:dot(bI)local bM=vec3(core.getConstructWorldPos())local bN=false;local bO=false;local bP=nil;local bQ=true;local bR=0;local bS=0;local bT=false;local bU={}local bV=showHud;local function bW(bX,bY)for i=1,#bY do table.insert(bX,bY[i])end;return bX end;local function bZ(b_)local c0={}local c1={"userControlScheme","freeLookToggle","BrakeToggleDefault","RemoteFreeze","brightHud","RemoteHud","VanillaRockets","InvertMouse","autoRollPreference","turnAssist","ExternalAGG","UseSatNav","ShouldCheckDamage","CalculateBrakeLandingSpeed","AtmoSpeedAssist","ForceAlignment","DisplayDeadZone","showHud","ShowOdometer","hideHudOnToggleWidgets","ShiftShowsRemoteButtons","DisplayOrbit","SetWaypointOnExit"}local c2={"YawStallAngle","PitchStallAngle","brakeLandingRate","MaxPitch","AtmoSpeedLimit","SpaceSpeedLimit","AutoTakeoffAltitude","TargetHoverHeight","LandingGearGroundHeight","MaxGameVelocity","AutopilotInterplanetaryThrottle","warmup","fuelTankHandlingAtmo","fuelTankHandlingSpace","fuelTankHandlingRocket","ContainerOptimization","FuelTankOptimization"}local c3={"ResolutionX","ResolutionY","circleRad","SafeR","SafeG","SafeB","PvPR","PvPG","PvPB","centerX","centerY","throtPosX","throtPosY","vSpdMeterX","vSpdMeterY","altMeterX","altMeterY","fuelX","fuelY","DeadZone","OrbitMapSize","OrbitMapX","OrbitMapY"}local c4={"speedChangeLarge","speedChangeSmall","MouseXSensitivity","MouseYSensitivity","autoRollFactor","rollSpeedFactor","autoRollRollThreshold","minRollVelocity","turnAssistFactor","TrajectoryAlignmentStrength","torqueFactor","pitchSpeedFactor","yawSpeedFactor","brakeSpeedFactor","brakeFlatFactor","DampingMultiplier","apTickRate","hudTickRate","ExtraLongitudeTags","ExtraLateralTags","ExtraVerticalTags"}if not b_ then bW(c0,c1)bW(c0,c2)bW(c0,c3)bW(c0,c4)return c0 elseif b_=="boolean"then return c1 elseif b_=="handling"then return c2 elseif b_=="hud"then return c3 elseif b_=="physics"then return c4 end end;local function c5(c6,c7,c8,c9,ca)if c9==nil then c9=""end;if ca==nil then ca=""end;return e([[%s]],c9,c6,c7,ca,c8)end;local function cb(cc,cd)if s:getAxisCommandType(0)~=axisCommandType.byThrottle and not cd then a.control.cancelCurrentControlMasterMode()end;s:setThrottleCommand(axisCommandId.longitudinal,cc)H=r(y(cc*100,0)/100,-1,1)end;local function ce(cc,cd)if s:getAxisCommandType(0)~=axisCommandType.byTargetSpeed and not cd then a.control.cancelCurrentControlMasterMode()end;s:setTargetSpeedCommand(axisCommandId.longitudinal,cc)bP=cc end;local function cf()AtlasOrdered={}for cg,ch in pairs(b4[0])do table.insert(AtlasOrdered,{name=ch.name,index=cg})end;local function ci(cj,ck)return cj.name100000;local cr,cs=""if cp==nil then cp=1 end;if cq then cr,cs=y(aj/1000/200,cp),"SU"elseif aj<1000 then cr,cs=y(aj,cp),"M"else cr,cs=y(aj/1000,cp),"KM"end;return cr,cs end;local function ct(cu)for cg,ch in pairs(cu)do if ch.name and ch.name==CustomTarget.name then return cg end end;return-1 end;local function cv()if VertTakeOff then AltitudeHold=false;StrongBrakes=true;Reentry=false;AutoTakeoff=false;AltitudeHold=false;BrakeLanding=true;VertTakeOff=false;bh=true;af=0;if at and aq==-1 then BrakeLanding=false;AltitudeHold=true;af=0;a:setEngineForceCommand('thrust analog vertical fueled ',vec3(),1)ce(d(bo))end else VertTakeOff=true;AltitudeHold=false;bz=false;GearExtended=false;a.control.retractLandingGears()s:setTargetGroundAltitude(TargetHoverHeight)BrakeIsOn=true end end;local function cw()bz=false;br=nil;bs=nil;bD=0;if au==0 then if IntoOrbit then IntoOrbit=false;bt=false;by=nil;bh=autoRollPreference;if AltitudeHold then AltitudeHold=false;AutoTakeoff=false end;bv.VectorToTarget=false;bv.AutopilotAlign=false;bw=false elseif unit.getClosestPlanetInfluence()>0 then IntoOrbit=true;bh=true;if by==nil then by=planet end;if AltitudeHold then AltitudeHold=false;AutoTakeoff=false end else a1="Unable to engage orbiting, not near planet"end else IntoOrbit=false;bt=false;by=nil;bh=autoRollPreference;if AltitudeHold then AltitudeHold=false end;bv.VectorToTarget=false;bv.AutopilotAlign=false;bw=false end end;local function cx()if bE-bm<1.5 then if planet.hasAtmosphere then if au>0 then HoldAltitude=planet.spaceEngineMinAltitude-50 else if unit.getClosestPlanetInfluence()>0 then HoldAltitude=planet.noAtmosphericDensityAltitude+1000;bx=HoldAltitude;bw=true;if not IntoOrbit then cw()end;bt=true end end;bm=-1;if AltitudeHold or IntoOrbit or VertTakeOff then return end end else bm=bE end;if unit.getClosestPlanetInfluence()>0 and au==0 then bx=av;bw=true;bt=true;cw()if IntoOrbit then bm=bE else bm=0 end;return end;AltitudeHold=not AltitudeHold;BrakeLanding=false;Reentry=false;if AltitudeHold then Autopilot=false;ProgradeIsOn=false;RetrogradeIsOn=false;Z=false;bh=true;LockPitch=nil;bz=false;if aq==-1 then AutoTakeoff=false;if bm>-1 then if unit.getClosestPlanetInfluence()>0 then HoldAltitude=av end end;if VertTakeOff then cv()end else AutoTakeoff=true;if bm>-1 then HoldAltitude=av+AutoTakeoffAltitude end;GearExtended=false;a.control.retractLandingGears()BrakeIsOn=true;s:setTargetGroundAltitude(TargetHoverHeight)if VertTakeOffEngine and bN then cv()end end;if ao then HoldAltitude=100000 end else if IntoOrbit then cw()end;if VertTakeOff then cv()end;bh=autoRollPreference;AutoTakeoff=false;VectorToTarget=false;bm=0 end end;local function cy()if m()==1 then Z=not Z;if Z then Autopilot=false;RetrogradeIsOn=false;ProgradeIsOn=false;AltitudeHold=false;Reentry=false;BrakeLanding=false;AutoTakeoff=false;OldGearExtended=GearExtended;GearExtended=false;a.control.retractLandingGears()s:setTargetGroundAltitude(TargetHoverHeight)else BrakeIsOn=true;bh=autoRollPreference;GearExtended=OldGearExtended;if GearExtended then a.control.extendLandingGears()s:setTargetGroundAltitude(LandingGearGroundHeight)end end else a1="Follow Mode only works with Remote controller"Z=false end end;local function cz()if AutopilotTargetIndex==0 then AutopilotTargetName="None"ab=nil;CustomTarget=nil;return true end;local cA=AtlasOrdered[AutopilotTargetIndex].index;local cB=b4[0][cA]if cB.center then AutopilotTargetName=cB.name;ab=ba[0][cA]if CustomTarget~=nil then if au==0 then if u(widgetMaxBrakeTimeText,widgetMaxBrakeTime)~=1 then v(widgetMaxBrakeTimeText,widgetMaxBrakeTime)end;if u(widgetMaxBrakeDistanceText,widgetMaxBrakeDistance)~=1 then v(widgetMaxBrakeDistanceText,widgetMaxBrakeDistance)end;if u(widgetCurBrakeTimeText,widgetCurBrakeTime)~=1 then v(widgetCurBrakeTimeText,widgetCurBrakeTime)end;if u(widgetCurBrakeDistanceText,widgetCurBrakeDistance)~=1 then v(widgetCurBrakeDistanceText,widgetCurBrakeDistance)end;if u(widgetTrajectoryAltitudeText,widgetTrajectoryAltitude)~=1 then v(widgetTrajectoryAltitudeText,widgetTrajectoryAltitude)end end;if u(widgetMaxMassText,widgetMaxMass)~=1 then v(widgetMaxMassText,widgetMaxMass)end;if u(widgetTravelTimeText,widgetTravelTime)~=1 then v(widgetTravelTimeText,widgetTravelTime)end;if u(widgetTargetOrbitText,widgetTargetOrbit)~=1 then v(widgetTargetOrbitText,widgetTargetOrbit)end end;CustomTarget=nil else CustomTarget=cB;for _,ch in pairs(ba[0])do if ch.name==CustomTarget.planetname then ab=ch;AutopilotTargetName=CustomTarget.name;break end end;if u(widgetMaxMassText,widgetMaxMass)~=1 then v(widgetMaxMassText,widgetMaxMass)end;if u(widgetTravelTimeText,widgetTravelTime)~=1 then v(widgetTravelTimeText,widgetTravelTime)end end;if CustomTarget==nil then AutopilotTargetCoords=vec3(ab.center)else AutopilotTargetCoords=CustomTarget.position end;if ab.planetname~="Space"then if ab.hasAtmosphere then AutopilotTargetOrbit=d(ab.radius*(TargetOrbitRadius-1)+ab.noAtmosphericDensityAltitude)else AutopilotTargetOrbit=d(ab.radius*(TargetOrbitRadius-1)+ab.surfaceMaxAltitude)end else AutopilotTargetOrbit=1000 end;if CustomTarget~=nil and CustomTarget.planetname=="Space"then AutopilotEndSpeed=0 else _,AutopilotEndSpeed=bd(ab):escapeAndOrbitalSpeed(AutopilotTargetOrbit)end;AutopilotPlanetGravity=0;AutopilotAccelerating=false;AutopilotBraking=false;AutopilotCruising=false;Autopilot=false;AutopilotRealigned=false;AutopilotStatus="Aligning"return true end;local function cC(cD)if not Autopilot and not VectorToTarget and not ao and not IntoOrbit then if cD==nil then AutopilotTargetIndex=AutopilotTargetIndex+1;if AutopilotTargetIndex>#AtlasOrdered then AutopilotTargetIndex=0 end else AutopilotTargetIndex=AutopilotTargetIndex-1;if AutopilotTargetIndex<0 then AutopilotTargetIndex=#AtlasOrdered end end;if AutopilotTargetIndex==0 then cz()else local cA=AtlasOrdered[AutopilotTargetIndex].index;local cB=b4[0][cA]if cB.name=="Space"then if cD==nil then cC()else cC(1)end else cz()end end else a1="Disengage autopilot before changing Interplanetary Helper"end end;local function cE(planet,cF)local function cG(cH,cI)local cJ=vec3(cI)if cH.bodyId==0 then return setmetatable({latitude=cJ.x,longitude=cJ.y,altitude=cJ.z,bodyId=0,systemId=cH.planetarySystemId},MapPosition)end;local cK=cJ-cH.center;local aj=cK:len()local cL=aj-cH.radius;local cM=0;local cN=0;if not cl(aj,0)then local cO=n(cK.y,cK.x)cN=cO>=0 and cO or 2*math.pi+cO;cM=math.pi/2-math.acos(cK.z/aj)end;return setmetatable({latitude=math.deg(cM),longitude=math.deg(cN),altitude=cL,bodyId=cH.bodyId,systemId=cH.planetarySystemId},MapPosition)end;local cP=cG(planet,cF)cP="::pos{"..cP.systemId..","..cP.bodyId..","..cP.latitude..","..cP.longitude..","..cP.altitude.."}"system.setWaypoint(cP)end;local function cQ()local function cR(SpaceTarget)VectorToTarget=not VectorToTarget;if VectorToTarget then TurnBurn=false;if not AltitudeHold and not SpaceTarget then cx()end end;VectorStatus="Proceeding to Waypoint"end;if bE-bn<1.5 and au>0 then if not bC then a1="No space engines detected, Orbital Hop not supported"return end;if planet.hasAtmosphere then if au>0 then HoldAltitude=planet.noAtmosphericDensityAltitude+1000 end;bn=-1;if Autopilot or VectorToTarget then return end end else bn=bE end;TargetSet=false;if AutopilotTargetIndex>0 and not Autopilot and not VectorToTarget and not ao then cz()cE(ab,AutopilotTargetCoords)if CustomTarget~=nil then LockPitch=nil;SpaceTarget=CustomTarget.planetname=="Space"if SpaceTarget then if au~=0 then ao=true;cx()else Autopilot=true end elseif planet.name==CustomTarget.planetname then StrongBrakes=true;if au>0 then if not VectorToTarget then cR(SpaceTarget)end else if av>AutopilotTargetOrbit*1.5 or av==0 then bz=false;Autopilot=true elseif not at then if IntoOrbit then cw()end;bx=planet.noAtmosphericDensityAltitude+1000;bw=true;bv.AutopilotAlign=true;bv.VectorToTarget=true;bt=false;if not IntoOrbit then cw()end end end else RetrogradeIsOn=false;ProgradeIsOn=false;if au~=0 then ao=true;cx()else Autopilot=true end end elseif au==0 then local cS=unit.getClosestPlanetInfluence()>0;if CustomTarget==nil and(ab.name==planet.name and cS)and not IntoOrbit then WaypointSet=false;bz=false;bt=false;cw()else Autopilot=true;RetrogradeIsOn=false;ProgradeIsOn=false;AutopilotRealigned=false;Z=false;AltitudeHold=false;BrakeLanding=false;Reentry=false;AutoTakeoff=false;O=false;LockPitch=nil;WaypointSet=false end else ao=true;cx()end else ao=false;Autopilot=false;AutopilotRealigned=false;VectorToTarget=false;O=false;AutoTakeoff=false;AltitudeHold=false;VectorToTarget=false;HoldAltitude=av;TargetSet=false;Reentry=false;if IntoOrbit then cw()end end end;local function cT(cU)local cV=-1;local cW;cV=ct(SavedLocations)if cV~=-1 then local cX;if cU~=nil then cW={position=SavedLocations[cV].position,name=cU,atmosphere=SavedLocations[cV].atmosphere,planetname=SavedLocations[cV].planetname,gravity=SavedLocations[cV].gravity}else cW={position=bM,name=SavedLocations[cV].name,atmosphere=au,planetname=planet.name,gravity=unit.getClosestPlanetInfluence(),safe=true}end;SavedLocations[cV]=cW;cV=-1;cV=ct(b4[0])if cV>-1 then b4[0][cV]=cW end;cf()a1=CustomTarget.name.." position updated"AutopilotTargetIndex=0;cz()else a1="Name Not Found"end end;local function cY()BrakeIsOn=not BrakeIsOn;if BrakeLanding then BrakeLanding=false;bh=autoRollPreference end;if BrakeIsOn then AltitudeHold=false;VectorToTarget=false;AutoTakeoff=false;VertTakeOff=false;Reentry=false;ProgradeIsOn=false;BrakeLanding=false;AutoLanding=false;AltitudeHold=false;if VertTakeOff then cv()end;if IntoOrbit then cw()end;LockPitch=nil;bh=autoRollPreference;an=false;ap=false;af=0 end end;local function cZ(c_,d0,d1)local function d2(c_,d3)c_=vec3(c_)d3=vec3(d3):normalize()local cr=c_*d3;return cr.x+cr.y+cr.z end;local d4=0.001;local d5=1;if not at or not bj or aq~=-1 or bJ

0 then return dh.."d "..dg.."h "elseif dg>0 then return dg.."h "..df.."m "elseif df>0 then return df.."m "..de.."s"elseif de>0 then return de.."s"else return"0s"end end;local function di()local dj=-1;if telemeter_1 then dj=telemeter_1.getDistance()end;if aq~=-1 and dj~=-1 then if aq0 then for i=1,#dC do local dP=string.sub(dC[i][dG],1,12)local dQ=0;for dR=1,dM do if dC[i][dG]==f(unit[dL.."_"..dR].getData()).name then dQ=dR;break end end;if b1 or dD[i]==nil or dE[i]==nil then local dS=0;local dT=0;local dU=0;local dV=0;local dW=q()if dQ~=0 then dE[i]=f(unit[dL.."_"..dQ].getData()).percentage;dD[i]=f(unit[dL.."_"..dQ].getData()).timeLeft;if dD[i]=="n/a"then dD[i]=0 end else dU=k(dC[i][dF])-dC[i][dI]dS=dC[i][dH]dE[i]=d(0.5+dU*100/dS)dT=dC[i][dJ]dV=dC[i][dK]if dT<=dU then dD[i]=0 else dD[i]=d(0.5+dU/((dT-dU)/(dW-dV)))end;dC[i][dJ]=dU;dC[i][dK]=dW end end;if dP==dA then dP=e("%s %d",dB,i)end;if dQ==0 then dP=dP.." *"end;local dX;if dD[i]==0 then dX="n/a"else dX=dd(dD[i])end;if dE[i]~=nil then local dY=d(dE[i]*2.55)local dZ=e("rgb(%d,%d,%d)",255-dY,dY,0)local c9=""if dX~="n/a"and dD[i]<120 or dE[i]<5 then if b1 then c9=[[class="red"]]end end;dz[#dz+1]=c5(c6,dN,dP,c9 .." pdim txtfuel")dz[#dz+1]=c5(c6,dO,e("%d%% %s",dE[i],dX),"pdim txtfuel","fill:"..dZ)dN=dN+30;dO=dO+30 end end end end;local function d_(dz,cL)if cL<200000 and not at or cL and at then local e0=0;if c(bL)>1 then e0=45*math.log(c(bL),10)if bL<0 then e0=-e0 end end;dz[#dz+1]=e([[ + local a=Navigator.new(system,core,unit)script={}VERSION_NUMBER=1.144;SetWaypointOnExit=true;BrakeToggleStatus=BrakeToggleDefault;VertTakeOffEngine=false;BrakeIsOn=false;RetrogradeIsOn=false;ProgradeIsOn=false;Autopilot=false;TurnBurn=false;AltitudeHold=false;BrakeLanding=false;AutoTakeoff=false;Reentry=false;VertTakeOff=false;HoldAltitude=1000;AutopilotAccelerating=false;AutopilotRealigned=false;AutopilotBraking=false;AutopilotCruising=false;AutopilotEndSpeed=0;AutopilotStatus="Aligning"AutopilotPlanetGravity=0;PrevViewLock=1;AutopilotTargetName="None"AutopilotTargetCoords=nil;AutopilotTargetIndex=0;GearExtended=nil;TotalDistanceTravelled=0.0;TotalFlightTime=0;SavedLocations={}VectorToTarget=false;LocationIndex=0;LastMaxBrake=0;LockPitch=nil;LastMaxBrakeInAtmo=0;AntigravTargetAltitude=1000;LastStartTime=0;SpaceTarget=false;LeftAmount=0;IntoOrbit=false;showHelp=true;local b={"showHelp","VertTakeOff","VertTakeOffEngine","SpaceTarget","BrakeToggleStatus","BrakeIsOn","RetrogradeIsOn","ProgradeIsOn","Autopilot","TurnBurn","AltitudeHold","BrakeLanding","Reentry","AutoTakeoff","HoldAltitude","AutopilotAccelerating","AutopilotBraking","AutopilotCruising","AutopilotRealigned","AutopilotEndSpeed","AutopilotStatus","AutopilotPlanetGravity","PrevViewLock","AutopilotTargetName","AutopilotTargetCoords","AutopilotTargetIndex","TotalDistanceTravelled","TotalFlightTime","SavedLocations","VectorToTarget","LocationIndex","LastMaxBrake","LockPitch","LastMaxBrakeInAtmo","AntigravTargetAltitude","LastStartTime"}local c=math.abs;local d=math.floor;local e=string.format;local f=json.decode;local g=json.encode;local h=core.getElementMaxHitPointsById;local j=unit.getAtmosphereDensity;local k=core.getElementMassById;local l=core.getConstructMass;local m=a.control.isRemoteControlled;local n=math.atan;local o=string.match;local tostring=tostring;local p=utils.round;local q=system.getTime;local vec3=vec3;local r=utils.clamp;local s=a.axisCommandManager;local t=system.destroyWidgetPanel;local u=system.updateData;local v=system.addDataToWidget;local w=system.lockView;local x=system.isViewLocked;local function y(z,A)local B=10^(A or 0)return d(z*B+0.5)/B end;local C=SafeR;local D=SafeB;local E=SafeG;local F=false;local G=0;local H=0;local I=0;local J=false;local K=0;local L=false;local M=y(ResolutionX/2,0)local N=y(ResolutionY/2,0)local O=false;local P=55;local Q=false;local R=false;local S=0;local T=0;local U=0;local V=0;local W=0;local X=0;local Y=0;local Z=false;local a0=false;local a1="empty"local a2=5;local a3=5;local a4=a2;local a5=a3;local a6=false;local a7,a8=0;local a9,aa=0;local ab=nil;local ac=0;local ad=0;local ae=false;local af=0;local ag=0;local ah=0;local ai=3;local aj=0;local ak=""local al=""local am=0;local an=false;local ao=false;local ap=false;local aq=-1;local ar=false;local as=""local at=j()>0;local au=j()local av=core.getAltitude()local aw=core.getElementIdList()local ax=q()local ay=nil;local az=false;local aA=[[rgb(]]..d(C+0.5)..","..d(E+0.5)..","..d(D+0.5)..[[)]]local aB=[[rgb(]]..d(C*0.9+0.5)..","..d(E*0.9+0.5)..","..d(D*0.9+0.5)..[[)]]local aC={}local aD=0;local aE=0;local aF=""local aG=true;local aH={}local aI={}local aJ={}local aK=ResolutionX;local aL=ResolutionY;local aM=false;local aN=false;local aO=0;local aP=nil;local aQ={}local aR={}local aS={}local aT=0;local aU=false;local aV={}local aW={}local aX=d(1/apTickRate)*2;local aY={}local aZ={}local a_={}local b0={}local b1=false;local b2=16;local b3=0;local b4=nil;local b5=""local b6=nil;local b7=nil;local b8=nil;local b9=nil;local ba=nil;local bb=nil;local bc=nil;local bd=nil;local be=nil;local bf=false;local bg=false;local bh=autoRollPreference;local bi=LandingGearGroundHeight;local bj=false;local bk=q()local bl=0;local bm=0;local bn=0;local bo=AtmoSpeedLimit;local bp=0;local bq=nil;local br=0;local bs=0;local bt=false;local bu=false;local bv={VectorToTarget=false}local bw=false;local bx=0;local by=nil;local bz=false;local bA=false;local bB=false;local bC=false;local bD=0;local bE=q()local bF=vec3(core.getConstructWorldOrientationUp())local bG=vec3(core.getConstructWorldOrientationForward())local bH=vec3(core.getConstructWorldOrientationRight())local bI=vec3(core.getWorldVelocity())local bJ=vec3(bI):len()local bK=vec3(core.getWorldVertical())local bL=-bK:dot(bI)local bM=vec3(core.getConstructWorldPos())local bN=false;local bO=false;local bP=nil;local bQ=true;local bR=0;local bS=0;local bT=false;local bU={}local bV=showHud;local function bW(bX,bY)for i=1,#bY do table.insert(bX,bY[i])end;return bX end;local function bZ(b_)local c0={}local c1={"userControlScheme","freeLookToggle","BrakeToggleDefault","RemoteFreeze","brightHud","RemoteHud","VanillaRockets","InvertMouse","autoRollPreference","turnAssist","ExternalAGG","UseSatNav","ShouldCheckDamage","CalculateBrakeLandingSpeed","AtmoSpeedAssist","ForceAlignment","DisplayDeadZone","showHud","ShowOdometer","hideHudOnToggleWidgets","ShiftShowsRemoteButtons","DisplayOrbit","SetWaypointOnExit"}local c2={"YawStallAngle","PitchStallAngle","brakeLandingRate","MaxPitch","AtmoSpeedLimit","SpaceSpeedLimit","AutoTakeoffAltitude","TargetHoverHeight","LandingGearGroundHeight","MaxGameVelocity","AutopilotInterplanetaryThrottle","warmup","fuelTankHandlingAtmo","fuelTankHandlingSpace","fuelTankHandlingRocket","ContainerOptimization","FuelTankOptimization"}local c3={"ResolutionX","ResolutionY","circleRad","SafeR","SafeG","SafeB","PvPR","PvPG","PvPB","centerX","centerY","throtPosX","throtPosY","vSpdMeterX","vSpdMeterY","altMeterX","altMeterY","fuelX","fuelY","DeadZone","OrbitMapSize","OrbitMapX","OrbitMapY"}local c4={"speedChangeLarge","speedChangeSmall","MouseXSensitivity","MouseYSensitivity","autoRollFactor","rollSpeedFactor","autoRollRollThreshold","minRollVelocity","turnAssistFactor","TrajectoryAlignmentStrength","torqueFactor","pitchSpeedFactor","yawSpeedFactor","brakeSpeedFactor","brakeFlatFactor","DampingMultiplier","apTickRate","hudTickRate","ExtraLongitudeTags","ExtraLateralTags","ExtraVerticalTags"}if not b_ then bW(c0,c1)bW(c0,c2)bW(c0,c3)bW(c0,c4)return c0 elseif b_=="boolean"then return c1 elseif b_=="handling"then return c2 elseif b_=="hud"then return c3 elseif b_=="physics"then return c4 end end;local function c5(c6,c7,c8,c9,ca)if c9==nil then c9=""end;if ca==nil then ca=""end;return e([[%s]],c9,c6,c7,ca,c8)end;local function cb(cc,cd)if s:getAxisCommandType(0)~=axisCommandType.byThrottle and not cd then a.control.cancelCurrentControlMasterMode()end;s:setThrottleCommand(axisCommandId.longitudinal,cc)H=r(y(cc*100,0)/100,-1,1)end;local function ce(cc,cd)if s:getAxisCommandType(0)~=axisCommandType.byTargetSpeed and not cd then a.control.cancelCurrentControlMasterMode()end;s:setTargetSpeedCommand(axisCommandId.longitudinal,cc)bP=cc end;local function cf()AtlasOrdered={}for cg,ch in pairs(b4[0])do table.insert(AtlasOrdered,{name=ch.name,index=cg})end;local function ci(cj,ck)return cj.name100000;local cr,cs=""if cp==nil then cp=1 end;if cq then cr,cs=y(aj/1000/200,cp),"SU"elseif aj<1000 then cr,cs=y(aj,cp),"M"else cr,cs=y(aj/1000,cp),"KM"end;return cr,cs end;local function ct(cu)for cg,ch in pairs(cu)do if ch.name and ch.name==CustomTarget.name then return cg end end;return-1 end;local function cv()if VertTakeOff then AltitudeHold=false;StrongBrakes=true;Reentry=false;AutoTakeoff=false;AltitudeHold=false;BrakeLanding=true;VertTakeOff=false;bh=true;af=0;if at and aq==-1 then BrakeLanding=false;AltitudeHold=true;af=0;a:setEngineForceCommand('thrust analog vertical fueled ',vec3(),1)ce(d(bo))end else VertTakeOff=true;AltitudeHold=false;bz=false;GearExtended=false;a.control.retractLandingGears()s:setTargetGroundAltitude(TargetHoverHeight)BrakeIsOn=true end end;local function cw()bz=false;br=nil;bs=nil;bD=0;if au==0 then if IntoOrbit then IntoOrbit=false;bt=false;by=nil;bh=autoRollPreference;if AltitudeHold then AltitudeHold=false;AutoTakeoff=false end;bv.VectorToTarget=false;bv.AutopilotAlign=false;bw=false elseif unit.getClosestPlanetInfluence()>0 then IntoOrbit=true;bh=true;if by==nil then by=planet end;if AltitudeHold then AltitudeHold=false;AutoTakeoff=false end else a1="Unable to engage orbiting, not near planet"end else IntoOrbit=false;bt=false;by=nil;bh=autoRollPreference;if AltitudeHold then AltitudeHold=false end;bv.VectorToTarget=false;bv.AutopilotAlign=false;bw=false end end;local function cx()if bE-bm<1.5 then if planet.hasAtmosphere then if au>0 then HoldAltitude=planet.spaceEngineMinAltitude-50 else if unit.getClosestPlanetInfluence()>0 then HoldAltitude=planet.noAtmosphericDensityAltitude+1000;bx=HoldAltitude;bw=true;if not IntoOrbit then cw()end;bt=true end end;bm=-1;if AltitudeHold or IntoOrbit or VertTakeOff then return end end else bm=bE end;if unit.getClosestPlanetInfluence()>0 and au==0 then bx=av;bw=true;bt=true;cw()if IntoOrbit then bm=bE else bm=0 end;return end;AltitudeHold=not AltitudeHold;BrakeLanding=false;Reentry=false;if AltitudeHold then Autopilot=false;ProgradeIsOn=false;RetrogradeIsOn=false;Z=false;bh=true;LockPitch=nil;bz=false;if aq==-1 then AutoTakeoff=false;if bm>-1 then if unit.getClosestPlanetInfluence()>0 then HoldAltitude=av end end;if VertTakeOff then cv()end else AutoTakeoff=true;if bm>-1 then HoldAltitude=av+AutoTakeoffAltitude end;GearExtended=false;a.control.retractLandingGears()BrakeIsOn=true;s:setTargetGroundAltitude(TargetHoverHeight)if VertTakeOffEngine and bN then cv()end end;if ao then HoldAltitude=100000 end else if IntoOrbit then cw()end;if VertTakeOff then cv()end;bh=autoRollPreference;AutoTakeoff=false;VectorToTarget=false;bm=0 end end;local function cy()if m()==1 then Z=not Z;if Z then Autopilot=false;RetrogradeIsOn=false;ProgradeIsOn=false;AltitudeHold=false;Reentry=false;BrakeLanding=false;AutoTakeoff=false;OldGearExtended=GearExtended;GearExtended=false;a.control.retractLandingGears()s:setTargetGroundAltitude(TargetHoverHeight)else BrakeIsOn=true;bh=autoRollPreference;GearExtended=OldGearExtended;if GearExtended then a.control.extendLandingGears()s:setTargetGroundAltitude(LandingGearGroundHeight)end end else a1="Follow Mode only works with Remote controller"Z=false end end;local function cz()if AutopilotTargetIndex==0 then AutopilotTargetName="None"ab=nil;CustomTarget=nil;return true end;local cA=AtlasOrdered[AutopilotTargetIndex].index;local cB=b4[0][cA]if cB.center then AutopilotTargetName=cB.name;ab=ba[0][cA]if CustomTarget~=nil then if au==0 then if u(widgetMaxBrakeTimeText,widgetMaxBrakeTime)~=1 then v(widgetMaxBrakeTimeText,widgetMaxBrakeTime)end;if u(widgetMaxBrakeDistanceText,widgetMaxBrakeDistance)~=1 then v(widgetMaxBrakeDistanceText,widgetMaxBrakeDistance)end;if u(widgetCurBrakeTimeText,widgetCurBrakeTime)~=1 then v(widgetCurBrakeTimeText,widgetCurBrakeTime)end;if u(widgetCurBrakeDistanceText,widgetCurBrakeDistance)~=1 then v(widgetCurBrakeDistanceText,widgetCurBrakeDistance)end;if u(widgetTrajectoryAltitudeText,widgetTrajectoryAltitude)~=1 then v(widgetTrajectoryAltitudeText,widgetTrajectoryAltitude)end end;if u(widgetMaxMassText,widgetMaxMass)~=1 then v(widgetMaxMassText,widgetMaxMass)end;if u(widgetTravelTimeText,widgetTravelTime)~=1 then v(widgetTravelTimeText,widgetTravelTime)end;if u(widgetTargetOrbitText,widgetTargetOrbit)~=1 then v(widgetTargetOrbitText,widgetTargetOrbit)end end;CustomTarget=nil else CustomTarget=cB;for _,ch in pairs(ba[0])do if ch.name==CustomTarget.planetname then ab=ch;AutopilotTargetName=CustomTarget.name;break end end;if u(widgetMaxMassText,widgetMaxMass)~=1 then v(widgetMaxMassText,widgetMaxMass)end;if u(widgetTravelTimeText,widgetTravelTime)~=1 then v(widgetTravelTimeText,widgetTravelTime)end end;if CustomTarget==nil then AutopilotTargetCoords=vec3(ab.center)else AutopilotTargetCoords=CustomTarget.position end;if ab.planetname~="Space"then if ab.hasAtmosphere then AutopilotTargetOrbit=d(ab.radius*(TargetOrbitRadius-1)+ab.noAtmosphericDensityAltitude)else AutopilotTargetOrbit=d(ab.radius*(TargetOrbitRadius-1)+ab.surfaceMaxAltitude)end else AutopilotTargetOrbit=1000 end;if CustomTarget~=nil and CustomTarget.planetname=="Space"then AutopilotEndSpeed=0 else _,AutopilotEndSpeed=bd(ab):escapeAndOrbitalSpeed(AutopilotTargetOrbit)end;AutopilotPlanetGravity=0;AutopilotAccelerating=false;AutopilotBraking=false;AutopilotCruising=false;Autopilot=false;AutopilotRealigned=false;AutopilotStatus="Aligning"return true end;local function cC(cD)if not Autopilot and not VectorToTarget and not ao and not IntoOrbit then if cD==nil then AutopilotTargetIndex=AutopilotTargetIndex+1;if AutopilotTargetIndex>#AtlasOrdered then AutopilotTargetIndex=0 end else AutopilotTargetIndex=AutopilotTargetIndex-1;if AutopilotTargetIndex<0 then AutopilotTargetIndex=#AtlasOrdered end end;if AutopilotTargetIndex==0 then cz()else local cA=AtlasOrdered[AutopilotTargetIndex].index;local cB=b4[0][cA]if cB.name=="Space"then if cD==nil then cC()else cC(1)end else cz()end end else a1="Disengage autopilot before changing Interplanetary Helper"end end;local function cE(planet,cF)local function cG(cH,cI)local cJ=vec3(cI)if cH.bodyId==0 then return setmetatable({latitude=cJ.x,longitude=cJ.y,altitude=cJ.z,bodyId=0,systemId=cH.planetarySystemId},MapPosition)end;local cK=cJ-cH.center;local aj=cK:len()local cL=aj-cH.radius;local cM=0;local cN=0;if not cl(aj,0)then local cO=n(cK.y,cK.x)cN=cO>=0 and cO or 2*math.pi+cO;cM=math.pi/2-math.acos(cK.z/aj)end;return setmetatable({latitude=math.deg(cM),longitude=math.deg(cN),altitude=cL,bodyId=cH.bodyId,systemId=cH.planetarySystemId},MapPosition)end;local cP=cG(planet,cF)cP="::pos{"..cP.systemId..","..cP.bodyId..","..cP.latitude..","..cP.longitude..","..cP.altitude.."}"system.setWaypoint(cP)end;local function cQ()local function cR(SpaceTarget)VectorToTarget=not VectorToTarget;if VectorToTarget then TurnBurn=false;if not AltitudeHold and not SpaceTarget then cx()end end;VectorStatus="Proceeding to Waypoint"end;if bE-bn<1.5 and au>0 then if not bC then a1="No space engines detected, Orbital Hop not supported"return end;if planet.hasAtmosphere then if au>0 then HoldAltitude=planet.noAtmosphericDensityAltitude+1000 end;bn=-1;if Autopilot or VectorToTarget then return end end else bn=bE end;TargetSet=false;if AutopilotTargetIndex>0 and not Autopilot and not VectorToTarget and not ao then cz()cE(ab,AutopilotTargetCoords)if CustomTarget~=nil then LockPitch=nil;SpaceTarget=CustomTarget.planetname=="Space"if SpaceTarget then if au~=0 then ao=true;cx()else Autopilot=true end elseif planet.name==CustomTarget.planetname then StrongBrakes=true;if au>0 then if not VectorToTarget then cR(SpaceTarget)end else if av>AutopilotTargetOrbit*1.5 or av==0 then bz=false;Autopilot=true elseif not at then if IntoOrbit then cw()end;bx=planet.noAtmosphericDensityAltitude+1000;bw=true;bv.AutopilotAlign=true;bv.VectorToTarget=true;bt=false;if not IntoOrbit then cw()end end end else RetrogradeIsOn=false;ProgradeIsOn=false;if au~=0 then ao=true;cx()else Autopilot=true end end elseif au==0 then local cS=unit.getClosestPlanetInfluence()>0;if CustomTarget==nil and(ab.name==planet.name and cS)and not IntoOrbit then WaypointSet=false;bz=false;bt=false;cw()else Autopilot=true;RetrogradeIsOn=false;ProgradeIsOn=false;AutopilotRealigned=false;Z=false;AltitudeHold=false;BrakeLanding=false;Reentry=false;AutoTakeoff=false;O=false;LockPitch=nil;WaypointSet=false end else ao=true;cx()end else ao=false;Autopilot=false;AutopilotRealigned=false;VectorToTarget=false;O=false;AutoTakeoff=false;AltitudeHold=false;VectorToTarget=false;HoldAltitude=av;TargetSet=false;Reentry=false;if IntoOrbit then cw()end end end;local function cT(cU)local cV=-1;local cW;cV=ct(SavedLocations)if cV~=-1 then local cX;if cU~=nil then cW={position=SavedLocations[cV].position,name=cU,atmosphere=SavedLocations[cV].atmosphere,planetname=SavedLocations[cV].planetname,gravity=SavedLocations[cV].gravity}else cW={position=bM,name=SavedLocations[cV].name,atmosphere=au,planetname=planet.name,gravity=unit.getClosestPlanetInfluence(),safe=true}end;SavedLocations[cV]=cW;cV=-1;cV=ct(b4[0])if cV>-1 then b4[0][cV]=cW end;cf()a1=CustomTarget.name.." position updated"AutopilotTargetIndex=0;cz()else a1="Name Not Found"end end;local function cY()BrakeIsOn=not BrakeIsOn;if BrakeLanding then BrakeLanding=false;bh=autoRollPreference end;if BrakeIsOn then AltitudeHold=false;VectorToTarget=false;AutoTakeoff=false;VertTakeOff=false;Reentry=false;ProgradeIsOn=false;BrakeLanding=false;AutoLanding=false;AltitudeHold=false;if VertTakeOff then cv()end;if IntoOrbit then cw()end;LockPitch=nil;bh=autoRollPreference;an=false;ap=false;af=0 end end;local function cZ(c_,d0,d1)local function d2(c_,d3)c_=vec3(c_)d3=vec3(d3):normalize()local cr=c_*d3;return cr.x+cr.y+cr.z end;local d4=0.001;local d5=1;if not at or not bj or aq~=-1 or bJ

0 then return dh.."d "..dg.."h "elseif dg>0 then return dg.."h "..df.."m "elseif df>0 then return df.."m "..de.."s"elseif de>0 then return de.."s"else return"0s"end end;local function di()local dj=-1;if telemeter_1 then dj=telemeter_1.getDistance()end;if aq~=-1 and dj~=-1 then if aq0 then for i=1,#dC do local dP=string.sub(dC[i][dG],1,12)local dQ=0;for dR=1,dM do if dC[i][dG]==f(unit[dL.."_"..dR].getData()).name then dQ=dR;break end end;if b1 or dD[i]==nil or dE[i]==nil then local dS=0;local dT=0;local dU=0;local dV=0;local dW=q()if dQ~=0 then dE[i]=f(unit[dL.."_"..dQ].getData()).percentage;dD[i]=f(unit[dL.."_"..dQ].getData()).timeLeft;if dD[i]=="n/a"then dD[i]=0 end else dU=k(dC[i][dF])-dC[i][dI]dS=dC[i][dH]dE[i]=d(0.5+dU*100/dS)dT=dC[i][dJ]dV=dC[i][dK]if dT<=dU then dD[i]=0 else dD[i]=d(0.5+dU/((dT-dU)/(dW-dV)))end;dC[i][dJ]=dU;dC[i][dK]=dW end end;if dP==dA then dP=e("%s %d",dB,i)end;if dQ==0 then dP=dP.." *"end;local dX;if dD[i]==0 then dX="n/a"else dX=dd(dD[i])end;if dE[i]~=nil then local dY=d(dE[i]*2.55)local dZ=e("rgb(%d,%d,%d)",255-dY,dY,0)local c9=""if dX~="n/a"and dD[i]<120 or dE[i]<5 then if b1 then c9=[[class="red"]]end end;dz[#dz+1]=c5(c6,dN,dP,c9 .." pdim txtfuel")dz[#dz+1]=c5(c6,dO,e("%d%% %s",dE[i],dX),"pdim txtfuel","fill:"..dZ)dN=dN+30;dO=dO+30 end end end end;local function d_(dz,cL)if cL<200000 and not at or cL and at then local e0=0;if c(bL)>1 then e0=45*math.log(c(bL),10)if bL<0 then e0=-e0 end end;dz[#dz+1]=e([[ 1000 100 @@ -251,7 +251,7 @@ handlers: ]],f8,throtPosX-7,throtPosY-50,throtPosX,throtPosY-50,throtPosX,throtPosY+50,throtPosX-7,throtPosY+50,1-c(f5),throtPosX-10,throtPosY+50,throtPosX-15,throtPosY+53,throtPosX-15,throtPosY+47)end;dz[#dz+1]=c5(throtPosX+10,dN,f7,"pbright txtstart")dz[#dz+1]=c5(throtPosX+10,dO,e("%.0f %s",cc,unit),"pbright txtstart")if at and AtmoSpeedAssist and bQ and J then f5=d(K*100+0.5)local f8="red"if f5<0 then f8="red"end;dz[#dz+1]=e([[ - ]],f8,1-c(f5),throtPosX-10,throtPosY+50,throtPosX-15,throtPosY+53,throtPosX-15,throtPosY+47)dz[#dz+1]=c5(throtPosX+10,dN+40,"LIMIT","pbright txtstart")dz[#dz+1]=c5(throtPosX+10,dO+40,f5 .."%","pbright txtstart")end;if at and AtmoSpeedAssist or Reentry then dz[#dz+1]=c5(throtPosX+10,dN-40,"LIMIT: "..bo.." km/h","dim txtstart")elseif not at and Autopilot then dz[#dz+1]=c5(throtPosX+10,dN-40,"LIMIT: "..d(MaxGameVelocity*3.6+0.5).." km/h","dim txtstart")end end;local function f9(dz,fa)local fb=throtPosY-10;local fc=throtPosX+10;dz[#dz+1]=c5(0,0,"","pdim txt txtend")if m()==1 and not RemoteHud then fb=75 end;dz[#dz+1]=c5(fc,fb,d(fa).." km/h","pbright txtbig txtstart")end;local function fd(dz)dz[#dz+1]=c5(dt(1900),du(1070),e("ARCH Hud Version: %.3f",VERSION_NUMBER),"hudver")dz[#dz+1]=[[]]if unit.isMouseControlActivated()==1 then dz[#dz+1]=c5(dt(960),du(550),"Warning: Invalid Control Scheme Detected","warnings")dz[#dz+1]=c5(dt(960),du(600),"Keyboard Scheme must be selected","warnings")dz[#dz+1]=c5(dt(960),du(650),"Set your preferred scheme in Lua Parameters instead","warnings")end;local fe=dt(960)local ff=du(860)local fg=du(880)local fh=du(900)local fi=du(960)local fj=du(200)local fk=du(150)local fl=du(960)if m()==1 and not RemoteHud then ff=du(135)fg=du(155)fh=du(175)fj=du(115)fk=du(95)end;if BrakeIsOn then dz[#dz+1]=c5(fe,ff,"Brake Engaged","warnings")elseif I>0 then dz[#dz+1]=c5(fe,ff,"Auto-Brake Engaged","warnings","opacity:"..I)end;if at and bj and aq==-1 then dz[#dz+1]=c5(fe,fj+50,"** STALL WARNING **","warnings")end;if ay then dz[#dz+1]=c5(fe,fl,"Gyro Enabled","warnings")end;if GearExtended then if R then dz[#dz+1]=c5(fe,fg,"Gear Extended","warn")else dz[#dz+1]=c5(fe,fg,"Landed (G: Takeoff)","warnings")end;local fm,cs=co(a:getTargetGroundAltitude())dz[#dz+1]=c5(fe,fh,"Hover Height: "..fm..cs,"warn")end;if a6 then dz[#dz+1]=c5(fe,fi+20,"ROCKET BOOST ENABLED","warn")end;if antigrav and not ExternalAGG and bO and AntigravTargetAltitude~=nil then if c(av-antigrav.getBaseAltitude())<501 then dz[#dz+1]=c5(fe,fj+15,e("AGG On - Target Altitude: %d Singularity Altitude: %d",d(AntigravTargetAltitude),d(antigrav.getBaseAltitude())),"warn")else dz[#dz+1]=c5(fe,fj+15,e("AGG On - Target Altitude: %d Singluarity Altitude: %d",d(AntigravTargetAltitude),d(antigrav.getBaseAltitude())),"warnings")end elseif Autopilot and AutopilotTargetName~="None"then dz[#dz+1]=c5(fe,fj+20,"Autopilot "..AutopilotStatus,"warn")elseif LockPitch~=nil then dz[#dz+1]=c5(fe,fj+20,e("LockedPitch: %d",d(LockPitch)),"warn")elseif Z then dz[#dz+1]=c5(fe,fj+20,"Follow Mode Engaged","warn")elseif Reentry then dz[#dz+1]=c5(fe,fj+20,"Re-entry in Progress","warn")end;local fn,fo,fp=ba:getPlanetarySystem(0):castIntersections(bM,bI:normalize(),function(fq)if fq.noAtmosphericDensityAltitude>0 then return fq.radius+fq.noAtmosphericDensityAltitude else return fq.radius+fq.surfaceMaxAltitude*1.5 end end)local fr=fo;if fp~=nil and fo~=nil then fr=math.min(fp,fo)end;if AltitudeHold or VertTakeOff then local fm,cs=co(HoldAltitude,2)if VertTakeOff then if bO then fm,cs=co(antigrav.getBaseAltitude(),2)end;dz[#dz+1]=c5(fe,fj,"VTO to %s"..fm..cs,"warn")elseif AutoTakeoff and not IntoOrbit then dz[#dz+1]=c5(fe,fj,"Takeoff to %s"..fm..cs,"warn")if BrakeIsOn and not VertTakeOff then dz[#dz+1]=c5(fe,fj+50,"Throttle Up and Disengage Brake For Takeoff","crit")end else dz[#dz+1]=c5("warn",fe,fj,"Altitude Hold: %s"..fm..cs,"warn")end end;if VertTakeOff and(antigrav~=nil and antigrav)then if au>0.1 then dz[#dz+1]=c5(fe,fj,"Beginning ascent","warn")elseif au<0.09 and au>0.05 then dz[#dz+1]=c5(fe,fj,"Aligning trajectory","warn")elseif au<0.05 then dz[#dz+1]=c5(fe,fj,"Leaving atmosphere","warn")end end;if IntoOrbit then if bq~=nil then dz[#dz+1]=c5(fe,fj,bq,"warn")end end;if BrakeLanding then if StrongBrakes then dz[#dz+1]=c5(fe,fj,"Brake-Landing","warnings")else dz[#dz+1]=c5(fe,fj,"Coast-Landing","warnings")end end;if ProgradeIsOn then dz[#dz+1]=c5(fe,fj,"Prograde Alignment","crit")end;if RetrogradeIsOn then dz[#dz+1]=c5(fe,fj,"Retrograde Alignment","crit")end;if fr~=nil and au==0 then local fm,cs=co(fr)local travelTime=bb.computeTravelTime(bJ,0,fr)local fs="Collision"if fn.noAtmosphericDensityAltitude>0 then fs="Atmosphere"end;dz[#dz+1]=c5(fe,fk,fn.name,fs..dd(travelTime).." In "..fm..cs,"crit")end;if VectorToTarget and not IntoOrbit then dz[#dz+1]=c5(fe,fj+35,VectorStatus,"warn")end;dz[#dz+1]=""return dz end;local function ft(em)return d(y(em*3.6,0)+0.5).." km/h"end;local function fu(dz)local fv=OrbitMapX;local fw=OrbitMapY;local fx=OrbitMapSize;local fy=4;local fz=15;local c6=0;local c7=0;local fA,fB,fC,fD;local function fE(type)local fF,bE,em,fG;if type=="Periapsis"then fF=orbit.periapsis.altitude;bE=orbit.timeToPeriapsis;em=orbit.periapsis.speed;fG=35 else fF=orbit.apoapsis.altitude;bE=orbit.timeToApoapsis;em=orbit.apoapsis.speed;fG=-35 end;dz[#dz+1]=e([[]],c6+fG,c7-5,fv+fx/2-fA+fD,c7-5)dz[#dz+1]=c5(c6,c7,type)c7=c7+fz;local fm,cs=co(fF)dz[#dz+1]=c5(c6,c7,fm..cs)c7=c7+fz;dz[#dz+1]=c5(c6,c7,dd(bE))c7=c7+fz;dz[#dz+1]=c5(c6,c7,ft(em))end;if orbit~=nil and au<0.2 and planet~=nil and orbit.apoapsis~=nil and orbit.periapsis~=nil and orbit.period~=nil and orbit.apoapsis.speed>5 and DisplayOrbit then fw=fw+fy;c6=fv+fx+fv/2+fy;c7=fw+fx/2+5+fy;fA=fx/4;fD=0;dz[#dz+1]=[[]]dz[#dz+1]=e('',fx+fv*2,fx+fw,fy,fy)if orbit.periapsis~=nil and orbit.apoapsis~=nil then fC=(orbit.apoapsis.altitude+orbit.periapsis.altitude+planet.radius*2)/(fA*2)fB=(planet.radius+orbit.periapsis.altitude+(orbit.apoapsis.altitude-orbit.periapsis.altitude)/2)/fC*(1-orbit.eccentricity)fD=fA-orbit.periapsis.altitude/fC-planet.radius/fC;local fH=""if orbit.periapsis.altitude<=0 then fH='redout'end;dz[#dz+1]=e([[]],fH,fv+fx/2+fD+fy,fw+fx/2+fy,fA,fB)dz[#dz+1]=e('',fv+fx/2+fy,fw+fx/2+fy,planet.radius/fC)end;if orbit.apoapsis~=nil and orbit.apoapsis.speed1 then fE("Apoapsis")end;c7=fw+fx/2+5+fy;c6=fv-fv/2+10+fy;if orbit.periapsis~=nil and orbit.periapsis.speed1 then fE("Periapsis")end;dz[#dz+1]=c5(fv+fx/2+fy,planet.name,20+fy,"txtorbbig")if orbit.period~=nil and orbit.periapsis~=nil and orbit.apoapsis~=nil and orbit.apoapsis.speed>1 then local fI=orbit.timeToApoapsis/orbit.period*2*math.pi;local fJ=fA*math.cos(fI)local fK=fB*math.sin(fI)dz[#dz+1]=e('',fv+fx/2+fJ+fD+fy,fw+fx/2+fK+fy)end;dz[#dz+1]=[[]]return dz else return dz end end;local function fL()if radarPanelID~=nil and am==0 then t(radarPanelID)radarPanelID=nil;if perisPanelID~=nil then t(perisPanelID)perisPanelID=nil end else if am==1 then t(radarPanelID)radarPanelID=nil;_autoconf.displayCategoryPanel(radar,radar_size,L_TEXT("ui_lua_widget_periscope", "Periscope"),"periscope")perisPanelID=_autoconf.panels[_autoconf.panels_size]end;placeRadar=true;if radarPanelID==nil and placeRadar then _autoconf.displayCategoryPanel(radar,radar_size,L_TEXT("ui_lua_widget_radar", "Radar"),"radar")radarPanelID=_autoconf.panels[_autoconf.panels_size]placeRadar=false end;am=0 end end;local function fM(dz)local c6=50;local c7=525;local fN={"Alt-1: Increment Interplanetary Helper","Alt-2: Decrement Interplanetary Helper","Alt-3: Toggle Vanilla Widget view"}local fO={"Alt-4: Autopilot in atmo to target","Alt-4-4: Autopilot to +1k over atmosphere and orbit to target","Alt-5: Lock Pitch at current pitch","Alt-6: Altitude hold at current altitude","Alt-6-6: Altitude Hold at 11% atmosphere","Alt-9: Activate Gyroscope"}local fP={"Alt-4 (Alt < 100k): Autopilot to Orbit and land","Alt-4 (Alt > 100k): Autopilot to target","Alt-6: Orbit at current altitude","Alt-6-6: Orbit at 1k over atmosphere","Alt-9: Activate Gyroscope"}local fQ={"CTRL: Toggle Brakes on and off, cancels active AP","LeftAlt: Tap to shift freelook on and off","Shift: Hold while not in freelook to see Buttons","Type /commands or /help in lua chat to see text commands"}if at then bW(fN,fO)table.insert(fN,"---------------------------------------")if VertTakeOff then table.insert(fN,"Hit Alt-6 before exiting Atmosphere during VTO to hold in level flight")end;if aq~=-1 then if antigrav then if bO then table.insert(fN,"Alt-6: AGG is on, will takeoff to AGG Height")else table.insert(fN,"Turn on AGG to takeoff to AGG Height")end end;if VertTakeOffEngine then table.insert(fN,"Alt-6: Begins Vertical Takeoff.")else table.insert(fN,"Alt-4/Alt-6: Autotakeoff if below hoverheight")end else table.insert(fN,"G: Begin BrakeLanding or Land")end else bW(fN,fP)end;if AltitudeHold then table.insert(fN,"Alt-Spacebar/Alt-C will raise/lower target height")end;table.insert(fN,"---------------------------------------")bW(fN,fQ)for i=1,#fN do c7=c7+12;dz[#dz+1]=c5(c6,c7,fN[i],"pdim txttick txtstart")end end;local fR={}function fR.HUDPrologue(dz)if not F then C=PvPR;E=PvPG;D=PvPB else C=SafeR;E=SafeG;D=SafeB end;aA=[[rgb(]]..d(C+0.5)..","..d(E+0.5)..","..d(D+0.5)..[[)]]aB=[[rgb(]]..d(C*0.9+0.5)..","..d(E*0.9+0.5)..","..d(D*0.9+0.5)..[[)]]local fS=aA;local fT=aB;local fU=aA;local fV=aB;if dv()and not brightHud then fS=[[rgb(]]..d(C*0.4+0.5)..","..d(E*0.4+0.5)..","..d(D*0.3+0.5)..[[)]]fT=[[rgb(]]..d(C*0.3+0.5)..","..d(E*0.3+0.5)..","..d(D*0.2+0.5)..[[)]]end;dz[#dz+1]=e([[ + ]],f8,1-c(f5),throtPosX-10,throtPosY+50,throtPosX-15,throtPosY+53,throtPosX-15,throtPosY+47)dz[#dz+1]=c5(throtPosX+10,dN+40,"LIMIT","pbright txtstart")dz[#dz+1]=c5(throtPosX+10,dO+40,f5 .."%","pbright txtstart")end;if at and AtmoSpeedAssist or Reentry then dz[#dz+1]=c5(throtPosX+10,dN-40,"LIMIT: "..bo.." km/h","dim txtstart")elseif not at and Autopilot then dz[#dz+1]=c5(throtPosX+10,dN-40,"LIMIT: "..d(MaxGameVelocity*3.6+0.5).." km/h","dim txtstart")end end;local function f9(dz,fa)local fb=throtPosY-10;local fc=throtPosX+10;dz[#dz+1]=c5(0,0,"","pdim txt txtend")if m()==1 and not RemoteHud then fb=75 end;dz[#dz+1]=c5(fc,fb,d(fa).." km/h","pbright txtbig txtstart")end;local function fd(dz)dz[#dz+1]=c5(dt(1900),du(1070),e("ARCH Hud Version: %.3f",VERSION_NUMBER),"hudver")dz[#dz+1]=[[]]if unit.isMouseControlActivated()==1 then dz[#dz+1]=c5(dt(960),du(550),"Warning: Invalid Control Scheme Detected","warnings")dz[#dz+1]=c5(dt(960),du(600),"Keyboard Scheme must be selected","warnings")dz[#dz+1]=c5(dt(960),du(650),"Set your preferred scheme in Lua Parameters instead","warnings")end;local fe=dt(960)local ff=du(860)local fg=du(880)local fh=du(900)local fi=du(960)local fj=du(200)local fk=du(150)local fl=du(960)if m()==1 and not RemoteHud then ff=du(135)fg=du(155)fh=du(175)fj=du(115)fk=du(95)end;if BrakeIsOn then dz[#dz+1]=c5(fe,ff,"Brake Engaged","warnings")elseif I>0 then dz[#dz+1]=c5(fe,ff,"Auto-Brake Engaged","warnings","opacity:"..I)end;if at and bj and aq==-1 then dz[#dz+1]=c5(fe,fj+50,"** STALL WARNING **","warnings")end;if ay then dz[#dz+1]=c5(fe,fl,"Gyro Enabled","warnings")end;if GearExtended then if R then dz[#dz+1]=c5(fe,fg,"Gear Extended","warn")else dz[#dz+1]=c5(fe,fg,"Landed (G: Takeoff)","warnings")end;local fm,cs=co(a:getTargetGroundAltitude())dz[#dz+1]=c5(fe,fh,"Hover Height: "..fm..cs,"warn")end;if a6 then dz[#dz+1]=c5(fe,fi+20,"ROCKET BOOST ENABLED","warn")end;if antigrav and not ExternalAGG and bO and AntigravTargetAltitude~=nil then if c(av-antigrav.getBaseAltitude())<501 then dz[#dz+1]=c5(fe,fj+15,e("AGG On - Target Altitude: %d Singularity Altitude: %d",d(AntigravTargetAltitude),d(antigrav.getBaseAltitude())),"warn")else dz[#dz+1]=c5(fe,fj+15,e("AGG On - Target Altitude: %d Singluarity Altitude: %d",d(AntigravTargetAltitude),d(antigrav.getBaseAltitude())),"warnings")end elseif Autopilot and AutopilotTargetName~="None"then dz[#dz+1]=c5(fe,fj+20,"Autopilot "..AutopilotStatus,"warn")elseif LockPitch~=nil then dz[#dz+1]=c5(fe,fj+20,e("LockedPitch: %d",d(LockPitch)),"warn")elseif Z then dz[#dz+1]=c5(fe,fj+20,"Follow Mode Engaged","warn")elseif Reentry then dz[#dz+1]=c5(fe,fj+20,"Re-entry in Progress","warn")end;local fn,fo,fp=ba:getPlanetarySystem(0):castIntersections(bM,bI:normalize(),function(fq)if fq.noAtmosphericDensityAltitude>0 then return fq.radius+fq.noAtmosphericDensityAltitude else return fq.radius+fq.surfaceMaxAltitude*1.5 end end)local fr=fo;if fp~=nil and fo~=nil then fr=math.min(fp,fo)end;if AltitudeHold or VertTakeOff then local fm,cs=co(HoldAltitude,2)if VertTakeOff then if bO then fm,cs=co(antigrav.getBaseAltitude(),2)end;dz[#dz+1]=c5(fe,fj,"VTO to "..fm..cs,"warn")elseif AutoTakeoff and not IntoOrbit then dz[#dz+1]=c5(fe,fj,"Takeoff to "..fm..cs,"warn")if BrakeIsOn and not VertTakeOff then dz[#dz+1]=c5(fe,fj+50,"Throttle Up and Disengage Brake For Takeoff","crit")end else dz[#dz+1]=c5(fe,fj,"Altitude Hold: "..fm..cs,"warn")end end;if VertTakeOff and(antigrav~=nil and antigrav)then if au>0.1 then dz[#dz+1]=c5(fe,fj,"Beginning ascent","warn")elseif au<0.09 and au>0.05 then dz[#dz+1]=c5(fe,fj,"Aligning trajectory","warn")elseif au<0.05 then dz[#dz+1]=c5(fe,fj,"Leaving atmosphere","warn")end end;if IntoOrbit then if bq~=nil then dz[#dz+1]=c5(fe,fj,bq,"warn")end end;if BrakeLanding then if StrongBrakes then dz[#dz+1]=c5(fe,fj,"Brake-Landing","warnings")else dz[#dz+1]=c5(fe,fj,"Coast-Landing","warnings")end end;if ProgradeIsOn then dz[#dz+1]=c5(fe,fj,"Prograde Alignment","crit")end;if RetrogradeIsOn then dz[#dz+1]=c5(fe,fj,"Retrograde Alignment","crit")end;if fr~=nil and au==0 then local fm,cs=co(fr)local travelTime=bb.computeTravelTime(bJ,0,fr)local fs="Collision"if fn.noAtmosphericDensityAltitude>0 then fs="Atmosphere"end;dz[#dz+1]=c5(fe,fk,fn.name.." "..fs.." "..dd(travelTime).." In "..fm..cs,"crit")end;if VectorToTarget and not IntoOrbit then dz[#dz+1]=c5(fe,fj+35,VectorStatus,"warn")end;dz[#dz+1]=""return dz end;local function ft(em)return d(y(em*3.6,0)+0.5).." km/h"end;local function fu(dz)local fv=OrbitMapX;local fw=OrbitMapY;local fx=OrbitMapSize;local fy=4;local fz=15;local c6=0;local c7=0;local fA,fB,fC,fD;local function fE(type)local fF,bE,em,fG;if type=="Periapsis"then fF=orbit.periapsis.altitude;bE=orbit.timeToPeriapsis;em=orbit.periapsis.speed;fG=35 else fF=orbit.apoapsis.altitude;bE=orbit.timeToApoapsis;em=orbit.apoapsis.speed;fG=-35 end;dz[#dz+1]=e([[]],c6+fG,c7-5,fv+fx/2-fA+fD,c7-5)dz[#dz+1]=c5(c6,c7,type)c7=c7+fz;local fm,cs=co(fF)dz[#dz+1]=c5(c6,c7,fm..cs)c7=c7+fz;dz[#dz+1]=c5(c6,c7,dd(bE))c7=c7+fz;dz[#dz+1]=c5(c6,c7,ft(em))end;if orbit~=nil and au<0.2 and planet~=nil and orbit.apoapsis~=nil and orbit.periapsis~=nil and orbit.period~=nil and orbit.apoapsis.speed>5 and DisplayOrbit then fw=fw+fy;c6=fv+fx+fv/2+fy;c7=fw+fx/2+5+fy;fA=fx/4;fD=0;dz[#dz+1]=[[]]dz[#dz+1]=e('',fx+fv*2,fx+fw,fy,fy)if orbit.periapsis~=nil and orbit.apoapsis~=nil then fC=(orbit.apoapsis.altitude+orbit.periapsis.altitude+planet.radius*2)/(fA*2)fB=(planet.radius+orbit.periapsis.altitude+(orbit.apoapsis.altitude-orbit.periapsis.altitude)/2)/fC*(1-orbit.eccentricity)fD=fA-orbit.periapsis.altitude/fC-planet.radius/fC;local fH=""if orbit.periapsis.altitude<=0 then fH='redout'end;dz[#dz+1]=e([[]],fH,fv+fx/2+fD+fy,fw+fx/2+fy,fA,fB)dz[#dz+1]=e('',fv+fx/2+fy,fw+fx/2+fy,planet.radius/fC)end;if orbit.apoapsis~=nil and orbit.apoapsis.speed1 then fE("Apoapsis")end;c7=fw+fx/2+5+fy;c6=fv-fv/2+10+fy;if orbit.periapsis~=nil and orbit.periapsis.speed1 then fE("Periapsis")end;dz[#dz+1]=c5(fv+fx/2+fy,planet.name,20+fy,"txtorbbig")if orbit.period~=nil and orbit.periapsis~=nil and orbit.apoapsis~=nil and orbit.apoapsis.speed>1 then local fI=orbit.timeToApoapsis/orbit.period*2*math.pi;local fJ=fA*math.cos(fI)local fK=fB*math.sin(fI)dz[#dz+1]=e('',fv+fx/2+fJ+fD+fy,fw+fx/2+fK+fy)end;dz[#dz+1]=[[]]return dz else return dz end end;local function fL()if radarPanelID~=nil and am==0 then t(radarPanelID)radarPanelID=nil;if perisPanelID~=nil then t(perisPanelID)perisPanelID=nil end else if am==1 then t(radarPanelID)radarPanelID=nil;_autoconf.displayCategoryPanel(radar,radar_size,L_TEXT("ui_lua_widget_periscope", "Periscope"),"periscope")perisPanelID=_autoconf.panels[_autoconf.panels_size]end;placeRadar=true;if radarPanelID==nil and placeRadar then _autoconf.displayCategoryPanel(radar,radar_size,L_TEXT("ui_lua_widget_radar", "Radar"),"radar")radarPanelID=_autoconf.panels[_autoconf.panels_size]placeRadar=false end;am=0 end end;local function fM(dz)local c6=50;local c7=525;local fN={"Alt-1: Increment Interplanetary Helper","Alt-2: Decrement Interplanetary Helper","Alt-3: Toggle Vanilla Widget view"}local fO={"Alt-4: Autopilot in atmo to target","Alt-4-4: Autopilot to +1k over atmosphere and orbit to target","Alt-5: Lock Pitch at current pitch","Alt-6: Altitude hold at current altitude","Alt-6-6: Altitude Hold at 11% atmosphere","Alt-9: Activate Gyroscope"}local fP={"Alt-4 (Alt < 100k): Autopilot to Orbit and land","Alt-4 (Alt > 100k): Autopilot to target","Alt-6: Orbit at current altitude","Alt-6-6: Orbit at 1k over atmosphere","Alt-9: Activate Gyroscope"}local fQ={"CTRL: Toggle Brakes on and off, cancels active AP","LeftAlt: Tap to shift freelook on and off","Shift: Hold while not in freelook to see Buttons","Type /commands or /help in lua chat to see text commands"}if at then bW(fN,fO)table.insert(fN,"---------------------------------------")if VertTakeOff then table.insert(fN,"Hit Alt-6 before exiting Atmosphere during VTO to hold in level flight")end;if aq~=-1 then if antigrav then if bO then table.insert(fN,"Alt-6: AGG is on, will takeoff to AGG Height")else table.insert(fN,"Turn on AGG to takeoff to AGG Height")end end;if VertTakeOffEngine then table.insert(fN,"Alt-6: Begins Vertical Takeoff.")else table.insert(fN,"Alt-4/Alt-6: Autotakeoff if below hoverheight")end else table.insert(fN,"G: Begin BrakeLanding or Land")end else bW(fN,fP)end;if AltitudeHold then table.insert(fN,"Alt-Spacebar/Alt-C will raise/lower target height")end;table.insert(fN,"---------------------------------------")bW(fN,fQ)for i=1,#fN do c7=c7+12;dz[#dz+1]=c5(c6,c7,fN[i],"pdim txttick txtstart")end end;local fR={}function fR.HUDPrologue(dz)if not F then C=PvPR;E=PvPG;D=PvPB else C=SafeR;E=SafeG;D=SafeB end;aA=[[rgb(]]..d(C+0.5)..","..d(E+0.5)..","..d(D+0.5)..[[)]]aB=[[rgb(]]..d(C*0.9+0.5)..","..d(E*0.9+0.5)..","..d(D*0.9+0.5)..[[)]]local fS=aA;local fT=aB;local fU=aA;local fV=aB;if dv()and not brightHud then fS=[[rgb(]]..d(C*0.4+0.5)..","..d(E*0.4+0.5)..","..d(D*0.3+0.5)..[[)]]fT=[[rgb(]]..d(C*0.3+0.5)..","..d(E*0.3+0.5)..","..d(D*0.2+0.5)..[[)]]end;dz[#dz+1]=e([[