you can now load submarines dynamically and load them into the lobby screen and added entity spawner

This commit is contained in:
Evil Factory
2021-10-01 12:41:58 -03:00
parent 1da9b5870c
commit 6345166742
7 changed files with 41 additions and 6 deletions
@@ -64,6 +64,14 @@ namespace Barotrauma
}
}
public EntitySpawner Spawner
{
get
{
return Entity.Spawner;
}
}
public GameSession GameSession
{
get
@@ -12,8 +12,28 @@ namespace Barotrauma
public static void RegisterAll()
{
RegisterSimpleAction<Item>();
RegisterSimpleAction();
}
}
public static void RegisterSimpleAction<T>()
{
Script.GlobalOptions.CustomConverters.SetScriptToClrCustomConversion(DataType.Function, typeof(Action<T>), v =>
{
var function = v.Function;
return (Action<T>)(p => function.Call(p));
});
}
}
public static void RegisterSimpleAction()
{
Script.GlobalOptions.CustomConverters.SetScriptToClrCustomConversion(DataType.Function, typeof(Action), v =>
{
var function = v.Function;
return (Action)(() => function.Call());
});
}
}
}
@@ -274,6 +274,7 @@ namespace Barotrauma
UserData.RegisterType<InputType>();
UserData.RegisterType<AttackResult>();
UserData.RegisterType<Entity>();
UserData.RegisterType<EntitySpawner>();
UserData.RegisterType<MapEntity>();
UserData.RegisterType<MapEntityPrefab>();
UserData.RegisterType<CauseOfDeath>();
@@ -293,7 +294,6 @@ namespace Barotrauma
UserData.RegisterType<Hull>();
UserData.RegisterType<Gap>();
UserData.RegisterType<PhysicsBody>();
UserData.RegisterType<SubmarineBody>();
UserData.RegisterType<InvSlotType>();
UserData.RegisterType<ItemPrefab>();
UserData.RegisterType<SerializableProperty>();
@@ -303,7 +303,6 @@ namespace Barotrauma
UserData.RegisterType<Fabricator>();
UserData.RegisterType<Pair<JobPrefab, int>>();
UserData.RegisterType<ContentPackage>();
UserData.RegisterType<SubmarineInfo>();
UserData.RegisterType<SubmarineBody>();
UserData.RegisterType<Explosion>();
UserData.RegisterType<AIController>();
@@ -338,6 +337,7 @@ namespace Barotrauma
AddCallMetaMember(UserData.RegisterType<Signal>());
AddCallMetaMember(UserData.RegisterType<Color>());
AddCallMetaMember(UserData.RegisterType<Point>());
AddCallMetaMember(UserData.RegisterType<SubmarineInfo>());
#if SERVER
@@ -415,6 +415,7 @@ namespace Barotrauma
lua.Globals["ClientPacketHeader"] = UserData.CreateStatic<ClientPacketHeader>();
lua.Globals["ServerPacketHeader"] = UserData.CreateStatic<ServerPacketHeader>();
lua.Globals["RandSync"] = UserData.CreateStatic<Rand.RandSync>();
lua.Globals["SubmarineInfo"] = UserData.CreateStatic<SubmarineInfo>();
#if SERVER