forked from LocuraDU/DU-DamageReport
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DamageReport_3_31e.json
1 lines (1 loc) · 177 KB
/
DamageReport_3_31e.json
1
{"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":[]}},"-3":{"name":"player","type":{"events":[],"methods":[]}},"-2":{"name":"construct","type":{"events":[],"methods":[]}},"-4":{"name":"system","type":{"events":[],"methods":[]}},"-5":{"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":"SaveToDatabank()\nSwitchScreens(\"off\")","filter":{"args":[],"signature":"onStop()","slotKey":"-1"},"key":"8"},{"code":"OnTickData()\n","filter":{"args":[{"value":"UpdateData"}],"signature":"onTimer(tag)","slotKey":"-1"},"key":"9"},{"code":"ToggleHighlight()","filter":{"args":[{"value":"UpdateHighlight"}],"signature":"onTimer(tag)","slotKey":"-1"},"key":"10"},{"code":"--[[\n Damage Report 3.31e\n A LUA script for Dual Universe\n\n Created By Dorian Gray\n Maintained By CredenceH\n\n 3.31e changes:\n [FIX] fixed version mismatched\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/LocuraDU/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 Jericho, Dmentia, Archaegeo, and blazemonger 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\n--[[ 1. USER DEFINED VARIABLES ]]\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\n-- SkillAtmosphericFuelEfficiency = 0 --export Enter (0-5) your talent \"Mining and Inventory -> Equipment Manager -> Repair Tool Efficiency\"\n-- SkillSpaceFuelEfficiency = 0 --export Enter (0-5) your talent \"Mining and Inventory -> Equipment Manager -> Repair Tool Efficiency\"\n-- SkillRocketFuelEfficiency = 0 --export Enter (0-5) your talent \"Mining and Inventory -> Equipment Manager -> Repair Tool Efficiency\"\n\n--[[ 2. GLOBAL VARIABLES ]]\n\nUpdateDataInterval = 1.0 -- How often shall the data be updated? (Increase if running into CPU issues.)\nHighlightBlinkingInterval = 0.5 -- How fast shall highlight arrows of marked elements blink?\n\nColorPrimary = \"FF6700\" -- Enter the hexcode of the main color to be used by all views.\nColorSecondary = \"FFFFFF\" -- Enter the hexcode of the secondary color to be used by all views.\nColorTertiary = \"000000\" -- Enter the hexcode of the tertiary color to be used by all views.\nColorHealthy = \"00FF00\" -- Enter the hexcode of the 'healthy' color to be used by all views.\nColorWarning = \"FFFF00\" -- Enter the hexcode of the 'warning' color to be used by all views.\nColorCritical = \"FF0000\" -- Enter the hexcode of the 'critical' color to be used by all views.\nColorBackground = \"000000\" -- Enter the hexcode of the background color to be used by all views.\nColorBackgroundPattern = \"4F4F4F\" -- Enter the hexcode of the background color to be used by all views.\nColorFuelAtmospheric = \"004444\" -- Enter the hexcode of the atmospheric fuel color.\nColorFuelSpace = \"444400\" -- Enter the hexcode of the space fuel color.\nColorFuelRocket = \"440044\" -- Enter the hexcode of the rocket fuel color.\n\nVERSION = \"3.31e\"\nDebugMode = false\nDebugRenderClickareas = true\n\nDBData = {}\n\ncore = nil\ndb = nil\nscreens = {}\ndscreens = {}\n\nWarnings = {}\n\nscreenModes = {\n [\"flight\"] = { id=\"flight\" },\n [\"damage\"] = { id=\"damage\" },\n [\"damageoutline\"] = { id=\"damageoutline\" },\n [\"fuel\"] = { id=\"fuel\" },\n [\"cargo\"] = { id=\"cargo\" },\n [\"agg\"] = { id=\"agg\" },\n [\"map\"] = { id=\"map\" },\n [\"time\"] = { id=\"time\", activetoggle=\"true\" },\n [\"settings1\"] = { id=\"settings1\" },\n [\"startup\"] = { id=\"startup\" },\n [\"systems\"] = { id=\"systems\" }\n}\n\nbackgroundModes = { \"deathstar\", \"capsule\", \"rain\", \"signal\", \"hexagon\", \"diagonal\", \"diamond\", \"plus\", \"dots\" }\nBackgroundMode =\"deathstar\"\nBackgroundSelected = 1\nBackgroundModeOpacity = 0.25\n\nSaveVars = { \"dscreens\",\n \"ColorPrimary\", \"ColorSecondary\", \"ColorTertiary\",\n \"ColorHealthy\", \"ColorWarning\", \"ColorCritical\",\n \"ColorBackground\", \"ColorBackgroundPattern\",\n \"ColorFuelAtmospheric\", \"ColorFuelSpace\", \"ColorFuelRocket\",\n \"ScrapTier\", \"HUDMode\", \"SimulationMode\", \"DMGOStretch\",\n \"HUDShiftU\", \"HUDShiftV\", \"colorIDIndex\", \"colorIDTable\",\n \"BackgroundMode\", \"BackgroundSelected\", \"BackgroundModeOpacity\" }\n\nHUDMode = false\nHUDShiftU = 0\nHUDShiftV = 0\nhudSelectedIndex = 0\nhudStartIndex = 1\nhudArrowSticker = {}\nhighlightOn = false\nhighlightID = 0\nhighlightX = 0\nhighlightY = 0\nhighlightZ = 0\n\nSimulationMode = false\nOkayCenterMessage = \"All systems nominal.\"\nCurrentDamagedPage = 1\nCurrentBrokenPage = 1\nDamagePageSize = 12\nScrapTier = 1\ntotalScraps = 0\nScrapTierRepairTimes = { 10, 50, 250, 1250 }\n\ncoreWorldOffset = 0\ntotalShipHP = 0\nformerTotalShipHP = -1\ntotalShipMaxHP = 0\ntotalShipIntegrity = 100\nelementsId = {}\nelementsIdList = {}\ndamagedElements = {}\nbrokenElements = {}\nrE = {}\nhealthyElements = {}\ntypeElements = {}\nElementCounter = 0\nUseMyElementNames = true\ndmgoElements = {}\nDMGOMaxElements = 250\nDMGOStretch = false\nShipXmin = 99999999\nShipXmax = -99999999\nShipYmin = 99999999\nShipYmax = -99999999\nShipZmin = 99999999\nShipZmax = -99999999\n\ntotalShipMass = 0\nformerTotalShipMass = -1\n\nformerTime = -1\n\nFuelAtmosphericTanks = {}\nFuelSpaceTanks = {}\nFuelRocketTanks = {}\nFuelAtmosphericTotal = 0\nFuelSpaceTotal = 0\nFuelRocketTotal = 0\nFuelAtmosphericCurrent = 0\nFuelSpaceTotalCurrent = 0\nFuelRocketTotalCurrent = 0\nformerFuelAtmosphericTotal = -1\nformerFuelSpaceTotal = -1\nformerFuelRocketTotal = -1\n\nhexTable = { \"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"A\", \"B\", \"C\", \"D\", \"E\", \"F\"}\ncolorIDIndex = 1\ncolorIDTable = {\n [1] = {\n id=\"ColorPrimary\",\n desc=\"Main HUD Color\",\n basec = \"FF6700\",\n newc = \"FF6700\"\n },\n [2] = {\n id=\"ColorSecondary\",\n desc=\"Secondary HUD Color\",\n basec = \"FFFFFF\",\n newc = \"FFFFFF\"\n },\n [3] = {\n id=\"ColorTertiary\",\n desc=\"Tertiary HUD Color\",\n basec = \"000000\",\n newc = \"000000\"\n },\n [4] = {\n id=\"ColorHealthy\",\n desc=\"Color code for Healthy/Okay\",\n basec = \"00FF00\",\n newc = \"00FF00\"\n },\n [5] = {\n id=\"ColorWarning\",\n desc=\"Color code for Damaged/Warning\",\n basec = \"FFFF00\",\n newc = \"FFFF00\"\n },\n [6] = {\n id=\"ColorCritical\",\n desc=\"Color code for Broken/Critical\",\n basec = \"FF0000\",\n newc = \"FF0000\"\n },\n [7] = {\n id=\"ColorBackground\",\n desc=\"Background Color\",\n basec = \"000000\",\n newc = \"000000\"\n },\n [8] = {\n id=\"ColorBackgroundPattern\",\n desc=\"Background Pattern Color\",\n basec = \"4F4F4F\",\n newc = \"4F4F4F\"\n },\n [9] = {\n id=\"ColorFuelAtmospheric\",\n desc=\"Color for Atmo Fuel/Elements\",\n basec = \"004444\",\n newc = \"004444\"\n },\n [10] = {\n id=\"ColorFuelSpace\",\n desc=\"Color for Space Fuel/Elements\",\n basec = \"444400\",\n newc = \"444400\"\n },\n [11] = {\n id=\"ColorFuelRocket\",\n desc=\"Color for Rocket Fuel/Elements\",\n basec = \"440044\",\n newc = \"440044\"\n }\n}\n\n--[[ 3. HELPER FUNCTIONS ]]\n\nfunction GenerateCommaValue(amount, kify, postcomma)\n kify = kify or false\n postcomma = postcomma or 1\n local formatted = amount\n if kify == true then\n if string.len(amount)>=4 then\n formatted = string.format(\"%.\"..postcomma..\"fk\", amount/1000)\n else\n formatted = string.format(\"%.\"..postcomma..\"f\", amount)\n end\n else\n while true do\n formatted, k = string.gsub(formatted, \"^(-?%d+)(%d%d%d)\", '%1,%2')\n if (k == 0) then break end\n end\n end\n return formatted\nend\n\nfunction PrintConsole(output, highlight)\n highlight = highlight or false\n if highlight then\n system.print(\n \"------------------------------------------------------------------------\")\n end\n system.print(output)\n if highlight then\n system.print(\n \"------------------------------------------------------------------------\")\n end\nend\n\nfunction DrawCenteredText(output)\n if screens ~= nil and #screens > 0 then\n for i = 1, #screens, 1 do\n screens[i].element.setCenteredText(output)\n end\n end\nend\n\nfunction ClearConsole()\n for i = 1, 10, 1 do\n PrintConsole()\n end\nend\n\nfunction SwitchScreens(state)\n state = state or \"on\"\n if screens ~= nil and #screens > 0 then\n for i = 1, #screens, 1 do\n if state == \"on\" then\n screens[i].element.clear()\n screens[i].element.activate()\n screens[i].active = true\n else\n screens[i].element.clear()\n screens[i].element.deactivate()\n screens[i].active = false\n end\n end\n end\nend\n\n--[[ Convert seconds to string (by Jericho) ]]\nfunction GetSecondsString(seconds)\n local seconds = tonumber(seconds)\n\n if seconds == nil or seconds <= 0 then\n return \"-\";\n else\n days = string.format(\"%2.f\", math.floor(seconds/(3600*24)));\n hours = string.format(\"%2.f\", math.floor(seconds/3600 - (days*24)));\n mins = string.format(\"%2.f\", math.floor(seconds/60 - (hours*60) - (days*24*60)));\n secs = string.format(\"%2.f\", math.floor(seconds - hours*3600 - (days*24*60*60) - mins *60));\n str = \"\"\n if tonumber(days) > 0 then str = str .. days..\"d \" end\n if tonumber(hours) > 0 then str = str .. hours..\"h \" end\n if tonumber(mins) > 0 then str = str .. mins..\"m \" end\n if tonumber(secs) > 0 then str = str .. secs ..\"s\" end\n return str\n end\nend\n\nfunction replace_char(pos, str, r)\n return str:sub(1, pos-1) .. r .. str:sub(pos+1)\nend\n\n--[[ 4. RENDER HELPER FUNCTIONS ]]\n\n--[[ epochTime function by Leodr (clock script), enhanced by Jericho (DU Industry script) ]]\nfunction epochTime()\n function rZ(a)\n if string.len(a) <= 1 then\n return \"0\" .. a\n else\n return a\n end\n end\n function dPoint(b)\n if not (b == math.floor(b)) then\n return true\n else\n return false\n end\n end\n function lYear(year)\n if not dPoint(year / 4) then\n if dPoint(year / 100) then\n return true\n else\n if not dPoint(year / 400) then\n return true\n else\n return false\n end\n end\n else\n return false\n end\n end\n local c = 5;\n local d = 3600;\n local e = 86400;\n local f = 31536000;\n local g = 31622400;\n local h = 2419200;\n local i = 2505600;\n local j = 2592000;\n local k = 2678400;\n local l = {4, 6, 9, 11}\n local m = {1, 3, 5, 7, 8, 10, 12}\n local n = 0;\n local o = 1506816000;\n local q = system.getArkTime()\n _G[\"formerTime\"] = q\n if AddSummertimeHour == true then q = q + 3600 end\n now = math.floor(q + o)\n year = 1970;\n secs = 0;\n n = 0;\n while secs + g < now or secs + f < now do\n if lYear(year + 1) then\n if secs + g < now then\n secs = secs + g;\n year = year + 1;\n n = n + 366\n end\n else\n if secs + f < now then\n secs = secs + f;\n year = year + 1;\n n = n + 365\n end\n end\n end\n secondsRemaining = now - secs;\n monthSecs = 0;\n yearlYear = lYear(year)\n month = 1;\n while monthSecs + h < secondsRemaining or monthSecs + j < secondsRemaining or\n monthSecs + k < secondsRemaining do\n if month == 1 then\n if monthSecs + k < secondsRemaining then\n month = 2;\n monthSecs = monthSecs + k;\n n = n + 31\n else\n break\n end\n end\n if month == 2 then\n if not yearlYear then\n if monthSecs + h < secondsRemaining then\n month = 3;\n monthSecs = monthSecs + h;\n n = n + 28\n else\n break\n end\n else\n if monthSecs + i < secondsRemaining then\n month = 3;\n monthSecs = monthSecs + i;\n n = n + 29\n else\n break\n end\n end\n end\n if month == 3 then\n if monthSecs + k < secondsRemaining then\n month = 4;\n monthSecs = monthSecs + k;\n n = n + 31\n else\n break\n end\n end\n if month == 4 then\n if monthSecs + j < secondsRemaining then\n month = 5;\n monthSecs = monthSecs + j;\n n = n + 30\n else\n break\n end\n end\n if month == 5 then\n if monthSecs + k < secondsRemaining then\n month = 6;\n monthSecs = monthSecs + k;\n n = n + 31\n else\n break\n end\n end\n if month == 6 then\n if monthSecs + j < secondsRemaining then\n month = 7;\n monthSecs = monthSecs + j;\n n = n + 30\n else\n break\n end\n end\n if month == 7 then\n if monthSecs + k < secondsRemaining then\n month = 8;\n monthSecs = monthSecs + k;\n n = n + 31\n else\n break\n end\n end\n if month == 8 then\n if monthSecs + k < secondsRemaining then\n month = 9;\n monthSecs = monthSecs + k;\n n = n + 31\n else\n break\n end\n end\n if month == 9 then\n if monthSecs + j < secondsRemaining then\n month = 10;\n monthSecs = monthSecs + j;\n n = n + 30\n else\n break\n end\n end\n if month == 10 then\n if monthSecs + k < secondsRemaining then\n month = 11;\n monthSecs = monthSecs + k;\n n = n + 31\n else\n break\n end\n end\n if month == 11 then\n if monthSecs + j < secondsRemaining then\n month = 12;\n monthSecs = monthSecs + j;\n n = n + 30\n else\n break\n end\n end\n end\n day = 1;\n daySecs = 0;\n daySecsRemaining = secondsRemaining - monthSecs;\n while daySecs + e < daySecsRemaining do\n day = day + 1;\n daySecs = daySecs + e;\n n = n + 1\n end\n hour = 0;\n hourSecs = 0;\n hourSecsRemaining = daySecsRemaining - daySecs;\n while hourSecs + d < hourSecsRemaining do\n hour = hour + 1;\n hourSecs = hourSecs + d\n end\n minute = 0;\n minuteSecs = 0;\n minuteSecsRemaining = hourSecsRemaining - hourSecs;\n while minuteSecs + 60 < minuteSecsRemaining do\n minute = minute + 1;\n minuteSecs = minuteSecs + 60\n end\n second = math.floor(now % 60)\n year = rZ(year)\n month = rZ(month)\n day = rZ(day)\n hour = rZ(hour)\n minute = rZ(minute)\n second = rZ(second)\n\n return [[<text class=\"f250mx\" x=\"960\" y=\"540\">]]..hour..\":\".. minute..[[</text>]]..\n [[<text class=\"f100mx\" x=\"960\" y=\"660\">]]..year..\"/\".. month..\"/\"..day..[[</text>]]\nend\n\n\nfunction ToggleHUD()\n if HUDMode == true then\n HUDMode = false\n forceDamageRedraw = true\n hudSelectedIndex = 0\n highlightID = 0\n HideHighlight()\n SetRefresh()\n RenderScreens()\n else\n HUDMode = true\n forceDamageRedraw = true\n hudSelectedIndex = 0\n highlightID = 0\n HideHighlight()\n SetRefresh()\n RenderScreens()\n end\nend\n\nfunction HudDeselectElement()\n hudSelectedIndex = 0\n hudStartIndex = 1\n highlightID = 0\n HideHighlight()\n if HUDMode == true then\n SetRefresh(\"damage\")\n SetRefresh(\"damageoutline\")\n RenderScreens()\n end\nend\n\nfunction ChangeHudSelectedElement(step)\n if HUDMode == true and #rE > 0 then\n\n hudSelectedIndex = hudSelectedIndex + step\n if hudSelectedIndex < 1 then hudSelectedIndex = 1\n elseif hudSelectedIndex > #rE then hudSelectedIndex = #rE\n end\n\n if hudSelectedIndex > 9 then\n hudStartIndex = hudSelectedIndex-9\n end\n if hudSelectedIndex ~= 0 then\n highlightID = rE[hudSelectedIndex].id\n if highlightID ~=nil and highlightID ~= 0 then\n -- PrintConsole(\"CHSE: hudSelectedIndex: \"..hudSelectedIndex..\" / hudStartIndex: \"..hudStartIndex..\" / highlightID: \"..highlightID)\n HideHighlight()\n elementPosition = vec3(rE[hudSelectedIndex].pos)\n highlightX = elementPosition.x\n highlightY = elementPosition.y\n highlightZ = elementPosition.z\n highlightOn = true\n ShowHighlight()\n end\n end\n\n SetRefresh(\"damage\")\n SetRefresh(\"damageoutline\")\n RenderScreens()\n\n end\nend\n\nfunction HideHighlight()\n if #hudArrowSticker > 0 then\n for i in pairs(hudArrowSticker) do\n core.deleteSticker(hudArrowSticker[i])\n end\n hudArrowSticker = {}\n end\nend\n\nfunction ShowHighlight()\n if highlightOn == true and highlightID > 0 then\n table.insert(hudArrowSticker, core.spawnArrowSticker(highlightX + 2, highlightY, highlightZ, \"north\"))\n table.insert(hudArrowSticker, core.spawnArrowSticker(highlightX, highlightY - 2, highlightZ, \"east\"))\n table.insert(hudArrowSticker, core.spawnArrowSticker(highlightX - 2, highlightY, highlightZ, \"south\"))\n table.insert(hudArrowSticker, core.spawnArrowSticker(highlightX, highlightY + 2, highlightZ, \"west\"))\n table.insert(hudArrowSticker, core.spawnArrowSticker(highlightX, highlightY, highlightZ - 2, \"up\"))\n table.insert(hudArrowSticker, core.spawnArrowSticker(highlightX, highlightY, highlightZ + 2,\"down\"))\n end\nend\n\nfunction ToggleHighlight()\n if highlightOn == true then\n highlightOn = false\n HideHighlight()\n else\n highlightOn = true\n ShowHighlight()\n end\nend\n\nfunction SortDamageTables()\n table.sort(damagedElements, function(a, b) return a.missinghp > b.missinghp end)\n table.sort(brokenElements, function(a, b) return a.maxhp > b.maxhp end)\nend\n\nfunction getScraps(damage,commaval)\n commaval = commaval or false\n damage = damage - SkillRepairToolOptimization * 0.05 * damage\n local res = math.ceil( damage / ( 10 * 5^(ScrapTier-1) ) )\n if commaval ==true then\n return GenerateCommaValue(string.format(\"%.0f\", res ), false)\n else\n return res\n end\nend\n\nfunction getRepairTime(damage,buildstring)\n buildstring = buildstring or false\n damage = damage - SkillRepairToolOptimization * 0.05 * damage\n local res = math.ceil(damage / ScrapTierRepairTimes[ScrapTier])\n res = res - ( SkillRepairToolEfficiency * 0.1 * res )\n if buildstring == true then\n return GetSecondsString(string.format(\"%.0f\", res ) )\n else\n return res\n end\nend\n\nfunction UpdateDataDamageoutline()\n\n dmgoElements = {}\n\n for i,element in ipairs(brokenElements) do\n if #dmgoElements < DMGOMaxElements then\n local elementPosition = vec3(element.pos)\n local x = elementPosition.x - coreWorldOffset\n local y = elementPosition.y - coreWorldOffset\n local z = elementPosition.z - coreWorldOffset\n if x < ShipXmin then ShipXmin = x end\n if y < ShipYmin then ShipYmin = y end\n if z < ShipZmin then ShipZmin = z end\n if x > ShipXmax then ShipXmax = x end\n if y > ShipYmax then ShipYmax = y end\n if z > ShipZmax then ShipZmax = z end\n table.insert( dmgoElements, {\n id = element.id,\n type = \"b\",\n size = element.maxhp,\n x = x, y = y, z = z,\n xp = 0, yp = 0, zp = 0,\n u = 0, v = 0\n })\n end\n end\n\n if #dmgoElements < DMGOMaxElements then\n for i,element in ipairs(damagedElements) do\n if #dmgoElements < DMGOMaxElements then\n local elementPosition = vec3(element.pos)\n local x = elementPosition.x - coreWorldOffset\n local y = elementPosition.y - coreWorldOffset\n local z = elementPosition.z - coreWorldOffset\n if x < ShipXmin then ShipXmin = x end\n if y < ShipYmin then ShipYmin = y end\n if z < ShipZmin then ShipZmin = z end\n if x > ShipXmax then ShipXmax = x end\n if y > ShipYmax then ShipYmax = y end\n if z > ShipZmax then ShipZmax = z end\n table.insert( dmgoElements, {\n id = element.id,\n type = \"d\",\n size = element.maxhp,\n x = x, y = y, z = z,\n xp = 0, yp = 0, zp = 0,\n u = 0, v = 0\n })\n end\n end\n end\n\n if #dmgoElements < DMGOMaxElements then\n for i,element in ipairs(healthyElements) do\n if #dmgoElements < DMGOMaxElements then\n local elementPosition = vec3(element.pos)\n local x = elementPosition.x - coreWorldOffset\n local y = elementPosition.y - coreWorldOffset\n local z = elementPosition.z - coreWorldOffset\n if x < ShipXmin then ShipXmin = x end\n if y < ShipYmin then ShipYmin = y end\n if z < ShipZmin then ShipZmin = z end\n if x > ShipXmax then ShipXmax = x end\n if y > ShipYmax then ShipYmax = y end\n if z > ShipZmax then ShipZmax = z end\n table.insert( dmgoElements, {\n id = element.id,\n type = \"h\",\n size = element.maxhp,\n x = x, y = y, z = z,\n xp = 0, yp = 0, zp = 0,\n u = 0, v = 0\n })\n end\n end\n end\n\n ShipX = math.abs(ShipXmax-ShipXmin)\n ShipY = math.abs(ShipYmax-ShipYmin)\n ShipZ = math.abs(ShipZmax-ShipZmin)\n\n for i,element in ipairs(dmgoElements) do\n dmgoElements[i].xp = math.abs(100/(ShipXmax-ShipXmin)*(element.x-ShipXmin))\n dmgoElements[i].yp = math.abs(100/(ShipYmax-ShipYmin)*(element.y-ShipYmin))\n dmgoElements[i].zp = math.abs(100/(ShipZmax-ShipZmin)*(element.z-ShipZmin))\n end\n\nend\n\nfunction UpdateViewDamageoutline(screen)\n -- Full Width of virtual screen:\n -- UStart = 20\n -- VStart = 180\n -- UDim = 1880\n -- VDim = 840\n -- Adding frames:\n UFrame = 40\n VFrame = 40\n\n UStart = 20 + UFrame\n VStart = 180 + VFrame\n UDim = 1880 - 2*UFrame\n VDim = 840 - 2*VFrame\n\n if screen.submode == \"top\" then\n if DMGOStretch == false then\n local UFactor = UDim/(ShipYmax-ShipYmin)\n local VFactor = VDim/(ShipXmax-ShipXmin)\n if UFactor>=VFactor then\n local cFactor = UFactor/VFactor\n local newUDim = math.floor(UDim/cFactor)\n UStart = UStart+(UDim-newUDim)/2\n for i,element in ipairs(dmgoElements) do\n dmgoElements[i].u = math.floor(UDim/100/cFactor*element.yp+UStart)\n dmgoElements[i].v = math.floor(VDim/100*element.xp+VStart)\n end\n else\n local cFactor = VFactor/UFactor\n local newVDim = math.floor(VDim/cFactor)\n VStart = VStart+(VDim-newVDim)/2\n for i,element in ipairs(dmgoElements) do\n dmgoElements[i].u = math.floor(UDim/100*element.yp+UStart)\n dmgoElements[i].v = math.floor(VDim/100/cFactor*element.xp+VStart)\n end\n end\n else\n for i,element in ipairs(dmgoElements) do\n dmgoElements[i].u = math.floor(UDim/100*element.yp+UStart)\n dmgoElements[i].v = math.floor(VDim/100*element.xp+VStart)\n end\n end\n\n\n elseif screen.submode == \"front\" then\n if DMGOStretch == false then\n local UFactor = UDim/(ShipXmax-ShipXmin)\n local VFactor = VDim/(ShipZmax-ShipZmin)\n if UFactor>=VFactor then\n local cFactor = UFactor/VFactor\n local newUDim = math.floor(UDim/cFactor)\n UStart = UStart+(UDim-newUDim)/2\n for i,element in ipairs(dmgoElements) do\n dmgoElements[i].u = math.floor(UDim/100/cFactor*element.xp+UStart)\n dmgoElements[i].v = math.floor(VDim/100*(100-element.zp)+VStart)\n end\n else\n local cFactor = VFactor/UFactor\n local newVDim = math.floor(VDim/cFactor)\n VStart = VStart+(VDim-newVDim)/2\n for i,element in ipairs(dmgoElements) do\n dmgoElements[i].u = math.floor(UDim/100*element.xp+UStart)\n dmgoElements[i].v = math.floor(VDim/100/cFactor*(100-element.zp)+VStart)\n end\n end\n else\n for i,element in ipairs(dmgoElements) do\n dmgoElements[i].u = math.floor(UDim/100*element.xp+UStart)\n dmgoElements[i].v = math.floor(VDim/100*(100-element.zp)+VStart)\n end\n end\n\n elseif screen.submode == \"side\" then\n if DMGOStretch == false then\n local UFactor = UDim/(ShipYmax-ShipYmin)\n local VFactor = VDim/(ShipXmax-ShipZmin)\n if UFactor>=VFactor then\n local cFactor = UFactor/VFactor\n local newUDim = math.floor(UDim/cFactor)\n UStart = UStart+(UDim-newUDim)/2\n for i,element in ipairs(dmgoElements) do\n dmgoElements[i].u = math.floor(UDim/100/cFactor*element.yp+UStart)\n dmgoElements[i].v = math.floor(VDim/100*(100-element.zp)+VStart)\n end\n else\n local cFactor = VFactor/UFactor\n local newVDim = math.floor(VDim/cFactor)\n VStart = VStart+(VDim-newVDim)/2\n for i,element in ipairs(dmgoElements) do\n dmgoElements[i].u = math.floor(UDim/100*element.yp+UStart)\n dmgoElements[i].v = math.floor(VDim/100/cFactor*(100-element.zp)+VStart)\n end\n end\n else\n for i,element in ipairs(dmgoElements) do\n dmgoElements[i].u = math.floor(UDim/100*element.yp+UStart)\n dmgoElements[i].v = math.floor(VDim/100*(100-element.zp)+VStart)\n end\n end\n else\n DrawCenteredText(\"ERROR: non-existing DMGO mode set.\")\n PrintConsole(\"ERROR: non-existing DMGO mode set.\")\n unit.exit()\n end\nend\n\nfunction GetDamageoutlineShip()\n local output = \"\"\n\n for i,element in ipairs(dmgoElements) do\n local cclass = \"\"\n local size = 1\n\n if element.type == \"h\" then\n cclass =\"ch\"\n elseif element.type == \"d\" then\n cclass = \"cw\"\n else\n cclass = \"cc\"\n end\n if element.id == highlightID then\n cclass = \"f2\"\n end\n\n if element.size > 0 and element.size < 1000 then\n size = 5\n elseif element.size >= 1000 and element.size < 2000 then\n size = 8\n elseif element.size >= 2000 and element.size < 5000 then\n size = 12\n elseif element.size >= 5000 and element.size < 10000 then\n size = 15\n elseif element.size >= 10000 and element.size < 20000 then\n size = 20\n elseif element.size >= 20000 then\n size = 30\n end\n output = output .. [[<circle cx=]]..element.u..[[ cy=]]..element.v..[[ r=]]..size..[[ class=]]..cclass..[[ />]]\n if element.id == highlightID then\n output = output .. [[<line class=daline x1=20 y1=]]..element.v..[[ x2=1900 y2=]]..element.v..[[ />]]\n output = output .. [[<line class=daline x1=]]..element.u..[[ y1=180 x2=]]..element.u..[[ y2=1020 />]]\n end\n end\n\n return output\nend\n\nfunction GetContentClickareas(screen)\n local output = \"\"\n if screen ~= nil and screen.ClickAreas ~= nil and #screen.ClickAreas > 0 then\n for i,ca in ipairs(screen.ClickAreas) do\n output = output ..\n [[<rect class=ll x=]]..ca.x1..[[ width=]]..(ca.x2-ca.x1)..[[ y=]]..ca.y1..[[ height=]]..(ca.y2-ca.y1)..[[ />]]\n end\n end\n return output\nend\n\nfunction GetElement1(x, y, width, height)\n x = x or 0\n y = y or 0\n width = width or 600\n height = height or 600\n local output = \"\"\n output = output ..\n [[<svg x=\"]]..x..[[px\" y=\"]]..y..[[px\" width=\"]]..width..[[px\" height=\"]]..height..[[px\" viewBox=\"0 0 200 200\">\n <g>\n <path fill=\"none\" stroke=\"#]]..ColorTertiary..[[\" stroke-width=\"3\" stroke-miterlimit=\"10\" d=\"M138.768,100c0,21.411-17.356,38.768-38.768,38.768c-21.411,0-38.768-17.356-38.768-38.768c0-21.411,17.357-38.768,38.768-38.768\"/>\n <animateTransform attributeType=\"xml\" attributeName=\"transform\" type=\"rotate\" from=\"0 100 100\" to=\"360 100 100\" dur=\"8s\" repeatCount=\"indefinite\"/>\n </g>\n <g>\n <path fill=\"none\" stroke=\"#]]..ColorTertiary..[[\" stroke-width=\"3\" stroke-miterlimit=\"10\" d=\"M132.605,100c0,18.008-14.598,32.605-32.605,32.605c-18.007,0-32.605-14.598-32.605-32.605c0-18.007,14.598-32.605,32.605-32.605\"/>\n <animateTransform attributeType=\"xml\" attributeName=\"transform\" type=\"rotate\" from=\"0 100 100\" to=\"360 100 100\" dur=\"4s\" repeatCount=\"indefinite\"/>\n </g>\n <g>\n <path fill=\"none\" stroke=\"#]]..ColorTertiary..[[\" stroke-width=\"3\" stroke-miterlimit=\"10\" d=\"M126.502,100c0,14.638-11.864,26.502-26.502,26.502c-14.636,0-26.501-11.864-26.501-26.502c0-14.636,11.865-26.501,26.501-26.501\"/>\n <animateTransform attributeType=\"xml\" attributeName=\"transform\" type=\"rotate\" from=\"0 100 100\" to=\"360 100 100\" dur=\"2s\" repeatCount=\"indefinite\"/>\n </g>\n <g>\n <path fill=\"none\" stroke=\"#]]..ColorTertiary..[[\" stroke-width=\"3\" stroke-miterlimit=\"10\" d=\"M120.494,100c0,11.32-9.174,20.494-20.494,20.494c-11.319,0-20.495-9.174-20.495-20.494c0-11.319,9.176-20.495,20.495-20.495\"/>\n <animateTransform attributeType=\"xml\" attributeName=\"transform\" type=\"rotate\" from=\"0 100 100\" to=\"360 100 100\" dur=\"1s\" repeatCount=\"indefinite\"/>\n </g>\n </svg>]]\n return output\nend\n\nfunction GetElement2(x, y)\n x = x or 0\n y = y or 0\n local output = \"\"\n output = output .. [[<svg x=\"]]..x..[[\" y=\"]]..y..[[\"><rect class=\"f\" y=\"13.25\" width=\"1356.84\" height=\"1.96\"/><rect class=\"f\" x=\"49.27\" y=\"12.27\" width=\"44.12\" height=\"3.93\"/><rect class=\"f\" x=\"142.33\" y=\"10.3\" width=\"109.16\" height=\"7.85\"/><rect class=\"f\" x=\"320.08\" y=\"10.3\" width=\"32.52\" height=\"7.85\"/><rect class=\"f\" x=\"379.01\" y=\"12.27\" width=\"106.26\" height=\"3.93\"/><rect class=\"f\" x=\"565.14\" y=\"12.27\" width=\"15.78\" height=\"3.93\"/><rect class=\"f\" x=\"607.64\" y=\"12.27\" width=\"63.44\" height=\"3.93\"/><rect class=\"f\" x=\"692.98\" y=\"13.25\" width=\"15.14\" height=\"1.96\"/><rect class=\"f\" x=\"743.53\" y=\"12.27\" width=\"68.59\" height=\"3.93\"/><rect class=\"f\" x=\"877.17\" y=\"10.3\" width=\"86.62\" height=\"7.85\"/><rect class=\"f\" x=\"992.13\" y=\"12.27\" width=\"56.35\" height=\"3.93\"/><rect class=\"f\" x=\"1092.6\" y=\"10.3\" width=\"40.9\" height=\"7.85\"/><rect class=\"f\" x=\"1172.14\" y=\"12.27\" width=\"11.59\" height=\"3.93\"/><rect class=\"f\" x=\"1202.08\" y=\"12.27\" width=\"40.25\" height=\"3.93\"/><rect class=\"f\" x=\"1260.69\" y=\"13.25\" width=\"12.83\" height=\"1.96\"/><rect class=\"f\" x=\"1306.74\" y=\"10.3\" width=\"28.98\" height=\"7.85\"/><rect class=\"f\" x=\"16.58\" y=\"1.47\" width=\"122.21\" height=\"1.96\"/><rect class=\"f\" x=\"158.11\" y=\"23.06\" width=\"38.8\" height=\"1.96\"/><rect class=\"f\" x=\"209.79\" y=\"1.47\" width=\"12.56\" height=\"1.96\"/><rect class=\"f\" x=\"251.49\" width=\"66.01\" height=\"1.96\"/><rect class=\"f\" x=\"341.66\" width=\"26.57\" height=\"1.96\"/><rect class=\"f\" x=\"432.14\" y=\"23.06\" width=\"106.91\" height=\"1.96\"/><rect class=\"f\" x=\"584.14\" y=\"23.06\" width=\"23.51\" height=\"1.96\"/><rect class=\"f\" x=\"637.27\" y=\"23.06\" width=\"11.11\" height=\"1.96\"/><rect class=\"f\" x=\"625.69\" width=\"79.68\" height=\"1.96\"/><rect class=\"f\" x=\"732.91\" width=\"38.64\" height=\"1.96\"/><rect class=\"f\" x=\"823.23\" y=\"23.06\" width=\"68.19\" height=\"1.96\"/><rect class=\"f\" x=\"914.76\" y=\"23.06\" width=\"81.03\" height=\"1.96\"/><rect class=\"f\" x=\"1023.69\" y=\"23.06\" width=\"18.35\" height=\"1.96\"/><rect class=\"f\" x=\"1056.05\" width=\"35.32\" height=\"1.96\"/><rect class=\"f\" x=\"1113.05\" width=\"28.98\" height=\"1.96\"/><rect class=\"f\" x=\"1213.09\" width=\"93.65\" height=\"1.96\"/><rect class=\"f\" x=\"1249.26\" y=\"26.5\" width=\"37.19\" height=\"1.96\"/></svg>]]\n return output\nend\n\nfunction GetElementLogo(x, y, primaryC, secondaryC, tertiaryC)\n x = x or 812\n y = y or 380\n primaryC = primaryC or \"f\"\n secondaryC = secondaryC or \"f2\"\n tertiaryC = tertiaryC or \"f3\"\n local output = \"\"\n output = output .. [[\n <svg x=\"]]..x..[[\" y=\"]]..y..[[\">\n <g>\n <g>\n <path class=\"]]..tertiaryC..[[\" d=\"M909.49,556l0,.63a9.39,9.39,0,0,0-.07,1.37c0,1-.07,2-.07,2H813l.14-5.73c0-1.43.12-2.86.21-3.94s.13-1.79.13-1.79Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..tertiaryC..[[\" d=\"M910.2,550.62s-.05.24-.11.61-.19.84-.23,1.34c-.11,1-.25,2-.25,2l-95.72-10.2.72-5.71c.18-1.43.47-2.84.65-3.91s.31-1.78.31-1.78Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..tertiaryC..[[\" d=\"M911.46,545.36s-.25,1-.54,1.9l-.44,1.93-94.07-20.42s.63-2.82,1.32-5.62,1.57-5.56,1.57-5.56Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..tertiaryC..[[\" d=\"M913.28,540.28s-.34.93-.71,1.84a12.07,12.07,0,0,0-.46,1.28l-.2.58L820.6,513.53s.23-.69.58-1.71.8-2.4,1.35-3.74l2.13-5.36Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..tertiaryC..[[\" d=\"M1007.3,578.3a18.4,18.4,0,0,0,.67-1.85c.16-.46.32-.93.45-1.28s.16-.59.16-.59l92.23,27.53-.5,1.74c-.35,1-.81,2.39-1.26,3.76-.9,2.75-2,5.43-2,5.43Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..tertiaryC..[[\" d=\"M1002.33,587.93s.53-.85,1.08-1.67,1-1.73,1-1.73l84.19,46.67-2.87,5-3.1,4.85Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..tertiaryC..[[\" d=\"M999.09,592.32s.62-.78,1.23-1.57a12.58,12.58,0,0,0,.81-1.1l.36-.51,78.71,55.41s-.41.59-1,1.47-1.45,2.05-2.35,3.17-1.78,2.27-2.45,3.11l-1.12,1.41Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..tertiaryC..[[\" d=\"M934.59,516.17a19.52,19.52,0,0,0-1.7,1l-1.15.73-.51.36-54.77-79.15,1.47-1,3.33-2.15c2.4-1.58,4.92-3,4.92-3Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..tertiaryC..[[\" d=\"M939.41,513.7l-.56.26a12.84,12.84,0,0,0-1.23.58c-.87.46-1.77.89-1.77.89l-46-84.56,5.13-2.64c1.28-.67,2.6-1.25,3.58-1.7l1.65-.75Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..tertiaryC..[[\" d=\"M949.68,510.38s-1,.24-1.92.45a13.32,13.32,0,0,0-1.31.35l-.6.17-26.78-92.46,1.73-.49c1.05-.29,2.43-.7,3.84-1l5.63-1.29Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..tertiaryC..[[\" d=\"M935.2,604.24l.53.32c.32.19.78.38,1.22.62s.87.46,1.2.62l.57.25-40.51,87.32-1.64-.76c-1-.46-2.26-1.13-3.54-1.78s-2.57-1.31-3.52-1.84L888,688.1Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..tertiaryC..[[\" d=\"M930.61,601.32l.51.36a11.48,11.48,0,0,0,1.13.77l1.15.74a6.12,6.12,0,0,0,.52.33L884.26,686s-.62-.36-1.53-1l-3.34-2.13c-1.22-.77-2.4-1.59-3.27-2.22l-1.47-1Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..tertiaryC..[[\" d=\"M985,515.92a18,18,0,0,0-1.74-.95l-1.21-.63-.57-.25,40.84-87.17,1.63.76,3.54,1.8c2.58,1.28,5.06,2.74,5.06,2.74Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..tertiaryC..[[\" d=\"M989.55,518.85l-.51-.36c-.31-.21-.69-.53-1.12-.77-.85-.53-1.67-1.08-1.67-1.08l50-82.28,4.85,3.1c1.22.76,2.38,1.61,3.27,2.23l1.46,1Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..tertiaryC..[[\" d=\"M997.69,526.13a3.89,3.89,0,0,0-.43-.46l-1-1a11,11,0,0,0-1-1l-.45-.43,66.29-69.8,1.3,1.24c.78.74,1.81,1.75,2.79,2.8l2.73,2.86c.74.78,1.21,1.32,1.21,1.32Z\" transform=\"translate(-813.04 -413.09)\"/>\n <animateTransform attributeType=\"xml\" attributeName=\"transform\" type=\"rotate\" from=\"0 147 147\" to=\"360 147 147\" dur=\"15s\" repeatCount=\"indefinite\"/>\n </g>\n <g>\n <path class=\"]]..tertiaryC..[[\" d=\"M985,515.92a18,18,0,0,0-1.74-.95l-1.21-.63-.57-.25,40.84-87.17,1.63.76,3.54,1.8c2.58,1.28,5.06,2.74,5.06,2.74Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..tertiaryC..[[\" d=\"M939.41,513.7l-.56.26a12.84,12.84,0,0,0-1.23.58c-.87.46-1.77.89-1.77.89l-46-84.56,5.13-2.64c1.28-.67,2.6-1.25,3.58-1.7l1.65-.75Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..tertiaryC..[[\" d=\"M910.2,550.62s-.05.24-.11.61-.19.84-.23,1.34c-.11,1-.25,2-.25,2l-95.72-10.2.72-5.71c.18-1.43.47-2.84.65-3.91s.31-1.78.31-1.78Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..tertiaryC..[[\" d=\"M930.61,601.32l.51.36a11.48,11.48,0,0,0,1.13.77l1.15.74a6.12,6.12,0,0,0,.52.33L884.26,686s-.62-.36-1.53-1l-3.34-2.13c-1.22-.77-2.4-1.59-3.27-2.22l-1.47-1Z\" transform=\"translate(-813.04 -413.09)\"/>\n <animateTransform attributeType=\"xml\" attributeName=\"transform\" type=\"rotate\" from=\"360 147 147\" to=\"0 147 147\" dur=\"8s\" repeatCount=\"indefinite\"/>\n </g>\n <g>\n <path class=\"]]..primaryC..[[\" d=\"M873.15,471.64l-.37.36c-.25.22-.6.57-1,1l-3.57,3.76a128.19,128.19,0,0,0-9.79,12.31c-.85,1.16-1.64,2.35-2.39,3.54s-1.52,2.35-2.21,3.5c-1.33,2.34-2.64,4.47-3.59,6.41s-1.82,3.49-2.32,4.65l-.81,1.79-21-9.49s.36-.77,1-2.13,1.6-3.24,2.76-5.51,2.67-4.84,4.26-7.6c.81-1.36,1.72-2.74,2.62-4.15s1.83-2.83,2.82-4.2a153.32,153.32,0,0,1,11.61-14.59c1.74-1.86,3.21-3.39,4.23-4.45.51-.54.93-.95,1.22-1.23l.43-.42Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..primaryC..[[\" d=\"M985.66,438.77s-.7-.17-1.93-.39-3-.55-5.12-.89a126.07,126.07,0,0,0-15.67-1.33c-2.85-.12-5.71,0-8.38.06s-5.18.36-7.31.52l-5.15.65c-.63.08-1.11.15-1.44.22l-.51.08L936.48,415l.61-.1c.39-.08,1-.16,1.7-.26l6.11-.76c2.53-.21,5.49-.49,8.66-.62s6.54-.22,9.92-.08A149,149,0,0,1,982,414.73c2.52.4,4.61.79,6.07,1.06s2.3.45,2.3.45Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..primaryC..[[\" d=\"M1077.65,521l-.64-1.87c-.38-1.2-1-2.87-1.82-4.87a122.77,122.77,0,0,0-6.73-14.25,127.15,127.15,0,0,0-8.49-13.26c-1.25-1.75-2.4-3.12-3.16-4.11l-1.22-1.54,17.74-14.66,1.45,1.82c.91,1.18,2.27,2.81,3.75,4.88a149,149,0,0,1,10.06,15.71,144.75,144.75,0,0,1,8,16.91c1,2.37,1.71,4.36,2.16,5.78l.76,2.22Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..primaryC..[[\" d=\"M1083,574.9s.09-.71.24-1.95.25-3,.41-5.17.18-4.64.26-7.31c0-1.34,0-2.72-.08-4.13s-.06-2.83-.19-4.26-.22-2.85-.33-4.25-.33-2.78-.49-4.11c-.3-2.67-.8-5.14-1.17-7.25s-.84-3.86-1.1-5.08-.45-1.92-.45-1.92l22.31-5.67s.2.83.54,2.28.87,3.52,1.3,6,1,5.44,1.39,8.6c.19,1.58.42,3.21.58,4.87s.26,3.35.39,5,.18,3.38.23,5,.09,3.3.08,4.89c-.08,3.16-.08,6.12-.29,8.65s-.34,4.65-.49,6.13-.28,2.31-.28,2.31Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..primaryC..[[\" d=\"M1018,669.57l.46-.23c.3-.16.74-.38,1.28-.7l4.5-2.59a128.6,128.6,0,0,0,12.89-9l1.69-1.33,1.61-1.39c1.06-.92,2.12-1.82,3.11-2.72,1.93-1.86,3.8-3.53,5.26-5.11,3-3.07,4.83-5.27,4.83-5.27L1071,656.3s-2.18,2.6-5.73,6.24c-1.73,1.86-3.93,3.86-6.23,6.05-1.18,1.07-2.43,2.14-3.69,3.23l-1.91,1.64-2,1.58a152.35,152.35,0,0,1-15.29,10.69l-5.34,3.07c-.64.38-1.16.65-1.51.83l-.55.28Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..primaryC..[[\" d=\"M854.89,625.68l1.06,1.66c.34.53.75,1.17,1.23,1.9l1.68,2.4a126.18,126.18,0,0,0,9.88,12.24,130,130,0,0,0,11.36,10.88c1.61,1.41,3.07,2.46,4,3.25l1.55,1.21-13.81,18.42L870,676.21c-1.15-.94-2.86-2.19-4.78-3.87a150.72,150.72,0,0,1-13.45-12.89A145.71,145.71,0,0,1,840.09,645c-.74-1-1.41-2-2-2.84s-1.05-1.63-1.46-2.25c-.8-1.25-1.25-2-1.25-2Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..primaryC..[[\" d=\"M836.93,574.52l.25,2c.08.62.18,1.38.29,2.24s.32,1.84.5,2.9l.62,3.41c.27,1.2.56,2.47.86,3.78.56,2.63,1.43,5.37,2.21,8.13.93,2.72,1.77,5.47,2.8,8,.5,1.25,1,2.46,1.44,3.6s1,2.19,1.43,3.17c.86,2,1.69,3.56,2.26,4.67s.9,1.76.9,1.76l-20.33,10.79-1.07-2.08c-.68-1.32-1.66-3.21-2.69-5.55l-1.68-3.76c-.57-1.34-1.13-2.78-1.71-4.27-1.22-3-2.24-6.2-3.33-9.43-.93-3.27-1.95-6.53-2.62-9.65-.35-1.56-.7-3.06-1-4.49l-.74-4c-.22-1.26-.42-2.41-.59-3.43s-.25-1.92-.35-2.66c-.19-1.47-.29-2.31-.29-2.31Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..primaryC..[[\" d=\"M912.27,674.43l1.83.73c1.18.44,2.82,1.16,4.87,1.83s4.4,1.52,7,2.21,5.38,1.42,8.18,2a123,123,0,0,0,15.58,2.27c2.14.16,3.92.32,5.17.33l2,0-.57,23-2.33-.06c-1.47,0-3.59-.2-6.12-.39a146.55,146.55,0,0,1-18.48-2.69c-3.32-.75-6.64-1.51-9.7-2.43s-5.9-1.81-8.31-2.63-4.39-1.65-5.78-2.17l-2.17-.87Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..primaryC..[[\" d=\"M965.68,683.83s.72,0,2-.11l5.17-.41a125.38,125.38,0,0,0,15.53-2.63c2.81-.6,5.55-1.45,8.14-2.18s4.94-1.61,7-2.38l4.84-1.91,1.8-.8,9.31,21.05-2.14.95-5.74,2.27c-2.38.9-5.22,1.84-8.25,2.82s-6.33,1.87-9.66,2.59a151.67,151.67,0,0,1-18.43,3.12c-2.53.23-4.64.38-6.12.49s-2.32.13-2.32.13Z\" transform=\"translate(-813.04 -413.09)\"/>\n <animateTransform attributeType=\"xml\" attributeName=\"transform\" type=\"rotate\" from=\"360 147 147\" to=\"0 147 147\" dur=\"100s\" repeatCount=\"indefinite\"/>\n </g>\n <g>\n <path class=\"]]..secondaryC..[[\" d=\"M930,519.2a3.27,3.27,0,0,0-.5.37l-1.28,1c-1,.85-2.4,2-3.7,3.3-.66.61-1.23,1.31-1.84,1.9s-1.06,1.24-1.52,1.74-.76,1-1,1.27l-.38.49L881.5,500l.74-.95c.49-.59,1.12-1.48,2-2.46s1.84-2.17,2.95-3.37,2.3-2.48,3.57-3.69c2.5-2.45,5.13-4.75,7.17-6.39l2.49-2c.59-.48,1-.72,1-.72Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..secondaryC..[[\" d=\"M977.4,512.38s-.85-.25-2.11-.71c-.63-.2-1.39-.38-2.19-.63s-1.68-.37-2.54-.61-1.76-.3-2.58-.47l-2.28-.3c-.66-.12-1.24-.09-1.63-.14l-.61,0,3.18-48,1.2.09c.76.08,1.86.1,3.16.28s2.82.34,4.43.59,3.34.57,5.05.93,3.42.75,5,1.19,3.06.85,4.31,1.25l4.13,1.4Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..secondaryC..[[\" d=\"M959.68,509.35l-1.08,0-1.1,0c-.4,0-.83.07-1.25.1a22.56,22.56,0,0,0-2.34.22l-1,.13-6.67-47.67,2-.26c1.23-.18,2.88-.31,4.53-.43.83-.05,1.65-.14,2.43-.17l2.11-.05,2.07,0Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..secondaryC..[[\" d=\"M1009.87,551s0-.22-.1-.61a13.68,13.68,0,0,0-.34-1.58c-.16-.65-.28-1.42-.55-2.21s-.43-1.67-.76-2.5c-.14-.42-.28-.85-.41-1.26s-.33-.81-.47-1.2c-.3-.78-.58-1.51-.88-2.11l-.66-1.47-.29-.55L1048.49,516l.55,1.07c.31.7.76,1.69,1.31,2.89s1.13,2.6,1.72,4.13c.29.77.63,1.54.9,2.36s.56,1.64.84,2.47c.6,1.64,1,3.33,1.49,4.91s.77,3.07,1.08,4.34.54,2.34.65,3.1l.22,1.18Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..secondaryC..[[\" d=\"M1003.64,534.22a7.16,7.16,0,0,0-.56-.91c-.36-.52-.77-1.27-1.27-1.95s-1-1.41-1.37-1.9l-.67-.84,37.74-29.87,1.28,1.62c.77,1,1.69,2.35,2.66,3.69s1.8,2.77,2.49,3.81,1.07,1.76,1.07,1.76Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..secondaryC..[[\" d=\"M1009.26,572s.06-.23.15-.64.27-1,.36-1.69a48.31,48.31,0,0,0,.72-5.21c.06-1,.18-1.92.16-2.84s.08-1.76,0-2.49,0-1.34,0-1.76-.06-.66-.06-.66l48-3.06s0,.47.1,1.28,0,2,.08,3.39,0,3,0,4.78-.18,3.61-.32,5.48a100.31,100.31,0,0,1-1.4,10.17c-.22,1.38-.53,2.51-.7,3.31s-.29,1.25-.29,1.25Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..secondaryC..[[\" d=\"M977.17,607.75a55.37,55.37,0,0,0,6.51-2.89c.81-.38,1.55-.89,2.29-1.28s1.37-.89,1.94-1.23,1-.72,1.34-.93l.51-.36L1018.07,640l-1,.7c-.63.43-1.49,1.11-2.6,1.8s-2.38,1.56-3.79,2.39-2.91,1.73-4.47,2.52c-3.09,1.63-6.28,3.08-8.7,4.08l-2.95,1.16a11.58,11.58,0,0,1-1.12.41Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..secondaryC..[[\" d=\"M956.34,610.57a21.57,21.57,0,0,0,2.42.12l1.18,0,1.31,0,1.41,0,1.43-.12a52,52,0,0,0,7.56-1.17l11,46.86-1.25.29-1.44.33-1.88.34c-1.38.24-3,.57-4.72.75s-3.59.48-5.45.58l-2.78.21-2.7.07-2.52.06-2.26-.06c-2.81,0-4.67-.22-4.67-.22Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..secondaryC..[[\" d=\"M913.63,580.53a50,50,0,0,0,3.35,6.31c.5.74.94,1.53,1.46,2.19s.91,1.35,1.36,1.86.76,1,1,1.29.41.47.41.47l-36.81,31-.78-.92-2-2.49c-.83-1-1.69-2.28-2.65-3.61s-1.88-2.81-2.83-4.28A97.28,97.28,0,0,1,869.63,600Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..secondaryC..[[\" d=\"M943.81,608.07l1.1.39c.68.17,1.57.43,2.47.7s1.82.42,2.51.57l1.16.19-8.41,47.39-2.25-.4c-1.35-.28-3.13-.72-4.92-1.12l-4.86-1.37-2.17-.74Z\" transform=\"translate(-813.04 -413.09)\"/>\n <path class=\"]]..secondaryC..[[\" d=\"M909.3,560s.06,1,.07,2.43c0,.72.11,1.57.18,2.47s.25,1.84.33,2.8l.5,2.76c.23.86.39,1.68.56,2.37.41,1.37.64,2.29.64,2.29l-46,14.31L864.35,585c-.33-1.35-.68-3-1.08-4.66s-.66-3.55-1-5.39-.5-3.7-.66-5.45-.27-3.37-.34-4.77l-.12-4.67Z\" transform=\"translate(-813.04 -413.09)\"/>\n <animateTransform attributeType=\"xml\" attributeName=\"transform\" type=\"rotate\" from=\"0 147 147\" to=\"360 147 147\" dur=\"45s\" repeatCount=\"indefinite\"/>\n </g>\n <g>\n <path class=\"]]..secondaryC..[[\" d=\"M909.3,560s.06,1,.07,2.43c0,.72.11,1.57.18,2.47s.25,1.84.33,2.8l.5,2.76c.23.86.39,1.68.56,2.37.41,1.37.64,2.29.64,2.29l-46,14.31L864.35,585c-.33-1.35-.68-3-1.08-4.66s-.66-3.55-1-5.39-.5-3.7-.66-5.45-.27-3.37-.34-4.77l-.12-4.67Z\" transform=\"translate(-813.04 -413.09)\"/>\n <animateTransform attributeType=\"xml\" attributeName=\"transform\" type=\"rotate\" from=\"0 147 147\" to=\"360 147 147\" dur=\"4s\" repeatCount=\"indefinite\"/>\n </g>\n <g>\n <path class=\"]]..secondaryC..[[\" d=\"M909.3,560s.06,1,.07,2.43c0,.72.11,1.57.18,2.47s.25,1.84.33,2.8l.5,2.76c.23.86.39,1.68.56,2.37.41,1.37.64,2.29.64,2.29l-46,14.31L864.35,585c-.33-1.35-.68-3-1.08-4.66s-.66-3.55-1-5.39-.5-3.7-.66-5.45-.27-3.37-.34-4.77l-.12-4.67Z\" transform=\"translate(-813.04 -413.09)\"/>\n <animateTransform attributeType=\"xml\" attributeName=\"transform\" type=\"rotate\" from=\"360 147 147\" to=\"0 147 147\" dur=\"12s\" repeatCount=\"indefinite\"/>\n </g>\n </g>\n </svg>]]\n return output\nend\n\nfunction GetHeader(headertext)\n headertext = headertext or \"ERROR: UNDEFINED\"\n local output = \"\"\n output = output ..\n [[<path class=\"f\" d=\"M1920,582v-2.42H1820l-3.71,4.66h-49.75l-4.65-4.66H1572.63L1519,526H1462.8l-2.84-6H1154l-6,6H0v74.06H28.43l5.4,5.4H260.42l2.78-5.4H490.58l3.66-4.58H788.61l4.58,4.58h574.75l8.91-11.16h119L1507,600.08h405.19v0l7.77-.1V582.81h-3.22V582Zm-7.77,14.87-.13,0h.13Z\" transform=\"translate(0 -520.01)\"/>\n <text class=\"f50sxx\" x=\"40\" y=\"60\">]]..headertext..[[</text>]]\n return output\nend\n\nfunction GetContentBackground(candidate, bgcolor)\n bgColor = ColorBackgroundPattern\n\n local output = \"\"\n\n if candidate == \"dots\" then\n output=[[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\");]]\n elseif candidate == \"rain\" then\n output=[[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\");]]\n elseif candidate == \"plus\" then\n output=[[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\");]]\n elseif candidate == \"signal\" then\n output=[[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\");]]\n elseif candidate == \"deathstar\" then\n output=[[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\");]]\n elseif candidate == \"diamond\" then\n output=[[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\");]]\n elseif candidate == \"hexagon\" then\n output=[[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\");]]\n elseif candidate == \"capsule\" then\n output=[[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\");]]\n elseif candidate == \"diagonal\" then\n output=[[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\");]]\n end\n return output;\nend\n\nfunction GetContentDamageHUDOutput()\n local hudWidth = 300\n local hudHeight = 165\n if #damagedElements > 0 or #brokenElements > 0 then hudHeight = 510 end\n local output = \"\"\n\n output = output .. [[<svg style=\"position:absolute;top:]].. HUDShiftV ..[[; left:]] .. HUDShiftU .. [[;\" viewBox=\"0 0 ]] .. hudWidth .. [[ ]] .. hudHeight .. [[\" width=\"]] .. hudWidth .. [[\" height=\"]] .. hudHeight .. [[\">\n <style>\n .f22mxxxb { font-size: 22px; font-weight: bold; text-anchor: middle; fill: #]]..ColorTertiary..[[; }\n .f20mxxb { font-size: 20px; font-weight:bold; text-anchor: middle; fill: #]]..ColorSecondary..[[; }\n .f18sxx { font-size: 18px; text-anchor: start; fill: #]]..ColorSecondary..[[; }\n .f18exx { font-size: 18px; text-anchor: end; fill: #]]..ColorSecondary..[[; }\n .f18mh { font-size: 18px; text-anchor: middle; fill: #]]..ColorHealthy..[[; }\n .f18exxb { font-size: 18px; font-weight: bold; text-anchor: end; fill: #]]..ColorSecondary..[[; }\n .f15swb { font-size: 15px; font-weight: bold; text-anchor: start; fill:#]]..ColorWarning..[[; }\n .f15scb { font-size: 15px; font-weight: bold; text-anchor: start; fill:#]]..ColorCritical..[[; }\n .f15ewb { font-size: 15px; font-weight: bold; text-anchor: end; fill:#]]..ColorWarning..[[; }\n .f15ecb { font-size: 15px; font-weight: bold; text-anchor: end; fill:#]]..ColorCritical..[[; }\n .f15sxxxb { font-size: 15px; font-weight: bold; text-anchor: start; fill:#]]..ColorTertiary..[[; }\n .f15exxxb { font-size: 15px; font-weight: bold; text-anchor: end; fill:#]]..ColorTertiary..[[; }\n .f12mxx { font-size: 12px; fill: #]]..ColorSecondary..[[; text-anchor: middle}\n .xfill { fill:#]]..ColorPrimary..[[;}\n .xline { stroke: #]]..ColorPrimary..[[; stroke-width: 1;}\n </style>\n ]]\n output = output .. [[<rect stroke=#]]..ColorPrimary..[[ stroke-width=2 x=0 y=0 rx=10 ry=10 width=\"]] .. hudWidth .. [[\" height=\"]] .. hudHeight .. [[\" fill=#]]..ColorBackground..[[ fill-opacity=0.6 />]] ..\n [[<rect class=xfill x=0 x=0 y=0 rx=10 ry=10 width=300 height=30 />]] ..\n [[<rect class=xfill x=0 x=0 y=5 rx=0 ry=0 width=300 height=30 />]] ..\n [[<text x=150 y=24 class=\"f20mxxb\">]]..(YourShipsName==\"Enter here\" and (\"Ship ID \"..ShipID) or YourShipsName) .. [[</text>]] ..\n [[<circle cx=17 cy=17 r=10 stroke=#]]..ColorBackground..[[ stroke-width=2 fill=none />]]\n if #brokenElements > 0 then\n output = output .. [[<svg x=\"2px\" y=\"2px\" width=\"30px\" height=\"30px\" viewBox=\"0 0 50 50\"><path fill=\"#]]..ColorCritical..[[\" d=\"M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z\"><animateTransform attributeType=\"xml\" attributeName=\"transform\" type=\"rotate\" from=\"0 25 25\" to=\"360 25 25\" dur=\"1s\" repeatCount=\"indefinite\"/></path></svg>]]\n elseif #damagedElements > 0 then\n output = output .. [[<svg x=\"2px\" y=\"2px\" width=\"30px\" height=\"30px\" viewBox=\"0 0 50 50\"><path fill=\"#]]..ColorWarning..[[\" d=\"M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z\"><animateTransform attributeType=\"xml\" attributeName=\"transform\" type=\"rotate\" from=\"0 25 25\" to=\"360 25 25\" dur=\"1s\" repeatCount=\"indefinite\"/></path></svg>]]\n else\n output = output .. [[<svg x=\"2px\" y=\"2px\" width=\"30px\" height=\"30px\" viewBox=\"0 0 50 50\"><path fill=\"#]]..ColorHealthy..[[\" d=\"M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z\"><animateTransform attributeType=\"xml\" attributeName=\"transform\" type=\"rotate\" from=\"0 25 25\" to=\"360 25 25\" dur=\"1s\" repeatCount=\"indefinite\"/></path></svg>]]\n end\n\n if #damagedElements > 0 or #brokenElements > 0 then\n\n output = output .. [[<text x=10 y=55 class=\"f18sxx\">Total Damage</text>]] ..\n [[<text x=290 y=55 class=\"f18exxb\">]]..GenerateCommaValue(string.format(\"%.0f\", totalShipMaxHP - totalShipHP))..[[</text>]]\n output = output .. [[<text x=10 y=75 class=\"f18sxx\">T]]..ScrapTier..[[ Scrap Needed</text>]] ..\n [[<text x=290 y=75 class=\"f18exxb\">]]..getScraps(totalShipMaxHP - totalShipHP, true)..[[</text>]]\n output = output .. [[<text x=10 y=95 class=\"f18sxx\">Repair Time</text>]] ..\n [[<text x=290 y=95 class=\"f18exxb\">]]..getRepairTime(totalShipMaxHP - totalShipHP, true)..[[</text>]]\n\n output = output .. [[<rect class=xfill x=0 y=105 rx=0 ry=0 width=300 height=40 />]] ..\n [[<rect fill=#]]..ColorHealthy..[[ stroke=#]]..ColorTertiary..[[ stroke-width=1 x=10 y=110 rx=5 ry=5 width=90 height=30 />]] ..\n [[<text x=55 y=132 class=\"f22mxxxb\">]]..#healthyElements..[[</text>]] ..\n [[<rect fill=#]]..ColorWarning..[[ stroke=#]]..ColorTertiary..[[ stroke-width=1 x=105 y=110 rx=5 ry=5 width=90 height=30 />]] ..\n [[<text x=150 y=132 class=\"f22mxxxb\">]]..#damagedElements..[[</text>]] ..\n [[<rect fill=#]]..ColorCritical..[[ stroke=#]]..ColorTertiary..[[ stroke-width=1 x=200 y=110 rx=5 ry=5 width=90 height=30 />]] ..\n [[<text x=245 y=132 class=\"f22mxxxb\">]]..#brokenElements..[[</text>]]\n local j=0\n\n for currentIndex=hudStartIndex,hudStartIndex+9,1 do\n if rE[currentIndex] ~= nil then\n v = rE[currentIndex]\n if v.hp > 0 then\n output = output .. [[<rect fill=#]]..ColorWarning..[[ fill-opacity=0.2 x=1 y=]]..(147+j*26)..[[ width=298 height=25 />]] ..\n [[<text x=10 y=]]..(165+j*26)..[[ class=\"f15swb\">]]..string.format(\"%.30s\", v.name)..[[</text>]] ..\n [[<text x=290 y=]]..(165+j*26)..[[ class=\"f15ewb\">]]..GenerateCommaValue(string.format(\"%.0f\", v.missinghp))..[[</text>]]\n if v.id == highlightID then\n output = output .. [[<rect fill=#]]..ColorWarning..[[ fill-opacity=1 x=1 y=]]..(147+j*26)..[[ width=298 height=25 />]] ..\n [[<text x=10 y=]]..(165+j*26)..[[ class=\"f15sxxxb\">]]..string.format(\"%.30s\", v.name)..[[</text>]] ..\n [[<text x=290 y=]]..(165+j*26)..[[ class=\"f15exxxb\">]]..GenerateCommaValue(string.format(\"%.0f\", v.missinghp))..[[</text>]]\n end\n else\n output = output .. [[<rect fill=#]]..ColorCritical..[[ x=1 y=]]..(147+j*26)..[[ fill-opacity=0.2 width=298 height=25 />]] ..\n [[<text x=10 y=]]..(165+j*26)..[[ class=\"f15scb\">]]..string.format(\"%.30s\", v.name)..[[</text>]] ..\n [[<text x=290 y=]]..(165+j*26)..[[ class=\"f15ecb\">]]..GenerateCommaValue(string.format(\"%.0f\", v.missinghp))..[[</text>]]\n if v.id == highlightID then\n highlightX = elementPosition.x - coreWorldOffset\n highlightY = elementPosition.y - coreWorldOffset\n highlightZ = elementPosition.z - coreWorldOffset\n output = output .. [[<rect fill=#]]..ColorCritical..[[ x=1 y=]]..(147+j*26)..[[ fill-opacity=1 width=298 height=25 />]] ..\n [[<text x=10 y=]]..(165+j*26)..[[ class=\"f15sxxxb\">]]..string.format(\"%.30s\", v.name)..[[</text>]] ..\n [[<text x=290 y=]]..(165+j*26)..[[ class=\"f15exxxb\">]]..GenerateCommaValue(string.format(\"%.0f\", v.missinghp))..[[</text>]]\n end\n end\n j=j+1\n end\n end\n if DisallowKeyPresses == true then\n output = output ..\n [[<svg x=\"0\" y=\"408\">]] ..\n [[<rect class=xfill x=0 y=0 rx=0 ry=0 width=300 height=40 />]] ..\n [[<rect class=xfill x=0 y=22 rx=10 ry=10 width=300 height=80 />]] ..\n [[<svg x=0 y=3>]] ..\n [[<text x=\"150\" y=\"15\" class=\"f12mxx\"></text>]] ..\n [[<text x=\"150\" y=\"30\" class=\"f12mxx\"></text>]] ..\n [[<text x=\"150\" y=\"45\" class=\"f12mxx\">Keypresses disabled.</text>]] ..\n [[<text x=\"150\" y=\"60\" class=\"f12mxx\">Change in LUA parameters</text>]] ..\n [[<text x=\"150\" y=\"75\" class=\"f12mxx\">by unchecking DisallowKeyPresses.</text>]] ..\n [[<text x=\"150\" y=\"90\" class=\"f12mxx\"></text>]] ..\n [[<svg>]] ..\n [[</svg>]]\n else\n output = output ..\n [[<svg x=\"0\" y=\"408\">]] ..\n [[<rect class=xfill x=0 y=0 rx=0 ry=0 width=300 height=40 />]] ..\n [[<rect class=xfill x=0 y=22 rx=10 ry=10 width=300 height=80 />]] ..\n [[<svg x=0 y=3>]] ..\n [[<text x=\"150\" y=\"15\" class=\"f12mxx\">Up/down arrows to highlight</text>]] ..\n [[<text x=\"150\" y=\"30\" class=\"f12mxx\">CTRL + arrows to move HUD</text>]] ..\n [[<text x=\"150\" y=\"45\" class=\"f12mxx\">Left arrow to toggle HUD Mode</text>]] ..\n [[<text x=\"150\" y=\"60\" class=\"f12mxx\">ALT+1-4 to set Scrap Tier</text>]] ..\n [[<text x=\"150\" y=\"75\" class=\"f12mxx\">ALT+8 to reset HUD position</text>]] ..\n [[<text x=\"150\" y=\"90\" class=\"f12mxx\">ALT+9 to shut script off</text>]] ..\n [[<svg>]] ..\n [[</svg>]]\n end\n else\n if DisallowKeyPresses == true then\n output = output ..\n [[<text x=\"150\" y=\"60\" class=\"f18mh\" fill=\"#]]..ColorHealthy..[[\">]] .. OkayCenterMessage .. [[</text>]] ..\n [[<text x=\"150\" y=\"88\" class=\"f18mh\" fill=\"#]]..ColorHealthy..[[\">]]..#healthyElements..[[ elements / ]] .. GenerateCommaValue(string.format(\"%.0f\", totalShipMaxHP)) .. [[ HP.</text>]] ..\n [[<svg x=\"0\" y=\"100\">]] ..\n [[<rect class=xfill x=0 y=0 rx=0 ry=0 width=300 height=40 />]] ..\n [[<rect class=xfill x=0 y=35 rx=10 ry=10 width=300 height=30 />]] ..\n [[<svg x=0 y=3>]] ..\n [[<text x=\"150\" y=\"10\" class=\"f12mxx\">Keypresses disabled.</text>]] ..\n [[<text x=\"150\" y=\"25\" class=\"f12mxx\">Change in LUA parameters</text>]] ..\n [[<text x=\"150\" y=\"40\" class=\"f12mxx\">by unchecking DisallowKeyPresses.</text>]] ..\n [[<text x=\"150\" y=\"55\" class=\"f12mxx\"></text>]] ..\n [[<svg>]] ..\n [[</svg>]]\n else\n output = output ..\n [[<text x=\"150\" y=\"60\" class=\"f18mh\" fill=\"#]]..ColorHealthy..[[\">]] .. OkayCenterMessage .. [[</text>]] ..\n [[<text x=\"150\" y=\"88\" class=\"f18mh\" fill=\"#]]..ColorHealthy..[[\">]]..#healthyElements..[[ elements / ]] .. GenerateCommaValue(string.format(\"%.0f\", totalShipMaxHP)) .. [[ HP.</text>]] ..\n [[<svg x=\"0\" y=\"100\">]] ..\n [[<rect class=xfill x=0 y=0 rx=0 ry=0 width=300 height=40 />]] ..\n [[<rect class=xfill x=0 y=35 rx=10 ry=10 width=300 height=30 />]] ..\n [[<svg x=0 y=3>]] ..\n [[<text x=\"150\" y=\"10\" class=\"f12mxx\">Left arrow to toggle HUD Mode</text>]] ..\n [[<text x=\"150\" y=\"25\" class=\"f12mxx\">CTRL + arrows to move HUD</text>]] ..\n [[<text x=\"150\" y=\"40\" class=\"f12mxx\">ALT+8 to reset HUD position</text>]] ..\n [[<text x=\"150\" y=\"55\" class=\"f12mxx\">ALT+9 to shut script off</text>]] ..\n [[<svg>]] ..\n [[</svg>]]\n end\n end\n output = output .. [[</svg>]]\n return output\nend\n\nfunction GetContentDamageScreen()\n\n local screenOutput = \"\"\n\n -- Draw damage elements\n if #damagedElements > 0 then\n local damagedElementsToDraw = #damagedElements\n if damagedElementsToDraw > DamagePageSize then\n damagedElementsToDraw = DamagePageSize\n end\n if CurrentDamagedPage == math.ceil(#damagedElements / DamagePageSize) then\n damagedElementsToDraw = #damagedElements % DamagePageSize + 12\n if damagedElementsToDraw > 12 then damagedElementsToDraw = damagedElementsToDraw - 12 end\n end\n screenOutput = screenOutput .. [[<rect x=\"20\" y=\"300\" rx=\"5\" ry=\"5\" width=\"930\" height=\"]] .. (70+(damagedElementsToDraw + 1) * 50) .. [[\" fill=\"#000000\" fill-opacity=\"0.5\" style=\"stroke:#]]..ColorWarning..[[;stroke-width:3;\" />]]\n screenOutput = screenOutput .. [[<rect x=\"30\" y=\"310\" rx=\"5\" ry=\"5\" width=\"910\" height=\"40\" fill=\"#]]..ColorWarning..[[\" fill-opacity=\"0.5\" />]]\n\n if UseMyElementNames == true then screenOutput = screenOutput .. [[<text x=\"110\" y=\"341\" class=\"f30sxx\">Damaged Name</text>]]\n else screenOutput = screenOutput .. [[<text x=\"110\" y=\"341\" class=\"f30sxx\">Damaged Type</text>]]\n end\n\n screenOutput = screenOutput .. [[<text x=\"417\" y=\"341\" class=\"f30sxx\">HLTH</text><text x=\"545\" y=\"341\" class=\"f30sxx\">DMG</text>]]\n screenOutput = screenOutput .. [[<text x=\"655\" y=\"341\" class=\"f30sxx\">T]]..ScrapTier..[[ SCR</text><text x=\"790\" y=\"341\" class=\"f30sxx\">REPTIME</text>]]\n\n AddClickArea(\"damage\", {\n id = \"SwitchScrapTier\",\n mode =\"damage\",\n x1 = 650,\n x2 = 775,\n y1 = 315,\n y2 = 360\n })\n\n local i = 0\n for j = 1 + (CurrentDamagedPage - 1) * DamagePageSize, damagedElementsToDraw + (CurrentDamagedPage - 1) * DamagePageSize, 1 do\n i = i + 1\n local DP = damagedElements[j]\n if UseMyElementNames == true then screenOutput = screenOutput .. [[<text x=\"40\" y=\"]] .. (330 + i * 50) .. [[\" class=\"f25sxx\">]] .. string.format(\"%.23s\", DP.name) .. [[</text>]]\n else screenOutput = screenOutput .. [[<text x=\"40\" y=\"]] .. (330 + i * 50) .. [[\" class=\"f25sxx\">]] .. string.format(\"%.23s\", DP.type) .. [[</text>]]\n end\n screenOutput = screenOutput .. [[<text x=\"485\" y=\"]] .. (330 + i * 50) .. [[\" class=\"f25exx\">]] .. DP.percent .. [[%</text>]] ..\n [[<text x=\"614\" y=\"]] .. (330 + i * 50) .. [[\" class=\"f25exx\">]] .. GenerateCommaValue(string.format(\"%.0f\", DP.missinghp), true) .. [[</text>]] ..\n [[<text x=\"734\" y=\"]] .. (330 + i * 50) .. [[\" class=\"f25exx\">]] .. getScraps(DP.missinghp, true) .. [[</text>]] ..\n [[<text x=\"908\" y=\"]] .. (330 + i * 50) .. [[\" class=\"f25exx\">]] .. getRepairTime(DP.missinghp, true) .. [[</text>]] ..\n [[<line x1=\"30\" x2=\"940\" y1=\"]] .. (336 + i * 50) .. [[\" y2=\"]] .. (336 + i * 50) .. [[\" style=\"stroke:#]]..ColorSecondary..[[;stroke-opacity:0.2\" />]]\n end\n\n if #damagedElements > DamagePageSize then\n screenOutput = screenOutput ..\n [[<text x=\"485\" y=\"]] .. (30+300 + 11 + (damagedElementsToDraw + 1) * 50) .. [[\" class=\"f25mw\">Page ]] .. CurrentDamagedPage .. \" of \" .. math.ceil(#damagedElements / DamagePageSize) ..[[</text>]]\n\n if CurrentDamagedPage < math.ceil(#damagedElements / DamagePageSize) then\n screenOutput = screenOutput .. [[<svg x=\"30\" y=\"]] .. (300 + 11 + (damagedElementsToDraw + 1) * 50) .. [[\">\n <rect x=\"0\" y=\"0\" rx=\"10\" ry=\"10\" width=\"200\" height=\"50\" style=\"fill:#]]..ColorWarning..[[;\" />\n <svg x=\"80\" y=\"15\"><path d=\"M52.48,35.23,69.6,19.4a3.23,3.23,0,0,0-2.19-5.6H32.59a3.23,3.23,0,0,0-2.19,5.6L47.52,35.23A3.66,3.66,0,0,0,52.48,35.23Z\" transform=\"translate(-29.36 -13.8)\"/></svg>\n </svg>]]\n AddClickArea(\"damage\", {\n id = \"DamagedPageDown\",\n mode =\"damage\",\n x1 = 65,\n x2 = 260,\n y1 = 290 + (damagedElementsToDraw + 1) * 50,\n y2 = 290 + 50 + (damagedElementsToDraw + 1) * 50\n })\n else\n DisableClickArea(\"DamagedPageDown\",\"damage\")\n end\n\n if CurrentDamagedPage > 1 then\n screenOutput = screenOutput .. [[<svg x=\"740\" y=\"]] .. (300 + 11 + (damagedElementsToDraw + 1) * 50) .. [[\">\n <rect x=\"0\" y=\"0\" rx=\"10\" ry=\"10\" width=\"200\" height=\"50\" style=\"fill:#]]..ColorWarning..[[;\" />\n <svg x=\"80\" y=\"15\"><path d=\"M47.52,14.77,30.4,30.6a3.23,3.23,0,0,0,2.19,5.6H67.41a3.23,3.23,0,0,0,2.19-5.6L52.48,14.77A3.66,3.66,0,0,0,47.52,14.77Z\" transform=\"translate(-29.36 -13.8)\"/></svg>\n </svg>]]\n AddClickArea(\"damage\", {\n id = \"DamagedPageUp\",\n mode =\"damage\",\n x1 = 750,\n x2 = 950,\n y1 = 290 + (damagedElementsToDraw + 1) * 50,\n y2 = 290 + 50 + (damagedElementsToDraw + 1) * 50\n })\n else\n DisableClickArea(\"DamagedPageUp\",\"damage\")\n end\n end\n end\n\n -- Draw broken elements\n if #brokenElements > 0 then\n local brokenElementsToDraw = #brokenElements\n if brokenElementsToDraw > DamagePageSize then\n brokenElementsToDraw = DamagePageSize\n end\n if CurrentBrokenPage == math.ceil(#brokenElements / DamagePageSize) then\n brokenElementsToDraw = #brokenElements % DamagePageSize + 12\n if brokenElementsToDraw > 12 then brokenElementsToDraw = brokenElementsToDraw - 12 end\n end\n screenOutput = screenOutput .. [[<rect x=\"970\" y=\"300\" rx=\"5\" ry=\"5\" width=\"930\" height=\"]] .. (70+(brokenElementsToDraw + 1) * 50) .. [[\" fill=\"#000000\" fill-opacity=\"0.5\" style=\"stroke:#]]..ColorCritical..[[;stroke-width:3;\" />]]\n screenOutput = screenOutput .. [[<rect x=\"980\" y=\"310\" rx=\"5\" ry=\"5\" width=\"910\" height=\"40\" fill=\"#]]..ColorCritical..[[\" fill-opacity=\"0.5\" />]]\n\n if UseMyElementNames == true then screenOutput = screenOutput .. [[<text x=\"1070\" y=\"341\" class=\"f30sxx\">Broken Name</text>]]\n else screenOutput = screenOutput .. [[<text x=\"1070\" y=\"341\" class=\"f30sxx\">Broken Type</text>]]\n end\n\n screenOutput = screenOutput .. [[<text x=\"1495\" y=\"341\" class=\"f30sxx\">DMG</text>]]\n screenOutput = screenOutput .. [[<text x=\"1605\" y=\"341\" class=\"f30sxx\">T]]..ScrapTier..[[ SCR</text><text x=\"1740\" y=\"341\" class=\"f30sxx\">REPTIME</text>]]\n\n AddClickArea(\"damage\", {\n id = \"SwitchScrapTier2\",\n mode =\"damage\",\n x1 = 1570,\n x2 = 1690,\n y1 = 315,\n y2 = 360\n })\n\n local i = 0\n for j = 1 + (CurrentBrokenPage - 1) * DamagePageSize, brokenElementsToDraw + (CurrentBrokenPage - 1) * DamagePageSize, 1 do\n i = i + 1\n local DP = brokenElements[j]\n if UseMyElementNames == true then screenOutput = screenOutput .. [[<text x=\"1000\" y=\"]] .. (330 + i * 50) .. [[\" class=\"f25sxx\">]] .. string.format(\"%.30s\", DP.name) .. [[</text>]]\n else screenOutput = screenOutput .. [[<text x=\"1000\" y=\"]] .. (330 + i * 50) .. [[\" class=\"f25sxx\">]] .. string.format(\"%.30s\", DP.type) .. [[</text>]]\n end\n screenOutput = screenOutput .. [[<text x=\"1564\" y=\"]] .. (330 + i * 50) .. [[\" class=\"f25exx\">]] .. GenerateCommaValue(string.format(\"%.0f\", DP.missinghp), true) .. [[</text>]] ..\n [[<text x=\"1684\" y=\"]] .. (330 + i * 50) .. [[\" class=\"f25exx\">]] .. getScraps(DP.missinghp, true) .. [[</text>]] ..\n [[<text x=\"1858\" y=\"]] .. (330 + i * 50) .. [[\" class=\"f25exx\">]] .. getRepairTime(DP.missinghp, true) .. [[</text>]] ..\n [[<line x1=\"980\" x2=\"1890\" y1=\"]] .. (336 + i * 50) .. [[\" y2=\"]] .. (336 + i * 50) .. [[\" style=\"stroke:#]]..ColorSecondary..[[;stroke-opacity:0.2\" />]]\n end\n\n\n\n if #brokenElements > DamagePageSize then\n screenOutput = screenOutput ..\n [[<text x=\"1435\" y=\"]] .. (30+300 + 11 + (brokenElementsToDraw + 1) * 50) .. [[\" class=\"f25mr\">Page ]] .. CurrentBrokenPage .. \" of \" .. math.ceil(#brokenElements / DamagePageSize) .. [[</text>]]\n\n if CurrentBrokenPage > 1 then\n screenOutput = screenOutput .. [[<svg x=\"1690\" y=\"]] .. (300 + 11 + (brokenElementsToDraw + 1) * 50) .. [[\">\n <rect x=\"0\" y=\"0\" rx=\"10\" ry=\"10\" width=\"200\" height=\"50\" style=\"fill:#]]..ColorCritical..[[;\" />\n <svg x=\"80\" y=\"15\"><path d=\"M47.52,14.77,30.4,30.6a3.23,3.23,0,0,0,2.19,5.6H67.41a3.23,3.23,0,0,0,2.19-5.6L52.48,14.77A3.66,3.66,0,0,0,47.52,14.77Z\" transform=\"translate(-29.36 -13.8)\"/></svg>\n </svg>]]\n AddClickArea(\"damage\", {\n id = \"BrokenPageUp\",\n mode =\"damage\",\n x1 = 1665,\n x2 = 1865,\n y1 = 290 + (brokenElementsToDraw + 1) * 50,\n y2 = 290 + 50 + (brokenElementsToDraw + 1) * 50\n })\n else\n DisableClickArea(\"BrokenPageUp\", \"damage\")\n end\n\n if CurrentBrokenPage < math.ceil(#brokenElements / DamagePageSize) then\n screenOutput = screenOutput .. [[<svg x=\"980\" y=\"]] .. (300 + 11 + (brokenElementsToDraw + 1) * 50) .. [[\">\n <rect x=\"0\" y=\"0\" rx=\"10\" ry=\"10\" width=\"200\" height=\"50\" style=\"fill:#]]..ColorCritical..[[;\" />\n <svg x=\"80\" y=\"15\"><path d=\"M52.48,35.23,69.6,19.4a3.23,3.23,0,0,0-2.19-5.6H32.59a3.23,3.23,0,0,0-2.19,5.6L47.52,35.23A3.66,3.66,0,0,0,52.48,35.23Z\" transform=\"translate(-29.36 -13.8)\"/></svg>\n </svg>]]\n AddClickArea(\"damage\", {\n id = \"BrokenPageDown\",\n mode =\"damage\",\n x1 = 980,\n x2 = 1180,\n y1 = 290 + (brokenElementsToDraw + 1) * 50,\n y2 = 290 + 50 + (brokenElementsToDraw + 1) * 50\n })\n else\n DisableClickArea(\"BrokenPageDown\", \"damage\")\n end\n end\n\n end\n\n -- Draw summary\n if #damagedElements > 0 or #brokenElements > 0 then\n local dWidth = math.floor(1878/#elementsIdList*#damagedElements)\n local bWidth = math.floor(1878/#elementsIdList*#brokenElements)\n local hWidth = 1878-dWidth-bWidth+1\n\n screenOutput = screenOutput .. [[<rect x=\"20\" y=\"180\" rx=\"0\" ry=\"0\" width=\"1880\" height=\"100\" fill=\"#000000\" fill-opacity=\"1.0\" style=\"stroke:#FF6700;stroke-width:0;\" />]]\n screenOutput = screenOutput .. [[<svg><rect style=\"stroke: #]]..ColorWarning..[[;stroke-width:5px;\" x=\"21\" y=\"180\" rx=\"0\" ry=\"0\" width=\"]]..dWidth..[[\" height=\"100\" fill=\"#]]..ColorWarning..[[\" fill-opacity=\"0.2\" /></svg>]]\n screenOutput = screenOutput .. [[<rect x=\"]]..(21+dWidth)..[[\" y=\"180\" rx=\"0\" ry=\"0\" width=\"]]..hWidth..[[\" height=\"100\" fill=\"#]]..ColorHealthy..[[\" fill-opacity=\"0.2\" />]]\n screenOutput = screenOutput .. [[<rect style=\"stroke: #]]..ColorCritical..[[;stroke-width:5px;\" x=\"]]..(21+dWidth+hWidth-1)..[[\" y=\"180\" rx=\"0\" ry=\"0\" width=\"]]..bWidth..[[\" height=\"100\" fill=\"#]]..ColorCritical..[[\" fill-opacity=\"0.2\" />]]\n\n if #damagedElements > 0 then\n screenOutput = screenOutput .. [[<text x=\"]]..(21+dWidth/2)..[[\" y=\"246\" class=\"f60m\" fill=\"#]]..ColorWarning..[[\">]]..#damagedElements..[[</text>]]\n end\n if #healthyElements > 0 then\n screenOutput = screenOutput .. [[<text x=\"]]..(21+dWidth+hWidth/2)..[[\" y=\"246\" class=\"f60m\" fill=\"#]]..ColorHealthy..[[\">]]..#healthyElements..[[</text>]]\n end\n if #brokenElements > 0 then\n screenOutput = screenOutput .. [[<text x=\"]]..(21+dWidth+hWidth-1+bWidth/2)..[[\" y=\"246\" class=\"f60m\" fill=\"#]]..ColorCritical..[[\">]]..#brokenElements..[[</text>]]\n end\n\n screenOutput = screenOutput .. [[<rect x=\"20\" y=\"180\" rx=\"0\" ry=\"0\" width=\"1880\" height=\"100\" fill=\"#000000\" fill-opacity=\"0\" style=\"stroke:#FF6700;stroke-width:0;\" />]]\n\n screenOutput = screenOutput .. [[<text x=\"960\" y=\"140\" class=\"f36mxx\">]] ..\n GenerateCommaValue(string.format(\"%.0f\", totalShipMaxHP - totalShipHP)) .. [[ HP damage in total ]] ..\n getScraps(totalShipMaxHP - totalShipHP, true) .. [[ T]]..ScrapTier..[[ scraps needed. ]] ..\n getRepairTime(totalShipMaxHP - totalShipHP, true) .. [[ projected repair time.</text>]]\n else\n screenOutput = screenOutput .. GetElementLogo(812, 380, \"ch\", \"ch\", \"ch\") ..\n [[<text x=\"960\" y=\"320\" class=\"f50m\" fill=\"#]]..ColorHealthy..[[\">]] .. OkayCenterMessage .. [[</text>]] ..\n [[<text x=\"960\" y=\"760\" class=\"f50m\" fill=\"#]]..ColorHealthy..[[\">]]..#healthyElements..[[ elements stand ]] .. GenerateCommaValue(string.format(\"%.0f\", totalShipMaxHP)) .. [[ HP strong.</text>]]\n end\n\n forceDamageRedraw = false\n\n return screenOutput\nend\n\nfunction ActionStopengines()\n if DisallowKeyPresses == true then return end\n ToggleHUD()\nend\n\nfunction ActionStrafeRight()\n if DisallowKeyPresses == true then return end\n if KeyCTRLPressed == true then\n if HUDShiftU < 4000 then\n HUDShiftU = HUDShiftU + 50\n SaveToDatabank()\n RenderScreens()\n end\n else\n HudDeselectElement()\n end\nend\n\nfunction ActionStrafeLeft()\n if DisallowKeyPresses == true then return end\n if KeyCTRLPressed == true then\n if HUDShiftU >= 50 then\n HUDShiftU = HUDShiftU - 50\n SaveToDatabank()\n RenderScreens()\n end\n else\n ToggleHUD()\n end\nend\n\nfunction ActionDown()\n if DisallowKeyPresses == true then return end\n if KeyCTRLPressed == true then\n if HUDShiftV < 4000 then\n HUDShiftV = HUDShiftV + 50\n SaveToDatabank()\n RenderScreens()\n end\n else\n ChangeHudSelectedElement(1)\n end\nend\n\nfunction ActionUp()\n if DisallowKeyPresses == true then return end\n if KeyCTRLPressed == true then\n if HUDShiftV >= 50 then\n HUDShiftV = HUDShiftV - 50\n SaveToDatabank()\n RenderScreens()\n end\n else\n ChangeHudSelectedElement(-1)\n end\nend\n\nfunction ActionOption1()\n if DisallowKeyPresses == true then return end\n ScrapTier = 1\n SetRefresh(\"damage\")\n RenderScreens(\"damage\")\nend\n\nfunction ActionOption2()\n if DisallowKeyPresses == true then return end\n ScrapTier = 2\n SetRefresh(\"damage\")\n RenderScreens(\"damage\")\nend\n\nfunction ActionOption3()\n if DisallowKeyPresses == true then return end\n ScrapTier = 3\n SetRefresh(\"damage\")\n RenderScreens(\"damage\")\nend\n\nfunction ActionOption4()\n if DisallowKeyPresses == true then return end\n ScrapTier = 4\n SetRefresh(\"damage\")\n RenderScreens(\"damage\")\nend\n\nfunction ActionOption8()\n if DisallowKeyPresses == true then return end\n HUDShiftU=0\n HUDShiftV=0\n SetRefresh(\"damage\")\n RenderScreens(\"damage\")\nend\n\nfunction ActionOption9()\n if DisallowKeyPresses == true then return end\n SaveToDatabank()\n SwitchScreens(\"off\")\n unit.exit()\nend\n\n--[[ 5. PROCESSING FUNCTIONS ]]\n\nfunction InitiateSlots()\n for slot_name, slot in pairs(unit) do\n if type(slot) == \"table\" and type(slot.export) == \"table\" and\n slot.getElementClass then\n local elementClass = slot.getClass():lower()\n if elementClass:find(\"coreunit\") then\n core = slot\n local coreHP = core.getMaxHitPoints()\n if coreHP > 10000 then\n coreWorldOffset = 128\n elseif coreHP > 1000 then\n coreWorldOffset = 64\n elseif coreHP > 150 then\n coreWorldOffset = 32\n else\n coreWorldOffset = 16\n end\n elseif elementClass == 'databankunit' then\n db = slot\n elseif elementClass == \"screenunit\" then\n local iScreenMode = \"startup\"\n screens[#screens + 1] = {\n element = slot,\n id = slot.getLocalId(),\n mode = iScreenMode,\n submode = \"\",\n ClickAreas = {},\n refresh = true,\n active = false,\n fuelA = true,\n fuelS = true,\n fuelR = true,\n fuelIndex = 1\n }\n end\n end\n end\nend\n\nfunction LoadFromDatabank()\n if db == nil then\n return\n else\n for _, data in pairs(SaveVars) do\n if db.hasKey(data) then\n local jData = json.decode( db.getStringValue(data) )\n if jData ~= nil then\n if data == \"YourShipsName\" or data == \"AddSummertimeHour\" or data == \"UpdateDataInterval\" or data == \"HighlightBlinkingInterval\" or\n data == \"SkillRepairToolEfficiency\" or data == \"SkillRepairToolOptimization\" or data == \"SkillAtmosphericFuelEfficiency\" or\n data == \"SkillSpaceFuelEfficiency\" or data == \"SkillRocketFuelEfficiency\" or data == \"StatAtmosphericFuelTankHandling\" or\n data == \"StatSpaceFuelTankHandling\" or data == \"StatRocketFuelTankHandling\"\n then\n -- Nada\n else\n _G[data] = jData\n end\n end\n end\n end\n\n for i,v in ipairs(screens) do\n for j,dv in ipairs(dscreens) do\n if screens[i].id == dscreens[j].id then\n screens[i].mode = dscreens[j].mode\n screens[i].submode = dscreens[j].submode\n screens[i].active = dscreens[j].active\n screens[i].refresh = true\n screens[i].fuelA = dscreens[j].fuelA\n screens[i].fuelS = dscreens[j].fuelS\n screens[i].fuelR = dscreens[j].fuelR\n screens[i].fuelIndex = dscreens[j].fuelIndex\n end\n end\n end\n end\nend\n\nfunction SaveToDatabank()\n if db == nil then\n return\n else\n dscreens = {}\n for i,screen in ipairs(screens) do\n dscreens[i] = {}\n dscreens[i].id = screen.id\n dscreens[i].mode = screen.mode\n dscreens[i].submode = screen.submode\n dscreens[i].active = screen.active\n dscreens[i].fuelA = screen.fuelA\n dscreens[i].fuelS = screen.fuelS\n dscreens[i].fuelR = screen.fuelR\n dscreens[i].fuelIndex = screen.fuelIndex\n end\n\n db.clear()\n\n for _, data in pairs(SaveVars) do\n db.setStringValue(data, json.encode(_G[data]))\n end\n\n end\nend\n\nfunction InitiateScreens()\n if screens ~= nil and #screens > 0 then\n for i = 1, #screens, 1 do\n screens[i] = CreateClickAreasForScreen(screens[i])\n end\n end\nend\n\nfunction UpdateTypeData()\n FuelAtmosphericTanks = {}\n FuelSpaceTanks = {}\n FuelRocketTanks = {}\n\n FuelAtmosphericTotal = 0\n FuelAtmosphericCurrent = 0\n FuelSpaceTotal = 0\n FuelSpaceCurrent = 0\n FuelRocketCurrent = 0\n FuelRocketTotal = 0\n\n local weightAtmosphericFuel = 4\n local weightSpaceFuel = 6\n local weightRocketFuel = 0.8\n\n if StatContainerOptimization > 0 then\n weightAtmosphericFuel = weightAtmosphericFuel - 0.05 * StatContainerOptimization * weightAtmosphericFuel\n weightSpaceFuel = weightSpaceFuel - 0.05 * StatContainerOptimization * weightSpaceFuel\n weightRocketFuel = weightRocketFuel - 0.05 * StatContainerOptimization * weightRocketFuel\n end\n if StatFuelTankOptimization > 0 then\n weightAtmosphericFuel = weightAtmosphericFuel - 0.05 * StatFuelTankOptimization * weightAtmosphericFuel\n weightSpaceFuel = weightSpaceFuel - 0.05 * StatFuelTankOptimization * weightSpaceFuel\n weightRocketFuel = weightRocketFuel - 0.05 * StatFuelTankOptimization * weightRocketFuel\n end\n\n for i, id in ipairs(typeElements) do\n local idName = core.getElementNameById(id) or \"\"\n local idType = core.getElementDisplayNameById(id) or \"\"\n local idPos = core.getElementPositionById(id) or 0\n local idHP = core.getElementHitPointsById(id) or 0\n local idMaxHP = core.getElementMaxHitPointsById(id) or 0\n local idMass = core.getElementMassById(id) or 0\n\n local baseSize = \"\"\n local baseVol = 0\n local baseMass = 0\n local cMass = 0\n local cVol = 0\n\n if idType == \"Atmospheric Fuel Tank\" then\n if idMaxHP > 10000 then\n baseSize = \"L\"\n baseMass = 5480\n baseVol = 12800\n elseif idMaxHP > 1300 then\n baseSize = \"M\"\n baseMass = 988.67\n baseVol = 1600\n elseif idMaxHP > 150 then\n baseSize = \"S\"\n baseMass = 182.67\n baseVol = 400\n else\n baseSize = \"XS\"\n baseMass = 35.03\n baseVol = 100\n end\n if StatAtmosphericFuelTankHandling > 0 then\n baseVol = 0.2 * StatAtmosphericFuelTankHandling * baseVol + baseVol\n end\n cMass = idMass - baseMass\n if cMass <=10 then cMass = 0 end\n cVol = string.format(\"%.0f\", cMass / weightAtmosphericFuel)\n cPercent = string.format(\"%.1f\", math.floor(100/baseVol * tonumber(cVol)))\n table.insert(FuelAtmosphericTanks, {\n type = 1,\n id = id,\n name = idName,\n maxhp = idMaxHP,\n hp = GetHPforElement(id),\n pos = idPos,\n size = baseSize,\n mass = baseMass,\n vol = baseVol,\n cvol = cVol,\n percent = cPercent\n })\n if idHP > 0 then\n FuelAtmosphericCurrent = FuelAtmosphericCurrent + cVol\n end\n FuelAtmosphericTotal = FuelAtmosphericTotal + baseVol\n elseif idType == \"Space Fuel Tank\" then\n if idMaxHP > 10000 then\n baseSize = \"L\"\n baseMass = 5480\n baseVol = 12800\n elseif idMaxHP > 1300 then\n baseSize = \"M\"\n baseMass = 988.67\n baseVol = 1600\n elseif idMaxHP > 150 then\n baseSize = \"S\"\n baseMass = 182.67\n baseVol = 400\n else\n baseSize = \"XS\"\n baseMass = 35.03\n baseVol = 100\n end\n if StatSpaceFuelTankHandling > 0 then\n baseVol = 0.2 * StatSpaceFuelTankHandling * baseVol + baseVol\n end\n cMass = idMass - baseMass\n if cMass <=10 then cMass = 0 end\n cVol = string.format(\"%.0f\", cMass / weightSpaceFuel)\n cPercent = string.format(\"%.1f\", (100/baseVol * tonumber(cVol)))\n table.insert(FuelSpaceTanks, {\n type = 2,\n id = id,\n name = idName,\n maxhp = idMaxHP,\n hp = GetHPforElement(id),\n pos = idPos,\n size = baseSize,\n mass = baseMass,\n vol = baseVol,\n cvol = cVol,\n percent = cPercent\n })\n if idHP > 0 then\n FuelSpaceCurrent = FuelSpaceCurrent + cVol\n end\n FuelSpaceTotal = FuelSpaceTotal + baseVol\n elseif idType == \"Rocket Fuel Tank\" then\n if idMaxHP > 65000 then\n baseSize = \"L\"\n baseMass = 25740\n baseVol = 50000\n elseif idMaxHP > 6000 then\n baseSize = \"M\"\n baseMass = 4720\n baseVol = 6400\n elseif idMaxHP > 700 then\n baseSize = \"S\"\n baseMass = 886.72\n baseVol = 800\n else\n baseSize = \"XS\"\n baseMass = 173.42\n baseVol = 400\n end\n if StatRocketFuelTankHandling > 0 then\n baseVol = 0.1 * StatRocketFuelTankHandling * baseVol + baseVol\n end\n cMass = idMass - baseMass\n if cMass <=10 then cMass = 0 end\n cVol = string.format(\"%.0f\", cMass / weightRocketFuel)\n cPercent = string.format(\"%.1f\", (100/baseVol * tonumber(cVol)))\n table.insert(FuelRocketTanks, {\n type = 3,\n id = id,\n name = idName,\n maxhp = idMaxHP,\n hp = GetHPforElement(id),\n pos = idPos,\n size = baseSize,\n mass = baseMass,\n vol = baseVol,\n cvol = cVol,\n percent = cPercent\n })\n if idHP > 0 then\n FuelRocketCurrent = FuelRocketCurrent + cVol\n end\n FuelRocketTotal = FuelRocketTotal + baseVol\n end\n\n end\n\n if FuelAtmosphericCurrent ~= formerFuelAtmosphericCurrent then\n SetRefresh(\"fuel\")\n formerFuelAtmosphericCurrent = FuelAtmosphericCurrent\n end\n if FuelSpaceCurrent ~= formerFuelSpaceCurrent then\n SetRefresh(\"fuel\")\n formerFuelSpaceCurrent = FuelSpaceCurrent\n end\n if FuelRocketCurrent ~= formerFuelRocketCurrent then\n SetRefresh(\"fuel\")\n formerFuelRocketCurrent = FuelRocketCurrent\n end\n\n\n\nend\n\nfunction UpdateDamageData(initial)\n\n initial = initial or false\n\n if SimulationActive == true then return end\n\n local formerTotalShipHP = totalShipHP\n totalShipHP = 0\n totalShipMaxHP = 0\n totalShipIntegrity = 100\n damagedElements = {}\n brokenElements = {}\n healthyElements = {}\n if initial == true then\n typeElements = {}\n end\n\n ElementCounter = 0\n\n elementsIdList = core.getElementIdList()\n\n for i, id in pairs(elementsIdList) do\n\n ElementCounter = ElementCounter + 1\n\n local idName = core.getElementNameById(id)\n\n local idType = core.getElementDisplayNameById(id)\n local idPos = core.getElementPositionById(id)\n local idHP = core.getElementHitPointsById(id)\n local idMaxHP = core.getElementMaxHitPointsById(id)\n\n if SimulationMode == true then\n SimulationActive = true\n local dice = math.random(0, 10)\n if dice < 2 and #brokenElements < 30 then\n idHP = 0\n elseif dice >= 2 and dice < 4 and #damagedElements < 30 then\n idHP = math.random(1, math.ceil(idMaxHP))\n else\n idHP = idMaxHP\n end\n end\n\n totalShipHP = totalShipHP + idHP\n totalShipMaxHP = totalShipMaxHP + idMaxHP\n\n if idMaxHP - idHP > constants.epsilon then\n\n if idHP > 0 then\n table.insert(damagedElements, {\n id = id,\n name = idName,\n type = idType,\n counter = ElementCounter,\n hp = idHP,\n maxhp = idMaxHP,\n missinghp = idMaxHP - idHP,\n percent = math.ceil(100 / idMaxHP * idHP),\n pos = idPos\n })\n else\n table.insert(brokenElements, {\n id = id,\n name = idName,\n type = idType,\n counter = ElementCounter,\n hp = idHP,\n maxhp = idMaxHP,\n missinghp = idMaxHP - idHP,\n percent = 0,\n pos = idPos\n })\n end\n else\n table.insert(healthyElements, {\n id = id,\n name = idName,\n type = idType,\n counter = ElementCounter,\n hp = idHP,\n maxhp = idMaxHP,\n pos = idPos\n })\n if id == highlightID then\n highlightID = 0\n highlightOn = false\n HideHighlight()\n hudSelectedIndex = 0\n end\n end\n\n if initial == true then\n if\n idType == \"Atmospheric Fuel Tank\" or\n idType == \"Space Fuel Tank\" or\n idType == \"Rocket Fuel Tank\"\n then\n table.insert(typeElements, id)\n end\n end\n end\n\n SortDamageTables()\n\n rE = {}\n\n if #brokenElements > 0 then\n for _,v in ipairs(brokenElements) do\n table.insert(rE, {id=v.id, missinghp=v.missinghp, hp=v.hp, name=v.name, type=v.type, pos=v.pos})\n end\n end\n if #damagedElements > 0 then\n for _,v in ipairs(damagedElements) do\n table.insert(rE, {id=v.id, missinghp=v.missinghp, hp=v.hp, name=v.name, type=v.type, pos=v.pos})\n end\n end\n if #rE > 0 then\n table.sort(rE, function(a,b) return a.missinghp>b.missinghp end)\n end\n\n totalShipIntegrity = string.format(\"%2.0f\", 100 / totalShipMaxHP * totalShipHP)\n\n if formerTotalShipHP ~= totalShipHP then\n forceDamageRedraw = true\n formerTotalShipHP = totalShipHP\n else\n forceDamageRedraw = false\n end\nend\n\nfunction GetHPforElement(id)\n for i,v in ipairs(brokenElements) do\n if v.id == id then\n return 0\n end\n end\n for i,v in ipairs(damagedElements) do\n if v.id == id then\n return v.hp\n end\n end\n for i,v in ipairs(healthyElements) do\n if v.id == id then\n return v.maxhp\n end\n end\nend\n\nfunction UpdateClickArea(candidate, newEntry, mode)\n for i, screen in ipairs(screens) do\n for k, v in pairs(screens[i].ClickAreas) do\n if v.id == candidate and v.mode == mode then\n screens[i].ClickAreas[k] = newEntry\n end\n end\n end\nend\n\nfunction AddClickArea(mode, newEntry)\n for i, screen in ipairs(screens) do\n if screens[i].mode == mode then\n table.insert(screens[i].ClickAreas, newEntry)\n end\n end\nend\n\nfunction AddClickAreaForScreenID(screenid, newEntry)\n for i, screen in ipairs(screens) do\n if screens[i].id == screenid then\n table.insert(screens[i].ClickAreas, newEntry)\n end\n end\nend\n\nfunction DisableClickArea(candidate, mode)\n UpdateClickArea(candidate, {\n id = candidate,\n mode = mode,\n x1 = -1,\n x2 = -1,\n y1 = -1,\n y2 = -1\n })\nend\n\nfunction SetRefresh(mode, submode)\n mode = mode or \"all\"\n submode = submode or \"all\"\n if screens ~= nil and #screens > 0 then\n for i = 1, #screens, 1 do\n if screens[i].mode == mode or mode == \"all\" then\n if screens[i].submode == submode or submode ==\"all\" then\n screens[i].refresh = true\n end\n end\n end\n end\nend\n\nfunction WipeClickAreasForScreen(screen)\n screen.ClickAreas = {}\n return screen\nend\n\nfunction CreateBaseClickAreas(screen)\n table.insert(screen.ClickAreas, {mode = \"all\", id = \"ToggleHudMode\", x1 = 1537, x2 = 1728, y1 = 1015, y2 = 1075} )\n table.insert(screen.ClickAreas, {mode = \"all\", id = \"ButtonPress\", param = \"damage\", x1 = 193, x2 = 384, y1 = 1015, y2 = 1075} )\n table.insert(screen.ClickAreas, {mode = \"all\", id = \"ButtonPress\", param = \"damageoutline\", x1 = 385, x2 = 576, y1 = 1015, y2 = 1075} )\n table.insert(screen.ClickAreas, {mode = \"all\", id = \"ButtonPress\", param = \"fuel\", x1 = 577, x2 = 768, y1 = 1015, y2 = 1075} )\n -- table.insert(screen.ClickAreas, {mode = \"all\", id = \"ButtonPress\", param = \"flight\", x1 = 769, x2 = 960, y1 = 1015, y2 = 1075} )\n -- table.insert(screen.ClickAreas, {mode = \"all\", id = \"ButtonPress\", param = \"cargo\", x1 = 961, x2 = 1152, y1 = 1015, y2 = 1075} )\n -- table.insert(screen.ClickAreas, {mode = \"all\", id = \"ButtonPress\", param = \"agg\", x1 = 1153, x2 = 1344, y1 = 1015, y2 = 1075} )\n -- table.insert(screen.ClickAreas, {mode = \"all\", id = \"ButtonPress\", param = \"map\", x1 = 1345, x2 = 1536, y1 = 1015, y2 = 1075} )\n table.insert(screen.ClickAreas, {mode = \"all\", id = \"ButtonPress\", param = \"time\", x1 = 0, x2 = 192, y1 = 1015, y2 = 1075} )\n table.insert(screen.ClickAreas, {mode = \"all\", id = \"ButtonPress\", param = \"settings1\", x1 = 1729, x2 = 1920, y1 = 1015, y2 = 1075} )\n return screen\nend\n\nfunction CreateClickAreasForScreen(screen)\n\n if screen == nil then return {} end\n\n if screen.mode == \"flight\" then\n elseif screen.mode == \"damage\" then\n table.insert( screen.ClickAreas, {mode = \"damage\", id = \"ToggleElementLabel\", x1 = 70, x2 = 425, y1 = 325, y2 = 355} )\n table.insert( screen.ClickAreas, {mode = \"damage\", id = \"ToggleElementLabel2\", x1 = 980, x2 = 1400, y1 = 325, y2 = 355} )\n elseif screen.mode == \"damageoutline\" then\n table.insert(screen.ClickAreas, {mode = \"damageoutline\", id = \"DMGOChangeView\", param = \"top\", x1 = 60, x2 = 439, y1 = 150, y2 = 200} )\n table.insert(screen.ClickAreas, {mode = \"damageoutline\", id = \"DMGOChangeView\", param = \"side\", x1 = 440, x2 = 824, y1 = 150, y2 = 200} )\n table.insert(screen.ClickAreas, {mode = \"damageoutline\", id = \"DMGOChangeView\", param = \"front\", x1 = 825, x2 = 1215, y1 = 150, y2 = 200} )\n table.insert(screen.ClickAreas, {mode = \"damageoutline\", id = \"DMGOChangeStretch\", x1 = 1530, x2 = 1580, y1 = 150, y2 = 200} )\n elseif screen.mode == \"fuel\" then\n elseif screen.mode == \"cargo\" then\n elseif screen.mode == \"agg\" then\n elseif screen.mode == \"map\" then\n elseif screen.mode == \"time\" then\n elseif screen.mode == \"settings1\" then\n table.insert( screen.ClickAreas, {mode = \"settings1\", id = \"ToggleBackground\", x1 = 75, x2 = 860, y1 = 170, y2 = 215} )\n table.insert( screen.ClickAreas, {mode = \"settings1\", id = \"PreviousBackground\", x1 = 75, x2 = 460, y1 = 235, y2 = 285} )\n table.insert( screen.ClickAreas, {mode = \"settings1\", id = \"NextBackground\", x1 = 480, x2 = 860, y1 = 235, y2 = 285} )\n table.insert( screen.ClickAreas, {mode = \"settings1\", id = \"DecreaseOpacity\", x1 = 75, x2 = 460, y1 = 300, y2 = 350} )\n table.insert( screen.ClickAreas, {mode = \"settings1\", id = \"IncreaseOpacity\", x1 = 480, x2 = 860, y1 = 300, y2 = 350} )\n table.insert( screen.ClickAreas, {mode = \"settings1\", id = \"ResetColors\", x1 = 75, x2 = 860, y1 = 370, y2 = 415} )\n table.insert( screen.ClickAreas, {mode = \"settings1\", id = \"PreviousColorID\", x1 = 90, x2 = 140, y1 = 500, y2 = 550} )\n table.insert( screen.ClickAreas, {mode = \"settings1\", id = \"NextColorID\", x1 = 795, x2 = 845, y1 = 500, y2 = 550} )\n\n table.insert( screen.ClickAreas, {mode = \"settings1\", id = \"ColorPosUp\", param=\"1\", x1 = 210, x2 = 290, y1 = 655, y2 = 700} )\n table.insert( screen.ClickAreas, {mode = \"settings1\", id = \"ColorPosUp\", param=\"2\", x1 = 300, x2 = 380, y1 = 655, y2 = 700} )\n table.insert( screen.ClickAreas, {mode = \"settings1\", id = \"ColorPosUp\", param=\"3\", x1 = 385, x2 = 465, y1 = 655, y2 = 700} )\n table.insert( screen.ClickAreas, {mode = \"settings1\", id = \"ColorPosUp\", param=\"4\", x1 = 470, x2 = 550, y1 = 655, y2 = 700} )\n table.insert( screen.ClickAreas, {mode = \"settings1\", id = \"ColorPosUp\", param=\"5\", x1 = 560, x2 = 640, y1 = 655, y2 = 700} )\n table.insert( screen.ClickAreas, {mode = \"settings1\", id = \"ColorPosUp\", param=\"6\", x1 = 645, x2 = 725, y1 = 655, y2 = 700} )\n\n table.insert( screen.ClickAreas, {mode = \"settings1\", id = \"ColorPosDown\", param=\"1\", x1 = 210, x2 = 290, y1 = 740, y2 = 780} )\n table.insert( screen.ClickAreas, {mode = \"settings1\", id = \"ColorPosDown\", param=\"2\", x1 = 300, x2 = 380, y1 = 740, y2 = 780} )\n table.insert( screen.ClickAreas, {mode = \"settings1\", id = \"ColorPosDown\", param=\"3\", x1 = 385, x2 = 465, y1 = 740, y2 = 780} )\n table.insert( screen.ClickAreas, {mode = \"settings1\", id = \"ColorPosDown\", param=\"4\", x1 = 470, x2 = 550, y1 = 740, y2 = 780} )\n table.insert( screen.ClickAreas, {mode = \"settings1\", id = \"ColorPosDown\", param=\"5\", x1 = 560, x2 = 640, y1 = 740, y2 = 780} )\n table.insert( screen.ClickAreas, {mode = \"settings1\", id = \"ColorPosDown\", param=\"6\", x1 = 645, x2 = 725, y1 = 740, y2 = 780} )\n\n table.insert( screen.ClickAreas, {mode = \"settings1\", id = \"ResetPosColor\", x1 = 160, x2 = 340, y1 = 885, y2 = 935} )\n table.insert( screen.ClickAreas, {mode = \"settings1\", id = \"ApplyPosColor\", x1 = 355, x2 = 780, y1 = 885, y2 = 935} )\n\n elseif screen.mode == \"startup\" then\n elseif screen.mode == \"systems\" then\n end\n\n screen = CreateBaseClickAreas(screen)\n\n return screen\nend\n\nfunction CheckClick(x, y, HitTarget)\n x = x*1920\n y = y*1120\n HitTarget = HitTarget or \"\"\n HitPayload = {}\n -- PrintConsole(\"Clicked: \"..x..\" / \"..y)\n if screens ~= nil and #screens > 0 then\n for i = 1, #screens, 1 do\n if screens[i].active == true and screens[i].element.getMouseX() ~= -1 and screens[i].element.getMouseY() ~= -1 then\n if HitTarget == \"\" then\n for k, v in pairs(screens[i].ClickAreas) do\n if v ~=nil and x >= v.x1 and x <= v.x2 and y >= v.y1 and y <= v.y2 then\n HitTarget = v.id\n HitPayload = v\n break\n end\n end\n end\n if HitTarget == \"ButtonPress\" then\n if screens[i].mode == HitPayload.param then\n screens[i].mode = \"startup\"\n else\n screens[i].mode = HitPayload.param\n end\n\n if screens[i].mode == \"damageoutline\" then\n if screens[i].submode == \"\" then\n screens[i].submode = \"top\"\n end\n end\n screens[i].refresh = true\n screens[i].ClickAreas = {}\n SaveToDatabank()\n SetRefresh()\n RenderScreens()\n elseif HitTarget == \"ToggleBackground\" and (HitPayload.mode == screens[i].mode or HitPayload.mode == \"all\") then\n if BackgroundMode == \"\" then\n BackgroundSelected = 1\n BackgroundMode = backgroundModes[BackgroundSelected]\n else\n BackgroundSelected = 1\n BackgroundMode = \"\"\n end\n for k, screen in pairs(screens) do\n screens[k].refresh = true\n end\n SaveToDatabank()\n SetRefresh()\n RenderScreens()\n elseif HitTarget == \"PreviousBackground\" and (HitPayload.mode == screens[i].mode or HitPayload.mode == \"all\") then\n if BackgroundMode == \"\" then\n BackgroundSelected = 1\n BackgroundMode = backgroundModes[BackgroundSelected]\n else\n if BackgroundSelected <= 1 then\n BackgroundSelected = #backgroundModes\n else\n BackgroundSelected = BackgroundSelected - 1\n end\n BackgroundMode = backgroundModes[BackgroundSelected]\n end\n for k, screen in pairs(screens) do\n screens[k].refresh = true\n end\n SaveToDatabank()\n SetRefresh()\n RenderScreens()\n elseif HitTarget == \"NextBackground\" and (HitPayload.mode == screens[i].mode or HitPayload.mode == \"all\") then\n if BackgroundMode == \"\" then\n BackgroundSelected = 1\n BackgroundMode = backgroundModes[BackgroundSelected]\n else\n if BackgroundSelected >= #backgroundModes then\n BackgroundSelected = 1\n else\n BackgroundSelected = BackgroundSelected + 1\n end\n BackgroundMode = backgroundModes[BackgroundSelected]\n end\n for k, screen in pairs(screens) do\n screens[k].refresh = true\n end\n SaveToDatabank()\n SetRefresh()\n RenderScreens()\n elseif HitTarget == \"DecreaseOpacity\" and (HitPayload.mode == screens[i].mode or HitPayload.mode == \"all\") then\n if BackgroundModeOpacity>0.1 then\n BackgroundModeOpacity = BackgroundModeOpacity - 0.05\n for k, screen in pairs(screens) do\n screens[k].refresh = true\n end\n SaveToDatabank()\n SetRefresh()\n RenderScreens()\n end\n elseif HitTarget == \"IncreaseOpacity\" and (HitPayload.mode == screens[i].mode or HitPayload.mode == \"all\") then\n if BackgroundModeOpacity<1.0 then\n BackgroundModeOpacity = BackgroundModeOpacity + 0.05\n for k, screen in pairs(screens) do\n screens[k].refresh = true\n end\n SaveToDatabank()\n SetRefresh()\n RenderScreens()\n end\n elseif HitTarget == \"ResetColors\" and (HitPayload.mode == screens[i].mode or HitPayload.mode == \"all\") then\n db.clear()\n ColorPrimary = \"FF6700\"\n ColorSecondary = \"FFFFFF\"\n ColorTertiary = \"000000\"\n ColorHealthy = \"00FF00\"\n ColorWarning = \"FFFF00\"\n ColorCritical = \"FF0000\"\n ColorBackground = \"000000\"\n ColorBackgroundPattern = \"4f4f4f\"\n ColorFuelAtmospheric = \"004444\"\n ColorFuelSpace = \"444400\"\n ColorFuelRocket = \"440044\"\n BackgroundMode = \"deathstar\"\n BackgroundSelected = 1\n BackgroundModeOpacity = 0.25\n colorIDTable = {\n [1] = {\n id=\"ColorPrimary\",\n desc=\"Main HUD Color\",\n basec = \"FF6700\",\n newc = \"FF6700\"\n },\n [2] = {\n id=\"ColorSecondary\",\n desc=\"Secondary HUD Color\",\n basec = \"FFFFFF\",\n newc = \"FFFFFF\"\n },\n [3] = {\n id=\"ColorTertiary\",\n desc=\"Tertiary HUD Color\",\n basec = \"000000\",\n newc = \"000000\"\n },\n [4] = {\n id=\"ColorHealthy\",\n desc=\"Color code for Healthy/Okay\",\n basec = \"00FF00\",\n newc = \"00FF00\"\n },\n [5] = {\n id=\"ColorWarning\",\n desc=\"Color code for Damaged/Warning\",\n basec = \"FFFF00\",\n newc = \"FFFF00\"\n },\n [6] = {\n id=\"ColorCritical\",\n desc=\"Color code for Broken/Critical\",\n basec = \"FF0000\",\n newc = \"FF0000\"\n },\n [7] = {\n id=\"ColorBackground\",\n desc=\"Background Color\",\n basec = \"000000\",\n newc = \"000000\"\n },\n [8] = {\n id=\"ColorBackgroundPattern\",\n desc=\"Background Pattern Color\",\n basec = \"4F4F4F\",\n newc = \"4F4F4F\"\n },\n [9] = {\n id=\"ColorFuelAtmospheric\",\n desc=\"Color for Atmo Fuel/Elements\",\n basec = \"004444\",\n newc = \"004444\"\n },\n [10] = {\n id=\"ColorFuelSpace\",\n desc=\"Color for Space Fuel/Elements\",\n basec = \"444400\",\n newc = \"444400\"\n },\n [11] = {\n id=\"ColorFuelRocket\",\n desc=\"Color for Rocket Fuel/Elements\",\n basec = \"440044\",\n newc = \"440044\"\n }\n }\n SaveToDatabank()\n SetRefresh()\n RenderScreens()\n elseif HitTarget == \"PreviousColorID\" and (HitPayload.mode == screens[i].mode or HitPayload.mode == \"all\") then\n colorIDIndex = colorIDIndex - 1\n if colorIDIndex < 1 then colorIDIndex = #colorIDTable end\n SaveToDatabank()\n SetRefresh(\"settings1\")\n RenderScreens(\"settings1\")\n elseif HitTarget == \"NextColorID\" and (HitPayload.mode == screens[i].mode or HitPayload.mode == \"all\") then\n colorIDIndex = colorIDIndex + 1\n if colorIDIndex > #colorIDTable then colorIDIndex = 1 end\n SaveToDatabank()\n SetRefresh(\"settings1\")\n RenderScreens(\"settings1\")\n elseif HitTarget == \"ColorPosUp\" and (HitPayload.mode == screens[i].mode or HitPayload.mode == \"all\") then\n local s = tonumber(string.sub(colorIDTable[colorIDIndex].newc, HitPayload.param, HitPayload.param),16)\n s = s + 1\n if s > 15 then s = 0 end\n colorIDTable[colorIDIndex].newc = replace_char(HitPayload.param, colorIDTable[colorIDIndex].newc, hexTable[s+1])\n SaveToDatabank()\n SetRefresh(\"settings1\")\n RenderScreens(\"settings1\")\n elseif HitTarget == \"ColorPosDown\" and (HitPayload.mode == screens[i].mode or HitPayload.mode == \"all\") then\n local s = tonumber(string.sub(colorIDTable[colorIDIndex].newc, HitPayload.param, HitPayload.param),16)\n s = s - 1\n if s < 0 then s = 15 end\n colorIDTable[colorIDIndex].newc = replace_char(HitPayload.param, colorIDTable[colorIDIndex].newc, hexTable[s+1])\n SaveToDatabank()\n SetRefresh(\"settings1\")\n RenderScreens(\"settings1\")\n elseif HitTarget == \"ResetPosColor\" and (HitPayload.mode == screens[i].mode or HitPayload.mode == \"all\") then\n colorIDTable[colorIDIndex].newc = colorIDTable[colorIDIndex].basec\n _G[colorIDTable[colorIDIndex].id] = colorIDTable[colorIDIndex].basec\n SaveToDatabank()\n SetRefresh()\n RenderScreens()\n elseif HitTarget == \"ApplyPosColor\" and (HitPayload.mode == screens[i].mode or HitPayload.mode == \"all\") then\n _G[colorIDTable[colorIDIndex].id] = colorIDTable[colorIDIndex].newc\n SaveToDatabank()\n SetRefresh()\n RenderScreens()\n elseif HitTarget == \"DamagedPageDown\" and (HitPayload.mode == screens[i].mode or HitPayload.mode == \"all\") then\n CurrentDamagedPage = CurrentDamagedPage + 1\n if CurrentDamagedPage > math.ceil(#damagedElements / DamagePageSize) then\n CurrentDamagedPage = math.ceil(#damagedElements / DamagePageSize)\n end\n HudDeselectElement()\n SaveToDatabank()\n SetRefresh(\"damage\")\n RenderScreens(\"damage\")\n elseif HitTarget == \"DamagedPageUp\" and (HitPayload.mode == screens[i].mode or HitPayload.mode == \"all\") then\n CurrentDamagedPage = CurrentDamagedPage - 1\n if CurrentDamagedPage < 1 then CurrentDamagedPage = 1 end\n HudDeselectElement()\n SaveToDatabank()\n SetRefresh(\"damage\")\n RenderScreens(\"damage\")\n elseif HitTarget == \"BrokenPageDown\" and (HitPayload.mode == screens[i].mode or HitPayload.mode == \"all\") then\n CurrentBrokenPage = CurrentBrokenPage + 1\n if CurrentBrokenPage > math.ceil(#brokenElements / DamagePageSize) then\n CurrentBrokenPage = math.ceil(#brokenElements / DamagePageSize)\n end\n HudDeselectElement()\n SaveToDatabank()\n SetRefresh(\"damage\")\n RenderScreens(\"damage\")\n elseif HitTarget == \"BrokenPageUp\" and (HitPayload.mode == screens[i].mode or HitPayload.mode == \"all\") then\n CurrentBrokenPage = CurrentBrokenPage - 1\n if CurrentBrokenPage < 1 then CurrentBrokenPage = 1 end\n HudDeselectElement()\n SaveToDatabank()\n SetRefresh(\"damage\")\n RenderScreens(\"damage\")\n elseif HitTarget == \"DMGOChangeView\" and (HitPayload.mode == screens[i].mode or HitPayload.mode == \"all\") then\n screens[i].submode = HitPayload.param\n UpdateViewDamageoutline(screens[i])\n SaveToDatabank()\n SetRefresh(\"damageoutline\", screens[i].submode)\n RenderScreens(\"damageoutline\", screens[i].submode)\n elseif HitTarget == \"DMGOChangeStretch\" and (HitPayload.mode == screens[i].mode or HitPayload.mode == \"all\") then\n if DMGOStretch == true then\n DMGOStretch = false\n else\n DMGOStretch = true\n end\n UpdateViewDamageoutline(screens[i])\n SaveToDatabank()\n SetRefresh(\"damageoutline\")\n RenderScreens(\"damageoutline\")\n elseif HitTarget == \"ToggleDisplayAtmosphere\" and (HitPayload.mode == screens[i].mode or HitPayload.mode == \"all\") then\n if screens[i].fuelA == true then\n screens[i].fuelA = false\n else\n screens[i].fuelA = true\n end\n screens[i].fuelIndex = 1\n SaveToDatabank()\n SetRefresh(\"fuel\")\n RenderScreens(\"fuel\")\n elseif HitTarget == \"ToggleDisplaySpace\" and (HitPayload.mode == screens[i].mode or HitPayload.mode == \"all\") then\n if screens[i].fuelS == true then\n screens[i].fuelS = false\n else\n screens[i].fuelS = true\n end\n screens[i].fuelIndex = 1\n SaveToDatabank()\n SetRefresh(\"fuel\")\n RenderScreens(\"fuel\")\n elseif HitTarget == \"ToggleDisplayRocket\" and (HitPayload.mode == screens[i].mode or HitPayload.mode == \"all\") then\n if screens[i].fuelR == true then\n screens[i].fuelR = false\n else\n screens[i].fuelR = true\n end\n screens[i].fuelIndex = 1\n SaveToDatabank()\n SetRefresh(\"fuel\")\n RenderScreens(\"fuel\")\n elseif HitTarget == \"DecreaseFuelIndex\" and (HitPayload.mode == screens[i].mode or HitPayload.mode == \"all\") then\n screens[i].fuelIndex = screens[i].fuelIndex - 1\n if screens[i].fuelIndex < 1 then screens[i].fuelIndex = 1 end\n SaveToDatabank()\n SetRefresh(\"fuel\")\n RenderScreens(\"fuel\")\n elseif HitTarget == \"IncreaseFuelIndex\" and (HitPayload.mode == screens[i].mode or HitPayload.mode == \"all\") then\n screens[i].fuelIndex = screens[i].fuelIndex + 1\n SaveToDatabank()\n SetRefresh(\"fuel\")\n RenderScreens(\"fuel\")\n elseif HitTarget == \"ToggleHudMode\" and (HitPayload.mode == screens[i].mode or HitPayload.mode == \"all\") then\n if HUDMode == true then\n HUDMode = false\n forceDamageRedraw = true\n HudDeselectElement()\n SaveToDatabank()\n SetRefresh()\n RenderScreens()\n else\n HUDMode = true\n forceDamageRedraw = true\n HudDeselectElement()\n SaveToDatabank()\n SetRefresh()\n RenderScreens()\n end\n elseif HitTarget == \"ToggleSimulation\" and (HitPayload.mode == screens[i].mode or HitPayload.mode == \"all\") then\n CurrentDamagedPage = 1\n CurrentBrokenPage = 1\n if SimulationMode == true then\n SimulationMode = false\n SimulationActive = false\n UpdateDamageData()\n UpdateTypeData()\n forceDamageRedraw = true\n HudDeselectElement()\n SetRefresh(\"damage\")\n SetRefresh(\"damageoutline\")\n SetRefresh(\"settings1\")\n SetRefresh(\"fuel\")\n SaveToDatabank()\n RenderScreens()\n else\n SimulationMode = true\n SimulationActive = false\n UpdateDamageData()\n UpdateTypeData()\n forceDamageRedraw = true\n HudDeselectElement()\n SetRefresh(\"damage\")\n SetRefresh(\"damageoutline\")\n SetRefresh(\"settings1\")\n SetRefresh(\"fuel\")\n SaveToDatabank()\n RenderScreens()\n end\n elseif (HitTarget == \"ToggleElementLabel\" or HitTarget == \"ToggleElementLabel2\") and (HitPayload.mode == screens[i].mode or HitPayload.mode == \"all\") then\n if UseMyElementNames == true then\n UseMyElementNames = false\n SetRefresh(\"damage\")\n RenderScreens(\"damage\")\n else\n UseMyElementNames = true\n SetRefresh(\"damage\")\n RenderScreens(\"damage\")\n end\n elseif (HitTarget == \"SwitchScrapTier\" or HitTarget == \"SwitchScrapTier2\") and (HitPayload.mode == screens[i].mode or HitPayload.mode == \"all\") then\n ScrapTier = ScrapTier + 1\n if ScrapTier > 4 then ScrapTier = 1 end\n SetRefresh(\"damage\")\n RenderScreens(\"damage\")\n end\n\n\n end\n end\n end\nend\n\n--[[ 6. RENDERING FUNCTIONS ]]\n\nfunction GetContentFlight()\n local output = \"\"\n output = output .. GetHeader(\"Flight Data Report\") ..\n [[\n\n ]]\n return output\nend\n\nfunction GetContentDamage()\n local output = \"\"\n if SimulationMode == true then\n output = output .. GetHeader(\"Damage Report (Simulated damage)\") .. [[]]\n else\n output = output .. GetHeader(\"Damage Report\") .. [[]]\n end\n output = output .. GetContentDamageScreen()\n return output\nend\n\nfunction GetContentDamageoutline(screen)\n UpdateDataDamageoutline()\n UpdateViewDamageoutline(screen)\n local output = \"\"\n output = output .. GetHeader(\"Damage Ship Outline Report\") ..\n GetDamageoutlineShip() ..\n [[<rect x=20 y=180 rx=5 ry=5 width=1880 height=840 fill=#000000 fill-opacity=0.5 style=\"stroke:#]]..ColorPrimary..[[;stroke-width:3;\" />]]\n\n if screen.submode==\"top\" then\n output = output ..\n [[\n <rect class=xfill x=20 y=130 rx=5 ry=5 width=400 height=50 />\n <text class=f30mxx x=220 y=165>Top View</text>\n <rect class=xborder x=420 y=130 rx=5 ry=5 width=400 height=50 />\n <text class=f30mx x=620 y=165>Side View</text>\n <rect class=xborder x=820 y=130 rx=5 ry=5 width=400 height=50 />\n <text class=f30mx x=1020 y=165>Front View</text>\n ]]\n elseif screen.submode==\"side\" then\n output = output ..\n [[\n <rect class=xborder x=20 y=130 rx=5 ry=5 width=400 height=50 />\n <text class=f30mx x=220 y=165>Top View</text>\n <rect class=xfill x=420 y=130 rx=5 ry=5 width=400 height=50 />\n <text class=f30mxx x=620 y=165>Side View</text>\n <rect class=xborder x=820 y=130 rx=5 ry=5 width=400 height=50 />\n <text class=f30mx x=1020 y=165>Front View</text>\n ]]\n elseif screen.submode==\"front\" then\n output = output ..\n [[\n <rect class=xborder x=20 y=130 rx=5 ry=5 width=400 height=50 />\n <text class=f30mx x=220 y=165>Top View</text>\n <rect class=xborder x=420 y=130 rx=5 ry=5 width=400 height=50 />\n <text class=f30mx x=620 y=165>Side View</text>\n <rect class=xfill x=820 y=130 rx=5 ry=5 width=400 height=50 />\n <text class=f30mxx x=1020 y=165>Front View</text>\n ]]\n else\n end\n output = output .. [[<text class=f30exx x=1900 y=120>]]..#dmgoElements..[[ of ]]..ElementCounter..[[ shown</text>]]\n output = output .. [[<rect class=xborder x=1550 y=130 rx=5 ry=5 width=50 height=50 />]]\n if DMGOStretch == true then\n output = output .. [[<rect class=xfill x=1558 y=138 rx=5 ry=5 width=34 height=34 />]]\n end\n output = output .. [[<text class=f30exx x=1900 y=165>Stretch both axis</text>]]\n return output\nend\n\nfunction GetContentFuel(screen)\n\n if #FuelAtmosphericTanks < 1 and #FuelSpaceTanks < 1 and #FuelRocketTanks < 1 then return \"\" end\n\n local FuelTypes = 0\n local output = \"\"\n local addHeadline = {}\n\n FuelDisplay = { screen.fuelA, screen.fuelS, screen.fuelR }\n\n if FuelDisplay[1] == true and #FuelAtmosphericTanks > 0 then\n table.insert(addHeadline, \"Atmospheric\")\n FuelTypes = FuelTypes + 1\n end\n if FuelDisplay[2] == true and #FuelSpaceTanks > 0 then\n table.insert(addHeadline, \"Space\")\n FuelTypes = FuelTypes + 1\n end\n if FuelDisplay[3] == true and #FuelRocketTanks > 0 then\n table.insert(addHeadline, \"Rocket\")\n FuelTypes = FuelTypes + 1\n end\n\n output = output .. GetHeader(\"Fuel Report (\"..table.concat(addHeadline, \", \")..\")\") ..\n [[\n <style>\n .fuele{fill:#]]..ColorBackground..[[;}\n .fuela{fill:#]]..ColorFuelAtmospheric..[[;fill-opacity:1;}\n .fuels{fill:#]]..ColorFuelSpace..[[;fill-opacity:1;}\n .fuelr{fill:#]]..ColorFuelRocket..[[;fill-opacity:1;}\n\n .fuela2{fill:none;stroke:#]]..ColorFuelAtmospheric..[[;stroke-width:3px;opacity:1;}\n .fuels2{fill:none;stroke:#]]..ColorFuelSpace..[[;stroke-width:3px;opacity:1;}\n .fuelr2{fill:none;stroke:#]]..ColorFuelRocket..[[;stroke-width:3px;opacity:1;}\n\n .fuela3{fill:#]]..ColorFuelAtmospheric..[[;fill-opacity:0.1;}\n .fuels3{fill:#]]..ColorFuelSpace..[[;fill-opacity:0.1;}\n .fuelr3{fill:#]]..ColorFuelRocket..[[;fill-opacity:0.1;}\n\n .fuela4{fill:#]]..ColorFuelAtmospheric..[[;fill-opacity:1;}\n .fuels4{fill:#]]..ColorFuelSpace..[[;fill-opacity:1;}\n .fuelr4{fill:#]]..ColorFuelRocket..[[;fill-opacity:1;}\n </style> ]]\n\n local totalH = 150\n local counter = 0\n local tOffset = 0\n\n if FuelDisplay[1] == true and #FuelAtmosphericTanks > 0 then\n\n if FuelTypes == 1 then tOffset = 50\n elseif FuelTypes == 2 then tOffset = 6\n elseif FuelTypes == 3 then tOffset = 0\n end\n\n output = output .. [[\n <svg x=20 y=]]..(95+totalH/FuelTypes*counter)..[[ width=1880 height=]]..totalH/FuelTypes..[[>\n <rect class=\"fuele\" width=\"100%\" height=\"100%\"/>\n <rect class=\"fuela\" width=\"]]..math.floor(100/FuelAtmosphericTotal*FuelAtmosphericCurrent)..[[%\" height=\"100%\"/>\n </svg>]]\n\n output = output ..\n [[<text class=f25sxx x=40 y=]]..(130+totalH/FuelTypes*counter+tOffset)..[[>]]..\n GenerateCommaValue(FuelAtmosphericCurrent, true)..\n [[ of ]]..GenerateCommaValue(FuelAtmosphericTotal, true)..\n [[ | Total Atmospheric Fuel in ]]..#FuelAtmosphericTanks..[[ tank]]..(#FuelAtmosphericTanks==1 and \"\" or \"s\")..[[ (]]..math.floor(100/FuelAtmosphericTotal*FuelAtmosphericCurrent)..[[%)</text>]]\n counter = counter + 1\n end\n\n if FuelDisplay[2] == true and #FuelSpaceTanks > 0 then\n\n if FuelTypes == 1 then tOffset = 50\n elseif FuelTypes == 2 then tOffset = 6\n elseif FuelTypes == 3 then tOffset = 0\n end\n\n output = output .. [[\n <svg x=20 y=]]..(95+totalH/FuelTypes*counter)..[[ width=1880 height=]]..totalH/FuelTypes..[[>\n <rect class=\"fuele\" width=\"100%\" height=\"100%\"/>\n <rect class=\"fuels\" width=\"]]..math.floor(100/FuelSpaceTotal*FuelSpaceCurrent)..[[%\" height=\"100%\"/>\n </svg>]]\n\n output = output ..\n [[<text class=f25sxx x=40 y=]]..(130+totalH/FuelTypes*counter+tOffset)..[[>]]..\n GenerateCommaValue(FuelSpaceCurrent, true)..\n [[ of ]]..GenerateCommaValue(FuelSpaceTotal, true)..\n [[ | Total Space Fuel in ]]..#FuelSpaceTanks..[[ tank]]..(#FuelSpaceTanks==1 and \"\" or \"s\")..[[ (]]..math.floor(100/FuelSpaceTotal*FuelSpaceCurrent)..[[%)</text>]]\n counter = counter + 1\n end\n\n if FuelDisplay[3] == true and #FuelRocketTanks > 0 then\n\n if FuelTypes == 1 then tOffset = 50\n elseif FuelTypes == 2 then tOffset = 6\n elseif FuelTypes == 3 then tOffset = 0\n end\n\n output = output .. [[\n <svg x=20 y=]]..(95+totalH/FuelTypes*counter)..[[ width=1880 height=]]..totalH/FuelTypes..[[>\n <rect class=\"fuele\" width=\"100%\" height=\"100%\"/>\n <rect class=\"fuelr\" width=\"]]..math.floor(100/FuelRocketTotal*FuelRocketCurrent)..[[%\" height=\"100%\"/>\n </svg> ]]\n\n output = output ..\n [[<text class=f25sxx x=40 y=]]..(130+totalH/FuelTypes*counter+tOffset)..[[>]]..\n GenerateCommaValue(FuelRocketCurrent, true)..\n [[ of ]]..GenerateCommaValue(FuelRocketTotal, true)..\n [[ | Total Rocket Fuel in ]]..#FuelRocketTanks..[[ tank]]..(#FuelRocketTanks==1 and \"\" or \"s\")..[[ (]]..math.floor(100/FuelRocketTotal*FuelRocketCurrent)..[[%)</text>]]\n end\n\n output = output .. [[\n <svg x=20 y=95 width=1880 height=]]..totalH..[[>\n <rect class=\"xborder\" width=\"100%\" height=\"100%\"/>\n </svg>\n ]]\n\n local DisplayTable = {}\n if screen.fuelIndex == nil or screen.fuelIndex < 1 then\n screen.fuelIndex = 1\n end\n\n if FuelDisplay[1] == true then\n for _,v in ipairs(FuelAtmosphericTanks) do\n table.insert(DisplayTable, v)\n end\n end\n if FuelDisplay[2] == true then\n for _,v in ipairs(FuelSpaceTanks) do\n table.insert(DisplayTable, v)\n end\n end\n if FuelDisplay[3] == true then\n for _,v in ipairs(FuelRocketTanks) do\n table.insert(DisplayTable, v)\n end\n end\n\n table.sort(DisplayTable, function(a,b) return a.type<b.type or (a.type == b.type and a.id<b.id) end)\n\n local cCounter = 0\n for i=screen.fuelIndex, screen.fuelIndex+6, 1 do\n if DisplayTable[i] ~= nil then\n local tank = DisplayTable[i]\n cCounter = cCounter + 1\n local colorChar = \"\"\n if tank.type == 1 then\n colorChar = \"a\"\n elseif tank.type == 2 then\n colorChar = \"s\"\n elseif tank.type == 3 then\n colorChar = \"r\"\n end\n\n\n local twidth = 1853/100\n if tank.percent == nil or tank.percent==0 then\n twidth = 0\n else\n twidth = twidth * tank.percent\n end\n if tank.cvol == nil then tank.cvol = 0 end\n if tank.name == nil then tank.name = \"\" end\n\n\n\n output = output .. [[\n <svg x=20 y=]]..(cCounter*100+220)..[[ width=1880 height=100 viewBox=\"0 0 1880 100\">\n <rect class=\"fuel]]..colorChar..[[3\" x=\"13.5\" y=\"9.5\" width=\"1853\" height=\"81\"/>\n <rect class=\"fuel]]..colorChar..[[4\" x=\"13.5\" y=\"9.5\" width=\"]]..twidth..[[\" height=\"81\"/>\n <rect class=\"fuel]]..colorChar..[[2\" x=\"13.5\" y=\"9.5\" width=\"1853\" height=\"81\"/>]]\n if tank.hp == 0 then\n output = output .. [[<polygon class=\"cc\" points=\"7 3 7 97 15 97 15 100 4 100 4 74.9 0 71.32 0 18.7 4 14.4 4 0 15 0 15 3 7 3\"/><polygon class=\"cc\" points=\"1873 3 1873 97 1865 97 1865 100 1876 100 1876 74.9 1880 71.32 1880 18.7 1876 14.4 1876 0 1865 0 1865 3 1873 3\"/>]]\n elseif tank.maxhp - tank.hp > constants.epsilon then\n output = output .. [[<polygon class=\"cw\" points=\"7 3 7 97 15 97 15 100 4 100 4 74.9 0 71.32 0 18.7 4 14.4 4 0 15 0 15 3 7 3\"/><polygon class=\"cw\" points=\"1873 3 1873 97 1865 97 1865 100 1876 100 1876 74.9 1880 71.32 1880 18.7 1876 14.4 1876 0 1865 0 1865 3 1873 3\"/>]]\n else\n output = output .. [[<polygon class=\"ch\" points=\"7 3 7 97 15 97 15 100 4 100 4 74.9 0 71.32 0 18.7 4 14.4 4 0 15 0 15 3 7 3\"/><polygon class=\"ch\" points=\"1873 3 1873 97 1865 97 1865 100 1876 100 1876 74.9 1880 71.32 1880 18.7 1876 14.4 1876 0 1865 0 1865 3 1873 3\"/>]]\n end\n if tank.hp == 0 then output = output .. [[<text class=f80mc x=60 y=82>]]..tank.size..[[</text>]]\n else output = output .. [[<text class=f80mxx07 x=60 y=82>]]..tank.size..[[</text>]]\n end\n\n if tank.hp == 0 then\n output = output .. [[<text class=f60mc x=940 y=74>Broken</text>]] ..\n [[<text class=f25ec x=1860 y=60>0 of ]]..GenerateCommaValue(tank.vol)..[[</text>]]\n elseif tonumber(tank.percent) < 10 then\n output = output .. [[<text class=f60mc x=940 y=74>]]..tank.percent..[[%</text>]] ..\n [[<text class=f25ec x=1860 y=60>]]..GenerateCommaValue(tank.cvol)..[[ of ]]..GenerateCommaValue(tank.vol)..[[</text>]]\n elseif tonumber(tank.percent) < 30 then\n output = output .. [[<text class=f60mw x=940 y=74>]]..tank.percent..[[%</text>]] ..\n [[<text class=f25ew x=1860 y=60>]]..GenerateCommaValue(tank.cvol)..[[ of ]]..GenerateCommaValue(tank.vol)..[[</text>]]\n else output =\n output .. [[<text class=f60mxx x=940 y=74>]]..tank.percent..[[%</text>]] ..\n [[<text class=f25exx x=1860 y=60>]]..GenerateCommaValue(tank.cvol)..[[ of ]]..GenerateCommaValue(tank.vol)..[[</text>]]\n end\n\n output = output ..[[<text class=f25sxx x=140 y=60>]]..tank.name..[[</text>]]\n\n output = output .. [[</svg>]]\n\n end\n end\n\n\n\n if #FuelAtmosphericTanks > 0 then\n output = output .. [[<rect class=xborder x=20 y=260 rx=5 ry=5 width=50 height=50 />]]\n if FuelDisplay[1] == true then\n output = output .. [[<rect class=xfill x=28 y=268 rx=5 ry=5 width=34 height=34 />]]\n end\n output = output .. [[<text class=f25sx x=80 y=290>ATM</text>]]\n AddClickAreaForScreenID(screen.id, {mode = \"fuel\", id = \"ToggleDisplayAtmosphere\", x1 = 50, x2 = 100, y1 = 270, y2 = 320} )\n end\n\n if #FuelSpaceTanks > 0 then\n output = output .. [[<rect class=xborder x=170 y=260 rx=5 ry=5 width=50 height=50 />]]\n if FuelDisplay[2] == true then\n output = output .. [[<rect class=xfill x=178 y=268 rx=5 ry=5 width=34 height=34 />]]\n end\n output = output .. [[<text class=f25sx x=230 y=290>SPC</text>]]\n AddClickAreaForScreenID(screen.id, {mode = \"fuel\", id = \"ToggleDisplaySpace\", x1 = 200, x2 = 250, y1 = 270, y2 = 320} )\n end\n\n if #FuelRocketTanks > 0 then\n output = output .. [[<rect class=xborder x=320 y=260 rx=5 ry=5 width=50 height=50 />]]\n if FuelDisplay[3] == true then\n output = output .. [[<rect class=xfill x=328 y=268 rx=5 ry=5 width=34 height=34 />]]\n end\n output = output .. [[<text class=f25sx x=380 y=290>RKT</text>]]\n AddClickAreaForScreenID(screen.id, {mode = \"fuel\", id = \"ToggleDisplayRocket\", x1 = 350, x2 = 400, y1 = 270, y2 = 320} )\n end\n\n if screen.fuelIndex > 1 then\n output = output .. [[<svg x=\"1490\" y=\"260\">\n <rect x=\"0\" y=\"0\" rx=\"10\" ry=\"10\" width=\"200\" height=\"50\" style=\"fill:#]]..ColorPrimary..[[;\" />\n <svg x=\"80\" y=\"15\"><path d=\"M47.52,14.77,30.4,30.6a3.23,3.23,0,0,0,2.19,5.6H67.41a3.23,3.23,0,0,0,2.19-5.6L52.48,14.77A3.66,3.66,0,0,0,47.52,14.77Z\" transform=\"translate(-29.36 -13.8)\"/></svg>\n </svg>]]\n AddClickAreaForScreenID(screen.id, {mode = \"fuel\", id = \"DecreaseFuelIndex\", x1 = 1470, x2 = 1670, y1 = 270, y2 = 320} )\n end\n\n if screen.fuelIndex+cCounter-1 < #DisplayTable then\n output = output .. [[<svg x=\"1700\" y=\"260\">\n <rect x=\"0\" y=\"0\" rx=\"10\" ry=\"10\" width=\"200\" height=\"50\" style=\"fill:#]]..ColorPrimary..[[;\" />\n <svg x=\"80\" y=\"15\"><path d=\"M52.48,35.23,69.6,19.4a3.23,3.23,0,0,0-2.19-5.6H32.59a3.23,3.23,0,0,0-2.19,5.6L47.52,35.23A3.66,3.66,0,0,0,52.48,35.23Z\" transform=\"translate(-29.36 -13.8)\"/></svg>\n </svg>]]\n AddClickAreaForScreenID(screen.id, {mode = \"fuel\", id = \"IncreaseFuelIndex\", x1 = 1680, x2 = 1880, y1 = 270, y2 = 320} )\n end\n\n if cCounter > 0 then\n output = output .. [[<text class=f30mx x=960 y=300>]]..\n #DisplayTable..\n [[ Tank]]..(#DisplayTable == 1 and \"\" or \"s\")..\n [[ (Showing ]]..screen.fuelIndex..[[ to ]]..(screen.fuelIndex+cCounter-1)..[[)</text>]]\n end\n\n return output\nend\n\nfunction GetContentCargo()\n local output = \"\"\n output = output .. GetHeader(\"Cargo Report\") ..\n [[\n\n ]]\n return output\nend\n\nfunction GetContentAGG()\n local output = \"\"\n output = output .. GetHeader(\"Anti-Grav Control\") ..\n [[\n\n ]]\n return output\nend\n\nfunction GetContentMap()\n local output = \"\"\n output = output .. GetHeader(\"Map Overview\") ..\n [[\n\n ]]\n return output\nend\n\nfunction GetContentTime()\n local output = \"\"\n output = output .. GetHeader(\"Time\") .. epochTime()\n output = output ..\n [[<svg x=460 y=370 width=120 height=150 viewBox=\"0 0 24 30\">\n <rect x=0 y=13 width=4 height=5 fill=#]]..ColorPrimary..[[>\n <animate attributeName=\"height\" attributeType=\"XML\"\n values=\"5;21;5\"\n begin=\"0s\" dur=\"1s\" repeatCount=\"indefinite\" />\n <animate attributeName=\"y\" attributeType=\"XML\"\n values=\"13; 5; 13\"\n begin=\"0s\" dur=\"1s\" repeatCount=\"indefinite\" />\n </rect>\n <rect x=10 y=13 width=4 height=5 fill=#]]..ColorPrimary..[[>\n <animate attributeName=\"height\" attributeType=\"XML\"\n values=\"5;21;5\"\n begin=\"0.15s\" dur=\"1s\" repeatCount=\"indefinite\" />\n <animate attributeName=\"y\" attributeType=\"XML\"\n values=\"13; 5; 13\"\n begin=\"0.15s\" dur=\"1s\" repeatCount=\"indefinite\" />\n </rect>\n <rect x=20 y=13 width=4 height=5 fill=#]]..ColorPrimary..[[>\n <animate attributeName=\"height\" attributeType=\"XML\"\n values=\"5;21;5\"\n begin=\"0.3s\" dur=\"1s\" repeatCount=\"indefinite\" />\n <animate attributeName=\"y\" attributeType=\"XML\"\n values=\"13; 5; 13\"\n begin=\"0.3s\" dur=\"1s\" repeatCount=\"indefinite\" />\n </rect>\n </svg>]]\n return output\nend\n\nfunction GetContentSettings1()\n local output = \"\"\n output = output .. GetHeader(\"Settings\") .. [[<rect class=\"xfill\" x=\"40\" y=\"150\" rx=\"5\" ry=\"5\" width=\"820\" height=\"50\" />]]\n if BackgroundMode==\"\" then\n output = output ..[[<text class=\"f30mxxx\" x=\"440\" y=\"185\">Activate background</text>]]\n else\n output = output ..[[<text class=\"f30mxxx\" x=\"440\" y=\"185\">Deactivate background (']]..BackgroundMode..[[', ]]..string.format(\"%.0f\",BackgroundModeOpacity*100)..[[%)</text>]]\n end\n output = output ..[[\n <rect class=\"xfill\" x=\"40\" y=\"220\" rx=\"5\" ry=\"5\" width=\"400\" height=\"50\" />\n <text class=\"f30mxxx\" x=\"240\" y=\"255\">Previous background</text>\n <rect class=\"xfill\" x=\"460\" y=\"220\" rx=\"5\" ry=\"5\" width=\"400\" height=\"50\" />\n <text class=\"f30mxxx\" x=\"660\" y=\"255\">Next background</text>\n\n <rect class=\"xfill\" x=\"40\" y=\"290\" rx=\"5\" ry=\"5\" width=\"400\" height=\"50\" />\n <text class=\"f30mxxx\" x=\"240\" y=\"325\">Decrease Opacity</text>\n <rect class=\"xfill\" x=\"460\" y=\"290\" rx=\"5\" ry=\"5\" width=\"400\" height=\"50\" />\n <text class=\"f30mxxx\" x=\"660\" y=\"325\">Increase Opacity</text>\n ]]\n\n output = output ..\n [[<rect class=\"xfill\" x=\"40\" y=\"360\" rx=\"5\" ry=\"5\" width=\"820\" height=\"50\" />]] ..\n [[<text class=\"f30mxxx\" x=\"440\" y=\"395\">Reset background and all colors</text>]]\n\n output = output ..\n [[<svg x=40 y=430 width=820 height=574>]] ..\n [[<rect class=\"xborder\" x=\"0\" y=\"0\" rx=\"5\" ry=\"5\" width=\"820\" height=\"574\" stroke-dasharray=\"2 5\" />]] ..\n [[<rect class=\"xborder\" x=\"0\" y=\"0\" rx=\"5\" ry=\"5\" width=\"820\" height=\"50\" />]] ..\n [[<text class=\"f30mxx\" x=\"410\" y=\"35\">Select and change any of the ]]..#colorIDTable..[[ HUD colors</text>]] ..\n [[<rect class=\"xfill\" x=\"20\" y=\"70\" rx=\"5\" ry=\"5\" width=\"50\" height=\"50\" />]] ..\n [[<svg x=32 y=74><path d=\"M1,23.13,16.79,40.25a3.23,3.23,0,0,0,5.6-2.19V3.24a3.23,3.23,0,0,0-5.6-2.19L1,18.17A3.66,3.66,0,0,0,1,23.13Z\" transform=\"translate(0.01 -0.01)\"/></svg>]] ..\n [[<rect class=\"xfill\" x=\"750\" y=\"70\" rx=\"5\" ry=\"5\" width=\"50\" height=\"50\" />]] ..\n [[<svg x=764 y=74><path d=\"M21.42,18.17,5.59,1.05A3.23,3.23,0,0,0,0,3.24V38.06a3.23,3.23,0,0,0,5.6,2.19L21.42,23.13A3.66,3.66,0,0,0,21.42,18.17Z\" transform=\"translate(0.01 -0.01)\"/></svg>]] ..\n [[<rect class=\"xborder\" x=\"90\" y=\"70\" rx=\"5\" ry=\"5\" width=\"640\" height=\"50\" />]] ..\n [[<text class=\"f30mxx\" x=\"410\" y=\"105\">]]..colorIDTable[colorIDIndex].desc..[[</text>]] ..\n [[<rect style=\"fill: #]].._G[colorIDTable[colorIDIndex].id]..[[; fill-opacity: 1; stroke: #]]..ColorPrimary..[[; stroke-width:3;\" x=\"90\" y=\"140\" rx=\"5\" ry=\"5\" width=\"640\" height=\"70\" />]] ..\n [[<text class=\"f20sxx\" x=\"100\" y=\"160\">Current color</text>]] ..\n [[<svg x=90 y=230 width=640 height=140>]] ..\n\n [[<rect class=xbfill x=55 y=5 rx=5 ry=5 width=80 height=40 />]] ..\n [[<svg x=75 y=15><path d=\"M47.52,14.77,30.4,30.6a3.23,3.23,0,0,0,2.19,5.6H67.41a3.23,3.23,0,0,0,2.19-5.6L52.48,14.77A3.66,3.66,0,0,0,47.52,14.77Z\" transform=\"translate(-29.36 -13.8)\"/></svg>]] ..\n [[<rect class=xbfill x=145 y=5 rx=5 ry=5 width=80 height=40 />]] ..\n [[<svg x=165 y=15><path d=\"M47.52,14.77,30.4,30.6a3.23,3.23,0,0,0,2.19,5.6H67.41a3.23,3.23,0,0,0,2.19-5.6L52.48,14.77A3.66,3.66,0,0,0,47.52,14.77Z\" transform=\"translate(-29.36 -13.8)\"/></svg>]] ..\n [[<rect class=xbfill x=235 y=5 rx=5 ry=5 width=80 height=40 />]] ..\n [[<svg x=255 y=15><path d=\"M47.52,14.77,30.4,30.6a3.23,3.23,0,0,0,2.19,5.6H67.41a3.23,3.23,0,0,0,2.19-5.6L52.48,14.77A3.66,3.66,0,0,0,47.52,14.77Z\" transform=\"translate(-29.36 -13.8)\"/></svg>]] ..\n [[<rect class=xbfill x=325 y=5 rx=5 ry=5 width=80 height=40 />]] ..\n [[<svg x=345 y=15><path d=\"M47.52,14.77,30.4,30.6a3.23,3.23,0,0,0,2.19,5.6H67.41a3.23,3.23,0,0,0,2.19-5.6L52.48,14.77A3.66,3.66,0,0,0,47.52,14.77Z\" transform=\"translate(-29.36 -13.8)\"/></svg>]] ..\n [[<rect class=xbfill x=415 y=5 rx=5 ry=5 width=80 height=40 />]] ..\n [[<svg x=435 y=15><path d=\"M47.52,14.77,30.4,30.6a3.23,3.23,0,0,0,2.19,5.6H67.41a3.23,3.23,0,0,0,2.19-5.6L52.48,14.77A3.66,3.66,0,0,0,47.52,14.77Z\" transform=\"translate(-29.36 -13.8)\"/></svg>]] ..\n [[<rect class=xbfill x=505 y=5 rx=5 ry=5 width=80 height=40 />]] ..\n [[<svg x=525 y=15><path d=\"M47.52,14.77,30.4,30.6a3.23,3.23,0,0,0,2.19,5.6H67.41a3.23,3.23,0,0,0,2.19-5.6L52.48,14.77A3.66,3.66,0,0,0,47.52,14.77Z\" transform=\"translate(-29.36 -13.8)\"/></svg>]] ..\n\n [[<text class=f60mx x=27 y=92>#</text>]] ..\n\n [[<rect class=xborder x=55 y=50 rx=5 ry=5 width=80 height=40 />]] ..\n [[<text class=f30mxx x=95 y=80>]]..string.sub(colorIDTable[colorIDIndex].newc,1,1)..[[</text>]] ..\n [[<rect class=xborder x=145 y=50 rx=5 ry=5 width=80 height=40 />]] ..\n [[<text class=f30mxx x=185 y=80>]]..string.sub(colorIDTable[colorIDIndex].newc,2,2)..[[</text>]] ..\n [[<rect class=xborder x=235 y=50 rx=5 ry=5 width=80 height=40 />]] ..\n [[<text class=f30mxx x=275 y=80>]]..string.sub(colorIDTable[colorIDIndex].newc,3,3)..[[</text>]] ..\n [[<rect class=xborder x=325 y=50 rx=5 ry=5 width=80 height=40 />]] ..\n [[<text class=f30mxx x=365 y=80>]]..string.sub(colorIDTable[colorIDIndex].newc,4,4)..[[</text>]] ..\n [[<rect class=xborder x=415 y=50 rx=5 ry=5 width=80 height=40 />]] ..\n [[<text class=f30mxx x=455 y=80>]]..string.sub(colorIDTable[colorIDIndex].newc,5,5)..[[</text>]] ..\n [[<rect class=xborder x=505 y=50 rx=5 ry=5 width=80 height=40 />]] ..\n [[<text class=f30mxx x=545 y=80>]]..string.sub(colorIDTable[colorIDIndex].newc,6,6)..[[</text>]] ..\n\n [[<rect class=xbfill x=55 y=95 rx=5 ry=5 width=80 height=40 />]] ..\n [[<svg x=75 y=105><path d=\"M52.48,35.23,69.6,19.4a3.23,3.23,0,0,0-2.19-5.6H32.59a3.23,3.23,0,0,0-2.19,5.6L47.52,35.23A3.66,3.66,0,0,0,52.48,35.23Z\" transform=\"translate(-29.36 -13.8)\"/></svg>]] ..\n [[<rect class=xbfill x=145 y=95 rx=5 ry=5 width=80 height=40 />]] ..\n [[<svg x=165 y=105><path d=\"M52.48,35.23,69.6,19.4a3.23,3.23,0,0,0-2.19-5.6H32.59a3.23,3.23,0,0,0-2.19,5.6L47.52,35.23A3.66,3.66,0,0,0,52.48,35.23Z\" transform=\"translate(-29.36 -13.8)\"/></svg>]] ..\n [[<rect class=xbfill x=235 y=95 rx=5 ry=5 width=80 height=40 />]] ..\n [[<svg x=255 y=105><path d=\"M52.48,35.23,69.6,19.4a3.23,3.23,0,0,0-2.19-5.6H32.59a3.23,3.23,0,0,0-2.19,5.6L47.52,35.23A3.66,3.66,0,0,0,52.48,35.23Z\" transform=\"translate(-29.36 -13.8)\"/></svg>]] ..\n [[<rect class=xbfill x=325 y=95 rx=5 ry=5 width=80 height=40 />]] ..\n [[<svg x=345 y=105><path d=\"M52.48,35.23,69.6,19.4a3.23,3.23,0,0,0-2.19-5.6H32.59a3.23,3.23,0,0,0-2.19,5.6L47.52,35.23A3.66,3.66,0,0,0,52.48,35.23Z\" transform=\"translate(-29.36 -13.8)\"/></svg>]] ..\n [[<rect class=xbfill x=415 y=95 rx=5 ry=5 width=80 height=40 />]] ..\n [[<svg x=435 y=105><path d=\"M52.48,35.23,69.6,19.4a3.23,3.23,0,0,0-2.19-5.6H32.59a3.23,3.23,0,0,0-2.19,5.6L47.52,35.23A3.66,3.66,0,0,0,52.48,35.23Z\" transform=\"translate(-29.36 -13.8)\"/></svg>]] ..\n [[<rect class=xbfill x=505 y=95 rx=5 ry=5 width=80 height=40 />]] ..\n [[<svg x=525 y=105><path d=\"M52.48,35.23,69.6,19.4a3.23,3.23,0,0,0-2.19-5.6H32.59a3.23,3.23,0,0,0-2.19,5.6L47.52,35.23A3.66,3.66,0,0,0,52.48,35.23Z\" transform=\"translate(-29.36 -13.8)\"/></svg>]] ..\n\n [[</svg>]] ..\n [[<rect style=\"fill: #]]..colorIDTable[colorIDIndex].newc..[[; fill-opacity: 1; stroke: #]]..ColorPrimary..[[; stroke-width:3;\" x=\"90\" y=\"390\" rx=\"5\" ry=\"5\" width=\"640\" height=\"70\" />]] ..\n [[<text class=f20sxx x=100 y=410>New color</text>]] ..\n [[<rect class=xfill x=290 y=480 rx=5 ry=5 width=440 height=50 />]] ..\n [[<text class=f30mxxx x=510 y=515>Apply new color</text>]] ..\n [[<rect class=xfill x=90 y=480 rx=5 ry=5 width=185 height=50 />]] ..\n [[<text class=f30mxxx x=182 y=515>Reset</text>]] ..\n [[</svg>]]\n\n output = output ..\n [[<svg x=940 y=150 width=936 height=774>]] ..\n [[<rect class=xborder x=0 y=0 rx=5 ry=5 width=936 height=774 stroke-dasharray=\"2 5\" />]] ..\n [[<rect class=xborder x=0 y=0 rx=5 ry=5 width=936 height=50 />]] ..\n [[<text class=f30mxx x=468 y=35>Explanation / Hints</text>]] ..\n [[<text class=f30mxx x=468 y=400>Coming soon.</text>]]\n\n\n output = output .. [[</svg>]]\n\n if SimulationMode == true then\n output = output .. [[<rect class=\"cfill\" x=\"940\" y=\"954\" rx=\"5\" ry=\"5\" width=\"936\" height=\"50\" /><text class=\"f30mxxx\" x=\"1408\" y=\"989\">Simulating Damage to elements</text>]]\n AddClickArea(\"settings1\", { id = \"ToggleSimulation\", mode =\"settings1\", x1 = 940, x2 = 1850, y1 = 919, y2 = 969 })\n else\n output = output .. [[<rect class=\"xfill\" x=\"940\" y=\"954\" rx=\"5\" ry=\"5\" width=\"936\" height=\"50\" /><text class=\"f30mxxx\" x=\"1408\" y=\"989\">Simulate Damage to elements</text>]]\n AddClickArea(\"settings1\", { id = \"ToggleSimulation\", mode =\"settings1\", x1 = 940, x2 = 1850, y1 = 919, y2 = 969 })\n end\n\n return output\nend\n\nfunction GetContentStartup()\n local output = \"\"\n output = output .. GetElementLogo(812, 380, \"f\", \"f\", \"f\")\n if YourShipsName == \"Enter here\" then\n output = output .. [[<g><text class=\"f160m\" x=\"960\" y=\"330\">Spaceship ID ]]..ShipID..[[</text><animate attributeName=\"fill\" values=\"#]]..ColorPrimary..[[;#]]..ColorSecondary..[[;#]]..ColorPrimary..[[\" dur=\"30s\" repeatCount=\"indefinite\" /></g>]]\n else\n output = output .. [[<g><text class=\"f160m\" x=\"960\" y=\"330\">]]..YourShipsName..[[</text><animate attributeName=\"fill\" values=\"#]]..ColorPrimary..[[;#]]..ColorSecondary..[[;#]]..ColorPrimary..[[\" dur=\"30s\" repeatCount=\"indefinite\" /></g>]]\n end\n if ShowWelcomeMessage == true then output = output .. [[<text class=\"f50mx\" x=\"960\" y=\"750\">Greetings, Commander ]]..PlayerName..[[.</text>]] end\n if #Warnings > 0 then\n output = output .. [[<text class=\"f25mc\" x=\"960\" y=\"880\">Warning: ]]..(table.concat(Warnings, \" \"))..[[</text>]]\n end\n output = output .. [[<text class=\"f30mxx\" style=\"fill-opacity:0.2\" x=\"960\" y=\"1000\">Damage Report v]]..VERSION..[[, by CredenceH - GitHub: LocuraDU.</text>]]\n return output\nend\n\nfunction RenderScreen(screen, contentToRender)\n if contentToRender == nil then\n PrintConsole(\"ERROR: contentToRender is nil.\")\n unit.exit()\n end\n\n CreateClickAreasForScreen(screen)\n\n local output =\"\"\n output = output .. [[\n <style>\n body{\n background-color: #]]..ColorBackground..[[; ]]..GetContentBackground(BackgroundMode)..[[\n }\n .screen { width: 1920px; height: 1120px; }\n .main { width: 1920px; height: 1040px; }\n .menu { width: 1920px; height: 70px; stroke: #]]..ColorPrimary..[[; stroke-width: 3; }\n\n .xline { stroke: #]]..ColorPrimary..[[; stroke-width: 3;}\n .daline { stroke: #]]..ColorSecondary..[[; stroke-dasharray: 2 5; }\n .ll { fill: #FF55FF; stroke: #FF0000}\n .xborder { fill:#]]..ColorPrimary..[[; fill-opacity:0.05; stroke: #]]..ColorPrimary..[[; stroke-width:3; }\n .xfill { fill:#]]..ColorPrimary..[[; fill-opacity:1; }\n .xbfill { fill:#]]..ColorPrimary..[[; fill-opacity:1; stroke: #]]..ColorPrimary..[[; stroke-width:3; }\n .cfill { fill:#]]..ColorCritical..[[; fill-opacity:1; }\n\n .hlrect { fill: #]]..ColorPrimary..[[; }\n .cx { fill: #]]..ColorPrimary..[[; }\n .ch { fill: #]]..ColorHealthy..[[; }\n .cw { fill: #]]..ColorWarning..[[; }\n .cc { fill: #]]..ColorCritical..[[; }\n\n .f { fill:#]]..ColorPrimary..[[; }\n .f2 { fill:#]]..ColorSecondary..[[; }\n .f3 { fill:#]]..ColorTertiary..[[; }\n .f250mx { font-size: 250px; text-anchor: middle; fill: #]]..ColorPrimary..[[; font-family: Impact, Charcoal, sans-serif; }\n .f160m { font-size: 160px; text-anchor: middle; font-family: Impact, Charcoal, sans-serif; }\n .f160mx { font-size: 160px; text-anchor: middle; fill: #]]..ColorPrimary..[[; font-family: Impact, Charcoal, sans-serif; }\n .f100mx { font-size: 100px; text-anchor: middle; fill: #]]..ColorPrimary..[[; font-family: Impact, Charcoal, sans-serif; }\n .f80mxx07 { opacity:0.7; font-size: 80px; text-anchor: middle; fill: #]]..ColorSecondary..[[; font-family: Impact, Charcoal, sans-serif; }\n .f80mc { opacity:1; font-size: 80px; text-anchor: middle; fill: #]]..ColorCritical..[[; font-family: Impact, Charcoal, sans-serif; }\n .f60s { font-size: 60px; text-anchor: start; }\n .f60m { font-size: 60px; text-anchor: middle; }\n .f60e { font-size: 60px; text-anchor: end; }\n .f60mx { font-size: 60px; text-anchor: middle; fill: #]]..ColorPrimary..[[; font-family: Impact, Charcoal, sans-serif; }\n .f60mxx { font-size: 60px; text-anchor: middle; fill: #]]..ColorSecondary..[[; font-family: Impact, Charcoal, sans-serif; }\n .f60mxx07 { opacity:0.7; font-size: 60px; text-anchor: middle; fill: #]]..ColorSecondary..[[; font-family: Impact, Charcoal, sans-serif; }\n .f60mc { opacity:1; font-size: 60px; text-anchor: middle; fill: #]]..ColorCritical..[[; font-family: Impact, Charcoal, sans-serif; }\n .f60mw { opacity:1; font-size: 60px; text-anchor: middle; fill: #]]..ColorWarning..[[; font-family: Impact, Charcoal, sans-serif; }\n .f50m { font-size: 50px; text-anchor: middle; }\n .f50sxx { font-size: 50px; text-anchor: start; fill: #]]..ColorSecondary..[[; }\n .f50mx { font-size: 50px; fill: #]]..ColorPrimary..[[; fill-opacity: 1; text-anchor: middle; }\n .f50mx02 { font-size: 50px; fill: #]]..ColorPrimary..[[; fill-opacity: 0.2; text-anchor: middle; }\n .f50mxx { font-size: 50px; fill: #]]..ColorSecondary..[[; fill-opacity: 1; text-anchor: middle }\n .f36mxx { font-size: 36px; fill: #]]..ColorSecondary..[[; fill-opacity: 1; text-anchor: middle }\n .f30mx { font-size: 30px; fill: #]]..ColorPrimary..[[; fill-opacity: 1; text-anchor: middle; }\n .f30sxx { font-size: 30px; fill: #]]..ColorSecondary..[[; fill-opacity: 1; text-anchor: start; }\n .f30exx { font-size: 30px; fill: #]]..ColorSecondary..[[; fill-opacity: 1; text-anchor: end; }\n .f30mxx { font-size: 30px; fill: #]]..ColorSecondary..[[; fill-opacity: 1; text-anchor: middle; }\n .f30mxxx { font-size: 30px; fill: #]]..ColorTertiary..[[; fill-opacity: 1; text-anchor: middle; }\n .f25sx { font-size: 25px; text-anchor: start; fill: #]]..ColorPrimary..[[; }\n .f25exx { font-size: 25px; text-anchor: end; fill: #]]..ColorSecondary..[[; }\n .f25sxx { font-size: 25px; text-anchor: start; fill: #]]..ColorSecondary..[[; }\n .f25mw { font-size: 25px; text-anchor: middle; fill: #]]..ColorWarning..[[; }\n .f25mr { font-size: 25px; text-anchor: middle; fill: #]]..ColorCritical..[[; }\n .f25ew { font-size: 25px; text-anchor: end; fill: #]]..ColorWarning..[[; }\n .f25ec { font-size: 25px; text-anchor: end; fill: #]]..ColorCritical..[[; }\n .f25mc { font-size: 25px; text-anchor: middle; fill: #]]..ColorCritical..[[; }\n .f20sxx { font-size: 20px; text-anchor: start; fill: #]]..ColorSecondary..[[; }\n .f20mxx { font-size: 20px; text-anchor: middle; fill: #]]..ColorSecondary..[[; }\n </style>\n <svg class=screen viewBox=\"0 0 1920 1120\">\n <svg class=main x=0 y=0>]]\n\n output = output .. contentToRender\n\n if screen.mode == \"startup\" then\n output = output .. [[<rect class=xborder x=0 y=0 rx=5 ry=5 width=1920 height=1040 />]]\n else\n output = output .. [[<rect class=xborder x=0 y=70 rx=5 ry=5 width=1920 height=970 />]]\n end\n\n output = output .. [[\n </svg>\n <svg class=menu x=0 y=1050>\n <rect class=xline x=0 y=0 rx=5 ry=5 width=1920 height=70 fill=#]]..ColorBackground..[[ />\n <text class=f50mx x=96 y=50>TIME</text>\n <text class=f50mx x=288 y=50>DMG</text>\n <text class=f50mx x=480 y=50>DMGO</text>\n <text class=f50mx x=672 y=50>FUEL</text>\n <text class=f50mx x=864 y=50>SYS</text>]]\n\n --[[\n <text class=f50mx x=672 y=50>FUEL</text>\n <text class=f50mx x=864 y=50>FLGT</text>\n <text class=f50mx x=1056 y=50>CRGO</text>\n <text class=f50mx x=1248 y=50>AGG</text>\n <text class=f50mx x=1440 y=50>MAP</text>\n ]]\n\n output = output .. [[\n <text class=f50mx x=1632 y=50>HUD</text>\n <text class=f50mx x=1824 y=50>SETS</text>\n <line class=xline x1=192 y1=10 x2=192 y2=60 />\n <line class=xline x1=384 y1=10 x2=384 y2=60 />\n <line class=xline x1=576 y1=10 x2=576 y2=60 />\n <line class=xline x1=768 y1=10 x2=768 y2=60 />\n <line class=xline x1=960 y1=10 x2=960 y2=60 />\n ]] ..\n -- [[\n -- <line class=xline x1=1152 y1=10 x2=1152 y2=60 />\n ---<line class=xline x1=1344 y1=10 x2=1344 y2=60 />]] ..\n [[<line class=xline x1=1536 y1=10 x2=1536 y2=60 />\n <line class=xline x1=1728 y1=10 x2=1728 y2=60 />]]\n if HUDMode == true then\n output = output .. [[\n <rect class=hlrect x=1544 y=6 rx=0 ry=0 width=176 height=58 />\n <text class=f50mxx x=1632 y=50>HUD</text>\n ]]\n end\n if screen.mode == \"damage\" then\n output = output .. [[\n <rect class=hlrect x=200 y=6 rx=0 ry=0 width=176 height=58 />\n <text class=f50mxx x=288 y=50>DMG</text>\n ]]\n elseif screen.mode == \"damageoutline\" then\n output = output .. [[\n <rect class=hlrect x=392 y=6 rx=0 ry=0 width=176 height=58 />\n <text class=f50mxx x=480 y=50>DMGO</text>\n ]]\n elseif screen.mode == \"fuel\" then\n output = output .. [[\n <rect class=hlrect x=584 y=6 rx=0 ry=0 width=176 height=58 />\n <text class=f50mxx x=672 y=50>FUEL</text>\n ]]\n elseif screen.mode == \"flight\" then\n output = output .. [[\n <rect class=hlrect x=776 y=6 rx=0 ry=0 width=176 height=58 />\n <text class=f50mxx x=864 y=50>FLGT</text>\n ]]\n elseif screen.mode == \"cargo\" then\n output = output .. [[\n <rect class=hlrect x=968 y=6 rx=0 ry=0 width=176 height=58 />\n <text class=f50mxx x=1056 y=50>CRGO</text>\n ]]\n elseif screen.mode == \"agg\" then\n output = output .. [[\n <rect class=hlrect x=1160 y=6 rx=0 ry=0 width=176 height=58 />\n <text class=f50mxx x=1248 y=50>AGG</text>\n ]]\n elseif screen.mode == \"map\" then\n output = output .. [[\n <rect class=hlrect x=1352 y=6 rx=0 ry=0 width=176 height=58 />\n <text class=f50mxx x=1440 y=50>MAP</text>\n ]]\n elseif screen.mode == \"time\" then\n output = output .. [[\n <rect class=hlrect x=8 y=6 rx=0 ry=0 width=176 height=58 />\n <text class=f50mxx x=96 y=50>TIME</text>\n ]]\n elseif screen.mode == \"settings1\" then\n output = output .. [[\n <rect class=hlrect x=1736 y=6 rx=0 ry=0 width=176 height=58 />\n <text class=f50mxx x=1824 y=50>SETS</text>\n ]]\n end\n output = output .. [[</svg>]]\n output = output .. [[</svg>]]\n\n -- Center:\n\n -- <line style=\"stroke: white;\" class=\"xline\" x1=\"960\" y1=\"0\" x2=\"960\" y2=\"1040\" />\n -- <line style=\"stroke: white;\" class=\"xline\" x1=\"0\" y1=\"520\" x2=\"1920\" y2=\"520\" />\n -- <line style=\"stroke: white;\" class=\"xline\" x1=\"960\" y1=\"0\" x2=\"960\" y2=\"1120\" />\n -- <line style=\"stroke: white;\" class=\"xline\" x1=\"0\" y1=\"560\" x2=\"1920\" y2=\"560\" />\n\n local outputLength = string.len(output)\n -- PrintConsole(\"Render: \"..screen.mode..\" (\"..outputLength..\" chars)\")\n screen.element.setSVG(output)\nend\n\nfunction RenderScreens(onlymode, onlysubmode)\n\n onlymode = onlymode or \"all\"\n onlysubmode = onlysubmode or \"all\"\n\n if screens ~= nil and #screens > 0 then\n\n local contentFlight = \"\"\n local contentDamage = \"\"\n local contentDamageoutlineTop = \"\"\n local contentDamageoutlineSide = \"\"\n local contentDamageoutlineFront = \"\"\n local contentFuel = \"\"\n local contentCargo = \"\"\n local contentAGG = \"\"\n local contentMap = \"\"\n local contentTime = \"\"\n local contentSettings1 = \"\"\n local contentStartup = \"\"\n\n for k,screen in pairs(screens) do\n if screen.refresh == true then\n local contentToRender = \"\"\n\n if screen.mode == \"flight\" and (onlymode ==\"flight\" or onlymode ==\"all\") then\n if contentFlight == \"\" then contentFlight = GetContentFlight() end\n contentToRender = contentFlight\n elseif screen.mode == \"damage\" and (onlymode ==\"damage\" or onlymode ==\"all\") then\n if contentDamage == \"\" then contentDamage = GetContentDamage() end\n contentToRender = contentDamage\n elseif screen.mode == \"damageoutline\" and (onlymode ==\"damageoutline\" or onlymode ==\"all\") then\n if screen.submode == \"\" then\n screen.submode = \"top\"\n screens[k].submode = \"top\"\n end\n if screen.submode == \"top\" and (onlysubmode == \"top\" or onlysubmode == \"all\") then\n if contentDamageoutlineTop == \"\" then contentDamageoutlineTop = GetContentDamageoutline(screen) end\n contentToRender = contentDamageoutlineTop\n end\n if screen.submode == \"side\" and (onlysubmode == \"side\" or onlysubmode == \"all\") then\n if contentDamageoutlineSide == \"\" then contentDamageoutlineSide = GetContentDamageoutline(screen) end\n contentToRender = contentDamageoutlineSide\n end\n if screen.submode == \"front\" and (onlysubmode == \"front\" or onlysubmode == \"all\") then\n if contentDamageoutlineFront == \"\" then contentDamageoutlineFront = GetContentDamageoutline(screen) end\n contentToRender = contentDamageoutlineFront\n end\n elseif screen.mode == \"fuel\" and (onlymode ==\"fuel\" or onlymode ==\"all\") then\n screen = WipeClickAreasForScreen(screens[k])\n contentToRender = GetContentFuel(screen)\n elseif screen.mode == \"cargo\" and (onlymode ==\"cargo\" or onlymode ==\"all\") then\n if contentCargo == \"\" then contentCargo = GetContentCargo() end\n contentToRender = contentCargo\n elseif screen.mode == \"agg\" and (onlymode ==\"agg\" or onlymode ==\"all\") then\n if contentAGG == \"\" then contentAGG = GetContentAGG() end\n contentToRender = contentAGG\n elseif screen.mode == \"map\" and (onlymode ==\"map\" or onlymode ==\"all\") then\n if contentMap == \"\" then contentMap = GetContentMap() end\n contentToRender = contentMap\n elseif screen.mode == \"time\" and (onlymode ==\"time\" or onlymode ==\"all\") then\n if contentTime == \"\" then contentTime = GetContentTime() end\n contentToRender = contentTime\n elseif screen.mode == \"settings1\" and (onlymode ==\"settings1\" or onlymode ==\"all\") then\n if contentSettings1 == \"\" then contentSettings1 = GetContentSettings1() end\n contentToRender = contentSettings1\n elseif screen.mode == \"startup\" and (onlymode ==\"startup\" or onlymode ==\"all\") then\n if contentStartup == \"\" then contentStartup = GetContentStartup() end\n contentToRender = contentStartup\n else\n contentToRender = \"Invalid screen mode. ('\"..screen.mode..\"')\"\n end\n\n if contentToRender ~= \"\" then\n RenderScreen(screen, contentToRender)\n else\n DrawCenteredText(\"ERROR: No contentToRender delivered for \"..screen.mode)\n PrintConsole(\"ERROR: No contentToRender delivered for \"..screen.mode)\n unit.exit()\n end\n screens[k].refresh = false\n end\n end\n end\n\n if HUDMode == true then\n system.setScreen(GetContentDamageHUDOutput())\n system.showScreen(1)\n else\n system.showScreen(0)\n end\n\nend\n\nfunction OnTickData(initial)\n if formerTime + 60 < system.getArkTime() then\n SetRefresh(\"time\")\n end\n totalShipMass = construct.getMass()\n if formerTotalShipMass ~= totalShipMass then\n UpdateDamageData(true)\n UpdateTypeData()\n SetRefresh()\n formerTotalShipMass = totalShipMass\n else\n UpdateDamageData(initial)\n UpdateTypeData()\n end\n RenderScreens()\nend\n\n--[[ 7. EXECUTION ]]\n\nunit.hideWidget()\nClearConsole()\nsystem.print(\"----------------------------------------\")\nsystem.print(\"DAMAGE REPORT v\" .. VERSION)\nsystem.print(\"GitHub/LocuraDU\")\nsystem.print(\"----------------------------------------\")\n-- PrintConsole(\"DAMAGE REPORT v\"..VERSION..\" STARTED\", true)\nInitiateSlots()\nLoadFromDatabank()\nSwitchScreens(\"on\")\nInitiateScreens()\n\nif core == nil then\n PrintConsole(\"ERROR: Connect the core to the programming board.\")\n unit.exit()\nelse\n OperatorID = player.getId()\n OperatorData = database.getPlayer(OperatorID)\n PlayerName = OperatorData[\"name\"]\n ShipID = construct.getId()\nend\n\nif db == nil then\n table.insert(Warnings, \"No databank connected, won't save/load settings.\")\nend\n\nif YourShipsName == \"Enter here\" then\n table.insert(Warnings, \"No ship name set in LUA settings.\")\nend\n\nif SkillRepairToolEfficiency == 0 and SkillRepairToolOptimization == 0 and StatFuelTankOptimization == 0 and StatContainerOptimization ==0 and\n StatAtmosphericFuelTankHandling == 0 and StatSpaceFuelTankHandling == 0 and StatRocketFuelTankHandling ==0 then\n table.insert(Warnings, \"No talents/stats set in LUA settings.\")\nend\n\nif SkillRepairToolEfficiency < 0 or SkillRepairToolOptimization < 0 or StatFuelTankOptimization < 0 or StatContainerOptimization < 0 or\n StatAtmosphericFuelTankHandling < 0 or StatSpaceFuelTankHandling < 0 or StatRocketFuelTankHandling < 0 or\n SkillRepairToolEfficiency > 5 or SkillRepairToolOptimization > 5 or StatFuelTankOptimization > 5 or StatContainerOptimization > 5 or\n StatAtmosphericFuelTankHandling > 5 or StatSpaceFuelTankHandling > 5 or StatRocketFuelTankHandling > 5 then\n PrintConsole(\"ERROR: Talents/stats can only range from 0 to 5. Please set correctly in LUA settings and reactivate script.\")\n unit.exit()\nend\n\nif screens == nil or #screens == 0 then\n HUDMode = true\n PrintConsole(\"Warning: No screens connected. Entering HUD mode only.\")\nend\n\nOnTickData(true)\n\nunit.setTimer('UpdateData', UpdateDataInterval)\nunit.setTimer('UpdateHighlight', HighlightBlinkingInterval)","filter":{"args":[],"signature":"onStart()","slotKey":"-1"},"key":"11"},{"code":"ActionUp()","filter":{"args":[{"value":"up"}],"signature":"actionStart(action)","slotKey":"-4"},"key":"12"},{"code":"ActionDown()","filter":{"args":[{"value":"down"}],"signature":"actionStart(action)","slotKey":"-4"},"key":"13"},{"code":"ActionStrafeLeft()","filter":{"args":[{"value":"strafeleft"}],"signature":"actionStart(action)","slotKey":"-4"},"key":"14"},{"code":"ActionStrafeRight()","filter":{"args":[{"value":"straferight"}],"signature":"actionStart(action)","slotKey":"-4"},"key":"15"},{"code":"KeyCTRLPressed = true","filter":{"args":[{"value":"brake"}],"signature":"actionStart(action)","slotKey":"-4"},"key":"16"},{"code":"KeyCTRLPressed = false","filter":{"args":[{"value":"brake"}],"signature":"actionStop(action)","slotKey":"-4"},"key":"17"},{"code":"ActionOption1()","filter":{"args":[{"value":"option1"}],"signature":"actionStart(action)","slotKey":"-4"},"key":"18"},{"code":"ActionOption2()","filter":{"args":[{"value":"option2"}],"signature":"actionStart(action)","slotKey":"-4"},"key":"19"},{"code":"ActionOption3()","filter":{"args":[{"value":"option3"}],"signature":"actionStart(action)","slotKey":"-4"},"key":"20"},{"code":"ActionOption4()","filter":{"args":[{"value":"option4"}],"signature":"actionStart(action)","slotKey":"-4"},"key":"21"},{"code":"ActionOption9()","filter":{"args":[{"value":"option9"}],"signature":"actionStart(action)","slotKey":"-4"},"key":"22"},{"code":"ActionOption8()","filter":{"args":[{"value":"option8"}],"signature":"actionStart(action)","slotKey":"-4"},"key":"23"}],"methods":[],"events":[]}