[READ-ONLY] Mirror of https://github.com/thoda-dev/DU-Industry-HUD. A simple HUD for monitoring and managing industry in Dual Universe
dual-universe lua
0

Configure Feed

Select the types of activity you want to include in your feed.

fix clock cpu load error

Thomas (Dec 29, 2020, 6:34 PM +0100) ce68882b 20f8a539

+45 -30
+2 -2
Master program/config.json
··· 125 125 "key": "2" 126 126 }, 127 127 { 128 - "code": "local year, month, day, hour, minute, second = epochTime()\nlocal dateStr = year .. \"/\" .. month .. \"/\" .. day .. \" \" .. hour .. \":\" .. minute .. \":\" .. second\nif dateFormat:lower() == \"fr\" then\n dateStr = day .. \"/\" .. month .. \"/\" .. year .. \" \" .. hour .. \":\" .. minute .. \":\" .. second\nend\n\nhud_help_command = [[<div class=\"hud_help_commands hud_container\">\n <table>\n <tr>\n <th colspan=\"2\">\n ]] .. dateStr .. [[\n </th>\n </tr>\n <tr>\n <td>Show/Hide HUD</td>\n <th style=\"text-align:right;\">Alt+7</th>\n </tr>\n </table>\n</div>]]", 128 + "code": "hud_help_command = [[<div class=\"hud_help_commands hud_container\">\n <table>\n <tr>\n <th colspan=\"2\">\n ]] .. getTimeString(system.getTime()) .. [[\n </th>\n </tr>\n <tr>\n <td>Show/Hide HUD</td>\n <th style=\"text-align:right;\">Alt+7</th>\n </tr>\n </table>\n</div>]]", 129 129 "filter": { 130 130 "args": [ 131 131 { ··· 334 334 "key": "19" 335 335 }, 336 336 { 337 - "code": "--[[\n\tClock script from Leodr, modified and updated by Jericho\n\toriginal script: https://github.com/leodr99/DU-quick_n_dirty-scripts/blob/main/clock/clock.lua\n]]\n--Globals\nlocal outputTime = false --for debug\nlocal summertime = false --export: summer time enabled\n--\n--//functions\nfunction epochTime()function rZ(a)if string.len(a)<=1 then return\"0\"..a else return a end end;function dPoint(b)if not(b==math.floor(b))then return true else return false end end;function lYear(year)if not dPoint(year/4)then if dPoint(year/100)then return true else if not dPoint(year/400)then return true else return false end end else return false end end;local c=5;local d=3600;local e=86400;local f=31536000;local g=31622400;local h=2419200;local i=2505600;local j=2592000;local k=2678400;local l={4,6,9,11}local m={1,3,5,7,8,10,12}local n=0;local o=1506816000;local p={\"Tur,\",\"Fri,\",\"Sat,\",\"Sun,\",\"Mon,\",\"Tue,\",\"Wed,\"}local q=system.getTime()if summertime==true then q=q+3600 end;now=math.floor(q+o)year=1970;secs=0;n=0;while secs+g<now or secs+f<now do if lYear(year+1)then if secs+g<now then secs=secs+g;year=year+1;n=n+366 end else if secs+f<now then secs=secs+f;year=year+1;n=n+365 end end end;secondsRemaining=now-secs;monthSecs=0;yearlYear=lYear(year)month=1;while monthSecs+h<secondsRemaining or monthSecs+j<secondsRemaining or monthSecs+k<secondsRemaining do if month==1 then if monthSecs+k<secondsRemaining then month=2;monthSecs=monthSecs+k;n=n+31 else break end end;if month==2 then if not yearlYear then if monthSecs+h<secondsRemaining then month=3;monthSecs=monthSecs+h;n=n+28 else break end else if monthSecs+i<secondsRemaining then month=3;monthSecs=monthSecs+i;n=n+29 else break end end end;if month==3 then if monthSecs+k<secondsRemaining then month=4;monthSecs=monthSecs+k;n=n+31 else break end end;if month==4 then if monthSecs+j<secondsRemaining then month=5;monthSecs=monthSecs+j;n=n+30 else break end end;if month==5 then if monthSecs+k<secondsRemaining then month=6;monthSecs=monthSecs+k;n=n+31 else break end end;if month==6 then if monthSecs+j<secondsRemaining then month=7;monthSecs=monthSecs+j;n=n+30 else break end end;if month==7 then if monthSecs+k<secondsRemaining then month=8;monthSecs=monthSecs+k;n=n+31 else break end end;if month==8 then if monthSecs+k<secondsRemaining then month=9;monthSecs=monthSecs+k;n=n+31 else break end end;if month==9 then if monthSecs+j<secondsRemaining then month=10;monthSecs=monthSecs+j;n=n+30 else break end end;if month==10 then if monthSecs+k<secondsRemaining then month=11;monthSecs=monthSecs+k;n=n+31 else break end end;if month==11 then if monthSecs+j<secondsRemaining then month=12;monthSecs=monthSecs+j;n=n+30 else break end end end;day=1;daySecs=0;daySecsRemaining=secondsRemaining-monthSecs;while daySecs+e<daySecsRemaining do day=day+1;daySecs=daySecs+e;n=n+1 end;hour=0;hourSecs=0;hourSecsRemaining=daySecsRemaining-daySecs;while hourSecs+d<hourSecsRemaining do hour=hour+1;hourSecs=hourSecs+d end;minute=0;minuteSecs=0;minuteSecsRemaining=hourSecsRemaining-hourSecs;while minuteSecs+60<minuteSecsRemaining do minute=minute+1;minuteSecs=minuteSecs+60 end;second=math.floor(now%60)year=rZ(year)month=rZ(month)day=rZ(day)hour=rZ(hour)minute=rZ(minute)second=rZ(second)remanderForDOW=n%7;DOW=p[remanderForDOW]if outputTime then str=\"Year: \"..year..\", Month: \"..month..\", Day: \"..day..\", Hour: \"..hour..\", Minute: \"..minute..\", Second: \"..second..\", Day of Week: \"..DOW;system.print(str)end;return year,month,day,hour,minute,second,DOW end", 337 + "code": "--[[\n Jericho's time script -- https://github.com/Jericho1060\n Display IRL time in game\n https://github.com/Jericho1060/DualUniverse/tree/master/TimeScript\n]]--\n\n\nsummer_time = false --export\n\nfunction getTimeTable(time)\n local additionnal_hour = 0\n if summer_time then additionnal_hour = 1 end\n local T = math.floor(time) % (3600*24)\n return {math.floor(T/3600+additionnal_hour)%24, math.floor(T%3600/60), math.floor(T%60)}\nend\n\nfunction getTimeString(time)\n local timeTable = getTimeTable(time)\n return string.format(\"%02d:%02d:%02d\",timeTable[1],timeTable[2],timeTable[3])\nend\n\n\n--[[\n USAGE\n Copy the full script in Library > Start\n \n local timeTable = getTimeTable(system.getTime()) -- return a table with 3 values : {hour, minutes, seconds}\n local timeString = getTimeString(system.getTime()) -- return a formated string : \"HH:mm:ss\"\n \n you can add a timer every seconds to display the time\n]]--", 338 338 "filter": { 339 339 "args": [], 340 340 "signature": "start()",
+30 -9
Master program/source/library/start_3.lua
··· 1 1 --[[ 2 - Clock script from Leodr, modified and updated by Jericho 3 - original script: https://github.com/leodr99/DU-quick_n_dirty-scripts/blob/main/clock/clock.lua 4 - ]] 5 - --Globals 6 - local outputTime = false --for debug 7 - local summertime = false --export: summer time enabled 8 - -- 9 - --//functions 10 - function epochTime()function rZ(a)if string.len(a)<=1 then return\"0\"..a else return a end end;function dPoint(b)if not(b==math.floor(b))then return true else return false end end;function lYear(year)if not dPoint(year/4)then if dPoint(year/100)then return true else if not dPoint(year/400)then return true else return false end end else return false end end;local c=5;local d=3600;local e=86400;local f=31536000;local g=31622400;local h=2419200;local i=2505600;local j=2592000;local k=2678400;local l={4,6,9,11}local m={1,3,5,7,8,10,12}local n=0;local o=1506816000;local p={\"Tur,\",\"Fri,\",\"Sat,\",\"Sun,\",\"Mon,\",\"Tue,\",\"Wed,\"}local q=system.getTime()if summertime==true then q=q+3600 end;now=math.floor(q+o)year=1970;secs=0;n=0;while secs+g<now or secs+f<now do if lYear(year+1)then if secs+g<now then secs=secs+g;year=year+1;n=n+366 end else if secs+f<now then secs=secs+f;year=year+1;n=n+365 end end end;secondsRemaining=now-secs;monthSecs=0;yearlYear=lYear(year)month=1;while monthSecs+h<secondsRemaining or monthSecs+j<secondsRemaining or monthSecs+k<secondsRemaining do if month==1 then if monthSecs+k<secondsRemaining then month=2;monthSecs=monthSecs+k;n=n+31 else break end end;if month==2 then if not yearlYear then if monthSecs+h<secondsRemaining then month=3;monthSecs=monthSecs+h;n=n+28 else break end else if monthSecs+i<secondsRemaining then month=3;monthSecs=monthSecs+i;n=n+29 else break end end end;if month==3 then if monthSecs+k<secondsRemaining then month=4;monthSecs=monthSecs+k;n=n+31 else break end end;if month==4 then if monthSecs+j<secondsRemaining then month=5;monthSecs=monthSecs+j;n=n+30 else break end end;if month==5 then if monthSecs+k<secondsRemaining then month=6;monthSecs=monthSecs+k;n=n+31 else break end end;if month==6 then if monthSecs+j<secondsRemaining then month=7;monthSecs=monthSecs+j;n=n+30 else break end end;if month==7 then if monthSecs+k<secondsRemaining then month=8;monthSecs=monthSecs+k;n=n+31 else break end end;if month==8 then if monthSecs+k<secondsRemaining then month=9;monthSecs=monthSecs+k;n=n+31 else break end end;if month==9 then if monthSecs+j<secondsRemaining then month=10;monthSecs=monthSecs+j;n=n+30 else break end end;if month==10 then if monthSecs+k<secondsRemaining then month=11;monthSecs=monthSecs+k;n=n+31 else break end end;if month==11 then if monthSecs+j<secondsRemaining then month=12;monthSecs=monthSecs+j;n=n+30 else break end end end;day=1;daySecs=0;daySecsRemaining=secondsRemaining-monthSecs;while daySecs+e<daySecsRemaining do day=day+1;daySecs=daySecs+e;n=n+1 end;hour=0;hourSecs=0;hourSecsRemaining=daySecsRemaining-daySecs;while hourSecs+d<hourSecsRemaining do hour=hour+1;hourSecs=hourSecs+d end;minute=0;minuteSecs=0;minuteSecsRemaining=hourSecsRemaining-hourSecs;while minuteSecs+60<minuteSecsRemaining do minute=minute+1;minuteSecs=minuteSecs+60 end;second=math.floor(now%60)year=rZ(year)month=rZ(month)day=rZ(day)hour=rZ(hour)minute=rZ(minute)second=rZ(second)remanderForDOW=n%7;DOW=p[remanderForDOW]if outputTime then str=\"Year: \"..year..\", Month: \"..month..\", Day: \"..day..\", Hour: \"..hour..\", Minute: \"..minute..\", Second: \"..second..\", Day of Week: \"..DOW;system.print(str)end;return year,month,day,hour,minute,second,DOW end 2 + Jericho's time script -- https://github.com/Jericho1060 3 + Display IRL time in game 4 + https://github.com/Jericho1060/DualUniverse/tree/master/TimeScript 5 + ]]-- 6 + 7 + 8 + summer_time = false --export 9 + 10 + function getTimeTable(time) 11 + local additionnal_hour = 0 12 + if summer_time then additionnal_hour = 1 end 13 + local T = math.floor(time) % (3600*24) 14 + return {math.floor(T/3600+additionnal_hour)%24, math.floor(T%3600/60), math.floor(T%60)} 15 + end 16 + 17 + function getTimeString(time) 18 + local timeTable = getTimeTable(time) 19 + return string.format(\"%02d:%02d:%02d\",timeTable[1],timeTable[2],timeTable[3]) 20 + end 21 + 22 + 23 + --[[ 24 + USAGE 25 + Copy the full script in Library > Start 26 + 27 + local timeTable = getTimeTable(system.getTime()) -- return a table with 3 values : {hour, minutes, seconds} 28 + local timeString = getTimeString(system.getTime()) -- return a formated string : \"HH:mm:ss\" 29 + 30 + you can add a timer every seconds to display the time 31 + ]]--
-19
Master program/source/unit/tick_hekperRefresh.lua
··· 1 - local year, month, day, hour, minute, second = epochTime() 2 - local dateStr = year .. "/" .. month .. "/" .. day .. " " .. hour .. ":" .. minute .. ":" .. second 3 - if dateFormat:lower() == "fr" then 4 - dateStr = day .. "/" .. month .. "/" .. year .. " " .. hour .. ":" .. minute .. ":" .. second 5 - end 6 - 7 - hud_help_command = [[<div class="hud_help_commands hud_container"> 8 - <table> 9 - <tr> 10 - <th colspan="2"> 11 - ]] .. dateStr .. [[ 12 - </th> 13 - </tr> 14 - <tr> 15 - <td>Show/Hide HUD</td> 16 - <th style="text-align:right;">Alt+7</th> 17 - </tr> 18 - </table> 19 - </div>]]
+13
Master program/source/unit/tick_helperRefresh.lua
··· 1 + hud_help_command = [[<div class="hud_help_commands hud_container"> 2 + <table> 3 + <tr> 4 + <th colspan="2"> 5 + ]] .. getTimeString(system.getTime()) .. [[ 6 + </th> 7 + </tr> 8 + <tr> 9 + <td>Show/Hide HUD</td> 10 + <th style="text-align:right;">Alt+7</th> 11 + </tr> 12 + </table> 13 + </div>]]