From 15cdacd611bf9d7eb1cdad27b09e0156ae9ed05e Mon Sep 17 00:00:00 2001 From: Jbleezy Date: Tue, 30 Jan 2024 23:54:49 -0800 Subject: [PATCH] Origins: change order of staff parts HUD --- README.md | 1 + ui_mp/t6/zombie/persistentitemtombdisplay.lua | 6 +- ui_mp/t6/zombie/questitemtombdisplay.lua | 67 ++++++++++++------- 3 files changed, 49 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 1ccf27a3..c8ba02b5 100644 --- a/README.md +++ b/README.md @@ -1055,6 +1055,7 @@ * Gramophone initially spawns at Excavation Site gramophone table * Musical parts on HUD change record color to show which table the gramophone is currently placed at * Musical parts on HUD fade out +* Changed the order of staff parts on HUD to match the order of the staff holders * Staff parts on HUD correctly show that a player has a staff and a gem * Staff parts on HUD no longer show that a player has a staff when it is crafted * Switched Zombie Shield and Maxis Drone recipe positions on HUD diff --git a/ui_mp/t6/zombie/persistentitemtombdisplay.lua b/ui_mp/t6/zombie/persistentitemtombdisplay.lua index cb00ef8c..3867e1ca 100644 --- a/ui_mp/t6/zombie/persistentitemtombdisplay.lua +++ b/ui_mp/t6/zombie/persistentitemtombdisplay.lua @@ -164,7 +164,8 @@ CoD.PersistentItemTombDisplay.UpdateQuestContainerAndTitle = function(f4_arg0, f if f4_arg1.newValue == 1 then f4_arg0.statusIcons[2].icon:setRGB(1, 1, 1) elseif f4_arg1.newValue >= 2 and f4_arg1.newValue <= 5 then - local recordColor = CoD.QuestItemTombDisplay.ClientFieldNames[f4_arg1.newValue - 1].color + local num = CoD.QuestItemTombDisplay.GetIndexFromNum(f4_arg1.newValue - 1) + local recordColor = CoD.QuestItemTombDisplay.ClientFieldNames[num].color f4_arg0.statusIcons[2].icon:setRGB(recordColor.r, recordColor.g, recordColor.b) end end @@ -260,7 +261,8 @@ CoD.PersistentItemTombDisplay.UpdateQuestStates = function(f10_arg0, f10_arg1) f10_arg0.icon:setAlpha(1) f10_arg0.icon:setRGB(1, 1, 1) elseif f10_arg1 >= 2 and f10_arg1 <= 5 then - local recordColor = CoD.QuestItemTombDisplay.ClientFieldNames[f10_arg1 - 1].color + local num = CoD.QuestItemTombDisplay.GetIndexFromNum(f10_arg1 - 1) + local recordColor = CoD.QuestItemTombDisplay.ClientFieldNames[num].color f10_arg0:setAlpha(1) f10_arg0.icon:setAlpha(1) f10_arg0.icon:setRGB(recordColor.r, recordColor.g, recordColor.b) diff --git a/ui_mp/t6/zombie/questitemtombdisplay.lua b/ui_mp/t6/zombie/questitemtombdisplay.lua index b4da326a..acc6e9c4 100644 --- a/ui_mp/t6/zombie/questitemtombdisplay.lua +++ b/ui_mp/t6/zombie/questitemtombdisplay.lua @@ -33,17 +33,6 @@ CoD.QuestItemTombDisplay.STATE_STAFF_PIECE_HAVE = 1 CoD.QuestItemTombDisplay.STATE_STAFF_PIECE_COMPLETED = 2 CoD.QuestItemTombDisplay.ClientFieldNames = {} CoD.QuestItemTombDisplay.ClientFieldNames[1] = { - name = "fire", - color = CoD.CraftablesStaffIcon.RedFire, - clientFieldName = "quest_state2", - gemClientFieldName = "piece_staff_zm_gem_fire", - recordClientFieldName = "piece_record_zm_vinyl_fire", - uStaffClientFieldName = "piece_staff_zm_ustaff_fire", - mStaffClientFieldName = "piece_staff_zm_mstaff_fire", - lStaffClientFieldName = "piece_staff_zm_lstaff_fire", - materialName = "zom_hud_craftable_element_fire", -} -CoD.QuestItemTombDisplay.ClientFieldNames[2] = { name = "air", color = CoD.CraftablesStaffIcon.YellowWind, clientFieldName = "quest_state1", @@ -53,6 +42,19 @@ CoD.QuestItemTombDisplay.ClientFieldNames[2] = { mStaffClientFieldName = "piece_staff_zm_mstaff_air", lStaffClientFieldName = "piece_staff_zm_lstaff_air", materialName = "zom_hud_craftable_element_wind", + num = 2, +} +CoD.QuestItemTombDisplay.ClientFieldNames[2] = { + name = "water", + color = CoD.CraftablesStaffIcon.BlueIce, + clientFieldName = "quest_state2", + gemClientFieldName = "piece_staff_zm_gem_water", + recordClientFieldName = "piece_record_zm_vinyl_water", + uStaffClientFieldName = "piece_staff_zm_ustaff_water", + mStaffClientFieldName = "piece_staff_zm_mstaff_water", + lStaffClientFieldName = "piece_staff_zm_lstaff_water", + materialName = "zom_hud_craftable_element_water", + num = 4, } CoD.QuestItemTombDisplay.ClientFieldNames[3] = { name = "lightning", @@ -64,17 +66,19 @@ CoD.QuestItemTombDisplay.ClientFieldNames[3] = { mStaffClientFieldName = "piece_staff_zm_mstaff_lightning", lStaffClientFieldName = "piece_staff_zm_lstaff_lightning", materialName = "zom_hud_craftable_element_lightning", + num = 3, } CoD.QuestItemTombDisplay.ClientFieldNames[4] = { - name = "water", - color = CoD.CraftablesStaffIcon.BlueIce, + name = "fire", + color = CoD.CraftablesStaffIcon.RedFire, clientFieldName = "quest_state4", - gemClientFieldName = "piece_staff_zm_gem_water", - recordClientFieldName = "piece_record_zm_vinyl_water", - uStaffClientFieldName = "piece_staff_zm_ustaff_water", - mStaffClientFieldName = "piece_staff_zm_mstaff_water", - lStaffClientFieldName = "piece_staff_zm_lstaff_water", - materialName = "zom_hud_craftable_element_water", + gemClientFieldName = "piece_staff_zm_gem_fire", + recordClientFieldName = "piece_record_zm_vinyl_fire", + uStaffClientFieldName = "piece_staff_zm_ustaff_fire", + mStaffClientFieldName = "piece_staff_zm_mstaff_fire", + lStaffClientFieldName = "piece_staff_zm_lstaff_fire", + materialName = "zom_hud_craftable_element_fire", + num = 1, } CoD.QuestItemTombDisplay.QuestItemName = Engine.Localize("ZM_TOMB_STAFF_PARTS") CoD.QuestItemTombDisplay.new = function(f1_arg0) @@ -245,6 +249,10 @@ CoD.QuestItemTombDisplay.PlayerGemOwner = function(f3_arg0, f3_arg1) if 0 < f3_arg1.newValue then f3_local1 = (f3_arg1.newValue - 1) % CoD.QuestItemTombDisplay.QuestClientFieldCount + 1 end + + f3_local0 = CoD.QuestItemTombDisplay.GetIndexFromNum(f3_local0) + f3_local1 = CoD.QuestItemTombDisplay.GetIndexFromNum(f3_local1) + local f3_local2 = tonumber(string.sub(f3_arg1.name, string.len(CoD.QuestItemTombDisplay.PlayerGemClientFieldName) + 1)) if f3_local2 < 1 or f3_local2 > 4 then return @@ -270,6 +278,10 @@ CoD.QuestItemTombDisplay.PlayerStaffOwner = function(f3_arg0, f3_arg1) if 0 < f3_arg1.newValue then f3_local1 = (f3_arg1.newValue - 1) % CoD.QuestItemTombDisplay.QuestClientFieldCount + 1 end + + f3_local0 = CoD.QuestItemTombDisplay.GetIndexFromNum(f3_local0) + f3_local1 = CoD.QuestItemTombDisplay.GetIndexFromNum(f3_local1) + local f3_local2 = tonumber(string.sub(f3_arg1.name, string.len(CoD.QuestItemTombDisplay.PlayerStaffClientFieldName) + 1)) if f3_local2 < 1 or f3_local2 > 4 then return @@ -414,10 +426,9 @@ end CoD.QuestItemTombDisplay.UpdateCompletedStaffDisplay = function(f10_arg0, f10_arg1) local f10_local0 = string.len(f10_arg1.name) - local f10_local1 = tonumber - local f10_local2 = string.sub - local f10_local3 = f10_arg1.name - CoD.QuestItemTombDisplay.UpdateQuestStatus(f10_arg0, f10_arg1, CoD.QuestItemTombDisplay.ClientFieldNames[f10_local1(f10_local2(f10_arg1.name, f10_local0))].name) + local num = tonumber(string.sub(f10_arg1.name, f10_local0)) + local index = CoD.QuestItemTombDisplay.GetIndexFromNum(num) + CoD.QuestItemTombDisplay.UpdateQuestStatus(f10_arg0, f10_arg1, CoD.QuestItemTombDisplay.ClientFieldNames[index].name) CoD.QuestItemTombDisplay.UpdateQuest(f10_arg0, f10_arg1) end @@ -500,3 +511,13 @@ CoD.QuestItemTombDisplay.GetMaterial = function(f19_arg0) end return f19_local0 end + +CoD.QuestItemTombDisplay.GetIndexFromNum = function(num) + for index = 1, CoD.QuestItemTombDisplay.QuestClientFieldCount, 1 do + if CoD.QuestItemTombDisplay.ClientFieldNames[index].num == num then + return index + end + end + + return num +end