Compat for FH

This commit is contained in:
ZioPao
2024-03-24 23:45:35 +01:00
parent 639841cf20
commit b6fb136098
2 changed files with 37 additions and 4 deletions

9
.vscode/tasks.json vendored
View File

@@ -50,6 +50,15 @@
"problemMatcher": [
"$eslint-stylish"
]
},
{
"label": "Run Zomboid Test Server 2",
"options": {"statusbar": {"label": "$(run) Zomboid Server (TOC+FH+BH)"}},
"type": "shell",
"command":"\"${config:zomboid_server_folder}\\StartServer64_nosteam_custom.bat\" TOC_FH_BH",
"problemMatcher": [
"$eslint-stylish"
]
}
]
}

View File

@@ -1,14 +1,38 @@
--* BRUTAL HANDS -- *
local function HandleModCompatibility()
if getActivatedMods():contains('BrutalHandwork') then
--* BRUTAL HANDS -- *
--[[
Brutal hands has a TOC_COMPAT but its check is wrong and uses an old API.
]]
local activatedMods = getActivatedMods()
TOC_DEBUG.print("Checking for mods compatibility")
if activatedMods:contains('BrutalHandwork') then
TOC_DEBUG.print("found BrutalHandwork, activating compat module")
BrutalHands = BrutalHands or {}
BrutalHands.TOC = require("TOC/API")
-- Brutal hands has a TOC_COMPAT but its check is wrong and uses an old API.
end
if activatedMods:contains('FancyHandwork') then
TOC_DEBUG.print("found FancyHandwork, activating compat module")
require("TimedActions/FHSwapHandsAction")
local og_FHSwapHandsAction_isValid = FHSwapHandsAction.isValid
function FHSwapHandsAction:isValid()
local tocApi = require("TOC/API")
if tocApi.hasBothHands(self.character) then
return og_FHSwapHandsAction_isValid(self)
else
return false
end
end
end
end
Events.OnGameStart.Add(HandleModCompatibility)