Compare commits

..

2 Commits

@ -8,71 +8,71 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony">
<HintPath>..\HarmonyForLogicWorld\HarmonyForLogicWorld\assemblies\client\0Harmony.dll</HintPath>
</Reference>
<Reference Include="FancyInput">
<HintPath>..\LogicWorld\Logic_World_Data\Managed\FancyInput.dll</HintPath>
<HintPath>$(LogicWorldGameLocation)\Logic_World_Data\Managed\FancyInput.dll</HintPath>
</Reference>
<Reference Include="JimmysUnityUtilities">
<HintPath>..\LogicWorld\Logic_World_Data\Managed\JimmysUnityUtilities.dll</HintPath>
<HintPath>$(LogicWorldGameLocation)\Logic_World_Data\Managed\JimmysUnityUtilities.dll</HintPath>
</Reference>
<Reference Include="LogicAPI">
<HintPath>..\LogicWorld\Logic_World_Data\Managed\LogicAPI.dll</HintPath>
<HintPath>$(LogicWorldGameLocation)\Logic_World_Data\Managed\LogicAPI.dll</HintPath>
</Reference>
<Reference Include="LogicAPI.Client">
<HintPath>..\LogicWorld\Logic_World_Data\Managed\LogicAPI.Client.dll</HintPath>
<HintPath>$(LogicWorldGameLocation)\Logic_World_Data\Managed\LogicAPI.Client.dll</HintPath>
</Reference>
<Reference Include="LogicLog">
<HintPath>..\LogicWorld\Logic_World_Data\Managed\LogicLog.dll</HintPath>
<HintPath>$(LogicWorldGameLocation)\Logic_World_Data\Managed\LogicLog.dll</HintPath>
</Reference>
<Reference Include="LogicLog">
<HintPath>..\LogicWorld\Logic_World_Data\Managed\LogicUI.dll</HintPath>
<HintPath>$(LogicWorldGameLocation)\Logic_World_Data\Managed\LogicUI.dll</HintPath>
</Reference>
<Reference Include="LogicWorld">
<HintPath>$(LogicWorldGameLocation)\Logic_World_Data\Managed\LogicWorld.dll</HintPath>
</Reference>
<Reference Include="LogicWorld.Building">
<HintPath>..\LogicWorld\Logic_World_Data\Managed\LogicWorld.Building.dll</HintPath>
<HintPath>$(LogicWorldGameLocation)\Logic_World_Data\Managed\LogicWorld.Building.dll</HintPath>
</Reference>
<Reference Include="LogicWorld.BuildingManagement">
<HintPath>..\LogicWorld\Logic_World_Data\Managed\LogicWorld.BuildingManagement.dll</HintPath>
<HintPath>$(LogicWorldGameLocation)\Logic_World_Data\Managed\LogicWorld.BuildingManagement.dll</HintPath>
</Reference>
<Reference Include="LogicWorld.Building">
<HintPath>..\LogicWorld\Logic_World_Data\Managed\LogicWorld.Players.dll</HintPath>
<HintPath>$(LogicWorldGameLocation)\Logic_World_Data\Managed\LogicWorld.Players.dll</HintPath>
</Reference>
<Reference Include="LogicWorld.Building">
<HintPath>..\LogicWorld\Logic_World_Data\Managed\LogicWorld.Physics.dll</HintPath>
<HintPath>$(LogicWorldGameLocation)\Logic_World_Data\Managed\LogicWorld.Physics.dll</HintPath>
</Reference>
<Reference Include="LogicWorld.GameStates">
<HintPath>..\LogicWorld\Logic_World_Data\Managed\LogicWorld.GameStates.dll</HintPath>
<HintPath>$(LogicWorldGameLocation)\Logic_World_Data\Managed\LogicWorld.GameStates.dll</HintPath>
</Reference>
<Reference Include="LogicWorld.Input">
<HintPath>..\LogicWorld\Logic_World_Data\Managed\LogicWorld.Input.dll</HintPath>
<HintPath>$(LogicWorldGameLocation)\Logic_World_Data\Managed\LogicWorld.Input.dll</HintPath>
</Reference>
<Reference Include="LogicWorld.Interfaces">
<HintPath>..\LogicWorld\Logic_World_Data\Managed\LogicWorld.Interfaces.dll</HintPath>
<HintPath>$(LogicWorldGameLocation)\Logic_World_Data\Managed\LogicWorld.Interfaces.dll</HintPath>
</Reference>
<Reference Include="LogicWorld.Modding">
<HintPath>..\LogicWorld\Logic_World_Data\Managed\LogicWorld.Modding.dll</HintPath>
<HintPath>$(LogicWorldGameLocation)\Logic_World_Data\Managed\LogicWorld.Modding.dll</HintPath>
</Reference>
<Reference Include="LogicWorld.Outlines">
<HintPath>..\LogicWorld\Logic_World_Data\Managed\LogicWorld.Outlines.dll</HintPath>
<HintPath>$(LogicWorldGameLocation)\Logic_World_Data\Managed\LogicWorld.Outlines.dll</HintPath>
</Reference>
<Reference Include="LogicWorld.SharedCode">
<HintPath>..\LogicWorld\Logic_World_Data\Managed\LogicWorld.SharedCode.dll</HintPath>
<HintPath>$(LogicWorldGameLocation)\Logic_World_Data\Managed\LogicWorld.SharedCode.dll</HintPath>
</Reference>
<Reference Include="LogicWorld.Networking">
<HintPath>..\LogicWorld\Logic_World_Data\Managed\LogicWorld.Networking.dll</HintPath>
<HintPath>$(LogicWorldGameLocation)\Logic_World_Data\Managed\LogicWorld.Networking.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\LogicWorld\Logic_World_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
<HintPath>$(LogicWorldGameLocation)\Logic_World_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="Server">
<HintPath>..\LogicWorld\Server\Server.dll</HintPath>
<HintPath>$(LogicWorldGameLocation)\Server\Server.dll</HintPath>
</Reference>
<Reference Include="LogicAPI.Server">
<HintPath>..\LogicWorld\Server\LogicAPI.Server.dll</HintPath>
<HintPath>$(LogicWorldGameLocation)\Server\LogicAPI.Server.dll</HintPath>
</Reference>
<Reference Include="MessagePack.Annotations">
<HintPath>..\LogicWorld\Server\MessagePack.Annotations.dll</HintPath>
<HintPath>$(LogicWorldGameLocation)\Server\MessagePack.Annotations.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>

@ -1,8 +1,7 @@
ID: CriticalPathAnalyzer
Name: CriticalPathAnalyzer
Author: D4VID
Version: 0.2.2
Version: 0.3.0
Priority: 0
Dependencies:
- HarmonyForLogicWorld
- EccsLogicWorldAPI

@ -6,6 +6,8 @@ using EccsLogicWorldAPI.Client.Injectors;
using FancyInput;
using LogicAPI.Client;
using LogicLog;
using LogicWorld;
using LogicWorld.GameStates;
namespace CriticalPathAnalyzer.Client {
public class CriticalPathAnalyzerClient : ClientMod {
@ -22,8 +24,14 @@ namespace CriticalPathAnalyzer.Client {
// Inject our own game state
GameStateInjector.inject(CriticalPathAnalyzerGameState.Id, typeof(CriticalPathAnalyzerGameState));
// Inject a hook into the game code to check for our keybindings
KeybindingsInjector.Inject();
// Register the keybinding to enter the path analyzer game state
FirstPersonInteraction.RegisterBuildingKeybinding(
CriticalPathAnalyzerTrigger.OpenPathAnalyzer,
() => {
GameStateManager.TransitionTo(CriticalPathAnalyzerGameState.Id);
return true;
}
);
// Inject packet handlers
RawPacketHandlerInjector.addPacketHandler(new AnnounceModPacketHandler(Manifest.Version));

@ -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…
Cancel
Save