parent
3bff2ca727
commit
fad6ead9ed
@ -1,8 +1,7 @@
|
|||||||
ID: CriticalPathAnalyzer
|
ID: CriticalPathAnalyzer
|
||||||
Name: CriticalPathAnalyzer
|
Name: CriticalPathAnalyzer
|
||||||
Author: D4VID
|
Author: D4VID
|
||||||
Version: 0.2.2
|
Version: 0.3.0
|
||||||
Priority: 0
|
Priority: 0
|
||||||
Dependencies:
|
Dependencies:
|
||||||
- HarmonyForLogicWorld
|
|
||||||
- EccsLogicWorldAPI
|
- EccsLogicWorldAPI
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
using CriticalPathAnalyzer.Client.Keybindings;
|
|
||||||
using EccsLogicWorldAPI.Shared.AccessHelper;
|
|
||||||
using FancyInput;
|
|
||||||
using HarmonyLib;
|
|
||||||
using LogicWorld.Building;
|
|
||||||
using LogicWorld.GameStates;
|
|
||||||
|
|
||||||
namespace CriticalPathAnalyzer.Client {
|
|
||||||
public class KeybindingsInjector {
|
|
||||||
// Fairly generic hook into adding custom keybindings to the main building game state of LW.
|
|
||||||
// Allows to add keybindings to open new GUI elements or add new core building actions (which are not build-operations).
|
|
||||||
public static void Inject() {
|
|
||||||
var methodTarget = Methods.getPrivateStatic(typeof(StuffDeleter), "RunFirstPersonWireDeleting");
|
|
||||||
var methodHook = Methods.getPrivateStatic(typeof(KeybindingsInjector), nameof(Hook));
|
|
||||||
var harmony = new Harmony(nameof(CriticalPathAnalyzer));
|
|
||||||
harmony.Patch(methodTarget, prefix: new HarmonyMethod(methodHook));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool Hook(out bool deletedWire) {
|
|
||||||
if (CustomInput.DownThisFrame(CriticalPathAnalyzerTrigger.OpenPathAnalyzer)) {
|
|
||||||
GameStateManager.TransitionTo(CriticalPathAnalyzerGameState.Id);
|
|
||||||
|
|
||||||
deletedWire = true; // True = Cancel remaining keybinding handling.
|
|
||||||
return false; // Prevent execution of the original/further functionality.
|
|
||||||
}
|
|
||||||
|
|
||||||
deletedWire = false; // Default, might be overwritten. False = Do not cancel remaining keybinding handling.
|
|
||||||
return true; // Allow original/further functionality.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in new issue