diff --git a/README.md b/README.md index f9aa377..b1f5323 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# The Only Cure but better +# JUST CUT IT OFF ``` Workshop ID: 2915572347 Mod ID: Amputation2 diff --git a/media/lua/client/ActionsMethods/TOC_CutLimb.lua b/media/lua/client/ActionsMethods/TOC_CutLimb.lua index 3e4c2f9..56d433e 100644 --- a/media/lua/client/ActionsMethods/TOC_CutLimb.lua +++ b/media/lua/client/ActionsMethods/TOC_CutLimb.lua @@ -1,5 +1,5 @@ ------------------------------------------ --------- THE ONLY CURE BUT BETTER -------- +-------- JUST CUT IT OFF -------- ------------------------------------------ ----------- CUT LIMB FUNCTIONS ----------- @@ -55,7 +55,7 @@ local function TocDeleteOtherAmputatedLimbs(side) -- if left hand is cut and we cut left lowerarm, then delete hand - for _, limb in pairs(TOC.limb_names) do + for _, limb in pairs(JCIO.limbNames) do local part_name = "TOC.Amputation_" .. side .. "_" .. limb local amputated_limb = getPlayer():getInventory():FindAndReturn(part_name) if amputated_limb then @@ -126,27 +126,28 @@ end ---------------------------------------------------------------------------------- --- Main function for cutting a limb ----@param part_name string the part name to amputate ----@param surgeon_factor any the surgeon factor, which will determine some stats for the inflicted wound ----@param bandage_table any bandages info +---@param partName string the part name to amputate +---@param surgeonFactor any the surgeon factor, which will determine some stats for the inflicted wound +---@param bandageTable any bandages info ---@param painkiller_table any painkillers info, not used -function TocCutLimb(part_name, surgeon_factor, bandage_table, painkiller_table) +function TocCutLimb(partName, surgeonFactor, bandageTable, painkiller_table) -- TODO Separate Cut Limb in side and limb instead of single part_name -- Items get unequipped in ISCutLimb.Start - local player = getPlayer() - local toc_data = player:getModData().TOC - local limbs_data = toc_data.Limbs + + local jcioModData = player:getModData().JCIO + local partsParameters = jcioModData.limbParameters + local limbsData = jcioModData.Limbs -- Cut Hand -> Damage in forearm -- Cut Forearm -> Damage in Upperarm -- Cut UpperArm -> Damage to torso - local body_damage = player:getBodyDamage() - local body_part = body_damage:getBodyPart(TocGetBodyPartFromPartName(part_name)) - local adiacent_body_part = player:getBodyDamage():getBodyPart(TocGetAdiacentBodyPartFromPartName(part_name)) + local bodyDamage = player:getBodyDamage() + local bodyPart = bodyDamage:getBodyPart(TocGetBodyPartFromPartName(partName)) + local adjacentBodyPart = player:getBodyDamage():getBodyPart(TocGetAdjacentBodyPartFromPartName(partName)) local stats = player:getStats() @@ -154,31 +155,31 @@ function TocCutLimb(part_name, surgeon_factor, bandage_table, painkiller_table) -- Reset the status of the first body part, since we just cut it off it shouldn't be bleeding anymore -- The bit will be checked later since we're not sure if the player is not infected from another wound - TocSetParametersForMissingLimb(body_part, false) + TocSetParametersForMissingLimb(bodyPart, false) -- Use a tourniquet if available - local tourniquet_item = FindTourniquetInWornItems(player, TocGetSideFromPartName(part_name)) + local tourniquetItem = FindTourniquetInWornItems(player, TocGetSideFromPartName(partName)) - local base_damage_value = 100 + local baseDamageValue = 100 - if tourniquet_item ~= nil then - base_damage_value = 50 -- TODO Decrease mostly blood and damage, add pain, not everything else + if tourniquetItem ~= nil then + baseDamageValue = 50 -- TODO Decrease mostly blood and damage, add pain, not everything else - if part_name == "Left_UpperArm" or part_name == "Right_UpperArm" then - player:removeWornItem(tourniquet_item) + if partName == "Left_UpperArm" or partName == "Right_UpperArm" then + player:removeWornItem(tourniquetItem) end end -- Set damage, stress, and low endurance after amputation - adiacent_body_part:AddDamage(base_damage_value - surgeon_factor) - adiacent_body_part:setAdditionalPain(base_damage_value - surgeon_factor) - adiacent_body_part:setBleeding(true) - adiacent_body_part:setBleedingTime(base_damage_value - surgeon_factor) - adiacent_body_part:setDeepWounded(true) - adiacent_body_part:setDeepWoundTime(base_damage_value - surgeon_factor) - stats:setEndurance(surgeon_factor) - stats:setStress(base_damage_value - surgeon_factor) + adjacentBodyPart:AddDamage(baseDamageValue - surgeonFactor) + adjacentBodyPart:setAdditionalPain(baseDamageValue - surgeonFactor) + adjacentBodyPart:setBleeding(true) + adjacentBodyPart:setBleedingTime(baseDamageValue - surgeonFactor) + adjacentBodyPart:setDeepWounded(true) + adjacentBodyPart:setDeepWoundTime(baseDamageValue - surgeonFactor) + stats:setEndurance(surgeonFactor) + stats:setStress(baseDamageValue - surgeonFactor) -- Set malus for strength and fitness @@ -189,8 +190,8 @@ function TocCutLimb(part_name, surgeon_factor, bandage_table, painkiller_table) -- If bandages are available, use them - adiacent_body_part:setBandaged(bandage_table.use_bandage, 10, bandage_table.is_bandage_sterilized, - bandage_table.bandage_type) + adjacentBodyPart:setBandaged(bandageTable.use_bandage, 10, bandageTable.is_bandage_sterilized, + bandageTable.bandage_type) @@ -201,24 +202,24 @@ function TocCutLimb(part_name, surgeon_factor, bandage_table, painkiller_table) -- A check for is_cut shouldn't be necessary here since if we've got here we've already checked it out enough - if limbs_data[part_name].is_cut == false then - limbs_data[part_name].is_cut = true - limbs_data[part_name].is_amputation_shown = true - limbs_data[part_name].cicatrization_time = limbs_data[part_name].cicatrization_base_time - surgeon_factor * 50 + if limbsData[partName].is_cut == false then + limbsData[partName].is_cut = true + limbsData[partName].is_amputation_shown = true + limbsData[partName].cicatrization_time = partsParameters[partName].cicatrization_base_time - surgeonFactor * 50 - for _, depended_v in pairs(limbs_data[part_name].depends_on) do - limbs_data[depended_v].is_cut = true - limbs_data[depended_v].is_amputation_shown = false - limbs_data[depended_v].cicatrization_time = limbs_data[part_name].cicatrization_base_time - - surgeon_factor * 50 + for _, depended_v in pairs(limbsData[partName].depends_on) do + limbsData[depended_v].is_cut = true + limbsData[depended_v].is_amputation_shown = false + limbsData[depended_v].cicatrization_time = partsParameters[partName].cicatrization_base_time - + surgeonFactor * 50 - local should_depended_v_be_healed_of_bite = limbs_data[depended_v].is_infected and - body_damage:getInfectionLevel() < 20 - local depended_body_part = body_damage:getBodyPart(TocGetBodyPartFromPartName(depended_v)) + local should_depended_v_be_healed_of_bite = limbsData[depended_v].is_infected and + bodyDamage:getInfectionLevel() < 20 + local depended_body_part = bodyDamage:getBodyPart(TocGetBodyPartFromPartName(depended_v)) TocSetParametersForMissingLimb(depended_body_part, should_depended_v_be_healed_of_bite) if should_depended_v_be_healed_of_bite then - limbs_data[depended_v].is_infected = false + limbsData[depended_v].is_infected = false end @@ -228,16 +229,16 @@ function TocCutLimb(part_name, surgeon_factor, bandage_table, painkiller_table) -- Heal the infection here local body_damage = player:getBodyDamage() - if limbs_data[part_name].is_infected and body_damage:getInfectionLevel() < 20 then - limbs_data[part_name].is_infected = false + if limbsData[partName].is_infected and body_damage:getInfectionLevel() < 20 then + limbsData[partName].is_infected = false -- NOT THE ADIACENT ONE!!! - body_part:SetBitten(false) - body_part:setBiteTime(0) + bodyPart:SetBitten(false) + bodyPart:setBiteTime(0) -- Second check, let's see if there is any other infected limb. - if TocCheckIfStillInfected(limbs_data) == false then - TocCureInfection(body_damage, part_name) + if TocCheckIfStillInfected(limbsData) == false then + TocCureInfection(body_damage, partName) getPlayer():Say("I'm gonna be fine...") -- TODO Make it visible to other players, check True Actions as reference else getPlayer():Say("I'm still gonna die...") @@ -247,11 +248,11 @@ function TocCutLimb(part_name, surgeon_factor, bandage_table, painkiller_table) -- Check for older amputation models and deletes them from player's inventory - local side = string.match(part_name, '(%w+)_') + local side = string.match(partName, '(%w+)_') TocDeleteOtherAmputatedLimbs(side) --Equip new model for amputation - local amputation_clothing_item_name = TocFindAmputatedClothingFromPartName(part_name) + local amputation_clothing_item_name = TocFindAmputatedClothingFromPartName(partName) print(amputation_clothing_item_name) local amputation_clothing_item = player:getInventory():AddItem(amputation_clothing_item_name) @@ -260,9 +261,9 @@ function TocCutLimb(part_name, surgeon_factor, bandage_table, painkiller_table) -- Set blood on the amputated limb - TocSetBloodOnAmputation(getPlayer(), adiacent_body_part) + TocSetBloodOnAmputation(getPlayer(), adjacentBodyPart) - if part_name == "Left_Foot" or part_name == "Right_Foot" then + if partName == "Left_Foot" or partName == "Right_Foot" then SetMissingFootAnimation(true) end end diff --git a/media/lua/client/ActionsMethods/TOC_LocalActions.lua b/media/lua/client/ActionsMethods/TOC_LocalActions.lua index 17026a3..ab35898 100644 --- a/media/lua/client/ActionsMethods/TOC_LocalActions.lua +++ b/media/lua/client/ActionsMethods/TOC_LocalActions.lua @@ -1,5 +1,5 @@ ------------------------------------------ --------- THE ONLY CURE BUT BETTER -------- +-------- JUST CUT IT OFF -------- ------------------------------------------ ------------- LOCAL ACTIONS -------------- diff --git a/media/lua/client/ActionsMethods/TOC_OperateLimb.lua b/media/lua/client/ActionsMethods/TOC_OperateLimb.lua index 8bd2e66..a97a510 100644 --- a/media/lua/client/ActionsMethods/TOC_OperateLimb.lua +++ b/media/lua/client/ActionsMethods/TOC_OperateLimb.lua @@ -1,5 +1,5 @@ ------------------------------------------ --------- THE ONLY CURE BUT BETTER -------- +-------- JUST CUT IT OFF -------- ------------------------------------------ --------- OPERATE LIMB FUNCTIONS --------- @@ -20,11 +20,11 @@ local function FixSingleBodyPartType(body_part_type, use_oven) end local function SetBodyPartsStatusAfterOperation(player, limbs_data, part_name, use_oven) - local body_part_type = player:getBodyDamage():getBodyPart(TocGetAdiacentBodyPartFromPartName(part_name)) + local body_part_type = player:getBodyDamage():getBodyPart(TocGetAdjacentBodyPartFromPartName(part_name)) FixSingleBodyPartType(body_part_type, use_oven) 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(TocGetAdjacentBodyPartFromPartName(v)) FixSingleBodyPartType(depended_body_part_type, use_oven) end diff --git a/media/lua/client/ActionsMethods/TOC_ProsthesisMethods.lua b/media/lua/client/ActionsMethods/TOC_ProsthesisMethods.lua index 36f24b7..ceb20c4 100644 --- a/media/lua/client/ActionsMethods/TOC_ProsthesisMethods.lua +++ b/media/lua/client/ActionsMethods/TOC_ProsthesisMethods.lua @@ -1,5 +1,5 @@ ------------------------------------------ --------- THE ONLY CURE BUT BETTER -------- +-------- JUST CUT IT OFF -------- ------------------------------------------ ---------- PROSTHESIS FUNCTIONS ---------- diff --git a/media/lua/client/JCIO_Compatibility.lua b/media/lua/client/JCIO_Compatibility.lua new file mode 100644 index 0000000..59b2584 --- /dev/null +++ b/media/lua/client/JCIO_Compatibility.lua @@ -0,0 +1,142 @@ +------------------------------------------ +------------- JUST CUT IT OFF ------------ +------------------------------------------ +---------- COMPATIBILITY FUNCS ----------- + + +if JCIOCompat == nil then + JCIOCompat = {} +end + +-- Gets the old status and turns it into the new. +JCIOCompat.CheckCompatibilityWithOlderVersions = function(modData) + + if modData.TOC ~= nil then + print("JCIO: found old data from TOC") + if modData.TOC.Limbs ~= nil then + JCIOCompat.MapOldDataToNew(modData) + modData.TOC = nil -- Deletes the old mod data stuff + else + print("JCIO: something is wrong, couldn't find Limbs table in old TOC modData") + end + else + print("JCIO: couldn't find old TOC data") + + end + +end + + +JCIOCompat.MapOldDataToNew = function(modData) + + local oldNamesTable = { "RightHand", "RightForearm", "RightArm", "LeftHand", "LeftForearm", "LeftArm" } + local newNamesTable = { "Right_Hand", "Right_LowerArm", "Right_UpperArm", "Left_Hand", "Left_LowerArm", "Left_UpperArm" } + + print("JCIO: Trying to backup old data from TOC") + + if modData == nil then + return + end + + print("JCIO: found old data from TOC") + + + TocResetEverything() + + -- Another check just in case the user is using Mr Bounty og version. I really don't wanna map that out so let's just reset everything directly + + local compatEnum = nil + + + + -- Player has the og version of the mod + if modData.TOC.Limbs.RightHand.IsCut ~= nil then + print("JCIO: Found TOC Beta data") + compatEnum = 1 + elseif modData.TOC.Limbs.Right_Hand.is_cut ~= nil then + print("JCIO: Found TOCBB data") + compatEnum = 2 + end + + + if compatEnum == nil then + print("JCIO: Couldn't find any compatible data that could be retrieved") + return + end + + + -- Key setup + local isCutOldKey = nil + local isInfectedOldKey = nil + local isOperatedOldKey = nil + local isCicatrizedOldKey = nil + local isCauterizedOldKey = nil + local isAmputationShownOldKey = nil + local cicatrizationTimeOldKey = nil + local isOtherBodypartInfectedOldKey = nil + + if compatEnum == 1 then + isCutOldKey = "IsCut" + isInfectedOldKey = "IsInfected" + isOperatedOldKey = "IsOperated" + isCicatrizedOldKey = "IsCicatrized" + isCauterizedOldKey = "ISBurn" + isAmputationShownOldKey = "ToDisplay" + cicatrizationTimeOldKey = "CicaTimeLeft" + isOtherBodypartInfectedOldKey = "OtherBody_IsInfected" + elseif compatEnum == 2 then + isCutOldKey = "is_cut" + isInfectedOldKey = "is_infected" + isOperatedOldKey = "is_operated" + isCicatrizedOldKey = "is_cicatrized" + isCauterizedOldKey = "is_cauterized" + isAmputationShownOldKey = "is_amputation_shown" + cicatrizationTimeOldKey = "cicatrization_time" + isOtherBodypartInfectedOldKey = "is_other_bodypart_infected" + + elseif compatEnum == 3 then + isCutOldKey = "isCut" + isInfectedOldKey = "isInfected" + isOperatedOldKey = "isOperated" + isCicatrizedOldKey = "isCicatrized" + isCauterizedOldKey = "isCauterized" + isAmputationShownOldKey = "isAmputationShwon" + cicatrizationTimeOldKey = "cicatrizationTime" + isOtherBodypartInfectedOldKey = "isOtherBodypartInfected" + end + + + -- Starts reapplying stuff + modData.JCIO.limbs.isOtherBodypartInfected = modData.TOC.Limbs[isOtherBodypartInfectedOldKey] + + for i = 1, #newNamesTable do + + local oldName = oldNamesTable[i] + local newName = newNamesTable[i] + print("JCIO: isCut: " .. oldName .. " " .. tostring(modData.TOC.Limbs[oldName][isCutOldKey])) + print("JCIO: isOperated: " .. oldName .. " " .. tostring(modData.TOC.Limbs[oldName][isOperatedOldKey])) + print("JCIO: isCicatrized: " .. oldName .. " " .. tostring(modData.TOC.Limbs[oldName][isCicatrizedOldKey])) + print("JCIO: isAmputationShown: " .. oldName .. " " .. tostring(modData.TOC.Limbs[oldName][isAmputationShownOldKey])) + print("JCIO: cicatrizationTime: " .. oldName .. " " .. tostring(modData.TOC.Limbs[oldName][cicatrizationTimeOldKey])) + + + modData.JCIO.limbs[newName].isCut = modData.TOC.Limbs[oldName][isCutOldKey] + + if modData.JCIO.limbs[newName].isCut then + print("JCIO: Found old cut limb, reapplying model") + local cloth = getPlayer():getInventory():AddItem(TocFindAmputatedClothingFromPartName(newName)) + getPlayer():setWornItem(cloth:getBodyLocation(), cloth) + end + + + modData.JCIO.limbs[newName].isInfected = modData.TOC.Limbs[oldName][isInfectedOldKey] + modData.JCIO.limbs[newName].isOperated = modData.TOC.Limbs[oldName][isOperatedOldKey] + modData.JCIO.limbs[newName].isCicatrized = modData.TOC.Limbs[oldName][isCicatrizedOldKey] + modData.JCIO.limbs[newName].isCauterized = modData.TOC.Limbs[oldName][isCauterizedOldKey] + modData.JCIO.limbs[newName].isAmputationShown = modData.TOC.Limbs[oldName][isAmputationShownOldKey] + modData.JCIO.limbs[newName].cicatrizationTime = modData.TOC.Limbs[oldName][cicatrizationTimeOldKey] + end + + + +end diff --git a/media/lua/client/TOC_Init.lua b/media/lua/client/JCIO_Init.lua similarity index 74% rename from media/lua/client/TOC_Init.lua rename to media/lua/client/JCIO_Init.lua index 8a51720..4b0fb1d 100644 --- a/media/lua/client/TOC_Init.lua +++ b/media/lua/client/JCIO_Init.lua @@ -1,5 +1,5 @@ ------------------------------------------ --------- THE ONLY CURE BUT BETTER -------- +------------- JUST CUT IT OFF ------------ ------------------------------------------ ------------- INIT FUNCTIONS ------------- --[[ @@ -7,10 +7,6 @@ Original code and idea by: Mr. Bounty Rewritten by: Pao --]] -if not TOC then - TOC = {} -end - local function InitializeTraits() local amp1 = TraitFactory.addTrait("Amputee_Hand", getText("UI_trait_Amputee_Hand"), -8, @@ -51,15 +47,15 @@ local function TocUpdateBaseData(mod_data) local accepted_prosthesis_upperarm = {} -- For future stuff local accepted_prosthesis_foot = {} - for _, side in pairs(TOC.side_names) do - for _, limb in pairs(TOC.limb_names) do + for _, side in pairs(JCIO.sideNames) do + for _, limb in pairs(JCIO.limbNames) do local part_name = side .. "_" .. limb -- Check if part was initialized, in case of previous errors if mod_data.TOC.Limbs[part_name] == nil then - TOC.InitPart(mod_data.TOC.Limbs, part_name) + JCIO.InitPart(mod_data.TOC.Limbs, part_name) end @@ -104,7 +100,7 @@ local function TocUpdateBaseData(mod_data) end -TOC.CutLimbForTrait = function(player, limbs_data, part_name) +JCIO.CutLimbForTrait = function(player, limbs_data, part_name) local amputation_clothing_item = player:getInventory():AddItem("TOC.Amputation_" .. part_name) TocSetCorrectTextureForAmputation(amputation_clothing_item, player, true) @@ -121,7 +117,7 @@ TOC.CutLimbForTrait = function(player, limbs_data, part_name) limbs_data[v].is_cicatrized = true end end -TOC.InitPart = function(limbs_data, part_name) +JCIO.InitPart = function(limbs_data, part_name) limbs_data[part_name].is_cut = false limbs_data[part_name].is_infected = false @@ -136,7 +132,7 @@ TOC.InitPart = function(limbs_data, part_name) limbs_data[part_name].equipped_prosthesis = {} end -TOC.SetInitData = function(mod_data, player) +JCIO.SetInitData = function(modData, player) print("TOC: Creating mod_data.TOC") -------- -- NEW NAMING SCHEME @@ -158,10 +154,10 @@ TOC.SetInitData = function(mod_data, player) -- TODO Move prosthesis to something more easily accessible -- TODO Acceptable prosthesis need to be moved to something more accessible - mod_data.TOC = {} + modData.JCIO = {} -- Limbs - mod_data.TOC.Limbs = { + modData.JCIO.limbs = { Right_Hand = {}, Right_LowerArm = {}, Right_UpperArm = {}, @@ -173,12 +169,12 @@ TOC.SetInitData = function(mod_data, player) Left_Foot = {}, Right_Foot = {}, - is_other_bodypart_infected = false + isOtherBodypartInfected = false } -- TODO Move this to the global TOC thing -- Prosthetics - mod_data.TOC.Prosthesis = { + modData.JCIO.prosthesis = { WoodenHook = { Right_Hand = {}, Right_LowerArm = {}, @@ -215,42 +211,47 @@ TOC.SetInitData = function(mod_data, player) -- TODO Move this to the global TOC thing -- Generic (future uses) - mod_data.TOC.Generic = {} + modData.JCIO.generic = {} - for _, side in pairs(TOC.side_names) do - for _, limb in pairs(TOC.limb_names) do - local part_name = side .. "_" .. limb - TOC.InitPart(mod_data.TOC.Limbs, part_name) + for _, side in pairs(JCIO.sideNames) do + for _, limb in pairs(JCIO.limbNames) do + local partName = side .. "_" .. limb + JCIO.InitPart(modData.JCIO.limbs, partName) end end -- Set data like prosthesis lists, cicatrization time etc -- TODO Change this - TocUpdateBaseData(mod_data) + TocUpdateBaseData(modData) -- Setup traits if player:HasTrait("Amputee_Hand") then - TOC.CutLimbForTrait(player, mod_data.TOC.Limbs, "Left_Hand") + JCIO.CutLimbForTrait(player, modData.JCIO.limbs, "Left_Hand") elseif player:HasTrait("Amputee_LowerArm") then - TOC.CutLimbForTrait(player, mod_data.TOC.Limbs, "Left_LowerArm") + JCIO.CutLimbForTrait(player, modData.TOC.limbs, "Left_LowerArm") elseif player:HasTrait("Amputee_UpperArm") then - TOC.CutLimbForTrait(player, mod_data.TOC.Limbs, "Left_UpperArm") + JCIO.CutLimbForTrait(player, modData.TOC.limbs, "Left_UpperArm") end end -TOC.Init = function(_, player) +JCIO.Init = function(_, player) - local mod_data = player:getModData() - - if mod_data.TOC == nil then - TOC.SetInitData(mod_data, player) + local modData = player:getModData() + if modData.JCIO == nil then + JCIO.SetInitData(modData, player) else - TocCheckCompatibilityWithOlderVersions(mod_data) + JCIOCompat.CheckCompatibilityWithOlderVersions(modData) -- TODO This is gonna be deleted and moved directly to TOC - TocUpdateBaseData(mod_data) -- Since it's gonna be common to update stuff - TocCheckLegsAmputations(mod_data) + TocUpdateBaseData(modData) -- Since it's gonna be common to update stuff + TocCheckLegsAmputations(modData) + end + + -- Compat fix with older versions + if modData.TOC ~= nil then + print("JCIO: found older data from TOC or TOCBB") + JCIOCompat.CheckCompatibilityWithOlderVersions(modData) end end @@ -258,30 +259,35 @@ end ------------------------------------------------------------------------------------ -- Rewrite 2 Electirc Bogaloo -local function InitializeTheOnlyCure() +local function InitializeJustCutItOff() + + if not JCIO then + JCIO = {} + end + -- Initializes static values in a global table - TOC.side_names = {"Left", "Right"} - TOC.limb_names = { "Hand", "LowerArm", "UpperArm", "Foot"} + JCIO.sideNames = {"Left", "Right"} + JCIO.limbNames = { "Hand", "LowerArm", "UpperArm", "Foot"} - TOC.limb_parameters = {} - for _, side in pairs(TOC.side_names) do - for _, limb in pairs(TOC.limb_names) do - local part_name = side .. "_" .. limb - TOC.limb_parameters[part_name] = {} + JCIO.limbParameters = {} + for _, side in pairs(JCIO.sideNames) do + for _, limb in pairs(JCIO.limbNames) do + local partName = side .. "_" .. limb + JCIO.limbParameters[partName] = {} if limb == "Hand" then - TOC.limb_parameters[part_name].cicatrization_base_time = 1700 - TOC.limb_parameters[part_name].depends_on = {} + JCIO.limbParameters[partName].cicatrization_base_time = 1700 + JCIO.limbParameters[partName].depends_on = {} elseif limb == "LowerArm" then - TOC.limb_parameters[part_name].cicatrization_base_time = 1800 - TOC.limb_parameters[part_name].depends_on = { side .. "_Hand", } + JCIO.limbParameters[partName].cicatrization_base_time = 1800 + JCIO.limbParameters[partName].depends_on = { side .. "_Hand", } elseif limb == "UpperArm" then - TOC.limb_parameters[part_name].cicatrization_base_time = 2000 - TOC.limb_parameters[part_name].depends_on = { side .. "_Hand", side .. "_LowerArm", } + JCIO.limbParameters[partName].cicatrization_base_time = 2000 + JCIO.limbParameters[partName].depends_on = { side .. "_Hand", side .. "_LowerArm", } elseif limb == "Foot" then - TOC.limb_parameters[part_name].cicatrization_base_time = 1700 - TOC.limb_parameters[part_name].depends_on = {} + JCIO.limbParameters[partName].cicatrization_base_time = 1700 + JCIO.limbParameters[partName].depends_on = {} end end end @@ -289,13 +295,13 @@ local function InitializeTheOnlyCure() -------------------------- InitializeTraits() - Events.OnCreatePlayer.Add(TOC.Init) + Events.OnCreatePlayer.Add(JCIO.Init) -- Setup updates - Events.OnTick.Add(TOC.UpdateOnTick) - Events.EveryTenMinutes.Add(TOC.UpdateEveryTenMinutes) - Events.EveryOneMinute.Add(TOC.UpdateEveryOneMinute) + Events.OnTick.Add(JCIO.UpdateOnTick) + Events.EveryTenMinutes.Add(JCIO.UpdateEveryTenMinutes) + Events.EveryOneMinute.Add(JCIO.UpdateEveryOneMinute) end -Events.OnGameBoot.Add(InitializeTheOnlyCure) \ No newline at end of file +Events.OnGameBoot.Add(InitializeJustCutItOff) \ No newline at end of file diff --git a/media/lua/client/TOC_Checks.lua b/media/lua/client/TOC_Checks.lua index f717226..2e54501 100644 --- a/media/lua/client/TOC_Checks.lua +++ b/media/lua/client/TOC_Checks.lua @@ -91,7 +91,7 @@ end function CheckIfProsthesisAlreadyInstalled(limbs_data, part_name) - for _, side in pairs(TOC.side_names) do + for _, side in pairs(JCIO.sideNames) 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_ClientCommands.lua b/media/lua/client/TOC_ClientCommands.lua index 7e06f68..02bc5a6 100644 --- a/media/lua/client/TOC_ClientCommands.lua +++ b/media/lua/client/TOC_ClientCommands.lua @@ -1,5 +1,5 @@ ------------------------------------------ --------- THE ONLY CURE BUT BETTER -------- +-------- JUST CUT IT OFF -------- ------------------------------------------ ------------ CLIENT COMMANDS ------------- diff --git a/media/lua/client/TOC_CommonFunctions.lua b/media/lua/client/TOC_CommonFunctions.lua index cd3fe32..e908865 100644 --- a/media/lua/client/TOC_CommonFunctions.lua +++ b/media/lua/client/TOC_CommonFunctions.lua @@ -82,7 +82,7 @@ function TocGetBodyPartFromPartName(part_name) end -- Custom mapping to make more sense when cutting a limb -function TocGetAdiacentBodyPartFromPartName(part_name) +function TocGetAdjacentBodyPartFromPartName(part_name) if part_name == "Right_Hand" then return BodyPartType.ForeArm_R end if part_name == "Right_LowerArm" then return BodyPartType.UpperArm_R end diff --git a/media/lua/client/TOC_Compatibility.lua b/media/lua/client/TOC_Compatibility.lua deleted file mode 100644 index dc28b56..0000000 --- a/media/lua/client/TOC_Compatibility.lua +++ /dev/null @@ -1,164 +0,0 @@ - - - - - -local function TocReapplyAmputationClothingItem(mod_data) - local player = getPlayer() - local player_inv = player:getInventory() - - for _, side in ipairs(TOC.side_names) do - for _, limb in ipairs(TOC.limb_names) do - local part_name = side .. "_" .. limb - - -- Check this before since we could have changed some stuff about part names before fixing them. Could break things - local part_data = mod_data.TOC.Limbs[part_name] - if part_data then - if part_data.is_cut and part_data.is_amputation_shown then - local amputated_clothing_name = "TOC.Amputation_" .. part_name - if player_inv:FindAndReturn(amputated_clothing_name) == nil then - local amputation_clothing_item = player:getInventory():AddItem(TocFindAmputatedClothingFromPartName(part_name)) - TocSetCorrectTextureForAmputation(amputation_clothing_item, player, part_data.is_cicatrized) - player:setWornItem(amputation_clothing_item:getBodyLocation(), amputation_clothing_item) - - end - end - end - - - - TocResetClothingItemBodyLocation(player, side, limb) - end - end - -end - --- Gets the old status and turns it into the new. -function TocCheckCompatibilityWithOlderVersions(mod_data) - - if mod_data.TOC.Limbs == nil then - print("TOC: Limbs is nil, setting new mod_data") - TocMapOldDataToNew(mod_data) - end - - if mod_data.TOC.Limbs.Right_Hand.is_cut == nil then - print("TOC: Something was wrongly initiliazed before. Resetting parameters") - TocResetEverything() - else - print("TOC: Bypassing reapplying of amputations, assuming that everything is correct") - --print("TOC: Found compatible data, correcting models in case of errors and adding limbs") - --TocReapplyAmputationClothingItem(mod_data) - end - -end - - - ----@param compat_og_mod boolean Changes how data is arranged since backup_old_data contains data from TOC Beta -local function TocSetModDataParams(mod_data, backup_old_data, new_names_table, old_names_table, compat_og_mod) - - - - if compat_og_mod == nil then - print("TOC: Couldn't find any compatible data that could be retrieved") - return -- SOmething was wrong here, so return and do nothing - end - - - -- Key setup - local is_cut_old_key = nil - local is_infected_old_key = nil - local is_operated_old_key = nil - local is_cicatrized_old_key = nil - local is_cauterized_old_key = nil - local is_amputation_shown_old_key = nil - local cicatrization_time_old_key = nil - local is_other_bodypart_infected_old_key = nil - - if compat_og_mod then - is_cut_old_key = "IsCut" - is_infected_old_key = "IsInfected" - is_operated_old_key = "IsOperated" - is_cicatrized_old_key = "IsCicatrized" - is_cauterized_old_key = "ISBurn" - is_amputation_shown_old_key = "ToDisplay" - cicatrization_time_old_key = "CicaTimeLeft" - is_other_bodypart_infected_old_key = "OtherBody_IsInfected" - else - is_cut_old_key = "is_cut" - is_infected_old_key = "is_infected" - is_operated_old_key = "IsOperated" - is_cicatrized_old_key = "is_cicatrized" - is_cauterized_old_key = "is_cauterized" - is_amputation_shown_old_key = "is_amputation_shown" - cicatrization_time_old_key = "cicatrization_time" - is_other_bodypart_infected_old_key = "is_other_bodypart_infected" - - end - - - - - mod_data.TOC.is_other_bodypart_infected = backup_old_data[is_other_bodypart_infected_old_key] - - for i = 1, #new_names_table do - - local old_name = old_names_table[i] - local new_name = new_names_table[i] - print("TOC: is_cut: " .. old_name .. " " .. tostring(backup_old_data[old_name][is_cut_old_key])) - print("TOC: is_operated: " .. old_name .. " " .. tostring(backup_old_data[old_name][is_operated_old_key])) - print("TOC: is_cicatrized: " .. old_name .. " " .. tostring(backup_old_data[old_name][is_cicatrized_old_key])) - print("TOC: is_amputation_shown: " .. old_name .. " " .. tostring(backup_old_data[old_name][is_amputation_shown_old_key])) - print("TOC: cicatrization_time: " .. old_name .. " " .. tostring(backup_old_data[old_name][cicatrization_time_old_key])) - - - mod_data.TOC.Limbs[new_name].is_cut = backup_old_data[old_name][is_cut_old_key] - - if mod_data.TOC.Limbs[new_name].is_cut then - print("TOC: Found old cut limb, reapplying model") - local cloth = getPlayer():getInventory():AddItem(TocFindAmputatedClothingFromPartName(new_name)) - getPlayer():setWornItem(cloth:getBodyLocation(), cloth) - end - - - mod_data.TOC.Limbs[new_name].is_infected = backup_old_data[old_name][is_infected_old_key] - mod_data.TOC.Limbs[new_name].is_operated = backup_old_data[old_name][is_operated_old_key] - mod_data.TOC.Limbs[new_name].is_cicatrized = backup_old_data[old_name][is_cicatrized_old_key] - mod_data.TOC.Limbs[new_name].is_cauterized = backup_old_data[old_name][is_cauterized_old_key] - mod_data.TOC.Limbs[new_name].is_amputation_shown = backup_old_data[old_name][is_amputation_shown_old_key] - mod_data.TOC.Limbs[new_name].cicatrization_time = backup_old_data[old_name][cicatrization_time_old_key] - end - -end - - - -function TocMapOldDataToNew(mod_data) - - local old_names_table = { "RightHand", "RightForearm", "RightArm", "LeftHand", "LeftForearm", "LeftArm" } - local new_names_table = { "Right_Hand", "Right_LowerArm", "Right_UpperArm", "Left_Hand", "Left_LowerArm", "Left_UpperArm" } - - print("TOC: Trying to backup old data") - local backup_old_data = mod_data.TOC - - TocResetEverything() - - -- Another check just in case the user is using Mr Bounty og version. I really don't wanna map that out so let's just reset everything directly - - local og_mod_check = nil - -- Player has the og version of the mod - if backup_old_data.RightHand.IsCut ~= nil then - print("TOC: Found TOC Beta data") - og_mod_check = true - elseif backup_old_data.RightHand.is_cut ~= nil then - print("TOC: Found TOCBB data") - og_mod_check = false - end - - - TocSetModDataParams(mod_data, backup_old_data, new_names_table, old_names_table, og_mod_check) - - - - -end diff --git a/media/lua/client/TOC_Debug.lua b/media/lua/client/TOC_Debug.lua index 9f55d93..0a4542a 100644 --- a/media/lua/client/TOC_Debug.lua +++ b/media/lua/client/TOC_Debug.lua @@ -1,5 +1,5 @@ ------------------------------------------ --------- THE ONLY CURE BUT BETTER -------- +-------- JUST CUT IT OFF -------- ------------------------------------------ ------------ DEBUG FUNCTIONS ------------- @@ -42,12 +42,12 @@ function TocResetEverything() toc_traits:remove("Amputee_UpperArm") - TOC.Init(_, player) + JCIO.Init(_, player) -- Destroy the amputation or prosthesis item - for _, side in pairs(TOC.side_names) do - for _, limb in pairs(TOC.limb_names) do + for _, side in pairs(JCIO.sideNames) do + for _, limb in pairs(JCIO.limbNames) do local part_name = side .. "_" .. limb local amputation_item_name = TocFindAmputationOrProsthesisName(part_name, player, "Amputation") diff --git a/media/lua/client/TOC_HelperFunctions.lua b/media/lua/client/TOC_HelperFunctions.lua index 993fcf3..54378f9 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 pairs(TOC.side_names) do + for _, side in pairs(JCIO.sideNames) do can_be_held[side] = true if limbs_data[side .. "_Hand"].is_cut then diff --git a/media/lua/client/TOC_OverridenFunctions.lua b/media/lua/client/TOC_OverridenFunctions.lua index ae88b9e..b1ae986 100644 --- a/media/lua/client/TOC_OverridenFunctions.lua +++ b/media/lua/client/TOC_OverridenFunctions.lua @@ -183,7 +183,7 @@ function ISWearClothing:isValid() -- TODO Sides local limbs_data = self.character:getModData().TOC.Limbs - for _, side in pairs(TOC.side_names) do + for _, side in pairs(JCIO.sideNames) do if string.find(item_full_type, "Test_Tourniquet_" .. side) then if limbs_data[side .. "_UpperArm"].is_cut then return false diff --git a/media/lua/client/TOC_Update.lua b/media/lua/client/TOC_Update.lua index b65f291..f4db544 100644 --- a/media/lua/client/TOC_Update.lua +++ b/media/lua/client/TOC_Update.lua @@ -158,7 +158,7 @@ local function UpdatePlayerHealth(player, part_data) end -- MAIN UPDATE FUNCTIONS -TOC.UpdateOnTick = function() +JCIO.UpdateOnTick = function() local player = getPlayer() if player == nil then @@ -173,7 +173,7 @@ TOC.UpdateOnTick = function() end -TOC.UpdateEveryTenMinutes = function() +JCIO.UpdateEveryTenMinutes = function() local player = getPlayer() @@ -184,7 +184,7 @@ TOC.UpdateEveryTenMinutes = function() local part_data = player:getModData().TOC.Limbs --Experience for prosthesis user - for _, side in pairs(TOC.side_names) do + for _, side in pairs(JCIO.sideNames) 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 @@ -215,7 +215,7 @@ TOC.UpdateEveryTenMinutes = function() end end -TOC.UpdateEveryOneMinute = function() +JCIO.UpdateEveryOneMinute = function() local player = getPlayer() -- To prevent errors during loading diff --git a/media/lua/shared/translate/EN/Sandbox_EN.txt b/media/lua/shared/translate/EN/Sandbox_EN.txt index 38a7342..fdd59d5 100644 --- a/media/lua/shared/translate/EN/Sandbox_EN.txt +++ b/media/lua/shared/translate/EN/Sandbox_EN.txt @@ -1,5 +1,5 @@ Sandbox_EN = { - Sandbox_TOC = "The Only Cure but better", + Sandbox_TOC = "JUST CUT IT OFF", Sandbox_TOC_RollUpSleeves = "Roll up sleeves", Sandbox_TOC_RollUpSleeves_tooltip = "Currently broken, will not do anything", diff --git a/mod.info b/mod.info index 6563eb7..e8b11cc 100644 --- a/mod.info +++ b/mod.info @@ -1,4 +1,4 @@ -name=The only cure but better +name=JUST CUT IT OFF poster=generic.png require=UIAPI description=Bitten? Not a problem! diff --git a/workshop.txt b/workshop.txt index 2ab7589..8b69cfb 100644 --- a/workshop.txt +++ b/workshop.txt @@ -1,6 +1,6 @@ version=1 id=2916771109 -title=The Only Cure but better DEV +title=JUST CUT IT OFF DEV description=Just for testing and shit tags= visibility=public