From 8de5e17cd0aec82f48fc897b77534bf77a1780ea Mon Sep 17 00:00:00 2001 From: Pao Date: Sun, 26 Feb 2023 23:12:57 +0100 Subject: [PATCH] Fixes after first test --- media/lua/client/ActionsMethods/JCIO_CutLimb.lua | 4 ++++ media/lua/client/Interface/JCIO_UI.lua | 2 +- media/lua/client/JCIO_CommonFunctions.lua | 2 +- media/lua/client/JCIO_HelperFunctions.lua | 10 +++++----- media/lua/client/JCIO_OverridenFunctions.lua | 6 +++--- media/lua/client/JCIO_Update.lua | 2 +- 6 files changed, 15 insertions(+), 11 deletions(-) diff --git a/media/lua/client/ActionsMethods/JCIO_CutLimb.lua b/media/lua/client/ActionsMethods/JCIO_CutLimb.lua index c2b66eb..0a60147 100644 --- a/media/lua/client/ActionsMethods/JCIO_CutLimb.lua +++ b/media/lua/client/ActionsMethods/JCIO_CutLimb.lua @@ -3,6 +3,10 @@ ------------------------------------------ ----------- CUT LIMB FUNCTIONS ----------- +-- Seems to be the first file loaded, so let's add this +if JCIO == nil then + JCIO = {} +end diff --git a/media/lua/client/Interface/JCIO_UI.lua b/media/lua/client/Interface/JCIO_UI.lua index 95ff46d..8f59522 100644 --- a/media/lua/client/Interface/JCIO_UI.lua +++ b/media/lua/client/Interface/JCIO_UI.lua @@ -592,7 +592,7 @@ JCIO.RefreshClientMenu = function(_) else - local limbs_data = JCIO_UI.onlineTempTable.patient:getModData().TOC.Limbs + local limbs_data = JCIO_UI.onlineTempTable.patient:getModData().JCIO.limbs JCIO_UI.SetupMainUI(JCIO_UI.onlineTempTable.patient, JCIO_UI.onlineTempTable.patient, limbs_data) end diff --git a/media/lua/client/JCIO_CommonFunctions.lua b/media/lua/client/JCIO_CommonFunctions.lua index 20d6e07..382563d 100644 --- a/media/lua/client/JCIO_CommonFunctions.lua +++ b/media/lua/client/JCIO_CommonFunctions.lua @@ -25,7 +25,7 @@ JCIO_Common.GeneratePartNames = function() end JCIO_Common.GetPartNames = function() - if JCIO_Common.partNames.size() == nil then + if JCIO_Common.partNames[1] == nil then JCIO_Common.GeneratePartNames() end diff --git a/media/lua/client/JCIO_HelperFunctions.lua b/media/lua/client/JCIO_HelperFunctions.lua index 99d7eac..db2d3af 100644 --- a/media/lua/client/JCIO_HelperFunctions.lua +++ b/media/lua/client/JCIO_HelperFunctions.lua @@ -30,13 +30,13 @@ local function PartNameToBodyLocationAmputation(name) if name == "Right_Foot" then return "JCIO_LegRight" end end -function TocFindItemInProstBodyLocation(part_name, patient) +function TocFindItemInProstBodyLocation(partName, patient) -- Can't be used for online purposes, since we can't get the online inventory of another player local worn_items = patient:getWornItems() for i = 1, worn_items:size() - 1 do -- Maybe wornItems:size()-1 local item = worn_items:get(i):getItem() - if item:getBodyLocation() == PartNameToBodyLocationProsthesis(part_name) then + if item:getBodyLocation() == PartNameToBodyLocationProsthesis(partName) then return item end end @@ -44,19 +44,19 @@ function TocFindItemInProstBodyLocation(part_name, patient) end -- Debug cheat and update every minute for cicatrization -function TocFindAmputationOrProsthesisName(part_name, player, choice) +function TocFindAmputationOrProsthesisName(partName, player, choice) local worn_items = player:getWornItems() for i = 1, worn_items:size() - 1 do local item = worn_items:get(i):getItem() if choice == "Amputation" then - if item:getBodyLocation() == PartNameToBodyLocationAmputation(part_name) then + if item:getBodyLocation() == PartNameToBodyLocationAmputation(partName) then return item:getFullType() end elseif choice == "Prosthesis" then - if item:getBodyLocation() == PartNameToBodyLocationProsthesis(part_name) then + if item:getBodyLocation() == PartNameToBodyLocationProsthesis(partName) then return item:getFullType() end diff --git a/media/lua/client/JCIO_OverridenFunctions.lua b/media/lua/client/JCIO_OverridenFunctions.lua index 1daacfa..8ae9918 100644 --- a/media/lua/client/JCIO_OverridenFunctions.lua +++ b/media/lua/client/JCIO_OverridenFunctions.lua @@ -123,9 +123,9 @@ function ISEquipWeaponAction:perform() --TODO Block it before even performing -- TODO in the inventory menu there is something broken, even though this works og_ISEquipWeaponActionPerform(self) - local limbs_data = self.character:getModData().TOC.Limbs - local can_be_held = {} - JCIO_Common.GetCanBeHeldTable(can_be_held, limbs_data) + local limbs_data = self.character:getModData().JCIO.limbs + local can_be_held = JCIO_Common.GetCanBeHeldTable(limbs_data) + if not self.item:isRequiresEquippedBothHands() then if can_be_held["Right"] and not can_be_held["Left"] then diff --git a/media/lua/client/JCIO_Update.lua b/media/lua/client/JCIO_Update.lua index 0442cc7..c061e79 100644 --- a/media/lua/client/JCIO_Update.lua +++ b/media/lua/client/JCIO_Update.lua @@ -4,7 +4,7 @@ ------------- UPDATE EVENTS -------------- -require "TOC_Init" +require "JCIO_Init" local function CheckIfPlayerIsInfected(player, limbsData)