Fix access range

This commit is contained in:
2025-03-31 12:02:54 +02:00
parent f21d288525
commit 79bfa72afd

View File

@@ -1,7 +1,23 @@
-- luacheck: globals MyModGlobal Character
-- luacheck: globals MyModGlobal Character Hook EnsurePatch
local utils = require "Cyka.utils"
local dump = require "Cyka.dump"
Hook.Add("Character_CanInteractWith_Item_Postfix", "YourModName.AllowRemoteInteraction", function()
return true
end)
-- Then patch the CanInteractWith method
Hook.Patch("YourModName", "Barotrauma.Character", "CanInteractWith",
{ "Barotrauma.Item", "System.Single&", "System.Boolean" },
function(_, ptable)
local result = Hook.Call("Character_CanInteractWith_Item_Postfix")
if result == true then
ptable.ReturnValue = true
end
end,
Hook.HookMethodType.After
)
local function tryAccessFabricator()
local items = utils.enqueueAllSubmarineItems({}, function(item)
return item.Prefab.Identifier.Value == "fabricator", item.Prefab.Identifier.Value == "fabricator"