diff --git a/ButtonHUD.conf b/ButtonHUD.conf
index 8300d38..73ef71f 100644
--- a/ButtonHUD.conf
+++ b/ButtonHUD.conf
@@ -1,4 +1,4 @@
-name: ButtonsHud - Dimencia and Archaegeo v5.300 (Minified)
+name: ButtonsHud - Dimencia and Archaegeo v5.320 (Minified)
slots:
core:
class: CoreUnit
@@ -182,7 +182,8 @@ handlers:
CalculateBrakeLandingSpeed = false --export: (Default: false) Whether BrakeLanding speed at non-waypoints should be calculated or use the brakeLandingRate user setting. Only set to true for ships with low mass to lift capability.
autoRollRollThreshold = 0 --export: (Default: 0) The minimum amount of roll before autoRoll kicks in and stabilizes (if active)
AtmoSpeedAssist = true --export: (Default: true) Whether or not atmospheric speeds should be limited to a maximum of AtmoSpeedLimit
- Nav=Navigator.new(system,core,unit)script={}BrakeToggleStatus=BrakeToggleDefault;BrakeIsOn=false;RetrogradeIsOn=false;ProgradeIsOn=false;Autopilot=false;TurnBurn=false;AltitudeHold=false;BrakeLanding=false;AutoTakeoff=false;Reentry=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=core.getAltitude()LastStartTime=0;SpaceTarget=false;local a={"userControlScheme","TargetOrbitRadius","apTickRate","freeLookToggle","turnAssist","PrimaryR","PrimaryG","PrimaryB","warmup","DeadZone","circleRad","MouseXSensitivity","MouseYSensitivity","MaxGameVelocity","showHud","autoRollPreference","InvertMouse","pitchSpeedFactor","yawSpeedFactor","rollSpeedFactor","brakeSpeedFactor","brakeFlatFactor","autoRollFactor","turnAssistFactor","torqueFactor","AutoTakeoffAltitude","TargetHoverHeight","AutopilotInterplanetaryThrottle","hideHudOnToggleWidgets","DampingMultiplier","fuelTankHandlingAtmo","ExternalAGG","ShouldCheckDamage","fuelTankHandlingSpace","fuelTankHandlingRocket","RemoteFreeze","hudTickRate","speedChangeLarge","speedChangeSmall","brightHud","brakeLandingRate","MaxPitch","ReentrySpeed","AtmoSpeedLimit","ReentryAltitude","centerX","centerY","SpaceSpeedLimit","AtmoSpeedAssist","vSpdMeterX","vSpdMeterY","altMeterX","altMeterY","fuelX","fuelY","LandingGearGroundHeight","TrajectoryAlignmentStrength","RemoteHud","YawStallAngle","PitchStallAngle","ResolutionX","ResolutionY","UseSatNav","FuelTankOptimization","ContainerOptimization","ExtraLongitudeTags","ExtraLateralTags","ExtraVerticalTags","OrbitMapSize","OrbitMapX","OrbitMapY","DisplayOrbit","CalculateBrakeLandingSpeed"}local b={"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=system.print;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.getElementHitPointsById;local l=core.getElementTypeById;local m=core.getElementMassById;local n=core.getConstructMass;local o=Nav.control.isRemoteControlled;function round(p,q)local r=10^(q or 0)return d(p*r+0.5)/r end;local s=0;local t=0;local u=false;local v=0;local w=false;local x=round(ResolutionX/2,0)local y=round(ResolutionY/2,0)local z=false;local A=true;local B=55;local C=false;local D=1;local E=1;local F=false;local G=0;local H=0;local I=0;local J=0;local K=0;local L=0;local M=0;local N=false;local O=false;local P="empty"local Q=1;local R=5;local S=5;local T=false;local U,V=0;local W,X=0;local Y=false;local Z=false;local a0=nil;local a1=0;local a2=0;local a3=false;local a4=0;local a5=0;local a6=0;local a7=3;local a8=0;local a9=""local aa=""local ab=0;local ac=false;local ad=false;local ae=false;local af=-1;local ag=false;local ah=""local ai=j()>0;local aj=core.getAltitude()local ak=core.getElementIdList()local al=system.getTime()local am=nil;local an=false;local ao=[[rgb(]]..d(PrimaryR+0.5)..","..d(PrimaryG+0.5)..","..d(PrimaryB+0.5)..[[)]]local ap=[[rgb(]]..d(PrimaryR*0.9+0.5)..","..d(PrimaryG*0.9+0.5)..","..d(PrimaryB*0.9+0.5)..[[)]]local aq={}local ar=0;local as=0;local at=""local au=true;local av={}local aw=1;local ax=0.001;local ay=ResolutionX;local az=ResolutionY;local aA=nil;local aB=nil;local aC=nil;local aD=nil;local aE=false;local aF=false;local aG=0;local aH=nil;local aI={}local aJ={}local aK={}local aL=0;local aM=false;local aN={}local aO={}local aP=d(1/apTickRate)*2;local aQ={}local aR={}local aS={}local aT={}local aU=false;local aV=16;local aW=0;local aX=nil;local aY=""local aZ=nil;local a_=nil;local b0=nil;local b1=nil;local b2=nil;local b3=nil;local b4=nil;local b5=nil;local b6=false;local b7=false;local b8=autoRollPreference;local b9=vec3(core.getConstructWorldOrientationForward()):dot(vec3(core.getWorldVelocity()):normalize())local ba=vec3(core.getWorldVelocity())local bb=vec3(ba):len()local bc=math.cos(YawStallAngle*constants.deg2rad)local bd=LandingGearGroundHeight;local be=system.getMouseDeltaX()local bf=system.getMouseDeltaY()local bg=false;local bh=system.getTime()local bi=0;local bj=0;local bk=AtmoSpeedLimit;function round(p,q)local r=10^(q or 0)return math.floor(p*r+0.5)/r end;function LoadVariables()if dbHud_1 then local bl=dbHud_1.hasKey;if not useTheseSettings then for bm,bn in pairs(a)do if bl(bn)then local bo=f(dbHud_1.getStringValue(bn))if bo~=nil then c(bn.." "..dbHud_1.getStringValue(bn))_G[bn]=bo;aE=true end end end end;coroutine.yield()for bm,bn in pairs(b)do if bl(bn)then local bo=f(dbHud_1.getStringValue(bn))if bo~=nil then c(bn.." "..dbHud_1.getStringValue(bn))_G[bn]=bo;aE=true end end end;if useTheseSettings then P="Updated user preferences used. Will be saved when you exit seat.\nToggle off useTheseSettings to use saved values"a7=5 elseif aE then P="Loaded Saved Variables (see Lua Chat Tab for list)"else P="No Saved Variables Found - Stand up / leave remote to save settings"end else P="No databank found, install one anywhere and rerun the autoconfigure to save variables"end;local bp=system.getTime()if LastStartTime+180br then br=bq end;if ContainerOptimization>0 then br=br-br*ContainerOptimization*0.05 end;if FuelTankOptimization>0 then br=br-br*FuelTankOptimization*0.05 end;return br end;function ProcessElements()local bs=fuelX~=0 and fuelY~=0;for bm in pairs(ak)do local type=l(ak[bm])if type=="Landing Gear"then F=true end;if type=="Dynamic Core Unit"then local bt=h(ak[bm])if bt>10000 then aV=128 elseif bt>1000 then aV=64 elseif bt>150 then aV=32 end end;aL=aL+h(ak[bm])if bs and(type=="Atmospheric Fuel Tank"or type=="Space Fuel Tank"or type=="Rocket Fuel Tank")then local bt=h(ak[bm])local bu=m(ak[bm])local bq=0;local bv=system.getTime()if type=="Atmospheric Fuel Tank"then local br=400;local bw=35.03;if bt>10000 then br=51200;bw=5480 elseif bt>1300 then br=6400;bw=988.67 elseif bt>150 then br=1600;bw=182.67 end;bq=bu-bw;if fuelTankHandlingAtmo>0 then br=br+br*fuelTankHandlingAtmo*0.2 end;br=CalculateFuelVolume(bq,br)aI[#aI+1]={ak[bm],core.getElementNameById(ak[bm]),br,bw,bq,bv}end;if type=="Rocket Fuel Tank"then local br=320;local bw=173.42;if bt>65000 then br=40000;bw=25740 elseif bt>6000 then br=5120;bw=4720 elseif bt>700 then br=640;bw=886.72 end;bq=bu-bw;if fuelTankHandlingRocket>0 then br=br+br*fuelTankHandlingRocket*0.1 end;br=CalculateFuelVolume(bq,br)aK[#aK+1]={ak[bm],core.getElementNameById(ak[bm]),br,bw,bq,bv}end;if type=="Space Fuel Tank"then local br=2400;local bw=182.67;if bt>10000 then br=76800;bw=5480 elseif bt>1300 then br=9600;bw=988.67 end;bq=bu-bw;if fuelTankHandlingSpace>0 then br=br+br*fuelTankHandlingSpace*0.2 end;br=CalculateFuelVolume(bq,br)aJ[#aJ+1]={ak[bm],core.getElementNameById(ak[bm]),br,bw,bq,bv}end end end end;function SetupChecks()if gyro~=nil then am=gyro.getState()==1 end;if userControlScheme~="keyboard"then system.lockView(1)else system.lockView(0)end;if radar_1 then if l(radar_1.getId())=="Space Radar"then Y=true else Z=true end end;local bx=j()if door and(bx>0 or bx==0 and aj<10000)then for _,bn in pairs(door)do bn.toggle()end end;if switch then for _,bn in pairs(switch)do bn.toggle()end end;if forcefield and(bx>0 or bx==0 and aj<10000)then for _,bn in pairs(forcefield)do bn.toggle()end end;if antigrav~=nil and not ExternalAGG then if antigrav.getState()==1 then antigrav.show()end end;if o()==1 and RemoteFreeze then system.freeze(1)else system.freeze(0)end;if F then GearExtended=Nav.control.isAnyLandingGearExtended()==1;if GearExtended then Nav.control.extendLandingGears()else Nav.control.retractLandingGears()end end;local by=AboveGroundLevel()if by~=-1 or not ai and vec3(core.getVelocity()):len()<50 then BrakeIsOn=true;if not F then GearExtended=true end else BrakeIsOn=false end;if bd~=nil then Nav.axisCommandManager:setTargetGroundAltitude(bd)if bd==0 and not F then GearExtended=true;BrakeIsOn=true end else bd=Nav:getTargetGroundAltitude()if GearExtended then Nav.axisCommandManager:setTargetGroundAltitude(LandingGearGroundHeight)else Nav.axisCommandManager:setTargetGroundAltitude(TargetHoverHeight)end end;if ai and by~=-1 then b4=core.getMaxKinematicsParametersAlongAxis("ground",core.getConstructOrientationUp())[1]end;userControlScheme=string.lower(userControlScheme)WasInAtmo=ai end;function ConvertResolutionX(bn)if ResolutionX==1920 then return bn else return round(ResolutionX*bn/1920,0)end end;function ConvertResolutionY(bn)if ResolutionY==1080 then return bn else return round(ResolutionY*bn/1080,0)end end;function RefreshLastMaxBrake(bz,bA)if bz==nil then bz=core.g()end;bz=round(bz,5)local bB=j()if bA~=nil and bA or(aH==nil or aH~=bz)then local ba=core.getVelocity()local bC=vec3(ba):len()local bD=f(unit.getData()).maxBrake;if bD~=nil and bD>0 and ai then bD=bD/utils.clamp(bC/100,0.1,1)bD=bD/bB;if bB>0.10 then if LastMaxBrakeInAtmo then LastMaxBrakeInAtmo=(LastMaxBrakeInAtmo+bD)/2 else LastMaxBrakeInAtmo=bD end end end;if bD~=nil and bD>0 then LastMaxBrake=bD end;aH=bz end end;function MakeButton(bE,bF,bG,bH,bI,bJ,bK,bL,bM)local bN={enableName=bE,disableName=bF,width=bG,height=bH,x=bI,y=bJ,toggleVar=bK,toggleFunction=bL,drawCondition=bM,hovered=false}table.insert(av,bN)return bN end;function UpdateAtlasLocationsList()AtlasOrdered={}for bm,bn in pairs(aX[0])do table.insert(AtlasOrdered,{name=bn.name,index=bm})end;local function bO(bP,bQ)return bP.name=0 and b_ or 2*math.pi+b_;bY=math.pi/2-math.acos(bW.z/a8)end;return setmetatable({latitude=math.deg(bY),longitude=math.deg(bZ),altitude=bX,bodyId=bT.bodyId,systemId=bT.planetarySystemId},MapPosition)end;function zeroConvertToWorldCoordinates(c0)local p=' *([+-]?%d+%.?%d*e?[+-]?%d*)'local c1='::pos{'..p..','..p..','..p..','..p..','..p..'}'local c2,c3,bY,bZ,bX=string.match(c0,c1)if c2=="0"and c3=="0"then return vec3(tonumber(bY),tonumber(bZ),tonumber(bX))end;bZ=math.rad(bZ)bY=math.rad(bY)local planet=aX[tonumber(c2)][tonumber(c3)]local c4=math.cos(bY)local c5=vec3(c4*math.cos(bZ),c4*math.sin(bZ),math.sin(bY))return planet.center+(planet.radius+bX)*c5 end;function AddNewLocationByWaypoint(c6,planet,c0)if dbHud_1 then local c7={}local position=zeroConvertToWorldCoordinates(c0)if planet.name=="Space"then c7={position=position,name=c6,atmosphere=false,planetname=planet.name,gravity=planet.gravity}else local bx=false;if planet.hasAtmosphere then bx=true else bx=false end;c7={position=position,name=c6,atmosphere=bx,planetname=planet.name,gravity=planet.gravity}end;SavedLocations[#SavedLocations+1]=c7;table.insert(aX[0],c7)UpdateAtlasLocationsList()else P="Databank must be installed to save locations"end end;function AddNewLocation()if dbHud_1 then local position=vec3(core.getConstructWorldPos())local c8=planet.name..". "..#SavedLocations;if radar_1 then local c9,_=radar_1.getData():match('"constructId":"([0-9]*)","distance":([%d%.]*)')if c9~=nil and c9~=""then c8=c8 .." "..radar_1.getConstructName(c9)end end;local c7={}local bx=false;if planet.hasAtmosphere then bx=true end;c7={position=position,name=c8,atmosphere=bx,planetname=planet.name,gravity=planet.gravity,safe=true}SavedLocations[#SavedLocations+1]=c7;table.insert(aX[0],c7)UpdateAtlasLocationsList()P="Location saved as "..c8 else P="Databank must be installed to save locations"end end;function UpdatePosition(ca)local cb=-1;local c7;for bm,bn in pairs(SavedLocations)do if bn.name and bn.name==CustomTarget.name then cb=bm;break end end;if cb~=-1 then local cc;if ca~=nil then c7={position=SavedLocations[cb].position,name=ca,atmosphere=SavedLocations[cb].atmosphere,planetname=SavedLocations[cb].planetname,gravity=SavedLocations[cb].gravity}else c7={position=vec3(core.getConstructWorldPos()),name=SavedLocations[cb].name,atmosphere=j(),planetname=planet.name,gravity=unit.getClosestPlanetInfluence(),safe=true}end;SavedLocations[cb]=c7;cb=-1;for bm,bn in pairs(aX[0])do if bn.name and bn.name==CustomTarget.name then cb=bm end end;if cb>-1 then aX[0][cb]=c7 end;UpdateAtlasLocationsList()P=CustomTarget.name.." position updated"AutopilotTargetIndex=0;UpdateAutopilotTarget()else P="Name Not Found"end end;function ClearCurrentPosition()local cb=-1;for bm,bn in pairs(aX[0])do if bn.name and bn.name==CustomTarget.name then cb=bm end end;if cb>-1 then table.remove(aX[0],cb)end;cb=-1;for bm,bn in pairs(SavedLocations)do if bn.name and bn.name==CustomTarget.name then P=bn.name.." saved location cleared"cb=bm;break end end;if cb~=-1 then table.remove(SavedLocations,cb)end;DecrementAutopilotTargetIndex()UpdateAtlasLocationsList()end;function DrawDeadZone(cd)cd[#cd+1]=e([[]],DeadZone)end;function ToggleRadarPanel()if radarPanelID~=nil and ab==0 then system.destroyWidgetPanel(radarPanelID)radarPanelID=nil;if perisPanelID~=nil then system.destroyWidgetPanel(perisPanelID)perisPanelID=nil end else if ab==1 then system.destroyWidgetPanel(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;ab=0 end end;function ToggleWidgets()if au then unit.show()core.show()if atmofueltank_size>0 then _autoconf.displayCategoryPanel(atmofueltank,atmofueltank_size,L_TEXT("ui_lua_widget_atmofuel", "Atmo Fuel"),"fuel_container")fuelPanelID=_autoconf.panels[_autoconf.panels_size]end;if spacefueltank_size>0 then _autoconf.displayCategoryPanel(spacefueltank,spacefueltank_size,L_TEXT("ui_lua_widget_spacefuel", "Space Fuel"),"fuel_container")spacefuelPanelID=_autoconf.panels[_autoconf.panels_size]end;if rocketfueltank_size>0 then _autoconf.displayCategoryPanel(rocketfueltank,rocketfueltank_size,L_TEXT("ui_lua_widget_rocketfuel", "Rocket Fuel"),"fuel_container")rocketfuelPanelID=_autoconf.panels[_autoconf.panels_size]end;au=false else unit.hide()core.hide()if fuelPanelID~=nil then system.destroyWidgetPanel(fuelPanelID)fuelPanelID=nil end;if spacefuelPanelID~=nil then system.destroyWidgetPanel(spacefuelPanelID)spacefuelPanelID=nil end;if rocketfuelPanelID~=nil then system.destroyWidgetPanel(rocketfuelPanelID)rocketfuelPanelID=nil end;au=true end end;function SetupInterplanetaryPanel()panelInterplanetary=system.createWidgetPanel("Interplanetary Helper")interplanetaryHeader=system.createWidget(panelInterplanetary,"value")interplanetaryHeaderText=system.createData('{"label": "Target Planet", "value": "N/A", "unit":""}')system.addDataToWidget(interplanetaryHeaderText,interplanetaryHeader)widgetDistance=system.createWidget(panelInterplanetary,"value")widgetDistanceText=system.createData('{"label": "distance", "value": "N/A", "unit":""}')system.addDataToWidget(widgetDistanceText,widgetDistance)widgetTravelTime=system.createWidget(panelInterplanetary,"value")widgetTravelTimeText=system.createData('{"label": "Travel Time", "value": "N/A", "unit":""}')system.addDataToWidget(widgetTravelTimeText,widgetTravelTime)widgetMaxMass=system.createWidget(panelInterplanetary,"value")widgetMaxMassText=system.createData('{"label": "Maximum Mass", "value": "N/A", "unit":""}')system.addDataToWidget(widgetMaxMassText,widgetMaxMass)widgetCurBrakeDistance=system.createWidget(panelInterplanetary,"value")widgetCurBrakeDistanceText=system.createData('{"label": "Cur Brake distance", "value": "N/A", "unit":""}')if not ai then system.addDataToWidget(widgetCurBrakeDistanceText,widgetCurBrakeDistance)end;widgetCurBrakeTime=system.createWidget(panelInterplanetary,"value")widgetCurBrakeTimeText=system.createData('{"label": "Cur Brake Time", "value": "N/A", "unit":""}')if not ai then system.addDataToWidget(widgetCurBrakeTimeText,widgetCurBrakeTime)end;widgetMaxBrakeDistance=system.createWidget(panelInterplanetary,"value")widgetMaxBrakeDistanceText=system.createData('{"label": "Max Brake distance", "value": "N/A", "unit":""}')if not ai then system.addDataToWidget(widgetMaxBrakeDistanceText,widgetMaxBrakeDistance)end;widgetMaxBrakeTime=system.createWidget(panelInterplanetary,"value")widgetMaxBrakeTimeText=system.createData('{"label": "Max Brake Time", "value": "N/A", "unit":""}')if not ai then system.addDataToWidget(widgetMaxBrakeTimeText,widgetMaxBrakeTime)end;widgetTrajectoryAltitude=system.createWidget(panelInterplanetary,"value")widgetTrajectoryAltitudeText=system.createData('{"label": "Projected Altitude", "value": "N/A", "unit":""}')if not ai then system.addDataToWidget(widgetTrajectoryAltitudeText,widgetTrajectoryAltitude)end;widgetTargetOrbit=system.createWidget(panelInterplanetary,"value")widgetTargetOrbitText=system.createData('{"label": "Target Altitude", "value": "N/A", "unit":""}')system.addDataToWidget(widgetTargetOrbitText,widgetTargetOrbit)end;function Contains(ce,cf,bI,bJ,bG,bH)if ce>bI and cebJ and cf-1 then HoldAltitude=aj end;if not ad and Nav.axisCommandManager:getAxisCommandType(0)==0 and not AtmoSpeedAssist then Nav.control.cancelCurrentControlMasterMode()end else AutoTakeoff=true;if bj>-1 then HoldAltitude=aj+AutoTakeoffAltitude end;GearExtended=false;Nav.control.retractLandingGears()BrakeIsOn=true;Nav.axisCommandManager:setTargetGroundAltitude(TargetHoverHeight)end;if ad then HoldAltitude=100000 end else b8=autoRollPreference;AutoTakeoff=false;BrakeLanding=false;Reentry=false;AutoTakeoff=false;VectorToTarget=false end end;function ToggleFollowMode()if o()==1 then N=not N;if N then Autopilot=false;RetrogradeIsOn=false;ProgradeIsOn=false;AltitudeHold=false;Reentry=false;BrakeLanding=false;AutoTakeoff=false;OldGearExtended=GearExtended;GearExtended=false;Nav.control.retractLandingGears()Nav.axisCommandManager:setTargetGroundAltitude(TargetHoverHeight)else BrakeIsOn=true;b8=autoRollPreference;GearExtended=OldGearExtended;if GearExtended then Nav.control.extendLandingGears()Nav.axisCommandManager:setTargetGroundAltitude(LandingGearGroundHeight)end end else P="Follow Mode only works with Remote controller"N=false end end;function ToggleAutopilot()TargetSet=false;if AutopilotTargetIndex>0 and not Autopilot and not VectorToTarget and not ad then UpdateAutopilotTarget()local ck=zeroConvertToMapPosition(a0,AutopilotTargetCoords)ck="::pos{"..ck.systemId..","..ck.bodyId..","..ck.latitude..","..ck.longitude..","..ck.altitude.."}"system.setWaypoint(ck)if CustomTarget~=nil then LockPitch=nil;SpaceTarget=CustomTarget.planetname=="Space"if SpaceTarget then if j()~=0 then ad=true;ToggleAltitudeHold()else Autopilot=true end elseif planet.name==CustomTarget.planetname then StrongBrakes=true;if j()>0 then if not AltitudeHold then if not VectorToTarget then ToggleVectorToTarget(SpaceTarget)end else if not VectorToTarget then ToggleVectorToTarget(SpaceTarget)end end else if aj>100000 or aj==0 then Autopilot=true else ac=true;ProgradeIsOn=true;if AltitudeHold then ToggleAltitudeHold()end end end else RetrogradeIsOn=false;ProgradeIsOn=false;if j()~=0 then ad=true;ToggleAltitudeHold()else Autopilot=true end end elseif j()==0 then Autopilot=true;RetrogradeIsOn=false;ProgradeIsOn=false;AutopilotRealigned=false;N=false;AltitudeHold=false;BrakeLanding=false;Reentry=false;AutoTakeoff=false;z=false;LockPitch=nil;WaypointSet=false else ad=true;ToggleAltitudeHold()end else ad=false;Autopilot=false;AutopilotRealigned=false;VectorToTarget=false;z=false;AutoTakeoff=false;AltitudeHold=false;VectorToTarget=false;HoldAltitude=aj;TargetSet=false end end;function ProgradeToggle()ProgradeIsOn=not ProgradeIsOn;RetrogradeIsOn=false;Autopilot=false;AltitudeHold=false;N=false;BrakeLanding=false;LockPitch=nil;Reentry=false;AutoTakeoff=false end;function RetrogradeToggle()RetrogradeIsOn=not RetrogradeIsOn;ProgradeIsOn=false;Autopilot=false;AltitudeHold=false;N=false;BrakeLanding=false;LockPitch=nil;Reentry=false;AutoTakeoff=false end;function BrakeToggle()BrakeIsOn=not BrakeIsOn;if BrakeLanding then BrakeLanding=false;b8=autoRollPreference end;if BrakeIsOn then AltitudeHold=false;VectorToTarget=false;AutoTakeoff=false;Reentry=false;ProgradeIsOn=false;BrakeLanding=false;AutoLanding=false;AltitudeHold=false;LockPitch=nil;b8=autoRollPreference;ac=false;ae=false end end;function CheckDamage(cd)local cl=0;at=""local cm=aL;local cn=0;local co=0;local cp=0;local cq=0;local cr=""for bm in pairs(ak)do local bt=0;local cs=0;cs=h(ak[bm])bt=k(ak[bm])cn=cn+bt;if bt0 and aq[11]==ak[bm]then for cu in pairs(aq)do core.deleteSticker(aq[cu])end;aq={}end end;cl=d(cn/cm*100)if cl<100 then cd[#cd+1]=[[]]cq=d(cl*2.55)cr=e("rgb(%d,%d,%d)",255-cq,cq,0)if cl<100 then cd[#cd+1]=e([[Elemental Integrity: %i %%]],cr,cl)if cp>0 then cd[#cd+1]=e([[Disabled Modules: %i Damaged Modules: %i]],cr,cp,co)elseif co>0 then cd[#cd+1]=e([[Damaged Modules: %i]],cr,co)end end;cd[#cd+1]=[[<\g>]]end end;function DrawCursorLine(cd)local cv=d(utils.clamp(a8/(ay/4)*255,0,255))cd[#cd+1]=e("",a5,a6,d(PrimaryR+0.5)+cv,d(PrimaryG+0.5)-cv,d(PrimaryB+0.5)-cv)end;function getPitch(cw,cx,bQ)local cy=cw:cross(bQ):normalize_inplace()local cj=math.acos(utils.clamp(cy:dot(-cx),-1,1))*constants.rad2deg;if cy:cross(-cx):dot(bQ)<0 then cj=-cj end;return cj end;local cz=math.atan;local function cA(cB,cC,cD)return cz(cC:cross(cD):dot(cB),cC:dot(cD))end;function clearAll()if ag then ag=false;AutopilotAccelerating=false;AutopilotBraking=false;AutopilotCruising=false;Autopilot=false;AutopilotRealigned=false;AutopilotStatus="Aligning"RetrogradeIsOn=false;ProgradeIsOn=false;AltitudeHold=false;Reentry=false;BrakeLanding=false;BrakeIsOn=false;AutoTakeoff=false;N=false;z=false;ac=false;ad=false;C=false;b8=autoRollPreference;VectorToTarget=false;TurnBurn=false;am=false;LockPitch=nil else ag=true end end;function wipeSaveVariables()if not dbHud_1 then P="No Databank Found, unable to wipe. \nYou must have a Databank attached to ship prior to running the HUD autoconfigure"a7=5 else if aF then for bm,bn in pairs(a)do dbHud_1.setStringValue(bn,g(nil))end;for bm,bn in pairs(b)do if bn~="SavedLocations"then dbHud_1.setStringValue(bn,g(nil))end end;P="Databank wiped. New variables will save after re-enter seat and exit"a7=5;aF=false;aE=false;a3=true else P="Press ALT-7 again to confirm wipe of ALL data"aF=true end end end;function CheckButtons()for _,bn in pairs(av)do if bn.hovered then if not bn.drawCondition or bn.drawCondition()then bn.toggleFunction()end;bn.hovered=false end end end;function SetButtonContains()local bI=a5+ay/2;local bJ=a6+az/2;for _,bn in pairs(av)do bn.hovered=Contains(bI,bJ,bn.x,bn.y,bn.width,bn.height)end end;function DrawButton(cd,cE,hover,bI,bJ,cF,cG,cH,cI,cJ,cK)if type(cJ)=="function"then cJ=cJ()end;if type(cK)=="function"then cK=cK()end;cd[#cd+1]=e(""cd[#cd+1]=e(""if cE then cd[#cd+1]=e("%s",cJ)else cd[#cd+1]=e("%s",cK)end end;function DrawButtons(cd)local cL="rgb(50,50,50)'"local cM="rgb(210,200,200)"local cN=DrawButton;for _,bn in pairs(av)do local bF=bn.disableName;local bE=bn.enableName;if type(bF)=="function"then bF=bF()end;if type(bE)=="function"then bE=bE()end;if not bn.drawCondition or bn.drawCondition()then cN(cd,bn.toggleVar(),bn.hovered,bn.x,bn.y,bn.width,bn.height,cM,cL,bF,bE)end end end;function DrawTank(cd,aU,bI,cO,cP,cQ,cR,cS)local cT=1;local cU=2;local cV=3;local cW=4;local cX=5;local cY=6;local cZ=""local c_=0;local d0=fuelY;local d1=fuelY+10;if o()==1 and not RemoteHud then d0=d0-50;d1=d1-50 end;cd[#cd+1]=[[]]if cP=="ATMO"then cZ="atmofueltank"elseif cP=="SPACE"then cZ="spacefueltank"else cZ="rocketfueltank"end;c_=_G[cZ.."_size"]if#cQ>0 then for i=1,#cQ do local c8=string.sub(cQ[i][cU],1,12)local d2=0;for cu=1,c_ do if cQ[i][cU]==f(unit[cZ.."_"..cu].getData()).name then d2=cu;break end end;if aU or cR[i]==nil or cS[i]==nil then local d3=0;local d4=0;local d5=0;local d6=0;local bv=system.getTime()if d2~=0 then cS[i]=f(unit[cZ.."_"..d2].getData()).percentage;cR[i]=f(unit[cZ.."_"..d2].getData()).timeLeft;if cR[i]=="n/a"then cR[i]=0 end else d5=m(cQ[i][cT])-cQ[i][cW]d3=cQ[i][cV]cS[i]=d(0.5+d5*100/d3)d4=cQ[i][cX]d6=cQ[i][cY]if d4<=d5 then cR[i]=0 else cR[i]=d(0.5+d5/((d4-d5)/(bv-d6)))end;cQ[i][cX]=d5;cQ[i][cY]=bv end end;if c8==cO then c8=e("%s %d",cP,i)end;if d2==0 then c8=c8 .." *"end;local d7;if cR[i]==0 then d7="n/a"else d7=FormatTimeString(cR[i])end;if cS[i]~=nil then local cq=d(cS[i]*2.55)local cr=e("rgb(%d,%d,%d)",255-cq,cq,0)local d8=""if d7~="n/a"and cR[i]<120 or cS[i]<5 then if aU then d8=[[class="red"]]end end;cd[#cd+1]=e([[
+ ForceAlignment = false --export: (Default: false) Whether velocity vector alignment should be forced when in Altitude Hold
+ Nav=Navigator.new(system,core,unit)script={}BrakeToggleStatus=BrakeToggleDefault;BrakeIsOn=false;RetrogradeIsOn=false;ProgradeIsOn=false;Autopilot=false;TurnBurn=false;AltitudeHold=false;BrakeLanding=false;AutoTakeoff=false;Reentry=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=core.getAltitude()LastStartTime=0;SpaceTarget=false;local a={"userControlScheme","TargetOrbitRadius","apTickRate","freeLookToggle","turnAssist","PrimaryR","PrimaryG","PrimaryB","warmup","DeadZone","circleRad","MouseXSensitivity","MouseYSensitivity","MaxGameVelocity","showHud","autoRollPreference","InvertMouse","pitchSpeedFactor","yawSpeedFactor","rollSpeedFactor","brakeSpeedFactor","brakeFlatFactor","autoRollFactor","turnAssistFactor","torqueFactor","AutoTakeoffAltitude","TargetHoverHeight","AutopilotInterplanetaryThrottle","hideHudOnToggleWidgets","DampingMultiplier","fuelTankHandlingAtmo","ExternalAGG","ShouldCheckDamage","fuelTankHandlingSpace","fuelTankHandlingRocket","RemoteFreeze","hudTickRate","speedChangeLarge","speedChangeSmall","brightHud","brakeLandingRate","MaxPitch","ReentrySpeed","AtmoSpeedLimit","ReentryAltitude","centerX","centerY","SpaceSpeedLimit","AtmoSpeedAssist","vSpdMeterX","vSpdMeterY","altMeterX","altMeterY","fuelX","fuelY","LandingGearGroundHeight","TrajectoryAlignmentStrength","RemoteHud","YawStallAngle","PitchStallAngle","ResolutionX","ResolutionY","UseSatNav","FuelTankOptimization","ContainerOptimization","ExtraLongitudeTags","ExtraLateralTags","ExtraVerticalTags","OrbitMapSize","OrbitMapX","OrbitMapY","DisplayOrbit","CalculateBrakeLandingSpeed","ForceAlignment"}local b={"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=system.print;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.getElementHitPointsById;local l=core.getElementTypeById;local m=core.getElementMassById;local n=core.getConstructMass;local o=Nav.control.isRemoteControlled;function round(p,q)local r=10^(q or 0)return d(p*r+0.5)/r end;local s=0;local t=0;local u=false;local v=0;local w=false;local x=round(ResolutionX/2,0)local y=round(ResolutionY/2,0)local z=false;local A=true;local B=55;local C=false;local D=1;local E=1;local F=false;local G=0;local H=0;local I=0;local J=0;local K=0;local L=0;local M=0;local N=false;local O=false;local P="empty"local Q=1;local R=5;local S=5;local T=false;local U,V=0;local W,X=0;local Y=false;local Z=false;local a0=nil;local a1=0;local a2=0;local a3=false;local a4=0;local a5=0;local a6=0;local a7=3;local a8=0;local a9=""local aa=""local ab=0;local ac=false;local ad=false;local ae=false;local af=-1;local ag=false;local ah=""local ai=j()>0;local aj=core.getAltitude()local ak=core.getElementIdList()local al=system.getTime()local am=nil;local an=false;local ao=[[rgb(]]..d(PrimaryR+0.5)..","..d(PrimaryG+0.5)..","..d(PrimaryB+0.5)..[[)]]local ap=[[rgb(]]..d(PrimaryR*0.9+0.5)..","..d(PrimaryG*0.9+0.5)..","..d(PrimaryB*0.9+0.5)..[[)]]local aq={}local ar=0;local as=0;local at=""local au=true;local av={}local aw=1;local ax=0.001;local ay=ResolutionX;local az=ResolutionY;local aA=nil;local aB=nil;local aC=nil;local aD=nil;local aE=false;local aF=false;local aG=0;local aH=nil;local aI={}local aJ={}local aK={}local aL=0;local aM=false;local aN={}local aO={}local aP=d(1/apTickRate)*2;local aQ={}local aR={}local aS={}local aT={}local aU=false;local aV=16;local aW=0;local aX=nil;local aY=""local aZ=nil;local a_=nil;local b0=nil;local b1=nil;local b2=nil;local b3=nil;local b4=nil;local b5=nil;local b6=false;local b7=false;local b8=autoRollPreference;local b9=vec3(core.getConstructWorldOrientationForward()):dot(vec3(core.getWorldVelocity()):normalize())local ba=vec3(core.getWorldVelocity())local bb=vec3(ba):len()local bc=math.cos(YawStallAngle*constants.deg2rad)local bd=LandingGearGroundHeight;local be=system.getMouseDeltaX()local bf=system.getMouseDeltaY()local bg=false;local bh=system.getTime()local bi=0;local bj=0;local bk=AtmoSpeedLimit;function round(p,q)local r=10^(q or 0)return math.floor(p*r+0.5)/r end;function LoadVariables()if dbHud_1 then local bl=dbHud_1.hasKey;if not useTheseSettings then for bm,bn in pairs(a)do if bl(bn)then local bo=f(dbHud_1.getStringValue(bn))if bo~=nil then c(bn.." "..dbHud_1.getStringValue(bn))_G[bn]=bo;aE=true end end end end;coroutine.yield()for bm,bn in pairs(b)do if bl(bn)then local bo=f(dbHud_1.getStringValue(bn))if bo~=nil then c(bn.." "..dbHud_1.getStringValue(bn))_G[bn]=bo;aE=true end end end;if useTheseSettings then P="Updated user preferences used. Will be saved when you exit seat.\nToggle off useTheseSettings to use saved values"a7=5 elseif aE then P="Loaded Saved Variables (see Lua Chat Tab for list)"else P="No Saved Variables Found - Stand up / leave remote to save settings"end else P="No databank found, install one anywhere and rerun the autoconfigure to save variables"end;local bp=system.getTime()if LastStartTime+180br then br=bq end;if ContainerOptimization>0 then br=br-br*ContainerOptimization*0.05 end;if FuelTankOptimization>0 then br=br-br*FuelTankOptimization*0.05 end;return br end;function ProcessElements()local bs=fuelX~=0 and fuelY~=0;for bm in pairs(ak)do local type=l(ak[bm])if type=="Landing Gear"then F=true end;if type=="Dynamic Core Unit"then local bt=h(ak[bm])if bt>10000 then aV=128 elseif bt>1000 then aV=64 elseif bt>150 then aV=32 end end;aL=aL+h(ak[bm])if bs and(type=="Atmospheric Fuel Tank"or type=="Space Fuel Tank"or type=="Rocket Fuel Tank")then local bt=h(ak[bm])local bu=m(ak[bm])local bq=0;local bv=system.getTime()if type=="Atmospheric Fuel Tank"then local br=400;local bw=35.03;if bt>10000 then br=51200;bw=5480 elseif bt>1300 then br=6400;bw=988.67 elseif bt>150 then br=1600;bw=182.67 end;bq=bu-bw;if fuelTankHandlingAtmo>0 then br=br+br*fuelTankHandlingAtmo*0.2 end;br=CalculateFuelVolume(bq,br)aI[#aI+1]={ak[bm],core.getElementNameById(ak[bm]),br,bw,bq,bv}end;if type=="Rocket Fuel Tank"then local br=320;local bw=173.42;if bt>65000 then br=40000;bw=25740 elseif bt>6000 then br=5120;bw=4720 elseif bt>700 then br=640;bw=886.72 end;bq=bu-bw;if fuelTankHandlingRocket>0 then br=br+br*fuelTankHandlingRocket*0.1 end;br=CalculateFuelVolume(bq,br)aK[#aK+1]={ak[bm],core.getElementNameById(ak[bm]),br,bw,bq,bv}end;if type=="Space Fuel Tank"then local br=2400;local bw=182.67;if bt>10000 then br=76800;bw=5480 elseif bt>1300 then br=9600;bw=988.67 end;bq=bu-bw;if fuelTankHandlingSpace>0 then br=br+br*fuelTankHandlingSpace*0.2 end;br=CalculateFuelVolume(bq,br)aJ[#aJ+1]={ak[bm],core.getElementNameById(ak[bm]),br,bw,bq,bv}end end end end;function SetupChecks()if gyro~=nil then am=gyro.getState()==1 end;if userControlScheme~="keyboard"then system.lockView(1)else system.lockView(0)end;if radar_1 then if l(radar_1.getId())=="Space Radar"then Y=true else Z=true end end;local bx=j()if door and(bx>0 or bx==0 and aj<10000)then for _,bn in pairs(door)do bn.toggle()end end;if switch then for _,bn in pairs(switch)do bn.toggle()end end;if forcefield and(bx>0 or bx==0 and aj<10000)then for _,bn in pairs(forcefield)do bn.toggle()end end;if antigrav~=nil and not ExternalAGG then if antigrav.getState()==1 then antigrav.show()end end;if o()==1 and RemoteFreeze then system.freeze(1)else system.freeze(0)end;if F then GearExtended=Nav.control.isAnyLandingGearExtended()==1;if GearExtended then Nav.control.extendLandingGears()else Nav.control.retractLandingGears()end end;local by=AboveGroundLevel()if by~=-1 or not ai and vec3(core.getVelocity()):len()<50 then BrakeIsOn=true;if not F then GearExtended=true end else BrakeIsOn=false end;if bd~=nil then Nav.axisCommandManager:setTargetGroundAltitude(bd)if bd==0 and not F then GearExtended=true;BrakeIsOn=true end else bd=Nav:getTargetGroundAltitude()if GearExtended then Nav.axisCommandManager:setTargetGroundAltitude(LandingGearGroundHeight)else Nav.axisCommandManager:setTargetGroundAltitude(TargetHoverHeight)end end;if ai and by~=-1 then b4=core.getMaxKinematicsParametersAlongAxis("ground",core.getConstructOrientationUp())[1]end;userControlScheme=string.lower(userControlScheme)WasInAtmo=ai end;function ConvertResolutionX(bn)if ResolutionX==1920 then return bn else return round(ResolutionX*bn/1920,0)end end;function ConvertResolutionY(bn)if ResolutionY==1080 then return bn else return round(ResolutionY*bn/1080,0)end end;function RefreshLastMaxBrake(bz,bA)if bz==nil then bz=core.g()end;bz=round(bz,5)local bB=j()if bA~=nil and bA or(aH==nil or aH~=bz)then local ba=core.getVelocity()local bC=vec3(ba):len()local bD=f(unit.getData()).maxBrake;if bD~=nil and bD>0 and ai then bD=bD/utils.clamp(bC/100,0.1,1)bD=bD/bB;if bB>0.10 then if LastMaxBrakeInAtmo then LastMaxBrakeInAtmo=(LastMaxBrakeInAtmo+bD)/2 else LastMaxBrakeInAtmo=bD end end end;if bD~=nil and bD>0 then LastMaxBrake=bD end;aH=bz end end;function MakeButton(bE,bF,bG,bH,bI,bJ,bK,bL,bM)local bN={enableName=bE,disableName=bF,width=bG,height=bH,x=bI,y=bJ,toggleVar=bK,toggleFunction=bL,drawCondition=bM,hovered=false}table.insert(av,bN)return bN end;function UpdateAtlasLocationsList()AtlasOrdered={}for bm,bn in pairs(aX[0])do table.insert(AtlasOrdered,{name=bn.name,index=bm})end;local function bO(bP,bQ)return bP.name=0 and b_ or 2*math.pi+b_;bY=math.pi/2-math.acos(bW.z/a8)end;return setmetatable({latitude=math.deg(bY),longitude=math.deg(bZ),altitude=bX,bodyId=bT.bodyId,systemId=bT.planetarySystemId},MapPosition)end;function zeroConvertToWorldCoordinates(c0)local p=' *([+-]?%d+%.?%d*e?[+-]?%d*)'local c1='::pos{'..p..','..p..','..p..','..p..','..p..'}'local c2,c3,bY,bZ,bX=string.match(c0,c1)if c2=="0"and c3=="0"then return vec3(tonumber(bY),tonumber(bZ),tonumber(bX))end;bZ=math.rad(bZ)bY=math.rad(bY)local planet=aX[tonumber(c2)][tonumber(c3)]local c4=math.cos(bY)local c5=vec3(c4*math.cos(bZ),c4*math.sin(bZ),math.sin(bY))return planet.center+(planet.radius+bX)*c5 end;function AddNewLocationByWaypoint(c6,planet,c0)if dbHud_1 then local c7={}local position=zeroConvertToWorldCoordinates(c0)if planet.name=="Space"then c7={position=position,name=c6,atmosphere=false,planetname=planet.name,gravity=planet.gravity}else local bx=false;if planet.hasAtmosphere then bx=true else bx=false end;c7={position=position,name=c6,atmosphere=bx,planetname=planet.name,gravity=planet.gravity}end;SavedLocations[#SavedLocations+1]=c7;table.insert(aX[0],c7)UpdateAtlasLocationsList()else P="Databank must be installed to save locations"end end;function AddNewLocation()if dbHud_1 then local position=vec3(core.getConstructWorldPos())local c8=planet.name..". "..#SavedLocations;if radar_1 then local c9,_=radar_1.getData():match('"constructId":"([0-9]*)","distance":([%d%.]*)')if c9~=nil and c9~=""then c8=c8 .." "..radar_1.getConstructName(c9)end end;local c7={}local bx=false;if planet.hasAtmosphere then bx=true end;c7={position=position,name=c8,atmosphere=bx,planetname=planet.name,gravity=planet.gravity,safe=true}SavedLocations[#SavedLocations+1]=c7;table.insert(aX[0],c7)UpdateAtlasLocationsList()P="Location saved as "..c8 else P="Databank must be installed to save locations"end end;function UpdatePosition(ca)local cb=-1;local c7;for bm,bn in pairs(SavedLocations)do if bn.name and bn.name==CustomTarget.name then cb=bm;break end end;if cb~=-1 then local cc;if ca~=nil then c7={position=SavedLocations[cb].position,name=ca,atmosphere=SavedLocations[cb].atmosphere,planetname=SavedLocations[cb].planetname,gravity=SavedLocations[cb].gravity}else c7={position=vec3(core.getConstructWorldPos()),name=SavedLocations[cb].name,atmosphere=j(),planetname=planet.name,gravity=unit.getClosestPlanetInfluence(),safe=true}end;SavedLocations[cb]=c7;cb=-1;for bm,bn in pairs(aX[0])do if bn.name and bn.name==CustomTarget.name then cb=bm end end;if cb>-1 then aX[0][cb]=c7 end;UpdateAtlasLocationsList()P=CustomTarget.name.." position updated"AutopilotTargetIndex=0;UpdateAutopilotTarget()else P="Name Not Found"end end;function ClearCurrentPosition()local cb=-1;for bm,bn in pairs(aX[0])do if bn.name and bn.name==CustomTarget.name then cb=bm end end;if cb>-1 then table.remove(aX[0],cb)end;cb=-1;for bm,bn in pairs(SavedLocations)do if bn.name and bn.name==CustomTarget.name then P=bn.name.." saved location cleared"cb=bm;break end end;if cb~=-1 then table.remove(SavedLocations,cb)end;DecrementAutopilotTargetIndex()UpdateAtlasLocationsList()end;function DrawDeadZone(cd)cd[#cd+1]=e([[]],DeadZone)end;function ToggleRadarPanel()if radarPanelID~=nil and ab==0 then system.destroyWidgetPanel(radarPanelID)radarPanelID=nil;if perisPanelID~=nil then system.destroyWidgetPanel(perisPanelID)perisPanelID=nil end else if ab==1 then system.destroyWidgetPanel(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;ab=0 end end;function ToggleWidgets()if au then unit.show()core.show()if atmofueltank_size>0 then _autoconf.displayCategoryPanel(atmofueltank,atmofueltank_size,L_TEXT("ui_lua_widget_atmofuel", "Atmo Fuel"),"fuel_container")fuelPanelID=_autoconf.panels[_autoconf.panels_size]end;if spacefueltank_size>0 then _autoconf.displayCategoryPanel(spacefueltank,spacefueltank_size,L_TEXT("ui_lua_widget_spacefuel", "Space Fuel"),"fuel_container")spacefuelPanelID=_autoconf.panels[_autoconf.panels_size]end;if rocketfueltank_size>0 then _autoconf.displayCategoryPanel(rocketfueltank,rocketfueltank_size,L_TEXT("ui_lua_widget_rocketfuel", "Rocket Fuel"),"fuel_container")rocketfuelPanelID=_autoconf.panels[_autoconf.panels_size]end;au=false else unit.hide()core.hide()if fuelPanelID~=nil then system.destroyWidgetPanel(fuelPanelID)fuelPanelID=nil end;if spacefuelPanelID~=nil then system.destroyWidgetPanel(spacefuelPanelID)spacefuelPanelID=nil end;if rocketfuelPanelID~=nil then system.destroyWidgetPanel(rocketfuelPanelID)rocketfuelPanelID=nil end;au=true end end;function SetupInterplanetaryPanel()panelInterplanetary=system.createWidgetPanel("Interplanetary Helper")interplanetaryHeader=system.createWidget(panelInterplanetary,"value")interplanetaryHeaderText=system.createData('{"label": "Target Planet", "value": "N/A", "unit":""}')system.addDataToWidget(interplanetaryHeaderText,interplanetaryHeader)widgetDistance=system.createWidget(panelInterplanetary,"value")widgetDistanceText=system.createData('{"label": "distance", "value": "N/A", "unit":""}')system.addDataToWidget(widgetDistanceText,widgetDistance)widgetTravelTime=system.createWidget(panelInterplanetary,"value")widgetTravelTimeText=system.createData('{"label": "Travel Time", "value": "N/A", "unit":""}')system.addDataToWidget(widgetTravelTimeText,widgetTravelTime)widgetMaxMass=system.createWidget(panelInterplanetary,"value")widgetMaxMassText=system.createData('{"label": "Maximum Mass", "value": "N/A", "unit":""}')system.addDataToWidget(widgetMaxMassText,widgetMaxMass)widgetCurBrakeDistance=system.createWidget(panelInterplanetary,"value")widgetCurBrakeDistanceText=system.createData('{"label": "Cur Brake distance", "value": "N/A", "unit":""}')if not ai then system.addDataToWidget(widgetCurBrakeDistanceText,widgetCurBrakeDistance)end;widgetCurBrakeTime=system.createWidget(panelInterplanetary,"value")widgetCurBrakeTimeText=system.createData('{"label": "Cur Brake Time", "value": "N/A", "unit":""}')if not ai then system.addDataToWidget(widgetCurBrakeTimeText,widgetCurBrakeTime)end;widgetMaxBrakeDistance=system.createWidget(panelInterplanetary,"value")widgetMaxBrakeDistanceText=system.createData('{"label": "Max Brake distance", "value": "N/A", "unit":""}')if not ai then system.addDataToWidget(widgetMaxBrakeDistanceText,widgetMaxBrakeDistance)end;widgetMaxBrakeTime=system.createWidget(panelInterplanetary,"value")widgetMaxBrakeTimeText=system.createData('{"label": "Max Brake Time", "value": "N/A", "unit":""}')if not ai then system.addDataToWidget(widgetMaxBrakeTimeText,widgetMaxBrakeTime)end;widgetTrajectoryAltitude=system.createWidget(panelInterplanetary,"value")widgetTrajectoryAltitudeText=system.createData('{"label": "Projected Altitude", "value": "N/A", "unit":""}')if not ai then system.addDataToWidget(widgetTrajectoryAltitudeText,widgetTrajectoryAltitude)end;widgetTargetOrbit=system.createWidget(panelInterplanetary,"value")widgetTargetOrbitText=system.createData('{"label": "Target Altitude", "value": "N/A", "unit":""}')system.addDataToWidget(widgetTargetOrbitText,widgetTargetOrbit)end;function Contains(ce,cf,bI,bJ,bG,bH)if ce>bI and cebJ and cf-1 then HoldAltitude=aj end;if not ad and Nav.axisCommandManager:getAxisCommandType(0)==0 and not AtmoSpeedAssist then Nav.control.cancelCurrentControlMasterMode()end else AutoTakeoff=true;if bj>-1 then HoldAltitude=aj+AutoTakeoffAltitude end;GearExtended=false;Nav.control.retractLandingGears()BrakeIsOn=true;Nav.axisCommandManager:setTargetGroundAltitude(TargetHoverHeight)end;if ad then HoldAltitude=100000 end else b8=autoRollPreference;AutoTakeoff=false;BrakeLanding=false;Reentry=false;AutoTakeoff=false;VectorToTarget=false end end;function ToggleFollowMode()if o()==1 then N=not N;if N then Autopilot=false;RetrogradeIsOn=false;ProgradeIsOn=false;AltitudeHold=false;Reentry=false;BrakeLanding=false;AutoTakeoff=false;OldGearExtended=GearExtended;GearExtended=false;Nav.control.retractLandingGears()Nav.axisCommandManager:setTargetGroundAltitude(TargetHoverHeight)else BrakeIsOn=true;b8=autoRollPreference;GearExtended=OldGearExtended;if GearExtended then Nav.control.extendLandingGears()Nav.axisCommandManager:setTargetGroundAltitude(LandingGearGroundHeight)end end else P="Follow Mode only works with Remote controller"N=false end end;function ToggleAutopilot()TargetSet=false;if AutopilotTargetIndex>0 and not Autopilot and not VectorToTarget and not ad then UpdateAutopilotTarget()local ck=zeroConvertToMapPosition(a0,AutopilotTargetCoords)ck="::pos{"..ck.systemId..","..ck.bodyId..","..ck.latitude..","..ck.longitude..","..ck.altitude.."}"system.setWaypoint(ck)if CustomTarget~=nil then LockPitch=nil;SpaceTarget=CustomTarget.planetname=="Space"if SpaceTarget then if j()~=0 then ad=true;ToggleAltitudeHold()else Autopilot=true end elseif planet.name==CustomTarget.planetname then StrongBrakes=true;if j()>0 then if not AltitudeHold then if not VectorToTarget then ToggleVectorToTarget(SpaceTarget)end else if not VectorToTarget then ToggleVectorToTarget(SpaceTarget)end end else if aj>100000 or aj==0 then Autopilot=true else ac=true;ProgradeIsOn=true;if AltitudeHold then ToggleAltitudeHold()end end end else RetrogradeIsOn=false;ProgradeIsOn=false;if j()~=0 then ad=true;ToggleAltitudeHold()else Autopilot=true end end elseif j()==0 then Autopilot=true;RetrogradeIsOn=false;ProgradeIsOn=false;AutopilotRealigned=false;N=false;AltitudeHold=false;BrakeLanding=false;Reentry=false;AutoTakeoff=false;z=false;LockPitch=nil;WaypointSet=false else ad=true;ToggleAltitudeHold()end else ad=false;Autopilot=false;AutopilotRealigned=false;VectorToTarget=false;z=false;AutoTakeoff=false;AltitudeHold=false;VectorToTarget=false;HoldAltitude=aj;TargetSet=false end end;function ProgradeToggle()ProgradeIsOn=not ProgradeIsOn;RetrogradeIsOn=false;Autopilot=false;AltitudeHold=false;N=false;BrakeLanding=false;LockPitch=nil;Reentry=false;AutoTakeoff=false end;function RetrogradeToggle()RetrogradeIsOn=not RetrogradeIsOn;ProgradeIsOn=false;Autopilot=false;AltitudeHold=false;N=false;BrakeLanding=false;LockPitch=nil;Reentry=false;AutoTakeoff=false end;function BrakeToggle()BrakeIsOn=not BrakeIsOn;if BrakeLanding then BrakeLanding=false;b8=autoRollPreference end;if BrakeIsOn then AltitudeHold=false;VectorToTarget=false;AutoTakeoff=false;Reentry=false;ProgradeIsOn=false;BrakeLanding=false;AutoLanding=false;AltitudeHold=false;LockPitch=nil;b8=autoRollPreference;ac=false;ae=false end end;function CheckDamage(cd)local cl=0;at=""local cm=aL;local cn=0;local co=0;local cp=0;local cq=0;local cr=""for bm in pairs(ak)do local bt=0;local cs=0;cs=h(ak[bm])bt=k(ak[bm])cn=cn+bt;if bt0 and aq[11]==ak[bm]then for cu in pairs(aq)do core.deleteSticker(aq[cu])end;aq={}end end;cl=d(cn/cm*100)if cl<100 then cd[#cd+1]=[[]]cq=d(cl*2.55)cr=e("rgb(%d,%d,%d)",255-cq,cq,0)if cl<100 then cd[#cd+1]=e([[Elemental Integrity: %i %%]],cr,cl)if cp>0 then cd[#cd+1]=e([[Disabled Modules: %i Damaged Modules: %i]],cr,cp,co)elseif co>0 then cd[#cd+1]=e([[Damaged Modules: %i]],cr,co)end end;cd[#cd+1]=[[<\g>]]end end;function DrawCursorLine(cd)local cv=d(utils.clamp(a8/(ay/4)*255,0,255))cd[#cd+1]=e("",a5,a6,d(PrimaryR+0.5)+cv,d(PrimaryG+0.5)-cv,d(PrimaryB+0.5)-cv)end;function getPitch(cw,cx,bQ)local cy=cw:cross(bQ):normalize_inplace()local cj=math.acos(utils.clamp(cy:dot(-cx),-1,1))*constants.rad2deg;if cy:cross(-cx):dot(bQ)<0 then cj=-cj end;return cj end;local cz=math.atan;local function cA(cB,cC,cD)cC=cC:project_on_plane(cB)cD=cD:project_on_plane(cB)return cz(cC:cross(cD):dot(cB),cC:dot(cD))end;function clearAll()if ag then ag=false;AutopilotAccelerating=false;AutopilotBraking=false;AutopilotCruising=false;Autopilot=false;AutopilotRealigned=false;AutopilotStatus="Aligning"RetrogradeIsOn=false;ProgradeIsOn=false;AltitudeHold=false;Reentry=false;BrakeLanding=false;BrakeIsOn=false;AutoTakeoff=false;N=false;z=false;ac=false;ad=false;C=false;b8=autoRollPreference;VectorToTarget=false;TurnBurn=false;am=false;LockPitch=nil else ag=true end end;function wipeSaveVariables()if not dbHud_1 then P="No Databank Found, unable to wipe. \nYou must have a Databank attached to ship prior to running the HUD autoconfigure"a7=5 else if aF then for bm,bn in pairs(a)do dbHud_1.setStringValue(bn,g(nil))end;for bm,bn in pairs(b)do if bn~="SavedLocations"then dbHud_1.setStringValue(bn,g(nil))end end;P="Databank wiped. New variables will save after re-enter seat and exit"a7=5;aF=false;aE=false;a3=true else P="Press ALT-7 again to confirm wipe of ALL data"aF=true end end end;function CheckButtons()for _,bn in pairs(av)do if bn.hovered then if not bn.drawCondition or bn.drawCondition()then bn.toggleFunction()end;bn.hovered=false end end end;function SetButtonContains()local bI=a5+ay/2;local bJ=a6+az/2;for _,bn in pairs(av)do bn.hovered=Contains(bI,bJ,bn.x,bn.y,bn.width,bn.height)end end;function DrawButton(cd,cE,hover,bI,bJ,cF,cG,cH,cI,cJ,cK)if type(cJ)=="function"then cJ=cJ()end;if type(cK)=="function"then cK=cK()end;cd[#cd+1]=e(""cd[#cd+1]=e(""if cE then cd[#cd+1]=e("%s",cJ)else cd[#cd+1]=e("%s",cK)end end;function DrawButtons(cd)local cL="rgb(50,50,50)'"local cM="rgb(210,200,200)"local cN=DrawButton;for _,bn in pairs(av)do local bF=bn.disableName;local bE=bn.enableName;if type(bF)=="function"then bF=bF()end;if type(bE)=="function"then bE=bE()end;if not bn.drawCondition or bn.drawCondition()then cN(cd,bn.toggleVar(),bn.hovered,bn.x,bn.y,bn.width,bn.height,cM,cL,bF,bE)end end end;function DrawTank(cd,aU,bI,cO,cP,cQ,cR,cS)local cT=1;local cU=2;local cV=3;local cW=4;local cX=5;local cY=6;local cZ=""local c_=0;local d0=fuelY;local d1=fuelY+10;if o()==1 and not RemoteHud then d0=d0-50;d1=d1-50 end;cd[#cd+1]=[[]]if cP=="ATMO"then cZ="atmofueltank"elseif cP=="SPACE"then cZ="spacefueltank"else cZ="rocketfueltank"end;c_=_G[cZ.."_size"]if#cQ>0 then for i=1,#cQ do local c8=string.sub(cQ[i][cU],1,12)local d2=0;for cu=1,c_ do if cQ[i][cU]==f(unit[cZ.."_"..cu].getData()).name then d2=cu;break end end;if aU or cR[i]==nil or cS[i]==nil then local d3=0;local d4=0;local d5=0;local d6=0;local bv=system.getTime()if d2~=0 then cS[i]=f(unit[cZ.."_"..d2].getData()).percentage;cR[i]=f(unit[cZ.."_"..d2].getData()).timeLeft;if cR[i]=="n/a"then cR[i]=0 end else d5=m(cQ[i][cT])-cQ[i][cW]d3=cQ[i][cV]cS[i]=d(0.5+d5*100/d3)d4=cQ[i][cX]d6=cQ[i][cY]if d4<=d5 then cR[i]=0 else cR[i]=d(0.5+d5/((d4-d5)/(bv-d6)))end;cQ[i][cX]=d5;cQ[i][cY]=bv end end;if c8==cO then c8=e("%s %d",cP,i)end;if d2==0 then c8=c8 .." *"end;local d7;if cR[i]==0 then d7="n/a"else d7=FormatTimeString(cR[i])end;if cS[i]~=nil then local cq=d(cS[i]*2.55)local cr=e("rgb(%d,%d,%d)",255-cq,cq,0)local d8=""if d7~="n/a"and cR[i]<120 or cS[i]<5 then if aU then d8=[[class="red"]]end end;cd[#cd+1]=e([[
%s%d%% %s
]],bI,d0,d8,c8,bI,d1,cr,cS[i],d7)d0=d0+30;d1=d1+30 end end end;cd[#cd+1]=""end;function HideInterplanetaryPanel()system.destroyWidgetPanel(panelInterplanetary)panelInterplanetary=nil end;function getRelativePitch(ba)ba=vec3(ba)local cj=-math.deg(math.atan(ba.y,ba.z))+180;cj=cj-90;if cj<0 then cj=360+cj end;if cj>180 then cj=-180+cj-180 end;return-cj end;function getRelativeYaw(ba)ba=vec3(ba)local d9=math.deg(math.atan(ba.y,ba.x))-90;if d9<-180 then d9=360+d9 end;return d9 end;function AlignToWorldVector(da,db,dc)if not ai or not bg or af~=-1 or bb0 and CustomTarget~=nil end)MakeButton("Clear Position","Clear Position",200,dp.height,dp.x-200-30,dp.y,function()return true end,ClearCurrentPosition,function()return AutopilotTargetIndex>0 and CustomTarget~=nil end)dl=60;dm=300;local bI=10;local bJ=az/2-300;MakeButton("Enable Turn and Burn","Disable Turn and Burn",dm,dl,bI,bJ,function()return TurnBurn end,ToggleTurnBurn)MakeButton("Engage Altitude Hold","Disable Altitude Hold",dm,dl,bI+dm+20,bJ,function()return AltitudeHold end,ToggleAltitudeHold)bJ=bJ+dl+20;MakeButton("Engage Autoland","Disable Autoland",dm,dl,bI,bJ,function()return AutoLanding end,ToggleAutoLanding)MakeButton("Engage Auto Takeoff","Disable Auto Takeoff",dm,dl,bI+dm+20,bJ,function()return AutoTakeoff end,ToggleAutoTakeoff)bJ=bJ+dl+20;MakeButton("Show Orbit Display","Hide Orbit Display",dm,dl,bI,bJ,function()return DisplayOrbit end,function()DisplayOrbit=not DisplayOrbit;if DisplayOrbit then P="Orbit Display Enabled"else P="Orbit Display Disabled"end end)bJ=bJ+dl+20;MakeButton("Glide Re-Entry","Cancel Glide Re-Entry",dm,dl,bI,bJ,function()return Reentry end,function()ac=true;ProgradeToggle()end,function()return aj>ReentryAltitude end)MakeButton("Parachute Re-Entry","Cancel Parachute Re-Entry",dm,dl,bI+dm+20,bJ,function()return Reentry end,BeginReentry,function()return aj>ReentryAltitude end)bJ=bJ+dl+20;MakeButton("Engage Follow Mode","Disable Follow Mode",dm,dl,bI,bJ,function()return N end,ToggleFollowMode,function()return o()==1 end)MakeButton("Enable Repair Arrows","Disable Repair Arrows",dm,dl,bI+dm+20,bJ,function()return aM end,function()aM=not aM;if aM then P="Repair Arrows Enabled"else P="Repair Arrows Diabled"end end,function()return o()==1 end)bJ=bJ+dl+20;if not ExternalAGG then MakeButton("Enable AGG","Disable AGG",dm,dl,bI,bJ,function()return antigrav.getState()==1 end,ToggleAntigrav,function()return antigrav~=nil end)end;bJ=bJ+dl+20;MakeButton(function()return e("Toggle Control Scheme - Current: %s",userControlScheme)end,function()return e("Control Scheme: %s",userControlScheme)end,dm*2,dl,bI,bJ,function()return false end,function()if userControlScheme=="keyboard"then userControlScheme="mouse"elseif userControlScheme=="mouse"then userControlScheme="virtual joystick"else userControlScheme="keyboard"end end)end;function GetFlightStyle()local dq=Nav.axisCommandManager:getAxisCommandType(0)local dr="TRAVEL"if dq==1 then dr="CRUISE"end;if Autopilot then dr="AUTOPILOT"end;return dr end;function UpdateHud(cd)local bX=aj;local ba=core.getVelocity()local bC=vec3(ba):len()local ci=vec3(core.getWorldVertical())local cg=vec3(core.getConstructWorldOrientationForward())local ch=vec3(core.getConstructWorldOrientationRight())local ds=vec3(core.getConstructWorldOrientationUp())local dt=getRoll(ci,cg,ch)local du=dt/180*math.pi;local dv=math.cos(du)local dw=math.sin(du)local cj=getPitch(ci,cg,ch*dv+ds*dw)local dx=dt;local dy=cj;local dz=j()local dA=d(unit.getThrottle())local dB=bC*3.6;local dC=unit.getAxisCommandValue(0)if AtmoSpeedAssist and Nav.axisCommandManager:getAxisCommandType(0)==axisCommandType.byThrottle then dC=s;dA=s*100 end;local dr=GetFlightStyle()local dD="ROLL"local dE=unit.getClosestPlanetInfluence()>0;if dA==nil then dA=0 end;if not dE then if bC>5 then cj=getRelativePitch(ba)dt=getRelativeYaw(ba)else cj=0;dt=0 end;dD="YAW"end;cd[#cd+1]=aa;cd[#cd+1]=at;cd[#cd+1]=a9;if aW%aP==0 then aU=true end;if fuelX~=0 and fuelY~=0 then DrawTank(cd,aU,fuelX,"Atmospheric ","ATMO",aI,aS,aT)DrawTank(cd,aU,fuelX+100,"Space fuel t","SPACE",aJ,aQ,aR)DrawTank(cd,aU,fuelX+200,"Rocket fuel ","ROCKET",aK,aN,aO)end;if aU then aU=false;aW=0 end;aW=aW+1;DrawVerticalSpeed(cd,bX)if o()==0 or RemoteHud then if not IsInFreeLook()or brightHud then if dE then DrawRollLines(cd,centerX,centerY,dx,dD,dE)DrawArtificialHorizon(cd,dy,dx,centerX,centerY,dE,d(getRelativeYaw(ba)),bC)else DrawRollLines(cd,centerX,centerY,dt,dD,dE)DrawArtificialHorizon(cd,cj,dt,centerX,centerY,dE,d(dt),bC)end;DrawAltitudeDisplay(cd,bX,dE)DrawPrograde(cd,ba,bC,centerX,centerY)end end;DrawThrottle(cd,dr,dA,dC)DrawSpeed(cd,dB)DrawWarnings(cd)DisplayOrbitScreen(cd)if screen_2 then local c0=vec3(core.getConstructWorldPos())local bI=960+c0.x/aZ;local bJ=450+c0.y/a_;screen_2.moveContent(b0,(bI-80)/19.2,(bJ-80)/10.8)end end;function IsInFreeLook()return system.isViewLocked()==0 and userControlScheme~="keyboard"and o()==0 end;function HUDPrologue(cd)local dF=ao;local dG=ap;local dH=ao;local dI=ap;if IsInFreeLook()and not brightHud then dF=[[rgb(]]..d(PrimaryR*0.4+0.5)..","..d(PrimaryG*0.4+0.5)..","..d(PrimaryB*0.3+0.5)..[[)]]dG=[[rgb(]]..d(PrimaryR*0.3+0.5)..","..d(PrimaryG*0.3+0.5)..","..d(PrimaryB*0.2+0.5)..[[)]]end;cd[#cd+1]=e([[
@@ -378,7 +379,7 @@ handlers:
Keyboard Scheme must be selected]],ConvertResolutionX(960),ConvertResolutionY(600))cd[#cd+1]=e([[
Set your preferred scheme in Lua Parameters instead]],ConvertResolutionX(960),ConvertResolutionY(650))end;local eN=ConvertResolutionX(960)local eO=ConvertResolutionY(860)local eP=ConvertResolutionY(880)local eQ=ConvertResolutionY(900)local eR=ConvertResolutionY(960)local eS=ConvertResolutionY(200)local eT=ConvertResolutionY(150)local eU=ConvertResolutionY(960)if o()==1 and not RemoteHud then eO=ConvertResolutionY(135)eP=ConvertResolutionY(155)eQ=ConvertResolutionY(175)eS=ConvertResolutionY(115)eT=ConvertResolutionY(95)end;if BrakeIsOn then cd[#cd+1]=e([[Brake Engaged]],eN,eO)elseif t>0 then cd[#cd+1]=e([[Auto-Brake Engaged]],eN,eO,t)end;if ai and bg and hoverDetectGround()==-1 then cd[#cd+1]=e([[** STALL WARNING **]],eN,eS+50)end;if am then cd[#cd+1]=e([[Gyro Enabled]],eN,eU)end;if GearExtended then if F then cd[#cd+1]=e([[Gear Extended]],eN,eP)else cd[#cd+1]=e([[Landed (G: Takeoff)]],eN,eP)end;local dh,di=getDistanceDisplayString(Nav:getTargetGroundAltitude())cd[#cd+1]=e([[Hover Height: %s]],eN,eQ,dh..di)end;if T then cd[#cd+1]=e([[ROCKET BOOST ENABLED]],eN,eR+20)end;if antigrav and not ExternalAGG and antigrav.getState()==1 and AntigravTargetAltitude~=nil then if math.abs(aj-antigrav.getBaseAltitude())<501 then cd[#cd+1]=e([[AGG On - Target Altitude: %d Singluarity Altitude: %d]],eN,eS+20,d(AntigravTargetAltitude),d(antigrav.getBaseAltitude()))else cd[#cd+1]=e([[AGG On - Target Altitude: %d Singluarity Altitude: %d]],eN,eS+20,d(AntigravTargetAltitude),d(antigrav.getBaseAltitude()))end elseif Autopilot and AutopilotTargetName~="None"then cd[#cd+1]=e([[Autopilot %s]],eN,eS+20,AutopilotStatus)elseif LockPitch~=nil then cd[#cd+1]=e([[LockedPitch: %d]],eN,eS+20,d(LockPitch))elseif N then cd[#cd+1]=e([[Follow Mode Engaged]],eN,eS+20)elseif Reentry then cd[#cd+1]=e([[Re-entry in Progress]],eN,eS+20)end;local eV,eW,eX=b2:getPlanetarySystem(0):castIntersections(vec3(core.getConstructWorldPos()),ba:normalize(),function(eY)if eY.noAtmosphericDensityAltitude>0 then return eY.radius+eY.noAtmosphericDensityAltitude else return eY.radius+eY.surfaceMaxAltitude*1.5 end end)local eZ=eW;if eX~=nil and eW~=nil then eZ=math.min(eX,eW)end;if AltitudeHold then if AutoTakeoff then local dh,di=getDistanceDisplayString(HoldAltitude)cd[#cd+1]=e([[Ascent to %s]],eN,eS,dh..di)if BrakeIsOn then cd[#cd+1]=e([[Throttle Up and Disengage Brake For Takeoff]],eN,eS+50)end else local dh,di=getDistanceDisplayString2(HoldAltitude)cd[#cd+1]=e([[Altitude Hold: %s]],eN,eS,dh..di)end end;if BrakeLanding then if StrongBrakes then cd[#cd+1]=e([[Brake-Landing]],eN,eS)else cd[#cd+1]=e([[Coast-Landing]],eN,eS)end end;if ProgradeIsOn then cd[#cd+1]=e([[Prograde Alignment]],eN,eS)end;if RetrogradeIsOn then cd[#cd+1]=e([[Retrograde Alignment]],eN,eS)end;if TurnBurn then cd[#cd+1]=e([[Turn & Burn Braking]],eN,eT)elseif eZ~=nil and j()==0 then local dh,di=getDistanceDisplayString(eZ)local travelTime=b3.computeTravelTime(bb,0,eZ)local e_="Collision"if eV.noAtmosphericDensityAltitude>0 then e_="Atmosphere"end;cd[#cd+1]=e([[%s %s In %s (%s)]],eN,eT,eV.name,e_,FormatTimeString(travelTime),dh..di)end;if VectorToTarget then cd[#cd+1]=e([[%s]],eN,eS+30,VectorStatus)end;cd[#cd+1]=""end;function DisplayOrbitScreen(cd)if orbit~=nil and j()<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 local f0=OrbitMapX;local f1=OrbitMapY;local f2=OrbitMapSize;local f3=4;f1=f1+f3;local f4=15;local bI=f0+f2+f0/2+f3;local bJ=f1+f2/2+5+f3;local f5,f6,f7,f8;f5=f2/4;f8=0;cd[#cd+1]=[[]]cd[#cd+1]=e('',f2+f0*2,f2+f1,f3,f3)if orbit.periapsis~=nil and orbit.apoapsis~=nil then f7=(orbit.apoapsis.altitude+orbit.periapsis.altitude+planet.radius*2)/(f5*2)f6=(planet.radius+orbit.periapsis.altitude+(orbit.apoapsis.altitude-orbit.periapsis.altitude)/2)/f7*(1-orbit.eccentricity)f8=f5-orbit.periapsis.altitude/f7-planet.radius/f7;local f9=""if orbit.periapsis.altitude<=0 then f9='redout'end;cd[#cd+1]=e([[]],f9,f0+f2/2+f8+f3,f1+f2/2+f3,f5,f6)cd[#cd+1]=e('',f0+f2/2+f3,f1+f2/2+f3,planet.radius/f7)end;if orbit.apoapsis~=nil and orbit.apoapsis.speed1 then cd[#cd+1]=e([[]],bI-35,bJ-5,f0+f2/2+f5+f8,bJ-5)cd[#cd+1]=e([[Apoapsis]],bI,bJ)bJ=bJ+f4;local dh,di=getDistanceDisplayString(orbit.apoapsis.altitude)cd[#cd+1]=e([[%s]],bI,bJ,dh..di)bJ=bJ+f4;cd[#cd+1]=e([[%s]],bI,bJ,FormatTimeString(orbit.timeToApoapsis))bJ=bJ+f4;cd[#cd+1]=e([[%s]],bI,bJ,getSpeedDisplayString(orbit.apoapsis.speed))end;bJ=f1+f2/2+5+f3;bI=f0-f0/2+10+f3;if orbit.periapsis~=nil and orbit.periapsis.speed1 then cd[#cd+1]=e([[]],bI+35,bJ-5,f0+f2/2-f5+f8,bJ-5)cd[#cd+1]=e([[Periapsis]],bI,bJ)bJ=bJ+f4;local dh,di=getDistanceDisplayString(orbit.periapsis.altitude)cd[#cd+1]=e([[%s]],bI,bJ,dh..di)bJ=bJ+f4;cd[#cd+1]=e([[%s]],bI,bJ,FormatTimeString(orbit.timeToPeriapsis))bJ=bJ+f4;cd[#cd+1]=e([[%s]],bI,bJ,getSpeedDisplayString(orbit.periapsis.speed))end;cd[#cd+1]=e([[%s]],f0+f2/2+f3,20+f3,planet.name)if orbit.period~=nil and orbit.periapsis~=nil and orbit.apoapsis~=nil and orbit.apoapsis.speed>1 then local fa=orbit.timeToApoapsis/orbit.period*2*math.pi;local fb=f5*math.cos(fa)local fc=f6*math.sin(fa)cd[#cd+1]=e('',f0+f2/2+fb+f8+f3,f1+f2/2+fc+f3)end;cd[#cd+1]=[[]]end end;function getDistanceDisplayString(a8)local fd=a8>100000;local bo,di=""if fd then bo,di=round(a8/1000/200,1),"SU"elseif a8<1000 then bo,di=round(a8,1),"m"else bo,di=round(a8/1000,1),"Km"end;return bo,di end;function getDistanceDisplayString2(a8)local fd=a8>100000;local bo,di=""if fd then bo,di=round(a8/1000/200,2)," SU"elseif a8<1000 then bo,di=round(a8,2)," M"else bo,di=round(a8/1000,2)," KM"end;return bo,di end;function getSpeedDisplayString(bC)return d(round(bC*3.6,0)+0.5).." km/h"end;function FormatTimeString(fe)local ff=0;local fg=0;local fh=0;if fe<60 then fe=d(fe)elseif fe<3600 then ff=d(fe/60)fe=d(fe%60)elseif fe<86400 then fg=d(fe/3600)ff=d(fe%3600/60)else fh=d(fe/86400)fg=d(fe%86400/3600)end;if fh>0 then return fh.."d "..fg.."h "elseif fg>0 then return fg.."h "..ff.."m "elseif ff>0 then return ff.."m "..fe.."s"elseif fe>0 then return fe.."s"else return"0s"end end;function getMagnitudeInDirection(da,fi)da=vec3(da)fi=vec3(fi):normalize()local bo=da*fi;return bo.x+bo.y+bo.z end;function UpdateAutopilotTarget()if AutopilotTargetIndex==0 then AutopilotTargetName="None"a0=nil;CustomTarget=nil;return true end;local fj=AtlasOrdered[AutopilotTargetIndex].index;local fk=aX[0][fj]if fk.center then AutopilotTargetName=fk.name;a0=b2[0][fj]if CustomTarget~=nil then if j()==0 then if system.updateData(widgetMaxBrakeTimeText,widgetMaxBrakeTime)~=1 then system.addDataToWidget(widgetMaxBrakeTimeText,widgetMaxBrakeTime)end;if system.updateData(widgetMaxBrakeDistanceText,widgetMaxBrakeDistance)~=1 then system.addDataToWidget(widgetMaxBrakeDistanceText,widgetMaxBrakeDistance)end;if system.updateData(widgetCurBrakeTimeText,widgetCurBrakeTime)~=1 then system.addDataToWidget(widgetCurBrakeTimeText,widgetCurBrakeTime)end;if system.updateData(widgetCurBrakeDistanceText,widgetCurBrakeDistance)~=1 then system.addDataToWidget(widgetCurBrakeDistanceText,widgetCurBrakeDistance)end;if system.updateData(widgetTrajectoryAltitudeText,widgetTrajectoryAltitude)~=1 then system.addDataToWidget(widgetTrajectoryAltitudeText,widgetTrajectoryAltitude)end end;if system.updateData(widgetMaxMassText,widgetMaxMass)~=1 then system.addDataToWidget(widgetMaxMassText,widgetMaxMass)end;if system.updateData(widgetTravelTimeText,widgetTravelTime)~=1 then system.addDataToWidget(widgetTravelTimeText,widgetTravelTime)end;if system.updateData(widgetTargetOrbitText,widgetTargetOrbit)~=1 then system.addDataToWidget(widgetTargetOrbitText,widgetTargetOrbit)end end;CustomTarget=nil else CustomTarget=fk;for _,bn in pairs(b2[0])do if bn.name==CustomTarget.planetname then a0=bn;AutopilotTargetName=CustomTarget.name;break end end;if system.updateData(widgetMaxMassText,widgetMaxMass)~=1 then system.addDataToWidget(widgetMaxMassText,widgetMaxMass)end;if system.updateData(widgetTravelTimeText,widgetTravelTime)~=1 then system.addDataToWidget(widgetTravelTimeText,widgetTravelTime)end end;if CustomTarget==nil then AutopilotTargetCoords=vec3(a0.center)else AutopilotTargetCoords=CustomTarget.position end;if a0.planetname~="Space"then if a0.hasAtmosphere then AutopilotTargetOrbit=math.floor(a0.radius*(TargetOrbitRadius-1)+a0.noAtmosphericDensityAltitude)else AutopilotTargetOrbit=math.floor(a0.radius*(TargetOrbitRadius-1)+a0.surfaceMaxAltitude)end else AutopilotTargetOrbit=1000 end;if CustomTarget~=nil and CustomTarget.planetname=="Space"then AutopilotEndSpeed=0 else _,AutopilotEndSpeed=b5(a0):escapeAndOrbitalSpeed(AutopilotTargetOrbit)end;AutopilotPlanetGravity=0;AutopilotAccelerating=false;AutopilotBraking=false;AutopilotCruising=false;Autopilot=false;AutopilotRealigned=false;AutopilotStatus="Aligning"return true end;function IncrementAutopilotTargetIndex()AutopilotTargetIndex=AutopilotTargetIndex+1;if AutopilotTargetIndex>#AtlasOrdered then AutopilotTargetIndex=0 end;if AutopilotTargetIndex==0 then UpdateAutopilotTarget()else local fj=AtlasOrdered[AutopilotTargetIndex].index;local fk=aX[0][fj]if fk.name=="Space"then IncrementAutopilotTargetIndex()else UpdateAutopilotTarget()end end end;function DecrementAutopilotTargetIndex()AutopilotTargetIndex=AutopilotTargetIndex-1;if AutopilotTargetIndex<0 then AutopilotTargetIndex=#AtlasOrdered end;if AutopilotTargetIndex==0 then UpdateAutopilotTarget()else local fj=AtlasOrdered[AutopilotTargetIndex].index;local fk=aX[0][fj]if fk.name=="Space"then DecrementAutopilotTargetIndex()else UpdateAutopilotTarget()end end end;function GetAutopilotMaxMass()local fl=LastMaxBrakeInAtmo/a0:getGravity(a0.center+vec3(0,0,1)*a0.radius):len()return fl end;function GetAutopilotTravelTime()if not Autopilot then if CustomTarget==nil or CustomTarget.planetname~=planet.name then AutopilotDistance=(a0.center-vec3(core.getConstructWorldPos())):len()else AutopilotDistance=(CustomTarget.position-vec3(core.getConstructWorldPos())):len()end end;local ba=core.getWorldVelocity()local bC=vec3(ba):len()local fm=unit.getThrottle()/100;if AtmoSpeedAssist then fm=s end;local fn,fo=b3.computeDistanceAndTime(vec3(ba):len(),MaxGameVelocity,n(),Nav:maxForceForward()*fm,warmup,0)local U,V;if not TurnBurn then U,V=GetAutopilotBrakeDistanceAndTime(MaxGameVelocity)else U,V=GetAutopilotTBBrakeDistanceAndTime(MaxGameVelocity)end;local _,fp;if not TurnBurn and bC>0 then _,fp=GetAutopilotBrakeDistanceAndTime(bC)else _,fp=GetAutopilotTBBrakeDistanceAndTime(bC)end;local fq=0;local fr=0;if AutopilotCruising or not Autopilot and bC>5 then fr=b3.computeTravelTime(bC,0,AutopilotDistance)elseif U+fn0 then return b3.computeDistanceAndTime(bC,AutopilotEndSpeed,n(),0,0,LastMaxBrakeInAtmo-AutopilotPlanetGravity*n())else return 0,0 end end end;function GetAutopilotTBBrakeDistanceAndTime(bC)RefreshLastMaxBrake()return b3.computeDistanceAndTime(bC,AutopilotEndSpeed,n(),Nav:maxForceForward(),warmup,LastMaxBrake-AutopilotPlanetGravity*n())end;function hoverDetectGround()local ft=-1;local fu=-1;if vBooster then ft=vBooster.distance()end;if hover then fu=hover.distance()end;if ft~=-1 and fu~=-1 then if ftProfileTimeMax then ProfileTimeMax=fA end;if fA0 then local fK=fH:find('identifiedConstructs":%[%]')if fK==nil and perisPanelID==nil then ab=1;ToggleRadarPanel()end;if fK~=nil and perisPanelID~=nil then ToggleRadarPanel()end;if radarPanelID==nil then ToggleRadarPanel()end;a9=e([[Radar: %i contacts]],fI,fJ,#fG)local fL={}for bm,bn in pairs(fG)do if radar_1.hasMatchingTransponder(bn)==1 then table.insert(fL,bn)end end;if#fL>0 then local bJ=ConvertResolutionY(15)local bI=ConvertResolutionX(1370)a9=e([[%sFriendlies In Range]],a9,bI,bJ)for bm,bn in pairs(fL)do bJ=bJ+20;a9=e([[%s%s]],a9,bI,bJ,radar_1.getConstructName(bn))end end else local fM;fM=fH:find('worksInEnvironment":false')if fM then a9=e([[
Radar: Jammed]],fI,fJ)else a9=e([[
- Radar: No Contacts]],fI,fJ)end;if radarPanelID~=nil then ab=0;ToggleRadarPanel()end end end end;function DisplayMessage(cd,dh)if dh~="empty"then cd[#cd+1]=[[]]for fN in string.gmatch(dh,"([^\n]+)")do cd[#cd+1]=e([[%s]],fN)end;cd[#cd+1]=[[]]end;if a7~=0 then unit.setTimer("msgTick",a7)a7=0 end end;function updateDistance()local bv=system.getTime()local ba=vec3(core.getWorldVelocity())local dB=vec3(ba):len()local fO=bv-al;if dB>1.38889 then dB=dB/1000;local fP=dB*(bv-al)TotalDistanceTravelled=TotalDistanceTravelled+fP;a1=a1+fP end;a2=a2+fO;TotalFlightTime=TotalFlightTime+fO;al=bv end;function composeAxisAccelerationFromTargetSpeed(fQ,fR)local fS=vec3()local fT=vec3()if fQ==axisCommandId.longitudinal then fS=vec3(core.getConstructOrientationForward())fT=vec3(core.getConstructWorldOrientationForward())elseif fQ==axisCommandId.vertical then fS=vec3(core.getConstructOrientationUp())fT=vec3(core.getConstructWorldOrientationUp())elseif fQ==axisCommandId.lateral then fS=vec3(core.getConstructOrientationRight())fT=vec3(core.getConstructWorldOrientationRight())else return vec3()end;local fU=vec3(core.getWorldGravity())local fV=fU:dot(fT)local fW=vec3(core.getWorldAirFrictionAcceleration())local fX=fW:dot(fT)local fY=vec3(core.getVelocity())local fZ=fY:dot(fS)local f_=fR*constants.kph2m;if targetSpeedPID==nil then targetSpeedPID=pid.new(1,0,10.0)end;targetSpeedPID:inject(f_-fZ)local g0=targetSpeedPID:get()local g1=(g0-fX-fV)*fT;return g1 end;function Atlas()return{[0]={[0]={GM=0,bodyId=0,center={x=0,y=0,z=0},name='Space',planetarySystemId=0,radius=0,hasAtmosphere=false,gravity=0,noAtmosphericDensityAltitude=0,surfaceMaxAltitude=0},[2]={name="Alioth",description="Alioth is the planet selected by the arkship for landfall; it is a typical goldilocks planet where humanity may rebuild in the coming decades. The arkship geological survey reports mountainous regions alongside deep seas and lush forests. This is where it all starts.",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0.9401,atmosphericEngineMaxAltitude=5580,biosphere="Forest",classification="Mesoplanet",bodyId=2,GM=157470826617,gravity=1.0082568597356114,fullAtmosphericDensityMaxAltitude=-10,habitability="High",hasAtmosphere=true,isSanctuary=false,noAtmosphericDensityAltitude=6272,numSatellites=2,positionFromSun=2,center={x=-8,y=-8,z=-126303},radius=126067.8984375,safeAreaEdgeAltitude=500000,size="M",spaceEngineMinAltitude=3410,surfaceArea=199718780928,surfaceAverageAltitude=200,surfaceMaxAltitude=1100,surfaceMinAltitude=-330,systemZone="High",territories=259472,type="Planet",waterLevel=0,planetarySystemId=0},[21]={name="Alioth Moon 1",description="",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0,atmosphericEngineMaxAltitude=0,biosphere="",classification="",bodyId=21,GM=2118960000,gravity=0.24006116402380084,fullAtmosphericDensityMaxAltitude=0,habitability="",hasAtmosphere=false,isSanctuary=false,noAtmosphericDensityAltitude=0,numSatellites=0,positionFromSun=0,center={x=457933,y=-1509011,z=115524},radius=30000,safeAreaEdgeAltitude=500000,size="M",spaceEngineMinAltitude=0,surfaceArea=11309733888,surfaceAverageAltitude=140,surfaceMaxAltitude=200,surfaceMinAltitude=10,systemZone=nil,territories=14522,type="",waterLevel=nil,planetarySystemId=0},[22]={name="Alioth Moon 4",description="",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0,atmosphericEngineMaxAltitude=0,biosphere="",classification="",bodyId=22,GM=2165833514,gravity=0.2427018259886451,fullAtmosphericDensityMaxAltitude=0,habitability="",hasAtmosphere=false,isSanctuary=false,noAtmosphericDensityAltitude=0,numSatellites=0,positionFromSun=0,center={x=-1692694,y=729681,z=-411464},radius=30330,safeAreaEdgeAltitude=500000,size="L",spaceEngineMinAltitude=0,surfaceArea=11559916544,surfaceAverageAltitude=-15,surfaceMaxAltitude=-5,surfaceMinAltitude=-50,systemZone=nil,territories=14522,type="",waterLevel=nil,planetarySystemId=0},[5]={name="Feli",description="Feli is easily identified by its massive and deep crater. Outside of the crater, the arkship geological survey reports a fairly bland and uniform planet, it also cannot explain the existence of the crater. Feli is particular for having an extremely small atmosphere, allowing life to develop in the deeper areas of its crater but limiting it drastically on the actual surface.",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0.5488,atmosphericEngineMaxAltitude=66725,biosphere="Barren",classification="Mesoplanet",bodyId=5,GM=16951680000,gravity=0.4801223280476017,fullAtmosphericDensityMaxAltitude=30,habitability="Low",hasAtmosphere=true,isSanctuary=false,noAtmosphericDensityAltitude=78500,numSatellites=1,positionFromSun=5,center={x=-43534464,y=22565536,z=-48934464},radius=41800,safeAreaEdgeAltitude=500000,size="S",spaceEngineMinAltitude=42800,surfaceArea=21956466688,surfaceAverageAltitude=18300,surfaceMaxAltitude=18500,surfaceMinAltitude=46,systemZone="Low",territories=27002,type="Planet",waterLevel=nil,planetarySystemId=0},[50]={name="Feli Moon 1",description="",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0,atmosphericEngineMaxAltitude=0,biosphere="",classification="",bodyId=50,GM=499917600,gravity=0.11202853997062348,fullAtmosphericDensityMaxAltitude=0,habitability="",hasAtmosphere=false,isSanctuary=false,noAtmosphericDensityAltitude=0,numSatellites=0,positionFromSun=0,center={x=-43902841.78,y=22261034.7,z=-48862386},radius=14000,safeAreaEdgeAltitude=500000,size="S",spaceEngineMinAltitude=0,surfaceArea=2463008768,surfaceAverageAltitude=800,surfaceMaxAltitude=900,surfaceMinAltitude=0,systemZone=nil,territories=3002,type="",waterLevel=nil,planetarySystemId=0},[120]={name="Ion",description="Ion is nothing more than an oversized ice cube frozen through and through. It is a largely inhospitable planet due to its extremely low temperatures. The arkship geological survey reports extremely rough mountainous terrain with little habitable land.",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0.9522,atmosphericEngineMaxAltitude=10480,biosphere="Ice",classification="Hypopsychroplanet",bodyId=120,GM=7135606629,gravity=0.36009174603570127,fullAtmosphericDensityMaxAltitude=-30,habitability="Average",hasAtmosphere=true,isSanctuary=false,noAtmosphericDensityAltitude=17700,numSatellites=2,positionFromSun=12,center={x=2865536.7,y=-99034464,z=-934462.02},radius=44950,safeAreaEdgeAltitude=500000,size="XS",spaceEngineMinAltitude=6410,surfaceArea=25390383104,surfaceAverageAltitude=500,surfaceMaxAltitude=1300,surfaceMinAltitude=250,systemZone="Average",territories=32672,type="Planet",waterLevel=nil,planetarySystemId=0},[121]={name="Ion Moon 1",description="",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0,atmosphericEngineMaxAltitude=0,biosphere="",classification="",bodyId=121,GM=106830900,gravity=0.08802242599860607,fullAtmosphericDensityMaxAltitude=0,habitability="",hasAtmosphere=false,isSanctuary=false,noAtmosphericDensityAltitude=0,numSatellites=0,positionFromSun=0,center={x=2472916.8,y=-99133747,z=-1133582.8},radius=11000,safeAreaEdgeAltitude=500000,size="XS",spaceEngineMinAltitude=0,surfaceArea=1520530944,surfaceAverageAltitude=100,surfaceMaxAltitude=200,surfaceMinAltitude=3,systemZone=nil,territories=1922,type="",waterLevel=nil,planetarySystemId=0},[122]={name="Ion Moon 2",description="",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0,atmosphericEngineMaxAltitude=0,biosphere="",classification="",bodyId=122,GM=176580000,gravity=0.12003058201190042,fullAtmosphericDensityMaxAltitude=0,habitability="",hasAtmosphere=false,isSanctuary=false,noAtmosphericDensityAltitude=0,numSatellites=0,positionFromSun=0,center={x=2995424.5,y=-99275010,z=-1378480.7},radius=15000,safeAreaEdgeAltitude=500000,size="XS",spaceEngineMinAltitude=0,surfaceArea=2827433472,surfaceAverageAltitude=-1900,surfaceMaxAltitude=-1400,surfaceMinAltitude=-2100,systemZone=nil,territories=3632,type="",waterLevel=nil,planetarySystemId=0},[9]={name="Jago",description="Jago is a water planet. The large majority of the planet's surface is covered by large oceans dotted by small areas of landmass across the planet. The arkship geological survey reports deep seas across the majority of the planet with sub 15 percent coverage of solid ground.",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0.9835,atmosphericEngineMaxAltitude=9695,biosphere="Water",classification="Mesoplanet",bodyId=9,GM=18606274330,gravity=0.5041284298678057,fullAtmosphericDensityMaxAltitude=-90,habitability="Very High",hasAtmosphere=true,isSanctuary=false,noAtmosphericDensityAltitude=10900,numSatellites=0,positionFromSun=9,center={x=-94134462,y=12765534,z=-3634464},radius=61590,safeAreaEdgeAltitude=500000,size="XL",spaceEngineMinAltitude=5900,surfaceArea=47668367360,surfaceAverageAltitude=0,surfaceMaxAltitude=1200,surfaceMinAltitude=-500,systemZone="Very High",territories=60752,type="Planet",waterLevel=0,planetarySystemId=0},[100]={name="Lacobus",description="Lacobus is an ice planet that also features large bodies of water. The arkship geological survey reports deep oceans alongside a frozen and rough mountainous environment. Lacobus seems to feature regional geothermal activity allowing for the presence of water on the surface.",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0.7571,atmosphericEngineMaxAltitude=11120,biosphere="Ice",classification="Psychroplanet",bodyId=100,GM=13975172474,gravity=0.45611622622739767,fullAtmosphericDensityMaxAltitude=-20,habitability="Average",hasAtmosphere=true,isSanctuary=false,noAtmosphericDensityAltitude=12510,numSatellites=3,positionFromSun=10,center={x=98865536,y=-13534464,z=-934461.99},radius=55650,safeAreaEdgeAltitude=500000,size="M",spaceEngineMinAltitude=6790,surfaceArea=38917074944,surfaceAverageAltitude=800,surfaceMaxAltitude=1660,surfaceMinAltitude=250,systemZone="Average",territories=50432,type="Planet",waterLevel=0,planetarySystemId=0},[102]={name="Lacobus Moon 1",description="",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0,atmosphericEngineMaxAltitude=0,biosphere="",classification="",bodyId=102,GM=444981600,gravity=0.14403669598391783,fullAtmosphericDensityMaxAltitude=0,habitability="",hasAtmosphere=false,isSanctuary=false,noAtmosphericDensityAltitude=0,numSatellites=0,positionFromSun=0,center={x=99180968,y=-13783862,z=-926156.4},radius=18000,safeAreaEdgeAltitude=500000,size="XL",spaceEngineMinAltitude=0,surfaceArea=4071504128,surfaceAverageAltitude=150,surfaceMaxAltitude=300,surfaceMinAltitude=10,systemZone=nil,territories=5072,type="",waterLevel=nil,planetarySystemId=0},[103]={name="Lacobus Moon 2",description="",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0,atmosphericEngineMaxAltitude=0,biosphere="",classification="",bodyId=103,GM=211503600,gravity=0.11202853997062348,fullAtmosphericDensityMaxAltitude=0,habitability="",hasAtmosphere=false,isSanctuary=false,noAtmosphericDensityAltitude=0,numSatellites=0,positionFromSun=0,center={x=99250052,y=-13629215,z=-1059341.4},radius=14000,safeAreaEdgeAltitude=500000,size="M",spaceEngineMinAltitude=0,surfaceArea=2463008768,surfaceAverageAltitude=-1380,surfaceMaxAltitude=-1280,surfaceMinAltitude=-1880,systemZone=nil,territories=3002,type="",waterLevel=nil,planetarySystemId=0},[101]={name="Lacobus Moon 3",description="",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0,atmosphericEngineMaxAltitude=0,biosphere="",classification="",bodyId=101,GM=264870000,gravity=0.12003058201190042,fullAtmosphericDensityMaxAltitude=0,habitability="",hasAtmosphere=false,isSanctuary=false,noAtmosphericDensityAltitude=0,numSatellites=0,positionFromSun=0,center={x=98905288.17,y=-13950921.1,z=-647589.53},radius=15000,safeAreaEdgeAltitude=500000,size="L",spaceEngineMinAltitude=0,surfaceArea=2827433472,surfaceAverageAltitude=500,surfaceMaxAltitude=820,surfaceMinAltitude=3,systemZone=nil,territories=3632,type="",waterLevel=nil,planetarySystemId=0},[1]={name="Madis",description="Madis is a barren wasteland of a rock; it sits closest to the sun and temperatures reach extreme highs during the day. The arkship geological survey reports long rocky valleys intermittently separated by small ravines.",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0.8629,atmosphericEngineMaxAltitude=7165,biosphere="Barren",classification="hyperthermoplanet",bodyId=1,GM=6930729684,gravity=0.36009174603570127,fullAtmosphericDensityMaxAltitude=220,habitability="Low",hasAtmosphere=true,isSanctuary=false,noAtmosphericDensityAltitude=8050,numSatellites=3,positionFromSun=1,center={x=17465536,y=22665536,z=-34464},radius=44300,safeAreaEdgeAltitude=500000,size="XS",spaceEngineMinAltitude=4480,surfaceArea=24661377024,surfaceAverageAltitude=750,surfaceMaxAltitude=850,surfaceMinAltitude=670,systemZone="Low",territories=30722,type="Planet",waterLevel=nil,planetarySystemId=0},[10]={name="Madis Moon 1",description="",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0,atmosphericEngineMaxAltitude=0,biosphere="",classification="",bodyId=10,GM=78480000,gravity=0.08002039003323584,fullAtmosphericDensityMaxAltitude=0,habitability="",hasAtmosphere=false,isSanctuary=false,noAtmosphericDensityAltitude=0,numSatellites=0,positionFromSun=0,center={x=17448118.224,y=22966846.286,z=143078.82},radius=10000,safeAreaEdgeAltitude=500000,size="XL",spaceEngineMinAltitude=0,surfaceArea=1256637056,surfaceAverageAltitude=210,surfaceMaxAltitude=420,surfaceMinAltitude=0,systemZone=nil,territories=1472,type="",waterLevel=nil,planetarySystemId=0},[11]={name="Madis Moon 2",description="",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0,atmosphericEngineMaxAltitude=0,biosphere="",classification="",bodyId=11,GM=237402000,gravity=0.09602446196397631,fullAtmosphericDensityMaxAltitude=0,habitability="",hasAtmosphere=false,isSanctuary=false,noAtmosphericDensityAltitude=0,numSatellites=0,positionFromSun=0,center={x=17194626,y=22243633.88,z=-214962.81},radius=12000,safeAreaEdgeAltitude=500000,size="S",spaceEngineMinAltitude=0,surfaceArea=1809557376,surfaceAverageAltitude=-700,surfaceMaxAltitude=300,surfaceMinAltitude=-2900,systemZone=nil,territories=1922,type="",waterLevel=nil,planetarySystemId=0},[12]={name="Madis Moon 3",description="",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0,atmosphericEngineMaxAltitude=0,biosphere="",classification="",bodyId=12,GM=265046609,gravity=0.12003058201190042,fullAtmosphericDensityMaxAltitude=0,habitability="",hasAtmosphere=false,isSanctuary=false,noAtmosphericDensityAltitude=0,numSatellites=0,positionFromSun=0,center={x=17520614,y=22184730,z=-309989.99},radius=15000,safeAreaEdgeAltitude=500000,size="S",spaceEngineMinAltitude=0,surfaceArea=2827433472,surfaceAverageAltitude=700,surfaceMaxAltitude=1100,surfaceMinAltitude=0,systemZone=nil,territories=3632,type="",waterLevel=nil,planetarySystemId=0},[26]={name="Sanctuary",description="",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0.9666,atmosphericEngineMaxAltitude=6935,biosphere="",classification="",bodyId=26,GM=68234043600,gravity=1.0000000427743831,fullAtmosphericDensityMaxAltitude=-30,habitability="",hasAtmosphere=true,isSanctuary=true,noAtmosphericDensityAltitude=7800,numSatellites=0,positionFromSun=0,center={x=-1404835,y=562655,z=-285074},radius=83400,safeAreaEdgeAltitude=0,size="L",spaceEngineMinAltitude=4230,surfaceArea=87406149632,surfaceAverageAltitude=80,surfaceMaxAltitude=500,surfaceMinAltitude=-60,systemZone=nil,territories=111632,type="",waterLevel=0,planetarySystemId=0},[6]={name="Sicari",description="Sicari is a typical desert planet; it has survived for millenniums and will continue to endure. While not the most habitable of environments it remains a relatively untouched and livable planet of the Alioth sector. The arkship geological survey reports large flatlands alongside steep plateaus.",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0.897,atmosphericEngineMaxAltitude=7725,biosphere="Desert",classification="Mesoplanet",bodyId=6,GM=10502547741,gravity=0.4081039739797361,fullAtmosphericDensityMaxAltitude=-625,habitability="Average",hasAtmosphere=true,isSanctuary=false,noAtmosphericDensityAltitude=8770,numSatellites=0,positionFromSun=6,center={x=52765536,y=27165538,z=52065535},radius=51100,safeAreaEdgeAltitude=500000,size="M",spaceEngineMinAltitude=4480,surfaceArea=32813432832,surfaceAverageAltitude=130,surfaceMaxAltitude=220,surfaceMinAltitude=50,systemZone="Average",territories=41072,type="Planet",waterLevel=nil,planetarySystemId=0},[7]={name="Sinnen",description="Sinnen is a an empty and rocky hell. With no atmosphere to speak of it is one of the least hospitable planets in the sector. The arkship geological survey reports mostly flatlands alongside deep ravines which look to have once been riverbeds. This planet simply looks to have dried up and died, likely from solar winds.",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0.9226,atmosphericEngineMaxAltitude=10335,biosphere="Desert",classification="Mesoplanet",bodyId=7,GM=13033380591,gravity=0.4401121421448438,fullAtmosphericDensityMaxAltitude=-120,habitability="Average",hasAtmosphere=true,isSanctuary=false,noAtmosphericDensityAltitude=11620,numSatellites=1,positionFromSun=7,center={x=58665538,y=29665535,z=58165535},radius=54950,safeAreaEdgeAltitude=500000,size="S",spaceEngineMinAltitude=6270,surfaceArea=37944188928,surfaceAverageAltitude=317,surfaceMaxAltitude=360,surfaceMinAltitude=23,systemZone="Average",territories=48002,type="Planet",waterLevel=nil,planetarySystemId=0},[70]={name="Sinnen Moon 1",description="",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0,atmosphericEngineMaxAltitude=0,biosphere="",classification="",bodyId=70,GM=396912600,gravity=0.1360346539426409,fullAtmosphericDensityMaxAltitude=0,habitability="",hasAtmosphere=false,isSanctuary=false,noAtmosphericDensityAltitude=0,numSatellites=0,positionFromSun=0,center={x=58969616,y=29797945,z=57969449},radius=17000,safeAreaEdgeAltitude=500000,size="S",spaceEngineMinAltitude=0,surfaceArea=3631681280,surfaceAverageAltitude=-2050,surfaceMaxAltitude=-1950,surfaceMinAltitude=-2150,systemZone=nil,territories=4322,type="",waterLevel=nil,planetarySystemId=0},[110]={name="Symeon",description="Symeon is an ice planet mysteriously split at the equator by a band of solid desert. Exactly how this phenomenon is possible is unclear but some sort of weather anomaly may be responsible. The arkship geological survey reports a fairly diverse mix of flat-lands alongside mountainous formations.",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0.9559,atmosphericEngineMaxAltitude=6920,biosphere="Ice, Desert",classification="Hybrid",bodyId=110,GM=9204742375,gravity=0.3920998898971822,fullAtmosphericDensityMaxAltitude=-30,habitability="High",hasAtmosphere=true,isSanctuary=false,noAtmosphericDensityAltitude=7800,numSatellites=0,positionFromSun=11,center={x=14165536,y=-85634465,z=-934464.3},radius=49050,safeAreaEdgeAltitude=500000,size="S",spaceEngineMinAltitude=4230,surfaceArea=30233462784,surfaceAverageAltitude=39,surfaceMaxAltitude=450,surfaceMinAltitude=126,systemZone="High",territories=38882,type="Planet",waterLevel=nil,planetarySystemId=0},[4]={name="Talemai",description="Talemai is a planet in the final stages of an Ice Age. It seems likely that the planet was thrown into tumult by a cataclysmic volcanic event which resulted in its current state. The arkship geological survey reports large mountainous regions across the entire planet.",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0.8776,atmosphericEngineMaxAltitude=9685,biosphere="Barren",classification="Psychroplanet",bodyId=4,GM=14893847582,gravity=0.4641182439650478,fullAtmosphericDensityMaxAltitude=-78,habitability="Average",hasAtmosphere=true,isSanctuary=false,noAtmosphericDensityAltitude=10890,numSatellites=3,positionFromSun=4,center={x=-13234464,y=55765536,z=465536},radius=57500,safeAreaEdgeAltitude=500000,size="M",spaceEngineMinAltitude=5890,surfaceArea=41547563008,surfaceAverageAltitude=580,surfaceMaxAltitude=610,surfaceMinAltitude=520,systemZone="Average",territories=52922,type="Planet",waterLevel=nil,planetarySystemId=0},[42]={name="Talemai Moon 1",description="",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0,atmosphericEngineMaxAltitude=0,biosphere="",classification="",bodyId=42,GM=264870000,gravity=0.12003058201190042,fullAtmosphericDensityMaxAltitude=0,habitability="",hasAtmosphere=false,isSanctuary=false,noAtmosphericDensityAltitude=0,numSatellites=0,positionFromSun=0,center={x=-13058408,y=55781856,z=740177.76},radius=15000,safeAreaEdgeAltitude=500000,size="M",spaceEngineMinAltitude=0,surfaceArea=2827433472,surfaceAverageAltitude=720,surfaceMaxAltitude=850,surfaceMinAltitude=0,systemZone=nil,territories=3632,type="",waterLevel=nil,planetarySystemId=0},[40]={name="Talemai Moon 2",description="",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0,atmosphericEngineMaxAltitude=0,biosphere="",classification="",bodyId=40,GM=141264000,gravity=0.09602446196397631,fullAtmosphericDensityMaxAltitude=0,habitability="",hasAtmosphere=false,isSanctuary=false,noAtmosphericDensityAltitude=0,numSatellites=0,positionFromSun=0,center={x=-13503090,y=55594325,z=769838.64},radius=12000,safeAreaEdgeAltitude=500000,size="S",spaceEngineMinAltitude=0,surfaceArea=1809557376,surfaceAverageAltitude=250,surfaceMaxAltitude=450,surfaceMinAltitude=0,systemZone=nil,territories=1922,type="",waterLevel=nil,planetarySystemId=0},[41]={name="Talemai Moon 3",description="",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0,atmosphericEngineMaxAltitude=0,biosphere="",classification="",bodyId=41,GM=106830900,gravity=0.08802242599860607,fullAtmosphericDensityMaxAltitude=0,habitability="",hasAtmosphere=false,isSanctuary=false,noAtmosphericDensityAltitude=0,numSatellites=0,positionFromSun=0,center={x=-12800515,y=55700259,z=325207.84},radius=11000,safeAreaEdgeAltitude=500000,size="XS",spaceEngineMinAltitude=0,surfaceArea=1520530944,surfaceAverageAltitude=190,surfaceMaxAltitude=400,surfaceMinAltitude=0,systemZone=nil,territories=1922,type="",waterLevel=nil,planetarySystemId=0},[8]={name="Teoma",description="[REDACTED] The arkship geological survey [REDACTED]. This planet should not be here.",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0.7834,atmosphericEngineMaxAltitude=5580,biosphere="Forest",classification="Mesoplanet",bodyId=8,GM=18477723600,gravity=0.48812434578525177,fullAtmosphericDensityMaxAltitude=15,habitability="High",hasAtmosphere=true,isSanctuary=false,noAtmosphericDensityAltitude=6280,numSatellites=0,positionFromSun=8,center={x=80865538,y=54665536,z=-934463.94},radius=62000,safeAreaEdgeAltitude=500000,size="L",spaceEngineMinAltitude=3420,surfaceArea=48305131520,surfaceAverageAltitude=700,surfaceMaxAltitude=1100,surfaceMinAltitude=-200,systemZone="High",territories=60752,type="Planet",waterLevel=0,planetarySystemId=0},[3]={name="Thades",description="Thades is a scorched desert planet. Perhaps it was once teaming with life but now all that remains is ash and dust. The arkship geological survey reports a rocky mountainous planet bisected by a massive unnatural ravine; something happened to this planet.",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0.03552,atmosphericEngineMaxAltitude=32180,biosphere="Desert",classification="Thermoplanet",bodyId=3,GM=11776905000,gravity=0.49612641213015557,fullAtmosphericDensityMaxAltitude=150,habitability="Low",hasAtmosphere=true,isSanctuary=false,noAtmosphericDensityAltitude=32800,numSatellites=2,positionFromSun=3,center={x=29165536,y=10865536,z=65536},radius=49000,safeAreaEdgeAltitude=500000,size="M",spaceEngineMinAltitude=21400,surfaceArea=30171856896,surfaceAverageAltitude=13640,surfaceMaxAltitude=13690,surfaceMinAltitude=370,systemZone="Low",territories=38882,type="Planet",waterLevel=nil,planetarySystemId=0},[30]={name="Thades Moon 1",description="",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0,atmosphericEngineMaxAltitude=0,biosphere="",classification="",bodyId=30,GM=211564034,gravity=0.11202853997062348,fullAtmosphericDensityMaxAltitude=0,habitability="",hasAtmosphere=false,isSanctuary=false,noAtmosphericDensityAltitude=0,numSatellites=0,positionFromSun=0,center={x=29214402,y=10907080.695,z=433858.2},radius=14000,safeAreaEdgeAltitude=500000,size="M",spaceEngineMinAltitude=0,surfaceArea=2463008768,surfaceAverageAltitude=60,surfaceMaxAltitude=300,surfaceMinAltitude=0,systemZone=nil,territories=3002,type="",waterLevel=nil,planetarySystemId=0},[31]={name="Thades Moon 2",description="",antiGravMinAltitude=1000,atmosphericDensityAboveSurface=0,atmosphericEngineMaxAltitude=0,biosphere="",classification="",bodyId=31,GM=264870000,gravity=0.12003058201190042,fullAtmosphericDensityMaxAltitude=0,habitability="",hasAtmosphere=false,isSanctuary=false,noAtmosphericDensityAltitude=0,numSatellites=0,positionFromSun=0,center={x=29404193,y=10432768,z=19554.131},radius=15000,safeAreaEdgeAltitude=500000,size="M",spaceEngineMinAltitude=0,surfaceArea=2827433472,surfaceAverageAltitude=70,surfaceMaxAltitude=350,surfaceMinAltitude=0,systemZone=nil,territories=3632,type="",waterLevel=nil,planetarySystemId=0}}}end;function SetupAtlas()aX=Atlas()for bm,bn in pairs(aX[0])do if aA==nil or bn.center.xaB then aB=bn.center.x end;if aC==nil or bn.center.yaD then aD=bn.center.y end end;aY=""local g2=1.1*(aB-aA)/1920;local g3=1.4*(aD-aC)/1080;for bm,bn in pairs(aX[0])do local bI=960+bn.center.x/g2;local bJ=540+bn.center.y/g3;aY=aY..''if not string.match(bn.name,"Moon")and not string.match(bn.name,"Sanctuary")and not string.match(bn.name,"Space")then aY=aY..""..bn.name..""end end;local c0=vec3(core.getConstructWorldPos())local bI=960+c0.x/g2;local bJ=540+c0.y/g3;aY=aY..''aY=aY.."You Are Here"aY=aY..[[]]aZ=g2;a_=g3;if screen_2 then screen_2.setHTML('