Fix command registration

This commit is contained in:
Norbi Peti 2021-05-12 01:34:40 +02:00
parent aa12b848d0
commit 7a53e1d32f
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56

View file

@ -2,11 +2,11 @@
using System.Reflection;
using HarmonyLib;
using Svelto.Context;
using Svelto.ECS;
using RobocraftX.CR.MainGame;
using RobocraftX.Multiplayer;
using RobocraftX.StateSync;
using TechbloxModdingAPI.Utility;
namespace TechbloxModdingAPI.Commands
{
@ -26,6 +26,7 @@ namespace TechbloxModdingAPI.Commands
var entityFunctions = enginesRoot.GenerateEntityFunctions();
var entityFactory = enginesRoot.GenerateEntityFactory();
var entitySerializer = enginesRoot.GenerateEntitySerializer();
Logging.MetaDebugLog("Adding existing command engines");
enginesRoot.AddEngine((IEngine) Activator.CreateInstance(
AccessTools.TypeByName("RobocraftX.GUI.CommandLine.ExecuteSetGravityCommandEngine")));
enginesRoot.AddEngine((IEngine) Activator.CreateInstance(
@ -92,6 +93,7 @@ namespace TechbloxModdingAPI.Commands
AccessTools.TypeByName("RobocraftX.GUI.CommandLine.DamageCharacterCommandEngine"), entityFactory));
enginesRoot.AddEngine((IEngine) Activator.CreateInstance(
AccessTools.TypeByName("RobocraftX.GUI.CommandLine.DisableCharacterDamageCommandEngine")));
Logging.MetaDebugLog("Existing command engines added");
CommandManager.RegisterEngines(enginesRoot);
}
@ -99,7 +101,7 @@ namespace TechbloxModdingAPI.Commands
public static MethodInfo TargetMethod()
{
return AccessTools.Method(typeof(MainGameCompositionRoot), "DeterministicCompose")
.MakeGenericMethod(typeof(UnityContext<MainGameCompositionRoot>));
.MakeGenericMethod(typeof(object));
}
}
}