Fixes for overriden methods, compat with b41
This commit is contained in:
31
common/media/lua/shared/TOC/OverridenMethodsArchive.lua
Normal file
31
common/media/lua/shared/TOC/OverridenMethodsArchive.lua
Normal file
@@ -0,0 +1,31 @@
|
||||
-- instead of relying on local to save og methods, we save them in a table here that we can use later.
|
||||
|
||||
---@class OverridenMethodsArchive
|
||||
local OverridenMethodsArchive = {}
|
||||
OverridenMethodsArchive.methods = {}
|
||||
|
||||
-- Save an original method, if it wasn't already saved and returns it to be used in common
|
||||
function OverridenMethodsArchive.Save(methodName, method)
|
||||
if not OverridenMethodsArchive.methods[methodName] then
|
||||
OverridenMethodsArchive.methods[methodName] = method
|
||||
TOC_DEBUG.print("Saved method " .. methodName)
|
||||
end
|
||||
|
||||
|
||||
return method
|
||||
|
||||
end
|
||||
|
||||
-- Get the original method
|
||||
function OverridenMethodsArchive.Get(methodName)
|
||||
--TOC_DEBUG.print("Getting og method " .. methodName)
|
||||
|
||||
--TOC_DEBUG.print("OverridenMethodsArchive.list[methodName] = " .. tostring(OverridenMethodsArchive.methods[methodName]))
|
||||
--TOC_DEBUG.print(methodName)
|
||||
--TOC_DEBUG.print(OverridenMethodsArchive.methods[methodName])
|
||||
return OverridenMethodsArchive.methods[methodName]
|
||||
|
||||
end
|
||||
|
||||
|
||||
return OverridenMethodsArchive
|
||||
@@ -21,6 +21,9 @@ local StaticData = {}
|
||||
---Mod name, used to setup Global Mod Data and various stuff
|
||||
StaticData.MOD_NAME = "TOC"
|
||||
|
||||
-- Game version, used to correct some stuff instead of relying on versioned folders
|
||||
StaticData.GAME_VERSION = getGameVersion()
|
||||
|
||||
-------------------------
|
||||
--* Base
|
||||
|
||||
@@ -278,7 +281,7 @@ StaticData.AMPUTATION_CLOTHING_ITEM_BASE = "TOC.Amputation_"
|
||||
|
||||
local sawObj
|
||||
local gardenSawObj
|
||||
if luautils.stringStarts(getGameVersion(), "41") then
|
||||
if luautils.stringStarts(StaticData.GAME_VERSION, "41") then
|
||||
sawObj = InventoryItemFactory.CreateItem("Base.Saw")
|
||||
gardenSawObj = InventoryItemFactory.CreateItem("Base.GardenSaw")
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user