Disable unusable commands
This commit is contained in:
parent
181597cd2f
commit
915e6b6434
3 changed files with 3 additions and 42 deletions
|
@ -16,8 +16,8 @@ using RobocraftX;
|
||||||
|
|
||||||
namespace ExtraCommands.Basics
|
namespace ExtraCommands.Basics
|
||||||
{
|
{
|
||||||
[HarmonyPatch]
|
//[HarmonyPatch]
|
||||||
[CustomCommand]
|
//[CustomCommand("ToggleJumpEnabled")]
|
||||||
class ToggleJumpCommandEngine : CustomCommandEngine
|
class ToggleJumpCommandEngine : CustomCommandEngine
|
||||||
{
|
{
|
||||||
private static bool isJumpEnabled = false;
|
private static bool isJumpEnabled = false;
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Reflection;
|
|
||||||
using Harmony;
|
|
||||||
using UnityEngine;
|
|
||||||
using Unity.Entities;
|
|
||||||
using RobocraftX;
|
|
||||||
using RobocraftX.GUI.CommandLine;
|
|
||||||
using RobocraftX.Multiplayer;
|
|
||||||
using Svelto.ECS;
|
|
||||||
using Svelto.Context;
|
|
||||||
|
|
||||||
namespace ExtraCommands
|
|
||||||
{
|
|
||||||
class UnregisterCommandEngine : CustomCommandEngine
|
|
||||||
{
|
|
||||||
public UnregisterCommandEngine(UnityContext<FullGameCompositionRoot> ctxHolder, EnginesRoot enginesRoot, World physW, Action reloadGame, MultiplayerInitParameters mpParams) : base(ctxHolder, enginesRoot, physW, reloadGame, mpParams)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
public override void Dispose()
|
|
||||||
{
|
|
||||||
int count = 0;
|
|
||||||
MethodInfo commandRemoveHelp = Harmony.AccessTools.Method(Harmony.AccessTools.TypeByName("RobocraftX.GUI.CommandLine.CommandLineUtility"), "UnregisterCommandHelp", new Type[] { typeof(string) });
|
|
||||||
foreach (Type t in typeof(CustomCommandEngine).Assembly.GetTypes())
|
|
||||||
{
|
|
||||||
CustomCommandAttribute[] attributes = (CustomCommandAttribute[])t.GetCustomAttributes(typeof(CustomCommandAttribute), false);
|
|
||||||
foreach (CustomCommandAttribute attr in attributes)
|
|
||||||
{
|
|
||||||
if (attr != null && t.IsSubclassOf(typeof(CustomCommandEngine)))
|
|
||||||
{
|
|
||||||
// remove Gamecraft help command
|
|
||||||
commandRemoveHelp.Invoke(null, new string[] { attr.Name });
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Debug.Log($"Removed {count} custom commands");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -21,7 +21,7 @@ namespace ExtraCommands.Basics
|
||||||
|
|
||||||
public override void Ready()
|
public override void Ready()
|
||||||
{
|
{
|
||||||
CustomCommandUtility.Register<int>("Wait", WaitCommand, "Delay execution for a length of time (ms)");
|
CustomCommandUtility.Register<int>("Wait", WaitCommand, "Delay execution (freeze the game) for a length of time (ms)");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WaitCommand(int ms)
|
private void WaitCommand(int ms)
|
||||||
|
|
Loading…
Reference in a new issue