replacing ipairs with pairs
This commit is contained in:
@@ -11,7 +11,7 @@ local function TocCheckIfStillInfected(limbs_data)
|
|||||||
local check = false
|
local check = false
|
||||||
|
|
||||||
|
|
||||||
for _, v in ipairs(GetBodyParts()) do
|
for _, v in pairs(GetBodyParts()) do
|
||||||
if limbs_data[v].is_infected then
|
if limbs_data[v].is_infected then
|
||||||
check = true
|
check = true
|
||||||
end
|
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
|
-- 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
|
for i = body_part_types:size() - 1, 0, -1 do
|
||||||
local bodyPart = body_part_types:get(i);
|
local bodyPart = body_part_types:get(i)
|
||||||
bodyPart:SetInfected(false);
|
bodyPart:SetInfected(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
if body_part_type:scratched() then body_part_type:setScratched(false, false) end
|
if body_part_type:scratched() then body_part_type:setScratched(false, false) end
|
||||||
|
|||||||
@@ -20,13 +20,10 @@ local function FixSingleBodyPartType(body_part_type, use_oven)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function SetBodyPartsStatusAfterOperation(player, limbs_data, part_name, use_oven)
|
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))
|
local body_part_type = player:getBodyDamage():getBodyPart(TocGetAdiacentBodyPartFromPartName(part_name))
|
||||||
FixSingleBodyPartType(body_part_type, use_oven)
|
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))
|
local depended_body_part_type = player:getBodyDamage():getBodyPart(TocGetAdiacentBodyPartFromPartName(v))
|
||||||
FixSingleBodyPartType(depended_body_part_type, use_oven)
|
FixSingleBodyPartType(depended_body_part_type, use_oven)
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ TocContextMenus.CreateMenus = function(player, context, worldObjects, test)
|
|||||||
local local_player = getSpecificPlayer(player)
|
local local_player = getSpecificPlayer(player)
|
||||||
--local players = getOnlinePlayers()
|
--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
|
-- help detecting a player by checking nearby squares
|
||||||
for x = v:getSquare():getX() - 1, v:getSquare():getX() + 1 do
|
for x = v:getSquare():getX() - 1, v:getSquare():getX() + 1 do
|
||||||
for y = v:getSquare():getY() - 1, v:getSquare():getY() + 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
|
-- Check temperature
|
||||||
if v_stove:getCurrentTemperature() > 250 then
|
if v_stove:getCurrentTemperature() > 250 then
|
||||||
|
|
||||||
|
-- ipairs here to keep the order
|
||||||
for _, v_bodypart in ipairs(GetBodyParts()) do
|
for _, v_bodypart in ipairs(GetBodyParts()) do
|
||||||
if part_data[v_bodypart].is_cut and part_data[v_bodypart].is_amputation_shown and
|
if part_data[v_bodypart].is_cut and part_data[v_bodypart].is_amputation_shown and
|
||||||
not part_data[v_bodypart].is_operated then
|
not part_data[v_bodypart].is_operated then
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ if TheOnlyCure == nil then
|
|||||||
TheOnlyCure = {}
|
TheOnlyCure = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local pairs = pairs
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
-- MP HANDLING CHECKS
|
-- MP HANDLING CHECKS
|
||||||
function CheckIfCanBeCut(part_name, limbs_data)
|
function CheckIfCanBeCut(part_name, limbs_data)
|
||||||
@@ -60,9 +64,8 @@ end
|
|||||||
|
|
||||||
function CheckIfItemIsProsthesis(item)
|
function CheckIfItemIsProsthesis(item)
|
||||||
|
|
||||||
-- TODO find a cleaner way
|
|
||||||
local item_full_type = item:getFullType()
|
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
|
for _, v in pairs(prosthesis_list) do
|
||||||
if v == item_full_type then
|
if v == item_full_type then
|
||||||
@@ -88,7 +91,7 @@ end
|
|||||||
|
|
||||||
function CheckIfProsthesisAlreadyInstalled(limbs_data, part_name)
|
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
|
if string.find(part_name, side) then
|
||||||
return (limbs_data[side .. "_Hand"].is_prosthesis_equipped or limbs_data[side .. "_LowerArm"].is_prosthesis_equipped)
|
return (limbs_data[side .. "_Hand"].is_prosthesis_equipped or limbs_data[side .. "_LowerArm"].is_prosthesis_equipped)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ end
|
|||||||
-- Override and mod compat helper
|
-- Override and mod compat helper
|
||||||
function TocPopulateCanBeHeldTable(can_be_held, limbs_data)
|
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
|
can_be_held[side] = true
|
||||||
|
|
||||||
if limbs_data[side .. "_Hand"].is_cut then
|
if limbs_data[side .. "_Hand"].is_cut then
|
||||||
|
|||||||
@@ -66,8 +66,8 @@ local function TocUpdateBaseData(mod_data)
|
|||||||
local accepted_prosthesis_upperarm = {} -- For future stuff
|
local accepted_prosthesis_upperarm = {} -- For future stuff
|
||||||
local accepted_prosthesis_foot = {}
|
local accepted_prosthesis_foot = {}
|
||||||
|
|
||||||
for _, side in ipairs(TOC_sides) do
|
for _, side in pairs(TOC_sides) do
|
||||||
for _, limb in ipairs(TOC_limbs) do
|
for _, limb in pairs(TOC_limbs) do
|
||||||
|
|
||||||
local part_name = side .. "_" .. limb
|
local part_name = side .. "_" .. limb
|
||||||
|
|
||||||
@@ -205,8 +205,8 @@ local function TocSetInitData(mod_data, player)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
for _, side in ipairs(TOC_sides) do
|
for _, side in pairs(TOC_sides) do
|
||||||
for _, limb in ipairs(TOC_limbs) do
|
for _, limb in pairs(TOC_limbs) do
|
||||||
|
|
||||||
local part_name = side .. "_" .. limb
|
local part_name = side .. "_" .. limb
|
||||||
|
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ function ISEquipWeaponAction:perform()
|
|||||||
if self.item then
|
if self.item then
|
||||||
local item_name = self.item:getFullType()
|
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)
|
local prosthesis_name = string.match(item_name, prost_v)
|
||||||
if prosthesis_name then
|
if prosthesis_name then
|
||||||
self.character:Say("This isn't the right way to equip this...")
|
self.character:Say("This isn't the right way to equip this...")
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ local function CheckIfPlayerIsInfected(player, toc_data)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Check for everything else
|
-- Check for everything else
|
||||||
for _, v in ipairs(GetOtherBodyPartTypes()) do
|
for _, v in pairs(GetOtherBodyPartTypes()) do
|
||||||
if body_damage:getBodyPart(v):bitten() then
|
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
|
toc_data.Limbs.is_other_bodypart_infected = true -- Even one is enough, stop cycling if we find it
|
||||||
break
|
break
|
||||||
@@ -198,7 +198,7 @@ local function TocUpdateEveryTenMinutes()
|
|||||||
local part_data = player:getModData().TOC.Limbs
|
local part_data = player:getModData().TOC.Limbs
|
||||||
|
|
||||||
--Experience for prosthesis user
|
--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
|
if part_data[side .. "_Hand"].is_prosthesis_equipped or part_data[side .. "_LowerArm"].is_prosthesis_equipped then
|
||||||
player:getXp():AddXP(Perks[side .. "_Hand"], 4)
|
player:getXp():AddXP(Perks[side .. "_Hand"], 4)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ def generate_clothing_item(name, model, texture_choices, guid = None):
|
|||||||
m_AllowRandomTint.text = "false"
|
m_AllowRandomTint.text = "false"
|
||||||
root.append(m_AllowRandomTint)
|
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:
|
for tex in texture_choices:
|
||||||
textureChoices = gfg.Element("textureChoices")
|
textureChoices = gfg.Element("textureChoices")
|
||||||
textureChoices.text = tex
|
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 )
|
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):
|
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 = f"recipe {recipe_name}\n"
|
||||||
root_element += "\t{\n"
|
root_element += "\t{\n"
|
||||||
|
|
||||||
@@ -71,8 +68,6 @@ def generate_recipe(recipe_name, recipe_items, result_name, time, skill_required
|
|||||||
file.close()
|
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):
|
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 = f"item {item_name}\n"
|
||||||
root_element += "\t{\n"
|
root_element += "\t{\n"
|
||||||
|
|
||||||
@@ -180,9 +175,7 @@ generate_normal_items(df_base, "Base")
|
|||||||
generate_normal_items(df_top, "Top")
|
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_name = "Test Recipe"
|
||||||
recipe_items = ["Ass", "Penis", "Shit=3"]
|
recipe_items = ["Ass", "Penis", "Shit=3"]
|
||||||
|
|||||||
Reference in New Issue
Block a user