{"slots":{"0":{"name":"slot1","type":{"events":[],"methods":[]}},"1":{"name":"slot2","type":{"events":[],"methods":[]}},"2":{"name":"slot3","type":{"events":[],"methods":[]}},"3":{"name":"slot4","type":{"events":[],"methods":[]}},"4":{"name":"slot5","type":{"events":[],"methods":[]}},"5":{"name":"slot6","type":{"events":[],"methods":[]}},"6":{"name":"slot7","type":{"events":[],"methods":[]}},"7":{"name":"slot8","type":{"events":[],"methods":[]}},"8":{"name":"slot9","type":{"events":[],"methods":[]}},"9":{"name":"slot10","type":{"events":[],"methods":[]}},"-1":{"name":"unit","type":{"events":[],"methods":[]}},"-2":{"name":"system","type":{"events":[],"methods":[]}},"-3":{"name":"library","type":{"events":[],"methods":[]}}},"handlers":[{"code":"CheckClick(x, y)","filter":{"args":[{"variable":"*"},{"variable":"*"}],"signature":"mouseDown(x,y)","slotKey":"2"},"key":"0"},{"code":"CheckClick(x, y)","filter":{"args":[{"variable":"*"},{"variable":"*"}],"signature":"mouseDown(x,y)","slotKey":"3"},"key":"1"},{"code":"CheckClick(x, y)","filter":{"args":[{"variable":"*"},{"variable":"*"}],"signature":"mouseDown(x,y)","slotKey":"4"},"key":"2"},{"code":"CheckClick(x, y)","filter":{"args":[{"variable":"*"},{"variable":"*"}],"signature":"mouseDown(x,y)","slotKey":"5"},"key":"3"},{"code":"CheckClick(x, y)","filter":{"args":[{"variable":"*"},{"variable":"*"}],"signature":"mouseDown(x,y)","slotKey":"6"},"key":"4"},{"code":"CheckClick(x, y)","filter":{"args":[{"variable":"*"},{"variable":"*"}],"signature":"mouseDown(x,y)","slotKey":"7"},"key":"5"},{"code":"CheckClick(x, y)","filter":{"args":[{"variable":"*"},{"variable":"*"}],"signature":"mouseDown(x,y)","slotKey":"8"},"key":"6"},{"code":"CheckClick(x, y)","filter":{"args":[{"variable":"*"},{"variable":"*"}],"signature":"mouseDown(x,y)","slotKey":"9"},"key":"7"},{"code":"function GenerateCommaValue(a,b,c)b=b or false;c=c or 1;local d=a;if b==true then if string.len(a)>=4 then d=string.format(\"%.\"..c..\"fk\",a/1000)else d=string.format(\"%.\"..c..\"f\",a)end else while true do d,k=string.gsub(d,\"^(-?%d+)(%d%d%d)\",'%1,%2')if k==0 then break end end end;return d end;function PrintConsole(e,f)f=f or false;if f then system.print(\"------------------------------------------------------------------------\")end;system.print(e)if f then system.print(\"------------------------------------------------------------------------\")end end;function DrawCenteredText(e)if screens~=nil and#screens>0 then for g=1,#screens,1 do screens[g].element.setCenteredText(e)end end end;function ClearConsole()for g=1,10,1 do PrintConsole()end end;function SwitchScreens(h)h=h or\"on\"if screens~=nil and#screens>0 then for g=1,#screens,1 do if h==\"on\"then screens[g].element.clear()screens[g].element.activate()screens[g].active=true else screens[g].element.clear()screens[g].element.deactivate()screens[g].active=false end end end end;function GetSecondsString(i)local i=tonumber(i)if i==nil or i<=0 then return\"-\"else days=string.format(\"%2.f\",math.floor(i/(3600*24)))hours=string.format(\"%2.f\",math.floor(i/3600-days*24))mins=string.format(\"%2.f\",math.floor(i/60-hours*60-days*24*60))secs=string.format(\"%2.f\",math.floor(i-hours*3600-days*24*60*60-mins*60))str=\"\"if tonumber(days)>0 then str=str..days..\"d \"end;if tonumber(hours)>0 then str=str..hours..\"h \"end;if tonumber(mins)>0 then str=str..mins..\"m \"end;if tonumber(secs)>0 then str=str..secs..\"s\"end;return str end end;function replace_char(j,str,l)return str:sub(1,j-1)..l..str:sub(j+1)end;function epochTime()function rZ(m)if string.len(m)<=1 then return\"0\"..m else return m end end;function dPoint(n)if not(n==math.floor(n))then return true else return false end end;function lYear(year)if not dPoint(year/4)then if dPoint(year/100)then return true else if not dPoint(year/400)then return true else return false end end else return false end end;local o=5;local p=3600;local q=86400;local r=31536000;local s=31622400;local t=2419200;local g=2505600;local u=2592000;local k=2678400;local w={4,6,9,11}local x={1,3,5,7,8,10,12}local y=0;local z=1506816000;local A=system.getTime()_G[\"formerTime\"]=A;if AddSummertimeHour==true then A=A+3600 end;now=math.floor(A+z)year=1970;secs=0;y=0;while secs+s]]..hour..\":\"..minute..[[]]..[[]]..year..\"/\"..month..\"/\"..day..[[]]end;function ToggleHUD()if HUDMode==true then HUDMode=false;forceDamageRedraw=true;hudSelectedIndex=0;highlightID=0;HideHighlight()SetRefresh()RenderScreens()else HUDMode=true;forceDamageRedraw=true;hudSelectedIndex=0;highlightID=0;HideHighlight()SetRefresh()RenderScreens()end end;function HudDeselectElement()hudSelectedIndex=0;hudStartIndex=1;highlightID=0;HideHighlight()if HUDMode==true then SetRefresh(\"damage\")SetRefresh(\"damageoutline\")RenderScreens()end end;function ChangeHudSelectedElement(B)if HUDMode==true and#rE>0 then hudSelectedIndex=hudSelectedIndex+B;if hudSelectedIndex<1 then hudSelectedIndex=1 elseif hudSelectedIndex>#rE then hudSelectedIndex=#rE end;if hudSelectedIndex>9 then hudStartIndex=hudSelectedIndex-9 end;if hudSelectedIndex~=0 then highlightID=rE[hudSelectedIndex].id;if highlightID~=nil and highlightID~=0 then HideHighlight()elementPosition=vec3(rE[hudSelectedIndex].pos)highlightX=elementPosition.x-coreWorldOffset;highlightY=elementPosition.y-coreWorldOffset;highlightZ=elementPosition.z-coreWorldOffset;highlightOn=true;ShowHighlight()end end;SetRefresh(\"damage\")SetRefresh(\"damageoutline\")RenderScreens()end end;function HideHighlight()if#hudArrowSticker>0 then for g in pairs(hudArrowSticker)do core.deleteSticker(hudArrowSticker[g])end;hudArrowSticker={}end end;function ShowHighlight()if highlightOn==true and highlightID>0 then table.insert(hudArrowSticker,core.spawnArrowSticker(highlightX+2,highlightY,highlightZ,\"north\"))table.insert(hudArrowSticker,core.spawnArrowSticker(highlightX,highlightY-2,highlightZ,\"east\"))table.insert(hudArrowSticker,core.spawnArrowSticker(highlightX-2,highlightY,highlightZ,\"south\"))table.insert(hudArrowSticker,core.spawnArrowSticker(highlightX,highlightY+2,highlightZ,\"west\"))table.insert(hudArrowSticker,core.spawnArrowSticker(highlightX,highlightY,highlightZ-2,\"up\"))table.insert(hudArrowSticker,core.spawnArrowSticker(highlightX,highlightY,highlightZ+2,\"down\"))end end;function ToggleHighlight()if highlightOn==true then highlightOn=false;HideHighlight()else highlightOn=true;ShowHighlight()end end;function SortDamageTables()table.sort(damagedElements,function(m,n)return m.missinghp>n.missinghp end)table.sort(brokenElements,function(m,n)return m.maxhp>n.maxhp end)end;function getScraps(C,D)D=D or false;C=C-SkillRepairToolOptimization*0.05*C;local E=math.ceil(C/(10*5^(ScrapTier-1)))if D==true then return GenerateCommaValue(string.format(\"%.0f\",E),false)else return E end end;function getRepairTime(C,F)F=F or false;C=C-SkillRepairToolOptimization*0.05*C;local E=math.ceil(C/ScrapTierRepairTimes[ScrapTier])E=E-SkillRepairToolEfficiency*0.1*E;if F==true then return GetSecondsString(string.format(\"%.0f\",E))else return E end end;function UpdateDataDamageoutline()dmgoElements={}for g,G in ipairs(brokenElements)do if#dmgoElementsShipXmax then ShipXmax=H end;if I>ShipYmax then ShipYmax=I end;if J>ShipZmax then ShipZmax=J end;table.insert(dmgoElements,{id=G.id,type=\"b\",size=G.maxhp,x=H,y=I,z=J,xp=0,yp=0,zp=0,u=0,v=0})end end;if#dmgoElementsShipXmax then ShipXmax=H end;if I>ShipYmax then ShipYmax=I end;if J>ShipZmax then ShipZmax=J end;table.insert(dmgoElements,{id=G.id,type=\"d\",size=G.maxhp,x=H,y=I,z=J,xp=0,yp=0,zp=0,u=0,v=0})end end end;if#dmgoElementsShipXmax then ShipXmax=H end;if I>ShipYmax then ShipYmax=I end;if J>ShipZmax then ShipZmax=J end;table.insert(dmgoElements,{id=G.id,type=\"h\",size=G.maxhp,x=H,y=I,z=J,xp=0,yp=0,zp=0,u=0,v=0})end end end;ShipX=math.abs(ShipXmax-ShipXmin)ShipY=math.abs(ShipYmax-ShipYmin)ShipZ=math.abs(ShipZmax-ShipZmin)for g,G in ipairs(dmgoElements)do dmgoElements[g].xp=math.abs(100/(ShipXmax-ShipXmin)*(G.x-ShipXmin))dmgoElements[g].yp=math.abs(100/(ShipYmax-ShipYmin)*(G.y-ShipYmin))dmgoElements[g].zp=math.abs(100/(ShipZmax-ShipZmin)*(G.z-ShipZmin))end end;function UpdateViewDamageoutline(K)UFrame=40;VFrame=40;UStart=20+UFrame;VStart=180+VFrame;UDim=1880-2*UFrame;VDim=840-2*VFrame;if K.submode==\"top\"then if DMGOStretch==false then local L=UDim/(ShipYmax-ShipYmin)local M=VDim/(ShipXmax-ShipXmin)if L>=M then local N=L/M;local O=math.floor(UDim/N)UStart=UStart+(UDim-O)/2;for g,G in ipairs(dmgoElements)do dmgoElements[g].u=math.floor(UDim/100/N*G.yp+UStart)dmgoElements[g].v=math.floor(VDim/100*G.xp+VStart)end else local N=M/L;local P=math.floor(VDim/N)VStart=VStart+(VDim-P)/2;for g,G in ipairs(dmgoElements)do dmgoElements[g].u=math.floor(UDim/100*G.yp+UStart)dmgoElements[g].v=math.floor(VDim/100/N*G.xp+VStart)end end else for g,G in ipairs(dmgoElements)do dmgoElements[g].u=math.floor(UDim/100*G.yp+UStart)dmgoElements[g].v=math.floor(VDim/100*G.xp+VStart)end end elseif K.submode==\"front\"then if DMGOStretch==false then local L=UDim/(ShipXmax-ShipXmin)local M=VDim/(ShipZmax-ShipZmin)if L>=M then local N=L/M;local O=math.floor(UDim/N)UStart=UStart+(UDim-O)/2;for g,G in ipairs(dmgoElements)do dmgoElements[g].u=math.floor(UDim/100/N*G.xp+UStart)dmgoElements[g].v=math.floor(VDim/100*(100-G.zp)+VStart)end else local N=M/L;local P=math.floor(VDim/N)VStart=VStart+(VDim-P)/2;for g,G in ipairs(dmgoElements)do dmgoElements[g].u=math.floor(UDim/100*G.xp+UStart)dmgoElements[g].v=math.floor(VDim/100/N*(100-G.zp)+VStart)end end else for g,G in ipairs(dmgoElements)do dmgoElements[g].u=math.floor(UDim/100*G.xp+UStart)dmgoElements[g].v=math.floor(VDim/100*(100-G.zp)+VStart)end end elseif K.submode==\"side\"then if DMGOStretch==false then local L=UDim/(ShipYmax-ShipYmin)local M=VDim/(ShipXmax-ShipZmin)if L>=M then local N=L/M;local O=math.floor(UDim/N)UStart=UStart+(UDim-O)/2;for g,G in ipairs(dmgoElements)do dmgoElements[g].u=math.floor(UDim/100/N*G.yp+UStart)dmgoElements[g].v=math.floor(VDim/100*(100-G.zp)+VStart)end else local N=M/L;local P=math.floor(VDim/N)VStart=VStart+(VDim-P)/2;for g,G in ipairs(dmgoElements)do dmgoElements[g].u=math.floor(UDim/100*G.yp+UStart)dmgoElements[g].v=math.floor(VDim/100/N*(100-G.zp)+VStart)end end else for g,G in ipairs(dmgoElements)do dmgoElements[g].u=math.floor(UDim/100*G.yp+UStart)dmgoElements[g].v=math.floor(VDim/100*(100-G.zp)+VStart)end end else DrawCenteredText(\"ERROR: non-existing DMGO mode set.\")PrintConsole(\"ERROR: non-existing DMGO mode set.\")unit.exit()end end;function GetDamageoutlineShip()local e=\"\"for g,G in ipairs(dmgoElements)do local Q=\"\"local R=1;if G.type==\"h\"then Q=\"ch\"elseif G.type==\"d\"then Q=\"cw\"else Q=\"cc\"end;if G.id==highlightID then Q=\"f2\"end;if G.size>0 and G.size<1000 then R=5 elseif G.size>=1000 and G.size<2000 then R=8 elseif G.size>=2000 and G.size<5000 then R=12 elseif G.size>=5000 and G.size<10000 then R=15 elseif G.size>=10000 and G.size<20000 then R=20 elseif G.size>=20000 then R=30 end;e=e..[[]]if G.id==highlightID then e=e..[[]]e=e..[[]]end end;return e end;function GetContentClickareas(K)local e=\"\"if K~=nil and K.ClickAreas~=nil and#K.ClickAreas>0 then for g,S in ipairs(K.ClickAreas)do e=e..[[]]end end;return e end;function GetElement1(H,I,T,U)H=H or 0;I=I or 0;T=T or 600;U=U or 600;local e=\"\"e=e..[[\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n ]]return e end;function GetElement2(H,I)H=H or 0;I=I or 0;local e=\"\"e=e..[[]]return e end;function GetElementLogo(H,I,V,W,X)H=H or 812;I=I or 380;V=V or\"f\"W=W or\"f2\"X=X or\"f3\"local e=\"\"e=e..[[\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n ]]return e end;function GetHeader(Y)Y=Y or\"ERROR: UNDEFINED\"local e=\"\"e=e..[[\n ]]..Y..[[]]return e end;function GetContentBackground(Z,_)bgColor=ColorBackgroundPattern;local e=\"\"if Z==\"dots\"then e=[[background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' viewBox='0 0 4 4'%3E%3Cpath fill='%23]]..bgColor..[[' fill-opacity=']]..BackgroundModeOpacity..[[' d='M1 3h1v1H1V3zm2-2h1v1H3V1z'%3E%3C/path%3E%3C/svg%3E\");]]elseif Z==\"rain\"then e=[[background-image: url(\"data:image/svg+xml,%3Csvg width='12' height='16' viewBox='0 0 12 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 .99C4 .445 4.444 0 5 0c.552 0 1 .45 1 .99v4.02C6 5.555 5.556 6 5 6c-.552 0-1-.45-1-.99V.99zm6 8c0-.546.444-.99 1-.99.552 0 1 .45 1 .99v4.02c0 .546-.444.99-1 .99-.552 0-1-.45-1-.99V8.99z' fill='%23]]..bgColor..[[' fill-opacity=']]..BackgroundModeOpacity..[[' fill-rule='evenodd'/%3E%3C/svg%3E\");]]elseif Z==\"plus\"then e=[[background-image: url(\"data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23]]..bgColor..[[' fill-opacity=']]..BackgroundModeOpacity..[['%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E\");]]elseif Z==\"signal\"then e=[[background-image: url(\"data:image/svg+xml,%3Csvg width='84' height='48' viewBox='0 0 84 48' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h12v6H0V0zm28 8h12v6H28V8zm14-8h12v6H42V0zm14 0h12v6H56V0zm0 8h12v6H56V8zM42 8h12v6H42V8zm0 16h12v6H42v-6zm14-8h12v6H56v-6zm14 0h12v6H70v-6zm0-16h12v6H70V0zM28 32h12v6H28v-6zM14 16h12v6H14v-6zM0 24h12v6H0v-6zm0 8h12v6H0v-6zm14 0h12v6H14v-6zm14 8h12v6H28v-6zm-14 0h12v6H14v-6zm28 0h12v6H42v-6zm14-8h12v6H56v-6zm0-8h12v6H56v-6zm14 8h12v6H70v-6zm0 8h12v6H70v-6zM14 24h12v6H14v-6zm14-8h12v6H28v-6zM14 8h12v6H14V8zM0 8h12v6H0V8z' fill='%23]]..bgColor..[[' fill-opacity=']]..BackgroundModeOpacity..[[' fill-rule='evenodd'/%3E%3C/svg%3E\");]]elseif Z==\"deathstar\"then e=[[background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='105' viewBox='0 0 80 105'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%23]]..bgColor..[[' fill-opacity=']]..BackgroundModeOpacity..[['%3E%3Cpath d='M20 10a5 5 0 0 1 10 0v50a5 5 0 0 1-10 0V10zm15 35a5 5 0 0 1 10 0v50a5 5 0 0 1-10 0V45zM20 75a5 5 0 0 1 10 0v20a5 5 0 0 1-10 0V75zm30-65a5 5 0 0 1 10 0v50a5 5 0 0 1-10 0V10zm0 65a5 5 0 0 1 10 0v20a5 5 0 0 1-10 0V75zM35 10a5 5 0 0 1 10 0v20a5 5 0 0 1-10 0V10zM5 45a5 5 0 0 1 10 0v50a5 5 0 0 1-10 0V45zm0-35a5 5 0 0 1 10 0v20a5 5 0 0 1-10 0V10zm60 35a5 5 0 0 1 10 0v50a5 5 0 0 1-10 0V45zm0-35a5 5 0 0 1 10 0v20a5 5 0 0 1-10 0V10z' /%3E%3C/g%3E%3C/g%3E%3C/svg%3E\");]]elseif Z==\"diamond\"then e=[[background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='32' viewBox='0 0 16 32'%3E%3Cg fill='%23]]..bgColor..[[' fill-opacity=']]..BackgroundModeOpacity..[['%3E%3Cpath fill-rule='evenodd' d='M0 24h4v2H0v-2zm0 4h6v2H0v-2zm0-8h2v2H0v-2zM0 0h4v2H0V0zm0 4h2v2H0V4zm16 20h-6v2h6v-2zm0 4H8v2h8v-2zm0-8h-4v2h4v-2zm0-20h-6v2h6V0zm0 4h-4v2h4V4zm-2 12h2v2h-2v-2zm0-8h2v2h-2V8zM2 8h10v2H2V8zm0 8h10v2H2v-2zm-2-4h14v2H0v-2zm4-8h6v2H4V4zm0 16h6v2H4v-2zM6 0h2v2H6V0zm0 24h2v2H6v-2z'/%3E%3C/g%3E%3C/svg%3E\");]]elseif Z==\"hexagon\"then e=[[background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='49' viewBox='0 0 28 49'%3E%3Cg fill-rule='evenodd'%3E%3Cg id='hexagons' fill='%23]]..bgColor..[[' fill-opacity=']]..BackgroundModeOpacity..[[' fill-rule='nonzero'%3E%3Cpath d='M13.99 9.25l13 7.5v15l-13 7.5L1 31.75v-15l12.99-7.5zM3 17.9v12.7l10.99 6.34 11-6.35V17.9l-11-6.34L3 17.9zM0 15l12.98-7.5V0h-2v6.35L0 12.69v2.3zm0 18.5L12.98 41v8h-2v-6.85L0 35.81v-2.3zM15 0v7.5L27.99 15H28v-2.31h-.01L17 6.35V0h-2zm0 49v-8l12.99-7.5H28v2.31h-.01L17 42.15V49h-2z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E\");]]elseif Z==\"capsule\"then e=[[background-image: url(\"data:image/svg+xml,%3Csvg width='32' height='26' viewBox='0 0 32 26' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14 0v3.994C14 7.864 10.858 11 7 11c-3.866 0-7-3.138-7-7.006V0h2v4.005C2 6.765 4.24 9 7 9c2.756 0 5-2.236 5-4.995V0h2zm0 26v-5.994C14 16.138 10.866 13 7 13c-3.858 0-7 3.137-7 7.006V26h2v-6.005C2 17.235 4.244 15 7 15c2.76 0 5 2.236 5 4.995V26h2zm2-18.994C16 3.136 19.142 0 23 0c3.866 0 7 3.138 7 7.006v9.988C30 20.864 26.858 24 23 24c-3.866 0-7-3.138-7-7.006V7.006zm2-.01C18 4.235 20.244 2 23 2c2.76 0 5 2.236 5 4.995v10.01C28 19.765 25.756 22 23 22c-2.76 0-5-2.236-5-4.995V6.995z' fill='%23]]..bgColor..[[' fill-opacity=']]..BackgroundModeOpacity..[[' fill-rule='evenodd'/%3E%3C/svg%3E\");]]elseif Z==\"diagonal\"then e=[[background-image: url(\"data:image/svg+xml,%3Csvg width='6' height='6' viewBox='0 0 6 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23]]..bgColor..[[' fill-opacity=']]..BackgroundModeOpacity..[[' fill-rule='evenodd'%3E%3Cpath d='M5 0h1L0 6V5zM6 5v1H5z'/%3E%3C/g%3E%3C/svg%3E\");]]end;return e end;function GetContentDamageHUDOutput()local a0=300;local a1=165;if#damagedElements>0 or#brokenElements>0 then a1=510 end;local e=\"\"e=e..[[\n \n ]]e=e..[[]]..[[]]..[[]]..[[]]..(YourShipsName==\"Enter here\"and\"Ship ID \"..ShipID or YourShipsName)..[[]]..[[]]if#brokenElements>0 then e=e..[[]]elseif#damagedElements>0 then e=e..[[]]else e=e..[[]]end;if#damagedElements>0 or#brokenElements>0 then e=e..[[Total Damage]]..[[]]..GenerateCommaValue(string.format(\"%.0f\",totalShipMaxHP-totalShipHP))..[[]]e=e..[[T]]..ScrapTier..[[ Scrap Needed]]..[[]]..getScraps(totalShipMaxHP-totalShipHP,true)..[[]]e=e..[[Repair Time]]..[[]]..getRepairTime(totalShipMaxHP-totalShipHP,true)..[[]]e=e..[[]]..[[]]..[[]]..#healthyElements..[[]]..[[]]..[[]]..#damagedElements..[[]]..[[]]..[[]]..#brokenElements..[[]]local u=0;for a2=hudStartIndex,hudStartIndex+9,1 do if rE[a2]~=nil then v=rE[a2]if v.hp>0 then e=e..[[]]..[[]]..string.format(\"%.30s\",v.name)..[[]]..[[]]..GenerateCommaValue(string.format(\"%.0f\",v.missinghp))..[[]]if v.id==highlightID then e=e..[[]]..[[]]..string.format(\"%.30s\",v.name)..[[]]..[[]]..GenerateCommaValue(string.format(\"%.0f\",v.missinghp))..[[]]end else e=e..[[]]..[[]]..string.format(\"%.30s\",v.name)..[[]]..[[]]..GenerateCommaValue(string.format(\"%.0f\",v.missinghp))..[[]]if v.id==highlightID then highlightX=elementPosition.x-coreWorldOffset;highlightY=elementPosition.y-coreWorldOffset;highlightZ=elementPosition.z-coreWorldOffset;e=e..[[]]..[[]]..string.format(\"%.30s\",v.name)..[[]]..[[]]..GenerateCommaValue(string.format(\"%.0f\",v.missinghp))..[[]]end end;u=u+1 end end;if DisallowKeyPresses==true then e=e..[[]]..[[]]..[[]]..[[]]..[[]]..[[]]..[[Keypresses disabled.]]..[[Change in LUA parameters]]..[[by unchecking DisallowKeyPresses.]]..[[]]..[[]]..[[]]else e=e..[[]]..[[]]..[[]]..[[]]..[[Up/down arrows to highlight]]..[[CTRL + arrows to move HUD]]..[[Left arrow to toggle HUD Mode]]..[[ALT+1-4 to set Scrap Tier]]..[[ALT+8 to reset HUD position]]..[[ALT+9 to shut script off]]..[[]]..[[]]end else if DisallowKeyPresses==true then e=e..[[]]..OkayCenterMessage..[[]]..[[]]..#healthyElements..[[ elements / ]]..GenerateCommaValue(string.format(\"%.0f\",totalShipMaxHP))..[[ HP.]]..[[]]..[[]]..[[]]..[[]]..[[Keypresses disabled.]]..[[Change in LUA parameters]]..[[by unchecking DisallowKeyPresses.]]..[[]]..[[]]..[[]]else e=e..[[]]..OkayCenterMessage..[[]]..[[]]..#healthyElements..[[ elements / ]]..GenerateCommaValue(string.format(\"%.0f\",totalShipMaxHP))..[[ HP.]]..[[]]..[[]]..[[]]..[[]]..[[Left arrow to toggle HUD Mode]]..[[CTRL + arrows to move HUD]]..[[ALT+8 to reset HUD position]]..[[ALT+9 to shut script off]]..[[]]..[[]]end end;e=e..[[]]return e end;function GetContentDamageScreen()local a3=\"\"if#damagedElements>0 then local a4=#damagedElements;if a4>DamagePageSize then a4=DamagePageSize end;if CurrentDamagedPage==math.ceil(#damagedElements/DamagePageSize)then a4=#damagedElements%DamagePageSize+12;if a4>12 then a4=a4-12 end end;a3=a3 ..[[]]a3=a3 ..[[]]if UseMyElementNames==true then a3=a3 ..[[Damaged Name]]else a3=a3 ..[[Damaged Type]]end;a3=a3 ..[[HLTHDMG]]a3=a3 ..[[T]]..ScrapTier..[[ SCRREPTIME]]AddClickArea(\"damage\",{id=\"SwitchScrapTier\",mode=\"damage\",x1=650,x2=775,y1=315,y2=360})local g=0;for u=1+(CurrentDamagedPage-1)*DamagePageSize,a4+(CurrentDamagedPage-1)*DamagePageSize,1 do g=g+1;local a5=damagedElements[u]if UseMyElementNames==true then a3=a3 ..[[]]..string.format(\"%.23s\",a5.name)..[[]]else a3=a3 ..[[]]..string.format(\"%.23s\",a5.type)..[[]]end;a3=a3 ..[[]]..a5.percent..[[%]]..[[]]..GenerateCommaValue(string.format(\"%.0f\",a5.missinghp),true)..[[]]..[[]]..getScraps(a5.missinghp,true)..[[]]..[[]]..getRepairTime(a5.missinghp,true)..[[]]..[[]]end;if#damagedElements>DamagePageSize then a3=a3 ..[[Page ]]..CurrentDamagedPage..\" of \"..math.ceil(#damagedElements/DamagePageSize)..[[]]if CurrentDamagedPage\n \n \n ]]AddClickArea(\"damage\",{id=\"DamagedPageDown\",mode=\"damage\",x1=65,x2=260,y1=290+(a4+1)*50,y2=290+50+(a4+1)*50})else DisableClickArea(\"DamagedPageDown\",\"damage\")end;if CurrentDamagedPage>1 then a3=a3 ..[[\n \n \n ]]AddClickArea(\"damage\",{id=\"DamagedPageUp\",mode=\"damage\",x1=750,x2=950,y1=290+(a4+1)*50,y2=290+50+(a4+1)*50})else DisableClickArea(\"DamagedPageUp\",\"damage\")end end end;if#brokenElements>0 then local a6=#brokenElements;if a6>DamagePageSize then a6=DamagePageSize end;if CurrentBrokenPage==math.ceil(#brokenElements/DamagePageSize)then a6=#brokenElements%DamagePageSize+12;if a6>12 then a6=a6-12 end end;a3=a3 ..[[]]a3=a3 ..[[]]if UseMyElementNames==true then a3=a3 ..[[Broken Name]]else a3=a3 ..[[Broken Type]]end;a3=a3 ..[[DMG]]a3=a3 ..[[T]]..ScrapTier..[[ SCRREPTIME]]AddClickArea(\"damage\",{id=\"SwitchScrapTier2\",mode=\"damage\",x1=1570,x2=1690,y1=315,y2=360})local g=0;for u=1+(CurrentBrokenPage-1)*DamagePageSize,a6+(CurrentBrokenPage-1)*DamagePageSize,1 do g=g+1;local a5=brokenElements[u]if UseMyElementNames==true then a3=a3 ..[[]]..string.format(\"%.30s\",a5.name)..[[]]else a3=a3 ..[[]]..string.format(\"%.30s\",a5.type)..[[]]end;a3=a3 ..[[]]..GenerateCommaValue(string.format(\"%.0f\",a5.missinghp),true)..[[]]..[[]]..getScraps(a5.missinghp,true)..[[]]..[[]]..getRepairTime(a5.missinghp,true)..[[]]..[[]]end;if#brokenElements>DamagePageSize then a3=a3 ..[[Page ]]..CurrentBrokenPage..\" of \"..math.ceil(#brokenElements/DamagePageSize)..[[]]if CurrentBrokenPage>1 then a3=a3 ..[[\n \n \n ]]AddClickArea(\"damage\",{id=\"BrokenPageUp\",mode=\"damage\",x1=1665,x2=1865,y1=290+(a6+1)*50,y2=290+50+(a6+1)*50})else DisableClickArea(\"BrokenPageUp\",\"damage\")end;if CurrentBrokenPage\n \n \n ]]AddClickArea(\"damage\",{id=\"BrokenPageDown\",mode=\"damage\",x1=980,x2=1180,y1=290+(a6+1)*50,y2=290+50+(a6+1)*50})else DisableClickArea(\"BrokenPageDown\",\"damage\")end end end;if#damagedElements>0 or#brokenElements>0 then local a7=math.floor(1878/#elementsIdList*#damagedElements)local a8=math.floor(1878/#elementsIdList*#brokenElements)local a9=1878-a7-a8+1;a3=a3 ..[[]]a3=a3 ..[[]]a3=a3 ..[[]]a3=a3 ..[[]]if#damagedElements>0 then a3=a3 ..[[]]..#damagedElements..[[]]end;if#healthyElements>0 then a3=a3 ..[[]]..#healthyElements..[[]]end;if#brokenElements>0 then a3=a3 ..[[]]..#brokenElements..[[]]end;a3=a3 ..[[]]a3=a3 ..[[]]..GenerateCommaValue(string.format(\"%.0f\",totalShipMaxHP-totalShipHP))..[[ HP damage in total ]]..getScraps(totalShipMaxHP-totalShipHP,true)..[[ T]]..ScrapTier..[[ scraps needed. ]]..getRepairTime(totalShipMaxHP-totalShipHP,true)..[[ projected repair time.]]else a3=a3 ..GetElementLogo(812,380,\"ch\",\"ch\",\"ch\")..[[]]..OkayCenterMessage..[[]]..[[]]..#healthyElements..[[ elements stand ]]..GenerateCommaValue(string.format(\"%.0f\",totalShipMaxHP))..[[ HP strong.]]end;forceDamageRedraw=false;return a3 end;function ActionStopengines()if DisallowKeyPresses==true then return end;ToggleHUD()end;function ActionStrafeRight()if DisallowKeyPresses==true then return end;if KeyCTRLPressed==true then if HUDShiftU<4000 then HUDShiftU=HUDShiftU+50;SaveToDatabank()RenderScreens()end else HudDeselectElement()end end;function ActionStrafeLeft()if DisallowKeyPresses==true then return end;if KeyCTRLPressed==true then if HUDShiftU>=50 then HUDShiftU=HUDShiftU-50;SaveToDatabank()RenderScreens()end else ToggleHUD()end end;function ActionDown()if DisallowKeyPresses==true then return end;if KeyCTRLPressed==true then if HUDShiftV<4000 then HUDShiftV=HUDShiftV+50;SaveToDatabank()RenderScreens()end else ChangeHudSelectedElement(1)end end;function ActionUp()if DisallowKeyPresses==true then return end;if KeyCTRLPressed==true then if HUDShiftV>=50 then HUDShiftV=HUDShiftV-50;SaveToDatabank()RenderScreens()end else ChangeHudSelectedElement(-1)end end;function ActionOption1()if DisallowKeyPresses==true then return end;ScrapTier=1;SetRefresh(\"damage\")RenderScreens(\"damage\")end;function ActionOption2()if DisallowKeyPresses==true then return end;ScrapTier=2;SetRefresh(\"damage\")RenderScreens(\"damage\")end;function ActionOption3()if DisallowKeyPresses==true then return end;ScrapTier=3;SetRefresh(\"damage\")RenderScreens(\"damage\")end;function ActionOption4()if DisallowKeyPresses==true then return end;ScrapTier=4;SetRefresh(\"damage\")RenderScreens(\"damage\")end;function ActionOption8()if DisallowKeyPresses==true then return end;HUDShiftU=0;HUDShiftV=0;SetRefresh(\"damage\")RenderScreens(\"damage\")end;function ActionOption9()if DisallowKeyPresses==true then return end;SaveToDatabank()SwitchScreens(\"off\")unit.exit()end","filter":{"args":[],"signature":"start()","slotKey":"-1"},"key":"8"},{"code":"SaveToDatabank()\nSwitchScreens(\"off\")","filter":{"args":[],"signature":"stop()","slotKey":"-1"},"key":"9"},{"code":"OnTickData()\n","filter":{"args":[{"value":"UpdateData"}],"signature":"tick(timerId)","slotKey":"-1"},"key":"10"},{"code":"ToggleHighlight()","filter":{"args":[{"value":"UpdateHighlight"}],"signature":"tick(timerId)","slotKey":"-1"},"key":"11"},{"code":"--[[\n Damage Report 3.31\n A LUA script for Dual Universe\n\n Created By Dorian Gray\n Ingame: DorianGray\n Discord: Dorian Gray#2623\n\n You can find/update this script on GitHub. Explanations, installation and usage information as well as screenshots can be found there too.\n GitHub: https://github.com/DorianTheGrey/DU-DamageReport\n\n GNU Public License 3.0. Use whatever you want, be so kind to leave credit.\n \n Credits & thanks: \n Thanks to Bayouking1 and kalazzerx for managing their forks of this script during my long absence to support the community. :)\n Thanks to Bayouking1 for fixing rocket fuel calculations.\n Thanks to NovaQuark for creating the MMO of the century.\n Thanks to Jericho, Dmentia and Archaegeo for learning a lot from their fine scripts.\n Thanks to TheBlacklist for testing and wonderful suggestions.\n SVG patterns by Hero Patterns.\n DU atlas data from Jayle Break.\n \n]]\n\nYourShipsName = \"Enter here\" --export Enter your ship name here if you want it displayed instead of the ship's ID. YOU NEED TO LEAVE THE QUOTATION MARKS.\n\nSkillRepairToolEfficiency = 0 --export Enter (0-5) your talent \"Mining and Inventory -> Equipment Manager -> Repair Tool Efficiency\"\nSkillRepairToolOptimization = 0 --export Enter your talent \"Mining and Inventory -> Equipment Manager -> Repair Tool Optimization\"\n\nStatAtmosphericFuelTankHandling = 0 --export (0-5) Enter the LEVEL OF YOUR PLACED ATMOSPHERIC FUEL TANKS (from the builders talent \"Piloting -> Atmospheric Flight Technician -> Atmospheric Fuel-Tank Handling\")\nStatSpaceFuelTankHandling = 0 --export (0-5) Enter the LEVEL OF YOUR PLACED FUEL SPACE TANKS (from the builders talent \"Piloting -> Atmospheric Engine Technician -> Space Fuel-Tank Handling\")\nStatRocketFuelTankHandling = 0 --export (0-5) Enter the LEVEL OF YOUR PLACED FUEL ROCKET TANKS (from the builders talent \"Piloting -> Rocket Scientist -> Rocket Booster Fuel Tank Handling\")\nStatContainerOptimization = 0 --export (0-5) Enter the LEVEL OF YOUR PLACED FUEL TANKS \"from the builders talent Mining and Inventory -> Stock Control -> Container Optimization\"\nStatFuelTankOptimization = 0 --export (0-5) Enter the LEVEL OF YOUR PLACED FUEL TANKS \"from the builders talent Mining and Inventory -> Stock Control -> Fuel Tank Optimization\"\n\nShowWelcomeMessage = true --export Do you want the welcome message on the start screen with your name?\nDisallowKeyPresses = false --export Need your keys for other scripts/huds and want to prevent Damage Report keypresses to be processed? Then check this. (Usability of the HUD mode will be small.)\nAddSummertimeHour = false --export: Is summertime currently enabled in your location? (Adds one hour.)\n\nUpdateDataInterval=1.0;HighlightBlinkingInterval=0.5;ColorPrimary=\"FF6700\"ColorSecondary=\"FFFFFF\"ColorTertiary=\"000000\"ColorHealthy=\"00FF00\"ColorWarning=\"FFFF00\"ColorCritical=\"FF0000\"ColorBackground=\"000000\"ColorBackgroundPattern=\"4F4F4F\"ColorFuelAtmospheric=\"004444\"ColorFuelSpace=\"444400\"ColorFuelRocket=\"440044\"VERSION=3.31;DebugMode=false;DebugRenderClickareas=true;DBData={}core=nil;db=nil;screens={}dscreens={}Warnings={}screenModes={[\"flight\"]={id=\"flight\"},[\"damage\"]={id=\"damage\"},[\"damageoutline\"]={id=\"damageoutline\"},[\"fuel\"]={id=\"fuel\"},[\"cargo\"]={id=\"cargo\"},[\"agg\"]={id=\"agg\"},[\"map\"]={id=\"map\"},[\"time\"]={id=\"time\",activetoggle=\"true\"},[\"settings1\"]={id=\"settings1\"},[\"startup\"]={id=\"startup\"}}backgroundModes={\"deathstar\",\"capsule\",\"rain\",\"signal\",\"hexagon\",\"diagonal\",\"diamond\",\"plus\",\"dots\"}BackgroundMode=\"deathstar\"BackgroundSelected=1;BackgroundModeOpacity=0.25;SaveVars={\"dscreens\",\"ColorPrimary\",\"ColorSecondary\",\"ColorTertiary\",\"ColorHealthy\",\"ColorWarning\",\"ColorCritical\",\"ColorBackground\",\"ColorBackgroundPattern\",\"ColorFuelAtmospheric\",\"ColorFuelSpace\",\"ColorFuelRocket\",\"ScrapTier\",\"HUDMode\",\"SimulationMode\",\"DMGOStretch\",\"HUDShiftU\",\"HUDShiftV\",\"colorIDIndex\",\"colorIDTable\",\"BackgroundMode\",\"BackgroundSelected\",\"BackgroundModeOpacity\"}HUDMode=false;HUDShiftU=0;HUDShiftV=0;hudSelectedIndex=0;hudStartIndex=1;hudArrowSticker={}highlightOn=false;highlightID=0;highlightX=0;highlightY=0;highlightZ=0;SimulationMode=false;OkayCenterMessage=\"All systems nominal.\"CurrentDamagedPage=1;CurrentBrokenPage=1;DamagePageSize=12;ScrapTier=1;totalScraps=0;ScrapTierRepairTimes={10,50,250,1250}coreWorldOffset=0;totalShipHP=0;formerTotalShipHP=-1;totalShipMaxHP=0;totalShipIntegrity=100;elementsId={}elementsIdList={}damagedElements={}brokenElements={}rE={}healthyElements={}typeElements={}ElementCounter=0;UseMyElementNames=true;dmgoElements={}DMGOMaxElements=250;DMGOStretch=false;ShipXmin=99999999;ShipXmax=-99999999;ShipYmin=99999999;ShipYmax=-99999999;ShipZmin=99999999;ShipZmax=-99999999;totalShipMass=0;formerTotalShipMass=-1;formerTime=-1;FuelAtmosphericTanks={}FuelSpaceTanks={}FuelRocketTanks={}FuelAtmosphericTotal=0;FuelSpaceTotal=0;FuelRocketTotal=0;FuelAtmosphericCurrent=0;FuelSpaceTotalCurrent=0;FuelRocketTotalCurrent=0;formerFuelAtmosphericTotal=-1;formerFuelSpaceTotal=-1;formerFuelRocketTotal=-1;hexTable={\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"A\",\"B\",\"C\",\"D\",\"E\",\"F\"}colorIDIndex=1;colorIDTable={[1]={id=\"ColorPrimary\",desc=\"Main HUD Color\",basec=\"FF6700\",newc=\"FF6700\"},[2]={id=\"ColorSecondary\",desc=\"Secondary HUD Color\",basec=\"FFFFFF\",newc=\"FFFFFF\"},[3]={id=\"ColorTertiary\",desc=\"Tertiary HUD Color\",basec=\"000000\",newc=\"000000\"},[4]={id=\"ColorHealthy\",desc=\"Color code for Healthy/Okay\",basec=\"00FF00\",newc=\"00FF00\"},[5]={id=\"ColorWarning\",desc=\"Color code for Damaged/Warning\",basec=\"FFFF00\",newc=\"FFFF00\"},[6]={id=\"ColorCritical\",desc=\"Color code for Broken/Critical\",basec=\"FF0000\",newc=\"FF0000\"},[7]={id=\"ColorBackground\",desc=\"Background Color\",basec=\"000000\",newc=\"000000\"},[8]={id=\"ColorBackgroundPattern\",desc=\"Background Pattern Color\",basec=\"4F4F4F\",newc=\"4F4F4F\"},[9]={id=\"ColorFuelAtmospheric\",desc=\"Color for Atmo Fuel/Elements\",basec=\"004444\",newc=\"004444\"},[10]={id=\"ColorFuelSpace\",desc=\"Color for Space Fuel/Elements\",basec=\"444400\",newc=\"444400\"},[11]={id=\"ColorFuelRocket\",desc=\"Color for Rocket Fuel/Elements\",basec=\"440044\",newc=\"440044\"}}function InitiateSlots()for a,b in pairs(unit)do if type(b)==\"table\"and type(b.export)==\"table\"and b.getElementClass then local c=b.getElementClass():lower()if c:find(\"coreunit\")then core=b;local d=core.getMaxHitPoints()if d>10000 then coreWorldOffset=128 elseif d>1000 then coreWorldOffset=64 elseif d>150 then coreWorldOffset=32 else coreWorldOffset=16 end elseif c=='databankunit'then db=b elseif c==\"screenunit\"then local e=\"startup\"screens[#screens+1]={element=b,id=b.getId(),mode=e,submode=\"\",ClickAreas={},refresh=true,active=false,fuelA=true,fuelS=true,fuelR=true,fuelIndex=1}end end end end;function LoadFromDatabank()if db==nil then return else for f,g in pairs(SaveVars)do if db.hasKey(g)then local h=json.decode(db.getStringValue(g))if h~=nil then if g==\"YourShipsName\"or g==\"AddSummertimeHour\"or g==\"UpdateDataInterval\"or g==\"HighlightBlinkingInterval\"or g==\"SkillRepairToolEfficiency\"or g==\"SkillRepairToolOptimization\"or g==\"SkillAtmosphericFuelEfficiency\"or g==\"SkillSpaceFuelEfficiency\"or g==\"SkillRocketFuelEfficiency\"or g==\"StatAtmosphericFuelTankHandling\"or g==\"StatSpaceFuelTankHandling\"or g==\"StatRocketFuelTankHandling\"then else _G[g]=h end end end end;for i,j in ipairs(screens)do for k,l in ipairs(dscreens)do if screens[i].id==dscreens[k].id then screens[i].mode=dscreens[k].mode;screens[i].submode=dscreens[k].submode;screens[i].active=dscreens[k].active;screens[i].refresh=true;screens[i].fuelA=dscreens[k].fuelA;screens[i].fuelS=dscreens[k].fuelS;screens[i].fuelR=dscreens[k].fuelR;screens[i].fuelIndex=dscreens[k].fuelIndex end end end end end;function SaveToDatabank()if db==nil then return else dscreens={}for i,m in ipairs(screens)do dscreens[i]={}dscreens[i].id=m.id;dscreens[i].mode=m.mode;dscreens[i].submode=m.submode;dscreens[i].active=m.active;dscreens[i].fuelA=m.fuelA;dscreens[i].fuelS=m.fuelS;dscreens[i].fuelR=m.fuelR;dscreens[i].fuelIndex=m.fuelIndex end;db.clear()for f,g in pairs(SaveVars)do db.setStringValue(g,json.encode(_G[g]))end end end;function InitiateScreens()if screens~=nil and#screens>0 then for i=1,#screens,1 do screens[i]=CreateClickAreasForScreen(screens[i])end end end;function UpdateTypeData()FuelAtmosphericTanks={}FuelSpaceTanks={}FuelRocketTanks={}FuelAtmosphericTotal=0;FuelAtmosphericCurrent=0;FuelSpaceTotal=0;FuelSpaceCurrent=0;FuelRocketCurrent=0;FuelRocketTotal=0;local n=4;local o=6;local p=0.8;if StatContainerOptimization>0 then n=n-0.05*StatContainerOptimization*n;o=o-0.05*StatContainerOptimization*o;p=p-0.05*StatContainerOptimization*p end;if StatFuelTankOptimization>0 then n=n-0.05*StatFuelTankOptimization*n;o=o-0.05*StatFuelTankOptimization*o;p=p-0.05*StatFuelTankOptimization*p end;for i,q in ipairs(typeElements)do local r=core.getElementNameById(q)or\"\"local s=core.getElementTypeById(q)or\"\"local t=core.getElementPositionById(q)or 0;local u=core.getElementHitPointsById(q)or 0;local v=core.getElementMaxHitPointsById(q)or 0;local w=core.getElementMassById(q)or 0;local x=\"\"local y=0;local z=0;local A=0;local B=0;if s==\"Atmospheric Fuel Tank\"then if v>10000 then x=\"L\"z=5480;y=12800 elseif v>1300 then x=\"M\"z=988.67;y=1600 elseif v>150 then x=\"S\"z=182.67;y=400 else x=\"XS\"z=35.03;y=100 end;if StatAtmosphericFuelTankHandling>0 then y=0.2*StatAtmosphericFuelTankHandling*y+y end;A=w-z;if A<=10 then A=0 end;B=string.format(\"%.0f\",A/n)cPercent=string.format(\"%.1f\",math.floor(100/y*tonumber(B)))table.insert(FuelAtmosphericTanks,{type=1,id=q,name=r,maxhp=v,hp=GetHPforElement(q),pos=t,size=x,mass=z,vol=y,cvol=B,percent=cPercent})if u>0 then FuelAtmosphericCurrent=FuelAtmosphericCurrent+B end;FuelAtmosphericTotal=FuelAtmosphericTotal+y elseif s==\"Space Fuel Tank\"then if v>10000 then x=\"L\"z=5480;y=12800 elseif v>1300 then x=\"M\"z=988.67;y=1600 else x=\"S\"z=182.67;y=400 end;if StatSpaceFuelTankHandling>0 then y=0.2*StatSpaceFuelTankHandling*y+y end;A=w-z;if A<=10 then A=0 end;B=string.format(\"%.0f\",A/o)cPercent=string.format(\"%.1f\",100/y*tonumber(B))table.insert(FuelSpaceTanks,{type=2,id=q,name=r,maxhp=v,hp=GetHPforElement(q),pos=t,size=x,mass=z,vol=y,cvol=B,percent=cPercent})if u>0 then FuelSpaceCurrent=FuelSpaceCurrent+B end;FuelSpaceTotal=FuelSpaceTotal+y elseif s==\"Rocket Fuel Tank\"then if v>65000 then x=\"L\"z=25740;y=50000 elseif v>6000 then x=\"M\"z=4720;y=6400 elseif v>700 then x=\"S\"z=886.72;y=800 else x=\"XS\"z=173.42;y=400 end;if StatRocketFuelTankHandling>0 then y=0.1*StatRocketFuelTankHandling*y+y end;A=w-z;if A<=10 then A=0 end;B=string.format(\"%.0f\",A/p)cPercent=string.format(\"%.1f\",100/y*tonumber(B))table.insert(FuelRocketTanks,{type=3,id=q,name=r,maxhp=v,hp=GetHPforElement(q),pos=t,size=x,mass=z,vol=y,cvol=B,percent=cPercent})if u>0 then FuelRocketCurrent=FuelRocketCurrent+B end;FuelRocketTotal=FuelRocketTotal+y end end;if FuelAtmosphericCurrent~=formerFuelAtmosphericCurrent then SetRefresh(\"fuel\")formerFuelAtmosphericCurrent=FuelAtmosphericCurrent end;if FuelSpaceCurrent~=formerFuelSpaceCurrent then SetRefresh(\"fuel\")formerFuelSpaceCurrent=FuelSpaceCurrent end;if FuelRocketCurrent~=formerFuelRocketCurrent then SetRefresh(\"fuel\")formerFuelRocketCurrent=FuelRocketCurrent end end;function UpdateDamageData(C)C=C or false;if SimulationActive==true then return end;local formerTotalShipHP=totalShipHP;totalShipHP=0;totalShipMaxHP=0;totalShipIntegrity=100;damagedElements={}brokenElements={}healthyElements={}if C==true then typeElements={}end;ElementCounter=0;elementsIdList=core.getElementIdList()for i,q in pairs(elementsIdList)do ElementCounter=ElementCounter+1;local r=core.getElementNameById(q)local s=core.getElementTypeById(q)local t=core.getElementPositionById(q)local u=core.getElementHitPointsById(q)local v=core.getElementMaxHitPointsById(q)if SimulationMode==true then SimulationActive=true;local D=math.random(0,10)if D<2 and#brokenElements<30 then u=0 elseif D>=2 and D<4 and#damagedElements<30 then u=math.random(1,math.ceil(v))else u=v end end;totalShipHP=totalShipHP+u;totalShipMaxHP=totalShipMaxHP+v;if v-u>constants.epsilon then if u>0 then table.insert(damagedElements,{id=q,name=r,type=s,counter=ElementCounter,hp=u,maxhp=v,missinghp=v-u,percent=math.ceil(100/v*u),pos=t})else table.insert(brokenElements,{id=q,name=r,type=s,counter=ElementCounter,hp=u,maxhp=v,missinghp=v-u,percent=0,pos=t})end else table.insert(healthyElements,{id=q,name=r,type=s,counter=ElementCounter,hp=u,maxhp=v,pos=t})if q==highlightID then highlightID=0;highlightOn=false;HideHighlight()hudSelectedIndex=0 end end;if C==true then if s==\"Atmospheric Fuel Tank\"or s==\"Space Fuel Tank\"or s==\"Rocket Fuel Tank\"then table.insert(typeElements,q)end end end;SortDamageTables()rE={}if#brokenElements>0 then for f,j in ipairs(brokenElements)do table.insert(rE,{id=j.id,missinghp=j.missinghp,hp=j.hp,name=j.name,type=j.type,pos=j.pos})end end;if#damagedElements>0 then for f,j in ipairs(damagedElements)do table.insert(rE,{id=j.id,missinghp=j.missinghp,hp=j.hp,name=j.name,type=j.type,pos=j.pos})end end;if#rE>0 then table.sort(rE,function(E,F)return E.missinghp>F.missinghp end)end;totalShipIntegrity=string.format(\"%2.0f\",100/totalShipMaxHP*totalShipHP)if formerTotalShipHP~=totalShipHP then forceDamageRedraw=true;formerTotalShipHP=totalShipHP else forceDamageRedraw=false end end;function GetHPforElement(q)for i,j in ipairs(brokenElements)do if j.id==q then return 0 end end;for i,j in ipairs(damagedElements)do if j.id==q then return j.hp end end;for i,j in ipairs(healthyElements)do if j.id==q then return j.maxhp end end end;function UpdateClickArea(G,H,I)for i,m in ipairs(screens)do for J,j in pairs(screens[i].ClickAreas)do if j.id==G and j.mode==I then screens[i].ClickAreas[J]=H end end end end;function AddClickArea(I,H)for i,m in ipairs(screens)do if screens[i].mode==I then table.insert(screens[i].ClickAreas,H)end end end;function AddClickAreaForScreenID(K,H)for i,m in ipairs(screens)do if screens[i].id==K then table.insert(screens[i].ClickAreas,H)end end end;function DisableClickArea(G,I)UpdateClickArea(G,{id=G,mode=I,x1=-1,x2=-1,y1=-1,y2=-1})end;function SetRefresh(I,L)I=I or\"all\"L=L or\"all\"if screens~=nil and#screens>0 then for i=1,#screens,1 do if screens[i].mode==I or I==\"all\"then if screens[i].submode==L or L==\"all\"then screens[i].refresh=true end end end end end;function WipeClickAreasForScreen(m)m.ClickAreas={}return m end;function CreateBaseClickAreas(m)table.insert(m.ClickAreas,{mode=\"all\",id=\"ToggleHudMode\",x1=1537,x2=1728,y1=1015,y2=1075})table.insert(m.ClickAreas,{mode=\"all\",id=\"ButtonPress\",param=\"damage\",x1=193,x2=384,y1=1015,y2=1075})table.insert(m.ClickAreas,{mode=\"all\",id=\"ButtonPress\",param=\"damageoutline\",x1=385,x2=576,y1=1015,y2=1075})table.insert(m.ClickAreas,{mode=\"all\",id=\"ButtonPress\",param=\"fuel\",x1=577,x2=768,y1=1015,y2=1075})table.insert(m.ClickAreas,{mode=\"all\",id=\"ButtonPress\",param=\"time\",x1=0,x2=192,y1=1015,y2=1075})table.insert(m.ClickAreas,{mode=\"all\",id=\"ButtonPress\",param=\"settings1\",x1=1729,x2=1920,y1=1015,y2=1075})return m end;function CreateClickAreasForScreen(m)if m==nil then return{}end;if m.mode==\"flight\"then elseif m.mode==\"damage\"then table.insert(m.ClickAreas,{mode=\"damage\",id=\"ToggleElementLabel\",x1=70,x2=425,y1=325,y2=355})table.insert(m.ClickAreas,{mode=\"damage\",id=\"ToggleElementLabel2\",x1=980,x2=1400,y1=325,y2=355})elseif m.mode==\"damageoutline\"then table.insert(m.ClickAreas,{mode=\"damageoutline\",id=\"DMGOChangeView\",param=\"top\",x1=60,x2=439,y1=150,y2=200})table.insert(m.ClickAreas,{mode=\"damageoutline\",id=\"DMGOChangeView\",param=\"side\",x1=440,x2=824,y1=150,y2=200})table.insert(m.ClickAreas,{mode=\"damageoutline\",id=\"DMGOChangeView\",param=\"front\",x1=825,x2=1215,y1=150,y2=200})table.insert(m.ClickAreas,{mode=\"damageoutline\",id=\"DMGOChangeStretch\",x1=1530,x2=1580,y1=150,y2=200})elseif m.mode==\"fuel\"then elseif m.mode==\"cargo\"then elseif m.mode==\"agg\"then elseif m.mode==\"map\"then elseif m.mode==\"time\"then elseif m.mode==\"settings1\"then table.insert(m.ClickAreas,{mode=\"settings1\",id=\"ToggleBackground\",x1=75,x2=860,y1=170,y2=215})table.insert(m.ClickAreas,{mode=\"settings1\",id=\"PreviousBackground\",x1=75,x2=460,y1=235,y2=285})table.insert(m.ClickAreas,{mode=\"settings1\",id=\"NextBackground\",x1=480,x2=860,y1=235,y2=285})table.insert(m.ClickAreas,{mode=\"settings1\",id=\"DecreaseOpacity\",x1=75,x2=460,y1=300,y2=350})table.insert(m.ClickAreas,{mode=\"settings1\",id=\"IncreaseOpacity\",x1=480,x2=860,y1=300,y2=350})table.insert(m.ClickAreas,{mode=\"settings1\",id=\"ResetColors\",x1=75,x2=860,y1=370,y2=415})table.insert(m.ClickAreas,{mode=\"settings1\",id=\"PreviousColorID\",x1=90,x2=140,y1=500,y2=550})table.insert(m.ClickAreas,{mode=\"settings1\",id=\"NextColorID\",x1=795,x2=845,y1=500,y2=550})table.insert(m.ClickAreas,{mode=\"settings1\",id=\"ColorPosUp\",param=\"1\",x1=210,x2=290,y1=655,y2=700})table.insert(m.ClickAreas,{mode=\"settings1\",id=\"ColorPosUp\",param=\"2\",x1=300,x2=380,y1=655,y2=700})table.insert(m.ClickAreas,{mode=\"settings1\",id=\"ColorPosUp\",param=\"3\",x1=385,x2=465,y1=655,y2=700})table.insert(m.ClickAreas,{mode=\"settings1\",id=\"ColorPosUp\",param=\"4\",x1=470,x2=550,y1=655,y2=700})table.insert(m.ClickAreas,{mode=\"settings1\",id=\"ColorPosUp\",param=\"5\",x1=560,x2=640,y1=655,y2=700})table.insert(m.ClickAreas,{mode=\"settings1\",id=\"ColorPosUp\",param=\"6\",x1=645,x2=725,y1=655,y2=700})table.insert(m.ClickAreas,{mode=\"settings1\",id=\"ColorPosDown\",param=\"1\",x1=210,x2=290,y1=740,y2=780})table.insert(m.ClickAreas,{mode=\"settings1\",id=\"ColorPosDown\",param=\"2\",x1=300,x2=380,y1=740,y2=780})table.insert(m.ClickAreas,{mode=\"settings1\",id=\"ColorPosDown\",param=\"3\",x1=385,x2=465,y1=740,y2=780})table.insert(m.ClickAreas,{mode=\"settings1\",id=\"ColorPosDown\",param=\"4\",x1=470,x2=550,y1=740,y2=780})table.insert(m.ClickAreas,{mode=\"settings1\",id=\"ColorPosDown\",param=\"5\",x1=560,x2=640,y1=740,y2=780})table.insert(m.ClickAreas,{mode=\"settings1\",id=\"ColorPosDown\",param=\"6\",x1=645,x2=725,y1=740,y2=780})table.insert(m.ClickAreas,{mode=\"settings1\",id=\"ResetPosColor\",x1=160,x2=340,y1=885,y2=935})table.insert(m.ClickAreas,{mode=\"settings1\",id=\"ApplyPosColor\",x1=355,x2=780,y1=885,y2=935})elseif m.mode==\"startup\"then end;m=CreateBaseClickAreas(m)return m end;function CheckClick(M,N,O)M=M*1920;N=N*1120;O=O or\"\"HitPayload={}if screens~=nil and#screens>0 then for i=1,#screens,1 do if screens[i].active==true and screens[i].element.getMouseX()~=-1 and screens[i].element.getMouseY()~=-1 then if O==\"\"then for J,j in pairs(screens[i].ClickAreas)do if j~=nil and M>=j.x1 and M<=j.x2 and N>=j.y1 and N<=j.y2 then O=j.id;HitPayload=j;break end end end;if O==\"ButtonPress\"then if screens[i].mode==HitPayload.param then screens[i].mode=\"startup\"else screens[i].mode=HitPayload.param end;if screens[i].mode==\"damageoutline\"then if screens[i].submode==\"\"then screens[i].submode=\"top\"end end;screens[i].refresh=true;screens[i].ClickAreas={}SaveToDatabank()SetRefresh()RenderScreens()elseif O==\"ToggleBackground\"and(HitPayload.mode==screens[i].mode or HitPayload.mode==\"all\")then if BackgroundMode==\"\"then BackgroundSelected=1;BackgroundMode=backgroundModes[BackgroundSelected]else BackgroundSelected=1;BackgroundMode=\"\"end;for J,m in pairs(screens)do screens[J].refresh=true end;SaveToDatabank()SetRefresh()RenderScreens()elseif O==\"PreviousBackground\"and(HitPayload.mode==screens[i].mode or HitPayload.mode==\"all\")then if BackgroundMode==\"\"then BackgroundSelected=1;BackgroundMode=backgroundModes[BackgroundSelected]else if BackgroundSelected<=1 then BackgroundSelected=#backgroundModes else BackgroundSelected=BackgroundSelected-1 end;BackgroundMode=backgroundModes[BackgroundSelected]end;for J,m in pairs(screens)do screens[J].refresh=true end;SaveToDatabank()SetRefresh()RenderScreens()elseif O==\"NextBackground\"and(HitPayload.mode==screens[i].mode or HitPayload.mode==\"all\")then if BackgroundMode==\"\"then BackgroundSelected=1;BackgroundMode=backgroundModes[BackgroundSelected]else if BackgroundSelected>=#backgroundModes then BackgroundSelected=1 else BackgroundSelected=BackgroundSelected+1 end;BackgroundMode=backgroundModes[BackgroundSelected]end;for J,m in pairs(screens)do screens[J].refresh=true end;SaveToDatabank()SetRefresh()RenderScreens()elseif O==\"DecreaseOpacity\"and(HitPayload.mode==screens[i].mode or HitPayload.mode==\"all\")then if BackgroundModeOpacity>0.1 then BackgroundModeOpacity=BackgroundModeOpacity-0.05;for J,m in pairs(screens)do screens[J].refresh=true end;SaveToDatabank()SetRefresh()RenderScreens()end elseif O==\"IncreaseOpacity\"and(HitPayload.mode==screens[i].mode or HitPayload.mode==\"all\")then if BackgroundModeOpacity<1.0 then BackgroundModeOpacity=BackgroundModeOpacity+0.05;for J,m in pairs(screens)do screens[J].refresh=true end;SaveToDatabank()SetRefresh()RenderScreens()end elseif O==\"ResetColors\"and(HitPayload.mode==screens[i].mode or HitPayload.mode==\"all\")then db.clear()ColorPrimary=\"FF6700\"ColorSecondary=\"FFFFFF\"ColorTertiary=\"000000\"ColorHealthy=\"00FF00\"ColorWarning=\"FFFF00\"ColorCritical=\"FF0000\"ColorBackground=\"000000\"ColorBackgroundPattern=\"4f4f4f\"ColorFuelAtmospheric=\"004444\"ColorFuelSpace=\"444400\"ColorFuelRocket=\"440044\"BackgroundMode=\"deathstar\"BackgroundSelected=1;BackgroundModeOpacity=0.25;colorIDTable={[1]={id=\"ColorPrimary\",desc=\"Main HUD Color\",basec=\"FF6700\",newc=\"FF6700\"},[2]={id=\"ColorSecondary\",desc=\"Secondary HUD Color\",basec=\"FFFFFF\",newc=\"FFFFFF\"},[3]={id=\"ColorTertiary\",desc=\"Tertiary HUD Color\",basec=\"000000\",newc=\"000000\"},[4]={id=\"ColorHealthy\",desc=\"Color code for Healthy/Okay\",basec=\"00FF00\",newc=\"00FF00\"},[5]={id=\"ColorWarning\",desc=\"Color code for Damaged/Warning\",basec=\"FFFF00\",newc=\"FFFF00\"},[6]={id=\"ColorCritical\",desc=\"Color code for Broken/Critical\",basec=\"FF0000\",newc=\"FF0000\"},[7]={id=\"ColorBackground\",desc=\"Background Color\",basec=\"000000\",newc=\"000000\"},[8]={id=\"ColorBackgroundPattern\",desc=\"Background Pattern Color\",basec=\"4F4F4F\",newc=\"4F4F4F\"},[9]={id=\"ColorFuelAtmospheric\",desc=\"Color for Atmo Fuel/Elements\",basec=\"004444\",newc=\"004444\"},[10]={id=\"ColorFuelSpace\",desc=\"Color for Space Fuel/Elements\",basec=\"444400\",newc=\"444400\"},[11]={id=\"ColorFuelRocket\",desc=\"Color for Rocket Fuel/Elements\",basec=\"440044\",newc=\"440044\"}}SaveToDatabank()SetRefresh()RenderScreens()elseif O==\"PreviousColorID\"and(HitPayload.mode==screens[i].mode or HitPayload.mode==\"all\")then colorIDIndex=colorIDIndex-1;if colorIDIndex<1 then colorIDIndex=#colorIDTable end;SaveToDatabank()SetRefresh(\"settings1\")RenderScreens(\"settings1\")elseif O==\"NextColorID\"and(HitPayload.mode==screens[i].mode or HitPayload.mode==\"all\")then colorIDIndex=colorIDIndex+1;if colorIDIndex>#colorIDTable then colorIDIndex=1 end;SaveToDatabank()SetRefresh(\"settings1\")RenderScreens(\"settings1\")elseif O==\"ColorPosUp\"and(HitPayload.mode==screens[i].mode or HitPayload.mode==\"all\")then local P=tonumber(string.sub(colorIDTable[colorIDIndex].newc,HitPayload.param,HitPayload.param),16)P=P+1;if P>15 then P=0 end;colorIDTable[colorIDIndex].newc=replace_char(HitPayload.param,colorIDTable[colorIDIndex].newc,hexTable[P+1])SaveToDatabank()SetRefresh(\"settings1\")RenderScreens(\"settings1\")elseif O==\"ColorPosDown\"and(HitPayload.mode==screens[i].mode or HitPayload.mode==\"all\")then local P=tonumber(string.sub(colorIDTable[colorIDIndex].newc,HitPayload.param,HitPayload.param),16)P=P-1;if P<0 then P=15 end;colorIDTable[colorIDIndex].newc=replace_char(HitPayload.param,colorIDTable[colorIDIndex].newc,hexTable[P+1])SaveToDatabank()SetRefresh(\"settings1\")RenderScreens(\"settings1\")elseif O==\"ResetPosColor\"and(HitPayload.mode==screens[i].mode or HitPayload.mode==\"all\")then colorIDTable[colorIDIndex].newc=colorIDTable[colorIDIndex].basec;_G[colorIDTable[colorIDIndex].id]=colorIDTable[colorIDIndex].basec;SaveToDatabank()SetRefresh()RenderScreens()elseif O==\"ApplyPosColor\"and(HitPayload.mode==screens[i].mode or HitPayload.mode==\"all\")then _G[colorIDTable[colorIDIndex].id]=colorIDTable[colorIDIndex].newc;SaveToDatabank()SetRefresh()RenderScreens()elseif O==\"DamagedPageDown\"and(HitPayload.mode==screens[i].mode or HitPayload.mode==\"all\")then CurrentDamagedPage=CurrentDamagedPage+1;if CurrentDamagedPage>math.ceil(#damagedElements/DamagePageSize)then CurrentDamagedPage=math.ceil(#damagedElements/DamagePageSize)end;HudDeselectElement()SaveToDatabank()SetRefresh(\"damage\")RenderScreens(\"damage\")elseif O==\"DamagedPageUp\"and(HitPayload.mode==screens[i].mode or HitPayload.mode==\"all\")then CurrentDamagedPage=CurrentDamagedPage-1;if CurrentDamagedPage<1 then CurrentDamagedPage=1 end;HudDeselectElement()SaveToDatabank()SetRefresh(\"damage\")RenderScreens(\"damage\")elseif O==\"BrokenPageDown\"and(HitPayload.mode==screens[i].mode or HitPayload.mode==\"all\")then CurrentBrokenPage=CurrentBrokenPage+1;if CurrentBrokenPage>math.ceil(#brokenElements/DamagePageSize)then CurrentBrokenPage=math.ceil(#brokenElements/DamagePageSize)end;HudDeselectElement()SaveToDatabank()SetRefresh(\"damage\")RenderScreens(\"damage\")elseif O==\"BrokenPageUp\"and(HitPayload.mode==screens[i].mode or HitPayload.mode==\"all\")then CurrentBrokenPage=CurrentBrokenPage-1;if CurrentBrokenPage<1 then CurrentBrokenPage=1 end;HudDeselectElement()SaveToDatabank()SetRefresh(\"damage\")RenderScreens(\"damage\")elseif O==\"DMGOChangeView\"and(HitPayload.mode==screens[i].mode or HitPayload.mode==\"all\")then screens[i].submode=HitPayload.param;UpdateViewDamageoutline(screens[i])SaveToDatabank()SetRefresh(\"damageoutline\",screens[i].submode)RenderScreens(\"damageoutline\",screens[i].submode)elseif O==\"DMGOChangeStretch\"and(HitPayload.mode==screens[i].mode or HitPayload.mode==\"all\")then if DMGOStretch==true then DMGOStretch=false else DMGOStretch=true end;UpdateViewDamageoutline(screens[i])SaveToDatabank()SetRefresh(\"damageoutline\")RenderScreens(\"damageoutline\")elseif O==\"ToggleDisplayAtmosphere\"and(HitPayload.mode==screens[i].mode or HitPayload.mode==\"all\")then if screens[i].fuelA==true then screens[i].fuelA=false else screens[i].fuelA=true end;screens[i].fuelIndex=1;SaveToDatabank()SetRefresh(\"fuel\")RenderScreens(\"fuel\")elseif O==\"ToggleDisplaySpace\"and(HitPayload.mode==screens[i].mode or HitPayload.mode==\"all\")then if screens[i].fuelS==true then screens[i].fuelS=false else screens[i].fuelS=true end;screens[i].fuelIndex=1;SaveToDatabank()SetRefresh(\"fuel\")RenderScreens(\"fuel\")elseif O==\"ToggleDisplayRocket\"and(HitPayload.mode==screens[i].mode or HitPayload.mode==\"all\")then if screens[i].fuelR==true then screens[i].fuelR=false else screens[i].fuelR=true end;screens[i].fuelIndex=1;SaveToDatabank()SetRefresh(\"fuel\")RenderScreens(\"fuel\")elseif O==\"DecreaseFuelIndex\"and(HitPayload.mode==screens[i].mode or HitPayload.mode==\"all\")then screens[i].fuelIndex=screens[i].fuelIndex-1;if screens[i].fuelIndex<1 then screens[i].fuelIndex=1 end;SaveToDatabank()SetRefresh(\"fuel\")RenderScreens(\"fuel\")elseif O==\"IncreaseFuelIndex\"and(HitPayload.mode==screens[i].mode or HitPayload.mode==\"all\")then screens[i].fuelIndex=screens[i].fuelIndex+1;SaveToDatabank()SetRefresh(\"fuel\")RenderScreens(\"fuel\")elseif O==\"ToggleHudMode\"and(HitPayload.mode==screens[i].mode or HitPayload.mode==\"all\")then if HUDMode==true then HUDMode=false;forceDamageRedraw=true;HudDeselectElement()SaveToDatabank()SetRefresh()RenderScreens()else HUDMode=true;forceDamageRedraw=true;HudDeselectElement()SaveToDatabank()SetRefresh()RenderScreens()end elseif O==\"ToggleSimulation\"and(HitPayload.mode==screens[i].mode or HitPayload.mode==\"all\")then CurrentDamagedPage=1;CurrentBrokenPage=1;if SimulationMode==true then SimulationMode=false;SimulationActive=false;UpdateDamageData()UpdateTypeData()forceDamageRedraw=true;HudDeselectElement()SetRefresh(\"damage\")SetRefresh(\"damageoutline\")SetRefresh(\"settings1\")SetRefresh(\"fuel\")SaveToDatabank()RenderScreens()else SimulationMode=true;SimulationActive=false;UpdateDamageData()UpdateTypeData()forceDamageRedraw=true;HudDeselectElement()SetRefresh(\"damage\")SetRefresh(\"damageoutline\")SetRefresh(\"settings1\")SetRefresh(\"fuel\")SaveToDatabank()RenderScreens()end elseif(O==\"ToggleElementLabel\"or O==\"ToggleElementLabel2\")and(HitPayload.mode==screens[i].mode or HitPayload.mode==\"all\")then if UseMyElementNames==true then UseMyElementNames=false;SetRefresh(\"damage\")RenderScreens(\"damage\")else UseMyElementNames=true;SetRefresh(\"damage\")RenderScreens(\"damage\")end elseif(O==\"SwitchScrapTier\"or O==\"SwitchScrapTier2\")and(HitPayload.mode==screens[i].mode or HitPayload.mode==\"all\")then ScrapTier=ScrapTier+1;if ScrapTier>4 then ScrapTier=1 end;SetRefresh(\"damage\")RenderScreens(\"damage\")end end end end end;function GetContentFlight()local Q=\"\"Q=Q..GetHeader(\"Flight Data Report\")..[[\n \n ]]return Q end;function GetContentDamage()local Q=\"\"if SimulationMode==true then Q=Q..GetHeader(\"Damage Report (Simulated damage)\")..[[]]else Q=Q..GetHeader(\"Damage Report\")..[[]]end;Q=Q..GetContentDamageScreen()return Q end;function GetContentDamageoutline(m)UpdateDataDamageoutline()UpdateViewDamageoutline(m)local Q=\"\"Q=Q..GetHeader(\"Damage Ship Outline Report\")..GetDamageoutlineShip()..[[]]if m.submode==\"top\"then Q=Q..[[\n \n Top View\n \n Side View\n \n Front View\n ]]elseif m.submode==\"side\"then Q=Q..[[\n \n Top View\n \n Side View\n \n Front View\n ]]elseif m.submode==\"front\"then Q=Q..[[\n \n Top View\n \n Side View\n \n Front View\n ]]else end;Q=Q..[[]]..#dmgoElements..[[ of ]]..ElementCounter..[[ shown]]Q=Q..[[]]if DMGOStretch==true then Q=Q..[[]]end;Q=Q..[[Stretch both axis]]return Q end;function GetContentFuel(m)if#FuelAtmosphericTanks<1 and#FuelSpaceTanks<1 and#FuelRocketTanks<1 then return\"\"end;local R=0;local Q=\"\"local S={}FuelDisplay={m.fuelA,m.fuelS,m.fuelR}if FuelDisplay[1]==true and#FuelAtmosphericTanks>0 then table.insert(S,\"Atmospheric\")R=R+1 end;if FuelDisplay[2]==true and#FuelSpaceTanks>0 then table.insert(S,\"Space\")R=R+1 end;if FuelDisplay[3]==true and#FuelRocketTanks>0 then table.insert(S,\"Rocket\")R=R+1 end;Q=Q..GetHeader(\"Fuel Report (\"..table.concat(S,\", \")..\")\")..[[\n ]]local T=150;local U=0;local V=0;if FuelDisplay[1]==true and#FuelAtmosphericTanks>0 then if R==1 then V=50 elseif R==2 then V=6 elseif R==3 then V=0 end;Q=Q..[[\n \n \n \n ]]Q=Q..[[]]..GenerateCommaValue(FuelAtmosphericCurrent,true)..[[ of ]]..GenerateCommaValue(FuelAtmosphericTotal,true)..[[ | Total Atmospheric Fuel in ]]..#FuelAtmosphericTanks..[[ tank]]..(#FuelAtmosphericTanks==1 and\"\"or\"s\")..[[ (]]..math.floor(100/FuelAtmosphericTotal*FuelAtmosphericCurrent)..[[%)]]U=U+1 end;if FuelDisplay[2]==true and#FuelSpaceTanks>0 then if R==1 then V=50 elseif R==2 then V=6 elseif R==3 then V=0 end;Q=Q..[[\n \n \n \n ]]Q=Q..[[]]..GenerateCommaValue(FuelSpaceCurrent,true)..[[ of ]]..GenerateCommaValue(FuelSpaceTotal,true)..[[ | Total Space Fuel in ]]..#FuelSpaceTanks..[[ tank]]..(#FuelSpaceTanks==1 and\"\"or\"s\")..[[ (]]..math.floor(100/FuelSpaceTotal*FuelSpaceCurrent)..[[%)]]U=U+1 end;if FuelDisplay[3]==true and#FuelRocketTanks>0 then if R==1 then V=50 elseif R==2 then V=6 elseif R==3 then V=0 end;Q=Q..[[\n \n \n \n ]]Q=Q..[[]]..GenerateCommaValue(FuelRocketCurrent,true)..[[ of ]]..GenerateCommaValue(FuelRocketTotal,true)..[[ | Total Rocket Fuel in ]]..#FuelRocketTanks..[[ tank]]..(#FuelRocketTanks==1 and\"\"or\"s\")..[[ (]]..math.floor(100/FuelRocketTotal*FuelRocketCurrent)..[[%)]]end;Q=Q..[[\n \n \n \n ]]local W={}if m.fuelIndex==nil or m.fuelIndex<1 then m.fuelIndex=1 end;if FuelDisplay[1]==true then for f,j in ipairs(FuelAtmosphericTanks)do table.insert(W,j)end end;if FuelDisplay[2]==true then for f,j in ipairs(FuelSpaceTanks)do table.insert(W,j)end end;if FuelDisplay[3]==true then for f,j in ipairs(FuelRocketTanks)do table.insert(W,j)end end;table.sort(W,function(E,F)return E.type\n \n \n ]]if Y.hp==0 then Q=Q..[[]]elseif Y.maxhp-Y.hp>constants.epsilon then Q=Q..[[]]else Q=Q..[[]]end;if Y.hp==0 then Q=Q..[[]]..Y.size..[[]]else Q=Q..[[]]..Y.size..[[]]end;if Y.hp==0 then Q=Q..[[Broken]]..[[0 of ]]..GenerateCommaValue(Y.vol)..[[]]elseif tonumber(Y.percent)<10 then Q=Q..[[]]..Y.percent..[[%]]..[[]]..GenerateCommaValue(Y.cvol)..[[ of ]]..GenerateCommaValue(Y.vol)..[[]]elseif tonumber(Y.percent)<30 then Q=Q..[[]]..Y.percent..[[%]]..[[]]..GenerateCommaValue(Y.cvol)..[[ of ]]..GenerateCommaValue(Y.vol)..[[]]else Q=Q..[[]]..Y.percent..[[%]]..[[]]..GenerateCommaValue(Y.cvol)..[[ of ]]..GenerateCommaValue(Y.vol)..[[]]end;Q=Q..[[]]..Y.name..[[]]Q=Q..[[]]end end;if#FuelAtmosphericTanks>0 then Q=Q..[[]]if FuelDisplay[1]==true then Q=Q..[[]]end;Q=Q..[[ATM]]AddClickAreaForScreenID(m.id,{mode=\"fuel\",id=\"ToggleDisplayAtmosphere\",x1=50,x2=100,y1=270,y2=320})end;if#FuelSpaceTanks>0 then Q=Q..[[]]if FuelDisplay[2]==true then Q=Q..[[]]end;Q=Q..[[SPC]]AddClickAreaForScreenID(m.id,{mode=\"fuel\",id=\"ToggleDisplaySpace\",x1=200,x2=250,y1=270,y2=320})end;if#FuelRocketTanks>0 then Q=Q..[[]]if FuelDisplay[3]==true then Q=Q..[[]]end;Q=Q..[[RKT]]AddClickAreaForScreenID(m.id,{mode=\"fuel\",id=\"ToggleDisplayRocket\",x1=350,x2=400,y1=270,y2=320})end;if m.fuelIndex>1 then Q=Q..[[\n \n \n ]]AddClickAreaForScreenID(m.id,{mode=\"fuel\",id=\"DecreaseFuelIndex\",x1=1470,x2=1670,y1=270,y2=320})end;if m.fuelIndex+X-1<#W then Q=Q..[[\n \n \n ]]AddClickAreaForScreenID(m.id,{mode=\"fuel\",id=\"IncreaseFuelIndex\",x1=1680,x2=1880,y1=270,y2=320})end;if X>0 then Q=Q..[[]]..#W..[[ Tank]]..(#W==1 and\"\"or\"s\")..[[ (Showing ]]..m.fuelIndex..[[ to ]]..m.fuelIndex+X-1 ..[[)]]end;return Q end;function GetContentCargo()local Q=\"\"Q=Q..GetHeader(\"Cargo Report\")..[[\n \n ]]return Q end;function GetContentAGG()local Q=\"\"Q=Q..GetHeader(\"Anti-Grav Control\")..[[\n \n ]]return Q end;function GetContentMap()local Q=\"\"Q=Q..GetHeader(\"Map Overview\")..[[\n \n ]]return Q end;function GetContentTime()local Q=\"\"Q=Q..GetHeader(\"Time\")..epochTime()Q=Q..[[\n \n \n \n \n \n \n \n \n \n \n \n \n ]]return Q end;function GetContentSettings1()local Q=\"\"Q=Q..GetHeader(\"Settings\")..[[]]if BackgroundMode==\"\"then Q=Q..[[Activate background]]else Q=Q..[[Deactivate background (']]..BackgroundMode..[[', ]]..string.format(\"%.0f\",BackgroundModeOpacity*100)..[[%)]]end;Q=Q..[[\n \n Previous background\n \n Next background\n\n \n Decrease Opacity\n \n Increase Opacity\n ]]Q=Q..[[]]..[[Reset background and all colors]]Q=Q..[[]]..[[]]..[[]]..[[Select and change any of the ]]..#colorIDTable..[[ HUD colors]]..[[]]..[[]]..[[]]..[[]]..[[]]..[[]]..colorIDTable[colorIDIndex].desc..[[]]..[[]]..[[Current color]]..[[]]..[[]]..[[]]..[[]]..[[]]..[[]]..[[]]..[[]]..[[]]..[[]]..[[]]..[[]]..[[]]..[[#]]..[[]]..[[]]..string.sub(colorIDTable[colorIDIndex].newc,1,1)..[[]]..[[]]..[[]]..string.sub(colorIDTable[colorIDIndex].newc,2,2)..[[]]..[[]]..[[]]..string.sub(colorIDTable[colorIDIndex].newc,3,3)..[[]]..[[]]..[[]]..string.sub(colorIDTable[colorIDIndex].newc,4,4)..[[]]..[[]]..[[]]..string.sub(colorIDTable[colorIDIndex].newc,5,5)..[[]]..[[]]..[[]]..string.sub(colorIDTable[colorIDIndex].newc,6,6)..[[]]..[[]]..[[]]..[[]]..[[]]..[[]]..[[]]..[[]]..[[]]..[[]]..[[]]..[[]]..[[]]..[[]]..[[]]..[[New color]]..[[]]..[[Apply new color]]..[[]]..[[Reset]]..[[]]Q=Q..[[]]..[[]]..[[]]..[[Explanation / Hints]]..[[Coming soon.]]Q=Q..[[]]if SimulationMode==true then Q=Q..[[Simulating Damage to elements]]AddClickArea(\"settings1\",{id=\"ToggleSimulation\",mode=\"settings1\",x1=940,x2=1850,y1=919,y2=969})else Q=Q..[[Simulate Damage to elements]]AddClickArea(\"settings1\",{id=\"ToggleSimulation\",mode=\"settings1\",x1=940,x2=1850,y1=919,y2=969})end;return Q end;function GetContentStartup()local Q=\"\"Q=Q..GetElementLogo(812,380,\"f\",\"f\",\"f\")if YourShipsName==\"Enter here\"then Q=Q..[[Spaceship ID ]]..ShipID..[[]]else Q=Q..[[]]..YourShipsName..[[]]end;if ShowWelcomeMessage==true then Q=Q..[[Greetings, Commander ]]..PlayerName..[[.]]end;if#Warnings>0 then Q=Q..[[Warning: ]]..table.concat(Warnings,\" \")..[[]]end;Q=Q..[[Damage Report v]]..VERSION..[[, by DorianGray - Discord: Dorian Gray#2623.]]return Q end;function RenderScreen(m,a0)if a0==nil then PrintConsole(\"ERROR: contentToRender is nil.\")unit.exit()end;CreateClickAreasForScreen(m)local Q=\"\"Q=Q..[[\n \n \n ]]Q=Q..a0;if m.mode==\"startup\"then Q=Q..[[]]else Q=Q..[[]]end;Q=Q..[[\n \n \n \n TIME\n DMG\n DMGO\n FUEL]]Q=Q..[[\n HUD\n SETS\n \n \n \n ]]..[[\n ]]if HUDMode==true then Q=Q..[[\n \n HUD\n ]]end;if m.mode==\"damage\"then Q=Q..[[\n \n DMG\n ]]elseif m.mode==\"damageoutline\"then Q=Q..[[\n \n DMGO\n ]]elseif m.mode==\"fuel\"then Q=Q..[[\n \n FUEL\n ]]elseif m.mode==\"flight\"then Q=Q..[[\n \n FLGT\n ]]elseif m.mode==\"cargo\"then Q=Q..[[\n \n CRGO\n ]]elseif m.mode==\"agg\"then Q=Q..[[\n \n AGG\n ]]elseif m.mode==\"map\"then Q=Q..[[\n \n MAP\n ]]elseif m.mode==\"time\"then Q=Q..[[\n \n TIME\n ]]elseif m.mode==\"settings1\"then Q=Q..[[\n \n SETS\n ]]end;Q=Q..[[]]Q=Q..[[]]local a1=string.len(Q)m.element.setSVG(Q)end;function RenderScreens(a2,a3)a2=a2 or\"all\"a3=a3 or\"all\"if screens~=nil and#screens>0 then local a4=\"\"local a5=\"\"local a6=\"\"local a7=\"\"local a8=\"\"local a9=\"\"local aa=\"\"local ab=\"\"local ac=\"\"local ad=\"\"local ae=\"\"local af=\"\"for J,m in pairs(screens)do if m.refresh==true then local a0=\"\"if m.mode==\"flight\"and(a2==\"flight\"or a2==\"all\")then if a4==\"\"then a4=GetContentFlight()end;a0=a4 elseif m.mode==\"damage\"and(a2==\"damage\"or a2==\"all\")then if a5==\"\"then a5=GetContentDamage()end;a0=a5 elseif m.mode==\"damageoutline\"and(a2==\"damageoutline\"or a2==\"all\")then if m.submode==\"\"then m.submode=\"top\"screens[J].submode=\"top\"end;if m.submode==\"top\"and(a3==\"top\"or a3==\"all\")then if a6==\"\"then a6=GetContentDamageoutline(m)end;a0=a6 end;if m.submode==\"side\"and(a3==\"side\"or a3==\"all\")then if a7==\"\"then a7=GetContentDamageoutline(m)end;a0=a7 end;if m.submode==\"front\"and(a3==\"front\"or a3==\"all\")then if a8==\"\"then a8=GetContentDamageoutline(m)end;a0=a8 end elseif m.mode==\"fuel\"and(a2==\"fuel\"or a2==\"all\")then m=WipeClickAreasForScreen(screens[J])a0=GetContentFuel(m)elseif m.mode==\"cargo\"and(a2==\"cargo\"or a2==\"all\")then if aa==\"\"then aa=GetContentCargo()end;a0=aa elseif m.mode==\"agg\"and(a2==\"agg\"or a2==\"all\")then if ab==\"\"then ab=GetContentAGG()end;a0=ab elseif m.mode==\"map\"and(a2==\"map\"or a2==\"all\")then if ac==\"\"then ac=GetContentMap()end;a0=ac elseif m.mode==\"time\"and(a2==\"time\"or a2==\"all\")then if ad==\"\"then ad=GetContentTime()end;a0=ad elseif m.mode==\"settings1\"and(a2==\"settings1\"or a2==\"all\")then if ae==\"\"then ae=GetContentSettings1()end;a0=ae elseif m.mode==\"startup\"and(a2==\"startup\"or a2==\"all\")then if af==\"\"then af=GetContentStartup()end;a0=af else a0=\"Invalid screen mode. ('\"..m.mode..\"')\"end;if a0~=\"\"then RenderScreen(m,a0)else DrawCenteredText(\"ERROR: No contentToRender delivered for \"..m.mode)PrintConsole(\"ERROR: No contentToRender delivered for \"..m.mode)unit.exit()end;screens[J].refresh=false end end end;if HUDMode==true then system.setScreen(GetContentDamageHUDOutput())system.showScreen(1)else system.showScreen(0)end end;function OnTickData(C)if formerTime+605 or SkillRepairToolOptimization>5 or StatFuelTankOptimization>5 or StatContainerOptimization>5 or StatAtmosphericFuelTankHandling>5 or StatSpaceFuelTankHandling>5 or StatRocketFuelTankHandling>5 then PrintConsole(\"ERROR: Talents/stats can only range from 0 to 5. Please set correctly in LUA settings and reactivate script.\")unit.exit()end;if screens==nil or#screens==0 then HUDMode=true;PrintConsole(\"Warning: No screens connected. Entering HUD mode only.\")end;OnTickData(true)unit.setTimer('UpdateData',UpdateDataInterval)unit.setTimer('UpdateHighlight',HighlightBlinkingInterval)","filter":{"args":[],"signature":"start()","slotKey":"-1"},"key":"12"},{"code":"ActionUp()","filter":{"args":[{"value":"up"}],"signature":"actionStart(action)","slotKey":"-2"},"key":"13"},{"code":"ActionDown()","filter":{"args":[{"value":"down"}],"signature":"actionStart(action)","slotKey":"-2"},"key":"14"},{"code":"ActionStrafeLeft()","filter":{"args":[{"value":"strafeleft"}],"signature":"actionStart(action)","slotKey":"-2"},"key":"15"},{"code":"ActionStrafeRight()","filter":{"args":[{"value":"straferight"}],"signature":"actionStart(action)","slotKey":"-2"},"key":"16"},{"code":"KeyCTRLPressed = true","filter":{"args":[{"value":"brake"}],"signature":"actionStart(action)","slotKey":"-2"},"key":"17"},{"code":"KeyCTRLPressed = false","filter":{"args":[{"value":"brake"}],"signature":"actionStop(action)","slotKey":"-2"},"key":"18"},{"code":"ActionOption1()","filter":{"args":[{"value":"option1"}],"signature":"actionStart(action)","slotKey":"-2"},"key":"19"},{"code":"ActionOption2()","filter":{"args":[{"value":"option2"}],"signature":"actionStart(action)","slotKey":"-2"},"key":"20"},{"code":"ActionOption3()","filter":{"args":[{"value":"option3"}],"signature":"actionStart(action)","slotKey":"-2"},"key":"21"},{"code":"ActionOption4()","filter":{"args":[{"value":"option4"}],"signature":"actionStart(action)","slotKey":"-2"},"key":"22"},{"code":"ActionOption9()","filter":{"args":[{"value":"option9"}],"signature":"actionStart(action)","slotKey":"-2"},"key":"23"},{"code":"ActionOption8()","filter":{"args":[{"value":"option8"}],"signature":"actionStart(action)","slotKey":"-2"},"key":"24"}],"methods":[],"events":[]}