From 61eac3c78034adc48bf9858ecef7f686374a76ca Mon Sep 17 00:00:00 2001 From: Pao Date: Tue, 31 Jan 2023 00:23:27 +0100 Subject: [PATCH] Cleaned Compatibility and added a changelog --- changelog.txt | 9 +++++ media/lua/client/TOC_Compatibility.lua | 48 ++++++++++++++------------ mod.info | 2 +- 3 files changed, 36 insertions(+), 23 deletions(-) create mode 100644 changelog.txt diff --git a/changelog.txt b/changelog.txt new file mode 100644 index 0000000..8ab77a2 --- /dev/null +++ b/changelog.txt @@ -0,0 +1,9 @@ +0.9.5 +- No more Right Click menu. You'll have to use the TOC Menu from the Medical Check, except for Cheats +- Fixes to how amputations are handled + before and after +- Compatibility fixes with older versions +- Various fixes to Traits +- New heavily WIP models for metal and wooden hooks +- Readded sounds during amputations +- Fixed banages not getting applied after an amputation when they were in the player's inventory diff --git a/media/lua/client/TOC_Compatibility.lua b/media/lua/client/TOC_Compatibility.lua index 8fcea16..1eff759 100644 --- a/media/lua/client/TOC_Compatibility.lua +++ b/media/lua/client/TOC_Compatibility.lua @@ -1,3 +1,28 @@ +local function TocReapplyAmputationClothingItem(mod_data) + local player = getPlayer() + local player_inv = player:getInventory() + + for _, side in ipairs(TOC_sides) do + for _, limb in ipairs(TOC_limbs) do + local part_name = side .. "_" .. limb + + if mod_data.TOC.Limbs[part_name].is_cut and mod_data.TOC.Limbs[part_name].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) + player:setWornItem(amputation_clothing_item:getBodyLocation(), amputation_clothing_item) + + end + end + + TocResetClothingItemBodyLocation(player, side, limb) + end + end + +end + + function TocCheckCompatibilityWithOlderVersions(mod_data) -- Gets the old status and turns it into the new. @@ -11,28 +36,7 @@ function TocCheckCompatibilityWithOlderVersions(mod_data) TocResetEverything() else print("TOC: Found compatible data, correcting models in case of errors") - - -- TODO check if models are correctly applied - local player = getPlayer() - local player_inv = player:getInventory() - - for _, side in ipairs(TOC_sides) do - for _, limb in ipairs(TOC_limbs) do - local part_name = side .. "_" .. limb - - if mod_data.TOC.Limbs[part_name].is_cut and mod_data.TOC.Limbs[part_name].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) - player:setWornItem(amputation_clothing_item:getBodyLocation(), amputation_clothing_item) - - end - end - - TocResetClothingItemBodyLocation(player, side, limb) - end - end + TocReapplyAmputationClothingItem(mod_data) end end diff --git a/mod.info b/mod.info index 930a423..0320ca5 100644 --- a/mod.info +++ b/mod.info @@ -5,5 +5,5 @@ description=Bitten? Not a problem! id=Amputation2 icon=icon.png url=https://github.com/ZioPao/The-Only-Cure-But-Better -modversion=0.9.4 +modversion=0.9.5 pzversion=41.65