Simplify how None is handled and fixed libs getting loaded too late

This commit is contained in:
EvilFactory
2023-03-17 20:24:54 -03:00
parent cf88aa4c5d
commit 6974c5338a
6 changed files with 16 additions and 20 deletions
@@ -2,11 +2,6 @@
namespace Barotrauma
{
public struct LuaNone
{
}
public struct LuaSByte
{
public readonly sbyte Value;
@@ -256,14 +256,12 @@ namespace Barotrauma
Script.GlobalOptions.CustomConverters.SetScriptToClrCustomConversion(dataType, typeof(Option<T>), v =>
{
if (v.UserData.Object is LuaNone)
{
return Option<T>.None();
}
else
{
return Option<T>.Some(v.ToObject<T>());
}
return Option<T>.Some(v.ToObject<T>());
});
Script.GlobalOptions.CustomConverters.SetScriptToClrCustomConversion(DataType.Nil, typeof(Option<T>), v =>
{
return Option<T>.None();
});
}