Add the content package and move the Lua files to it

This commit is contained in:
Evil Factory
2026-01-25 17:50:23 -03:00
committed by Maplewheels
parent 8dedc54468
commit 25081466be
22 changed files with 104 additions and 101 deletions
@@ -0,0 +1,97 @@
local clrLuaUserData = LuaUserData
local luaUserData = {}
luaUserData.Descriptors = {}
LuaSetup.LuaUserData = luaUserData
luaUserData.IsRegistered = clrLuaUserData.IsRegistered
luaUserData.UnregisterType = clrLuaUserData.UnregisterType
luaUserData.RegisterGenericType = clrLuaUserData.RegisterGenericType
luaUserData.RegisterExtensionType = clrLuaUserData.RegisterExtensionType
luaUserData.UnregisterGenericType = clrLuaUserData.UnregisterGenericType
luaUserData.IsTargetType = clrLuaUserData.IsTargetType
luaUserData.TypeOf = clrLuaUserData.TypeOf
luaUserData.GetType = clrLuaUserData.GetType
luaUserData.CreateEnumTable = clrLuaUserData.CreateEnumTable
luaUserData.MakeFieldAccessible = clrLuaUserData.MakeFieldAccessible
luaUserData.MakeMethodAccessible = clrLuaUserData.MakeMethodAccessible
luaUserData.MakePropertyAccessible = clrLuaUserData.MakePropertyAccessible
luaUserData.AddMethod = clrLuaUserData.AddMethod
luaUserData.AddField = clrLuaUserData.AddField
luaUserData.RemoveMember = clrLuaUserData.RemoveMember
luaUserData.CreateUserDataFromDescriptor = clrLuaUserData.CreateUserDataFromDescriptor
luaUserData.CreateUserDataFromType = clrLuaUserData.CreateUserDataFromType
luaUserData.HasMember = clrLuaUserData.HasMember
luaUserData.RegisterType = function(typeName)
local success, result = pcall(clrLuaUserData.RegisterType, typeName)
if not success then
error(result, 2)
end
luaUserData.Descriptors[typeName] = result
return result
end
luaUserData.RegisterTypeBarotrauma = function(typeName)
typeName = "Barotrauma." .. typeName
local success, result = pcall(luaUserData.RegisterType, typeName)
if not success then
error(result, 2)
end
return result
end
luaUserData.AddCallMetaTable = function (userdata)
if userdata == nil then
error("Attempted to add a call metatable to a nil value.", 2)
end
if not LuaUserData.HasMember(userdata, ".ctor") then
error("Attempted to add a call metatable to a userdata that does not have a constructor.", 2)
end
debug.setmetatable(userdata, {
__call = function(obj, ...)
if userdata == nil then
error("userdata was nil.", 2)
end
local success, result = pcall(userdata.__new, ...)
if not success then
error(result, 2)
end
return result
end
})
end
luaUserData.CreateStatic = function(typeName)
if type(typeName) ~= "string" then
error("Expected a string for typeName, got " .. type(typeName) .. ".", 2)
end
local success, result = pcall(clrLuaUserData.CreateStatic, typeName)
if not success then
error(result, 2)
end
if result == nil then
return
end
if LuaUserData.HasMember(result, ".ctor") then
luaUserData.AddCallMetaTable(result)
end
return result
end
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<ModConfig>
<Lua File="%ModDir%/Lua/LuaSetup.lua" Target="Any" />
</ModConfig>
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<contentpackage name="LuaCsForBarotrauma" >
</contentpackage>
-11
View File
@@ -1,11 +0,0 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "MoonSharp Attach",
"type": "moonsharp-debug",
"debugServer": 41912,
"request": "attach"
}
]
}
-40
View File
@@ -1,40 +0,0 @@
{
"Lua.diagnostics.globals": [
"Game",
"Player",
"Random",
"Hook",
"Timer",
"bit32",
"TotalTime",
"DoFile",
"WayPoint",
"SpawnType",
"Level",
"Submarine",
"Vector2",
"PositionType",
"ServerLog_MessageType",
"Character",
"TraitorMessageType",
"ChatMessageType",
"CauseOfDeathType",
"CreateVector2",
"Item",
"ChatMessage",
"AfflictionPrefab",
"Gap",
"File",
"Networking",
"printNoLog",
"Client",
"SERVER",
"setmodulepaths",
"Type",
"BindingFlags",
"UserData",
"LuaUserData",
"CLIENT",
"ContentPackageManager"
]
}
@@ -1,50 +0,0 @@
<?xml version="1.0"?>
<!-- For: DataType="typeof(Barotrauma.LuaCs.Data.IModConfig)"-->
<schema
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:xs="http://www.w3.org/2001/XMLSchema-datatypes"
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
targetNamespace="Barotrauma.LuaCs.Data"
vc:minVersion="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- ATTRIBUTES -->
<!--Attribute "Folder" restrictions-->
<attribute name="Folder">
<simpleType>
<restriction base="string"/>
</simpleType>
</attribute>
<!--Attribute "File" restrictions-->
<attribute name="File">
<simpleType>
<restriction base="string"/>
</simpleType>
</attribute>
<!--Attribute "Platform" restrictions-->
<attribute name="Platform">
<simpleType>
<restriction base="string">
<pattern value="(Windows|Linux|OSX)"/>
</restriction>
</simpleType>
</attribute>
<!--Attribute "Target" restrictions-->
<attribute name="Target">
<simpleType>
<restriction base="string">
<pattern value="(Client|Server|Any)"/>
</restriction>
</simpleType>
</attribute>
<!--Attribute "Culture" restrictions-->
<attribute name="Culture">
<simpleType>
<restriction base="string">
<pattern value="^[a-z]{2,3}(?:-[A-Z]{2,3}(?:-[a-zA-Z]{4})?)?$"/>
</restriction>
</simpleType>
</attribute>
</schema>