Skip to content

Commit

Permalink
alpha v3.0.9 - item displayed on tranfer unit without schematic count…
Browse files Browse the repository at this point in the history
… and reverse navigation
  • Loading branch information
Jericho1060 committed Aug 18, 2022
1 parent 6a65262 commit b5c7fe2
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 47 deletions.
2 changes: 1 addition & 1 deletion Master program/config.json

Large diffs are not rendered by default.

22 changes: 7 additions & 15 deletions Master program/source/system/onActionStart_down.lua
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
if Ctrl_pressed == true then
if selected_index < #elementsTypes then
selected_index = selected_index + 1
selected_type = elementsTypes[selected_index]
selected_machine_index = 1
page = 1
Storage.clear()
craft_quantity_digits = {"0","0","0","0","0","0","0","0"}
selectedElementsId = {}
hud_machines_rows = {}
elements = {}
selectedElementsId = {}
temp_selectedElementsId = {}
temp_elements_for_sorting = {}
temp_elements = {}
temp_refresh_id_list = {}
machineLoaded = false
reloadMachinesOnTypeChange()
else
selected_index = 1
reloadMachinesOnTypeChange()
end
else
if selected_machine_index < #elements then
selected_machine_index = selected_machine_index + 1
craft_quantity_digits = {"0","0","0","0","0","0","0","0"}
else
selected_machine_index = 1
end
craft_quantity_digits = {"0","0","0","0","0","0","0","0"}
end
11 changes: 4 additions & 7 deletions Master program/source/system/onActionStart_strafeleft.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
if page > 1 then
page = page - 1
selected_machine_index = 1
Storage.clear()
hud_machines_rows = {}
elements = {}
temp_elements_for_sorting = {}
temp_elements = {}
temp_refresh_id_list = {}
reloadMachinesOnPageChange()
elseif page ~= maxPage then
page = maxPage
reloadMachinesOnPageChange()
end
11 changes: 4 additions & 7 deletions Master program/source/system/onActionStart_straferight.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
if page < maxPage then
page = page + 1
selected_machine_index = 1
Storage.clear()
hud_machines_rows = {}
elements = {}
temp_elements_for_sorting = {}
temp_elements = {}
temp_refresh_id_list = {}
reloadMachinesOnPageChange()
elseif page ~= 1 then
page = 1
reloadMachinesOnPageChange()
end
22 changes: 7 additions & 15 deletions Master program/source/system/onActionStart_up.lua
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
if Ctrl_pressed == true then
if selected_index > 1 then
selected_index = selected_index - 1
selected_type = elementsTypes[selected_index]
selected_machine_index = 1
page = 1
Storage.clear()
craft_quantity_digits = {"0","0","0","0","0","0","0","0"}
selectedElementsId = {}
hud_machines_rows = {}
elements = {}
selectedElementsId = {}
temp_selectedElementsId = {}
temp_elements_for_sorting = {}
temp_elements = {}
temp_refresh_id_list = {}
machineLoaded = false
reloadMachinesOnTypeChange()
else
selected_index = #elementsTypes
reloadMachinesOnTypeChange()
end
else
if selected_machine_index > 1 then
selected_machine_index = selected_machine_index - 1
craft_quantity_digits = {"0","0","0","0","0","0","0","0"}
else
selected_machine_index = #elements
end
craft_quantity_digits = {"0","0","0","0","0","0","0","0"}
end
31 changes: 29 additions & 2 deletions Master program/source/unit/onStart.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
DU Industry HUD By Jericho
]]

local version = "V 3.0.8 - alpha"
local version = "V 3.0.9 - alpha"
local log_split = "================================================="
--printing version in lua chat
system.print(log_split)local a=""local b=math.ceil((50-#version-2)/2)for c=1,b,1 do a=a..'='end;a=a.." "..version.." "for c=1,b,1 do a=a..'='end;system.print(a)system.print(log_split)
Expand Down Expand Up @@ -374,7 +374,7 @@ MyCoroutines = {
local unitsProduced = 0
if element.unitsProduced then unitsProduced = element.unitsProduced end
hud_machines_rows[i] = hud_machines_rows[i] .. '><th>' .. machine_id .. '</th><th><span class="' .. status_class .. '">' .. element.name .. '</span><br><small>' .. element.type .. '</small></th><th>' .. recipeName
if schematicId > 0 then
if schematicId > 0 and element.type:lower() ~= 'transfer unit' then
local schematic = system.getItem(schematicId)
local schematicsRemaining = statusData.schematicsRemaining
local schematic_color = "#fff"
Expand Down Expand Up @@ -675,5 +675,32 @@ end

MainCoroutine = coroutine.create(runCoroutines)

function reloadMachinesOnTypeChange()
selected_type = elementsTypes[selected_index]
selected_machine_index = 1
page = 1
Storage.clear()
craft_quantity_digits = {"0","0","0","0","0","0","0","0"}
selectedElementsId = {}
hud_machines_rows = {}
elements = {}
selectedElementsId = {}
temp_selectedElementsId = {}
temp_elements_for_sorting = {}
temp_elements = {}
temp_refresh_id_list = {}
machineLoaded = false
end

function reloadMachinesOnPageChange()
selected_machine_index = 1
Storage.clear()
hud_machines_rows = {}
elements = {}
temp_elements_for_sorting = {}
temp_elements = {}
temp_refresh_id_list = {}
end

--Enable Display of the HUD
system.showScreen(1)

0 comments on commit b5c7fe2

Please sign in to comment.