Compare commits

..

No commits in common. 'fad6ead9edd74b2a8e159a8d4c2b2d277b1fa88e' and '79a30bcccf4646e27bf5d3e3fae4675b14257890' have entirely different histories.

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

@ -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

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

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