Compare commits
No commits in common. 'fad6ead9edd74b2a8e159a8d4c2b2d277b1fa88e' and '79a30bcccf4646e27bf5d3e3fae4675b14257890' have entirely different histories.
fad6ead9ed
...
79a30bcccf
@ -1,7 +1,8 @@
|
|||||||
ID: CriticalPathAnalyzer
|
ID: CriticalPathAnalyzer
|
||||||
Name: CriticalPathAnalyzer
|
Name: CriticalPathAnalyzer
|
||||||
Author: D4VID
|
Author: D4VID
|
||||||
Version: 0.3.0
|
Version: 0.2.2
|
||||||
Priority: 0
|
Priority: 0
|
||||||
Dependencies:
|
Dependencies:
|
||||||
|
- HarmonyForLogicWorld
|
||||||
- EccsLogicWorldAPI
|
- EccsLogicWorldAPI
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
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