From 751e36cba753166ba0e696d41d2ddfe5e97e824b Mon Sep 17 00:00:00 2001 From: ZioPao Date: Sat, 17 Aug 2024 16:47:28 +0200 Subject: [PATCH] Fixed zombie amputations not enabling --- .vscode/tasks.json | 6 +++--- media/lua/client/TOC/Controllers/ItemsController.lua | 3 +++ media/lua/client/TOC/Main.lua | 2 +- media/lua/client/TOC/Zombies/ZombiesAmputation.lua | 8 +++++--- mod.info | 2 +- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 6fe0a36..8f6ce15 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -10,10 +10,10 @@ "command": "python ${config:zomboid_user_folder}/PaosCrap/make_workshop_pack.py picch ${workspaceFolderBasename}", }, { - "label": "Upload mod", + "label": "Bump Mod Version", "type": "shell", - "options": {"statusbar": {"label": "$(arrow-up) Upload Mod"}}, - "command": "python ${config:zomboid_user_folder}/PaosCrap/upload_mod_to_steam/main.py ${config:mod_id} ${config:zomboid_user_folder}/Workshop/${workspaceFolderBasename}", + "options": {"statusbar": {"label": "$(arrow-up) Bump Mod Version"}}, + "command": "python ${config:zomboid_user_folder}/PaosCrap/bump_version.py media/lua/client/TOC/Main.lua", }, { "label": "Run Zomboid Debug No Steam", diff --git a/media/lua/client/TOC/Controllers/ItemsController.lua b/media/lua/client/TOC/Controllers/ItemsController.lua index f539e6c..a4fbf35 100644 --- a/media/lua/client/TOC/Controllers/ItemsController.lua +++ b/media/lua/client/TOC/Controllers/ItemsController.lua @@ -156,6 +156,9 @@ function ItemsController.Zombie.SpawnAmputationItem(zombie, amputationFullType) -- Spawn the item too in the inventory to keep track of stuff this way. It's gonna get deleted when we reload the game local zombieInv = zombie:getInventory() zombieInv:AddItem(amputationFullType) + + + -- TODO Remove objects in that part of the body to prevent items floating in mid air end function ItemsController.Zombie.GetAmputationTexturesIndex(zombie) diff --git a/media/lua/client/TOC/Main.lua b/media/lua/client/TOC/Main.lua index 50d9ecb..8b540bc 100644 --- a/media/lua/client/TOC/Main.lua +++ b/media/lua/client/TOC/Main.lua @@ -6,7 +6,7 @@ require("TOC/Events") ---@class Main local Main = { - _version = "2.1" + _version = "2.1.1" } function Main.Start() diff --git a/media/lua/client/TOC/Zombies/ZombiesAmputation.lua b/media/lua/client/TOC/Zombies/ZombiesAmputation.lua index 191fae2..56adbd4 100644 --- a/media/lua/client/TOC/Zombies/ZombiesAmputation.lua +++ b/media/lua/client/TOC/Zombies/ZombiesAmputation.lua @@ -1,6 +1,3 @@ - -if not SandboxVars.TOC.EnableZombieAmputations then return end - require "lua_timers" local ItemsController = require("TOC/Controllers/ItemsController") @@ -73,6 +70,8 @@ local bloodAmount = 10 ---@param zombie IsoZombie ---@param handWeapon HandWeapon local function HandleZombiesAmputations(player, zombie, handWeapon, damage) + if not SandboxVars.TOC.EnableZombieAmputations then return end + if not instanceof(zombie, "IsoZombie") or not instanceof(player, "IsoPlayer") then return end if player ~= getPlayer() then return end @@ -109,6 +108,7 @@ Events.OnWeaponHitCharacter.Add(HandleZombiesAmputations) local localOnlyZombiesMD local function SetupZombiesModData() + if not SandboxVars.TOC.EnableZombieAmputations then return end local zombieKey = CommandsData.GetZombieKey() localOnlyZombiesMD = ModData.getOrCreate(zombieKey) end @@ -118,6 +118,8 @@ Events.OnInitGlobalModData.Add(SetupZombiesModData) ---@param zombie IsoZombie local function ReapplyAmputation(zombie) + if not SandboxVars.TOC.EnableZombieAmputations then return end + local pID = GetZombieID(zombie) if localOnlyZombiesMD[pID] ~= nil then diff --git a/mod.info b/mod.info index c3866c7..3ba4d94 100644 --- a/mod.info +++ b/mod.info @@ -4,5 +4,5 @@ description=You've been bitten. You have only two choices. id=TheOnlyCure icon=icon.png url=https://github.com/ZioPao/The-Only-Cure -modversion=2.1 +modversion=2.1.1 pzversion=41.65