OBT/1.0.17

Removed Client Kick to see if this will fix some of "Received an update for an entity that doesn't exist"
Revert some change from pervious updates due to performance issue
Sync with upstream
This commit is contained in:
NotAlwaysTrue
2026-02-20 14:54:04 +08:00
committed by GitHub
parent d16707a2f3
commit de1f1c599f
9 changed files with 253 additions and 184 deletions
+11 -73
View File
@@ -1,75 +1,13 @@
if CSActive then
return
if not CSActive then
LuaUserDataIUUD = LuaUserData.RegisterType("Barotrauma.LuaSafeUserData")
LuaUserData = LuaUserData.CreateStatic("Barotrauma.LuaSafeUserData");
for k, v in pairs(debug) do
if k ~= "getmetatable" and k ~= "setmetatable" and k ~= "traceback" then
debug[k] = nil
end
end
end
local function IsAllowed(typeName)
if string.startsWith(typeName, "Barotrauma.Lua") or string.startsWith(typeName, "Barotrauma.Cs") or string.startsWith(typeName, "Barotrauma.LuaCs") then
return false
end
if string.startsWith(typeName, "System.Collections") then return true end
if string.startsWith(typeName, "Microsoft.Xna") then return true end
if string.startsWith(typeName, "Barotrauma.IO") then return false end
if string.startsWith(typeName, "Barotrauma.ToolBox") then return false end
if string.startsWith(typeName, "Barotrauma.SaveUtil") then return false end
if string.startsWith(typeName, "Barotrauma.") then return true end
return false
end
local function CanBeReRegistered(typeName)
if string.startsWith(typeName, "Barotrauma.Lua") or string.startsWith(typeName, "Barotrauma.Cs") or string.startsWith(typeName, "Barotrauma.LuaCs") then
return false
end
return true
end
local originalRegisterType = LuaUserData.RegisterType
LuaUserData.RegisterType = function (typeName)
if not (CanBeReRegistered(typeName) and LuaUserData.IsRegistered(typeName)) and not IsAllowed(typeName) then
error("Couldn't register type " .. typeName .. ".", 2)
end
local success, result = pcall(originalRegisterType, typeName)
if not success then
error(result, 2)
end
return result
end
local originalRegisterGenericType = LuaUserData.RegisterType
LuaUserData.RegisterGenericType = function (typeName, ...)
if not (CanBeReRegistered(typeName) and LuaUserData.IsRegistered(typeName)) and not IsAllowed(typeName) then
error("Couldn't register generic type " .. typeName .. ".", 2)
end
local success, result = pcall(originalRegisterGenericType, typeName, ...)
if not success then
error(result, 2)
end
return result
end
local originalCreateStatic = LuaUserData.CreateStatic
LuaUserData.CreateStatic = function (typeName, addCallMethod)
if not (CanBeReRegistered(typeName) and LuaUserData.IsRegistered(typeName)) and not IsAllowed(typeName) then
error("Couldn't create static type " .. typeName .. ".", 2)
end
local success, result = pcall(originalCreateStatic, typeName, addCallMethod)
if not success then
error(result, 2)
end
return result
end
Descriptors = LuaUserData.__new()
LuaUserDataIUUD = nil