Bladeren bron

Disable unusable commands

tags/v0.0.2
NGnius (Graham) 4 jaren geleden
bovenliggende
commit
915e6b6434
3 gewijzigde bestanden met toevoegingen van 3 en 42 verwijderingen
  1. +2
    -2
      extracommands/ToggleJumpCommandEngine.cs
  2. +0
    -39
      extracommands/UnregisterCommandEngine.cs
  3. +1
    -1
      extracommands/WaitCommandEngine.cs

+ 2
- 2
extracommands/ToggleJumpCommandEngine.cs Bestand weergeven

@@ -16,8 +16,8 @@ using RobocraftX;

namespace ExtraCommands.Basics
{
[HarmonyPatch]
[CustomCommand]
//[HarmonyPatch]
//[CustomCommand("ToggleJumpEnabled")]
class ToggleJumpCommandEngine : CustomCommandEngine
{
private static bool isJumpEnabled = false;


+ 0
- 39
extracommands/UnregisterCommandEngine.cs Bestand weergeven

@@ -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");
}
}
}

+ 1
- 1
extracommands/WaitCommandEngine.cs Bestand weergeven

@@ -21,7 +21,7 @@ namespace ExtraCommands.Basics

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)


Laden…
Annuleren
Opslaan