diff --git a/media/lua/client/ActionsMethods/TOC_CutLimb.lua b/media/lua/client/ActionsMethods/TOC_CutLimb.lua index 8eb95b4..0d07300 100644 --- a/media/lua/client/ActionsMethods/TOC_CutLimb.lua +++ b/media/lua/client/ActionsMethods/TOC_CutLimb.lua @@ -11,7 +11,7 @@ local function TocCheckIfStillInfected(limbs_data) local check = false - for _, v in ipairs(GetBodyParts()) do + for _, v in pairs(GetBodyParts()) do if limbs_data[v].is_infected then check = true end @@ -37,8 +37,8 @@ local function TocCureInfection(body_damage, part_name) -- TODO I think this is enough... we should just cycle if with everything instead of that crap up there for i = body_part_types:size() - 1, 0, -1 do - local bodyPart = body_part_types:get(i); - bodyPart:SetInfected(false); + local bodyPart = body_part_types:get(i) + bodyPart:SetInfected(false) end if body_part_type:scratched() then body_part_type:setScratched(false, false) end diff --git a/media/lua/client/ActionsMethods/TOC_OperateLimb.lua b/media/lua/client/ActionsMethods/TOC_OperateLimb.lua index 5379e83..8bd2e66 100644 --- a/media/lua/client/ActionsMethods/TOC_OperateLimb.lua +++ b/media/lua/client/ActionsMethods/TOC_OperateLimb.lua @@ -20,13 +20,10 @@ local function FixSingleBodyPartType(body_part_type, use_oven) end local function SetBodyPartsStatusAfterOperation(player, limbs_data, part_name, use_oven) - --for _, v in ipairs(GetBodyParts()) do - - local body_part_type = player:getBodyDamage():getBodyPart(TocGetAdiacentBodyPartFromPartName(part_name)) FixSingleBodyPartType(body_part_type, use_oven) - for _, v in ipairs(limbs_data[part_name].depends_on) do + for _, v in pairs(limbs_data[part_name].depends_on) do local depended_body_part_type = player:getBodyDamage():getBodyPart(TocGetAdiacentBodyPartFromPartName(v)) FixSingleBodyPartType(depended_body_part_type, use_oven) diff --git a/media/lua/client/Interface/TOC_ContextMenus.lua b/media/lua/client/Interface/TOC_ContextMenus.lua index f2bec76..fc6c519 100644 --- a/media/lua/client/Interface/TOC_ContextMenus.lua +++ b/media/lua/client/Interface/TOC_ContextMenus.lua @@ -16,7 +16,7 @@ TocContextMenus.CreateMenus = function(player, context, worldObjects, test) local local_player = getSpecificPlayer(player) --local players = getOnlinePlayers() - for k, v in ipairs(worldObjects) do + for k, v in pairs(worldObjects) do -- help detecting a player by checking nearby squares for x = v:getSquare():getX() - 1, v:getSquare():getX() + 1 do for y = v:getSquare():getY() - 1, v:getSquare():getY() + 1 do @@ -79,6 +79,7 @@ TocContextMenus.CreateOperateWithOvenMenu = function(player, context, worldObjec -- Check temperature if v_stove:getCurrentTemperature() > 250 then + -- ipairs here to keep the order for _, v_bodypart in ipairs(GetBodyParts()) do if part_data[v_bodypart].is_cut and part_data[v_bodypart].is_amputation_shown and not part_data[v_bodypart].is_operated then diff --git a/media/lua/client/TOC_Checks.lua b/media/lua/client/TOC_Checks.lua index 4086d77..0d7d51b 100644 --- a/media/lua/client/TOC_Checks.lua +++ b/media/lua/client/TOC_Checks.lua @@ -4,6 +4,10 @@ if TheOnlyCure == nil then TheOnlyCure = {} end + +local pairs = pairs + + ----------------------------------------- -- MP HANDLING CHECKS function CheckIfCanBeCut(part_name, limbs_data) @@ -60,9 +64,8 @@ end function CheckIfItemIsProsthesis(item) - -- TODO find a cleaner way local item_full_type = item:getFullType() - local prosthesis_list = GetProsthesisList() + local prosthesis_list = GetProsthesisList() -- TODO this isn't gonna work after the modular prost rewrite for _, v in pairs(prosthesis_list) do if v == item_full_type then @@ -88,7 +91,7 @@ end function CheckIfProsthesisAlreadyInstalled(limbs_data, part_name) - for _, side in ipairs(TOC_sides) do + for _, side in pairs(TOC_sides) do if string.find(part_name, side) then return (limbs_data[side .. "_Hand"].is_prosthesis_equipped or limbs_data[side .. "_LowerArm"].is_prosthesis_equipped) end diff --git a/media/lua/client/TOC_HelperFunctions.lua b/media/lua/client/TOC_HelperFunctions.lua index 2bb23c0..6793d07 100644 --- a/media/lua/client/TOC_HelperFunctions.lua +++ b/media/lua/client/TOC_HelperFunctions.lua @@ -74,7 +74,7 @@ end -- Override and mod compat helper function TocPopulateCanBeHeldTable(can_be_held, limbs_data) - for _, side in ipairs(TOC_sides) do + for _, side in pairs(TOC_sides) do can_be_held[side] = true if limbs_data[side .. "_Hand"].is_cut then diff --git a/media/lua/client/TOC_Init.lua b/media/lua/client/TOC_Init.lua index c28c70d..eb43a18 100644 --- a/media/lua/client/TOC_Init.lua +++ b/media/lua/client/TOC_Init.lua @@ -66,8 +66,8 @@ local function TocUpdateBaseData(mod_data) local accepted_prosthesis_upperarm = {} -- For future stuff local accepted_prosthesis_foot = {} - for _, side in ipairs(TOC_sides) do - for _, limb in ipairs(TOC_limbs) do + for _, side in pairs(TOC_sides) do + for _, limb in pairs(TOC_limbs) do local part_name = side .. "_" .. limb @@ -205,8 +205,8 @@ local function TocSetInitData(mod_data, player) - for _, side in ipairs(TOC_sides) do - for _, limb in ipairs(TOC_limbs) do + for _, side in pairs(TOC_sides) do + for _, limb in pairs(TOC_limbs) do local part_name = side .. "_" .. limb diff --git a/media/lua/client/TOC_OverridenFunctions.lua b/media/lua/client/TOC_OverridenFunctions.lua index 3ff974f..fd8fe8d 100644 --- a/media/lua/client/TOC_OverridenFunctions.lua +++ b/media/lua/client/TOC_OverridenFunctions.lua @@ -151,7 +151,7 @@ function ISEquipWeaponAction:perform() if self.item then local item_name = self.item:getFullType() - for _, prost_v in ipairs(GetProsthesisList()) do + for _, prost_v in pairs(GetProsthesisList()) do local prosthesis_name = string.match(item_name, prost_v) if prosthesis_name then self.character:Say("This isn't the right way to equip this...") diff --git a/media/lua/client/TOC_Update.lua b/media/lua/client/TOC_Update.lua index 8931761..254faf8 100644 --- a/media/lua/client/TOC_Update.lua +++ b/media/lua/client/TOC_Update.lua @@ -19,7 +19,7 @@ local function CheckIfPlayerIsInfected(player, toc_data) end -- Check for everything else - for _, v in ipairs(GetOtherBodyPartTypes()) do + for _, v in pairs(GetOtherBodyPartTypes()) do if body_damage:getBodyPart(v):bitten() then toc_data.Limbs.is_other_bodypart_infected = true -- Even one is enough, stop cycling if we find it break @@ -198,7 +198,7 @@ local function TocUpdateEveryTenMinutes() local part_data = player:getModData().TOC.Limbs --Experience for prosthesis user - for _, side in ipairs(TOC_sides) do + for _, side in pairs(TOC_sides) do if part_data[side .. "_Hand"].is_prosthesis_equipped or part_data[side .. "_LowerArm"].is_prosthesis_equipped then player:getXp():AddXP(Perks[side .. "_Hand"], 4) end diff --git a/python_helpers/main.py b/python_helpers/main.py index 74333e1..ab242ff 100644 --- a/python_helpers/main.py +++ b/python_helpers/main.py @@ -31,7 +31,7 @@ def generate_clothing_item(name, model, texture_choices, guid = None): m_AllowRandomTint.text = "false" root.append(m_AllowRandomTint) - # TODO Defined by the amount of textures that we're gonna pass + # Defined by the amount of textures that we're gonna pass for tex in texture_choices: textureChoices = gfg.Element("textureChoices") textureChoices.text = tex @@ -45,9 +45,6 @@ def generate_clothing_item(name, model, texture_choices, guid = None): tree.write(file, encoding='utf-8', xml_declaration=True, pretty_print=True ) def generate_recipe(recipe_name, recipe_items, result_name, time, skill_required, tooltip): - # TODO Simple txt, so strings should be fine. - print("Generating recipe") - root_element = f"recipe {recipe_name}\n" root_element += "\t{\n" @@ -71,8 +68,6 @@ def generate_recipe(recipe_name, recipe_items, result_name, time, skill_required file.close() def generate_item(item_name, weight, item_type, display_category, display_name, icon, tooltip, can_have_holes, clothing_item=None, body_location = None, blood_location = None): - # TODO This is a txt, so we're gonna use simple strings I guess - root_element = f"item {item_name}\n" root_element += "\t{\n" @@ -180,9 +175,7 @@ generate_normal_items(df_base, "Base") generate_normal_items(df_top, "Top") -#generate_clothing_item() - -# TODO we should get this stuff from a csv\xlsx and generate the correct values from that +######################################################################################### recipe_name = "Test Recipe" recipe_items = ["Ass", "Penis", "Shit=3"]