refactor: changed check for version

This commit is contained in:
ZioPao
2025-04-17 11:26:58 +02:00
parent 9011579f08
commit 8234abd5e2
3 changed files with 17 additions and 14 deletions

View File

@@ -122,8 +122,10 @@ function ISDrinkFromBottle:new(character, item, uses)
return action return action
end end
if luautils.stringStarts(StaticData.GAME_VERSION, "41") then
-- This doesn't exist anymore in B42 if StaticData.COMPAT_42 == false then
-- TODO confirm that this doesn't exist anymore in B42
-- B42 nenen
local og_ISFinalizeDealAction_new = ISFinalizeDealAction.new local og_ISFinalizeDealAction_new = ISFinalizeDealAction.new
function ISFinalizeDealAction:new(player, otherPlayer, itemsToGive, itemsToReceive, time) function ISFinalizeDealAction:new(player, otherPlayer, itemsToGive, itemsToReceive, time)
local action = og_ISFinalizeDealAction_new(self, player, otherPlayer, itemsToGive, itemsToReceive, time) local action = og_ISFinalizeDealAction_new(self, player, otherPlayer, itemsToGive, itemsToReceive, time)
@@ -131,8 +133,8 @@ if luautils.stringStarts(StaticData.GAME_VERSION, "41") then
action.skipTOC = true action.skipTOC = true
return action return action
end end
end
end
local og_ISCampingInfoAction_new = ISCampingInfoAction.new local og_ISCampingInfoAction_new = ISCampingInfoAction.new

View File

@@ -13,14 +13,13 @@ local isReady = false
local xMod, yMod local xMod, yMod
if luautils.stringStarts(StaticData.GAME_VERSION, "41") then if StaticData.COMPAT_42 then
xMod = 0 -- B42 For some reason (I didn't investigate), when applying stuff to the health panel there is an un-accounted shift in B42.
yMod = 0
else
-- For some reason (I didn't investigate), when applying stuff to the health panel
-- there is an un-accounted shift in B42.
xMod = 5 xMod = 5
yMod = 13 yMod = 13
else
xMod = 0
yMod = 0
end end

View File

@@ -22,7 +22,8 @@ local StaticData = {}
StaticData.MOD_NAME = "TOC" StaticData.MOD_NAME = "TOC"
-- Game version, used to correct some stuff instead of relying on versioned folders -- Game version, used to correct some stuff instead of relying on versioned folders
StaticData.GAME_VERSION = getGameVersion()
StaticData.COMPAT_42 = luautils.stringStarts(getGameVersion(), "42")
------------------------- -------------------------
--* Base --* Base
@@ -281,12 +282,13 @@ StaticData.AMPUTATION_CLOTHING_ITEM_BASE = "TOC.Amputation_"
local sawObj local sawObj
local gardenSawObj local gardenSawObj
if luautils.stringStarts(StaticData.GAME_VERSION, "41") then
sawObj = InventoryItemFactory.CreateItem("Base.Saw") if StaticData.COMPAT_42 then
gardenSawObj = InventoryItemFactory.CreateItem("Base.GardenSaw")
else
sawObj = instanceItem("Base.Saw") sawObj = instanceItem("Base.Saw")
gardenSawObj = instanceItem("Base.GardenSaw") gardenSawObj = instanceItem("Base.GardenSaw")
else
sawObj = InventoryItemFactory.CreateItem("Base.Saw")
gardenSawObj = InventoryItemFactory.CreateItem("Base.GardenSaw")
end end