From 62318b08433a16b182908f0d6ebf697e4c9fd84d Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Fri, 12 Jun 2020 17:27:36 +0200 Subject: [PATCH] Update to Gamecraft 2020.06.11.18.50 Removed some inputs from FakeInput --- GamecraftModdingAPI/Blocks/RemovalEngine.cs | 2 +- GamecraftModdingAPI/Blocks/SignalEngine.cs | 23 ++++++++-------- GamecraftModdingAPI/Commands/CommandPatch.cs | 8 ++---- .../GamecraftModdingAPI.csproj | 12 --------- GamecraftModdingAPI/Input/FakeInput.cs | 21 +++++---------- GamecraftModdingAPI/Input/FakeInputEngine.cs | 18 ++++++------- GamecraftModdingAPI/Inventory/HotbarEngine.cs | 6 ++--- .../HotbarSlotSelectionHandlerEnginePatch.cs | 2 +- GamecraftModdingAPI/Players/PlayerEngine.cs | 27 ++++++++++--------- .../Tests/GamecraftModdingAPIPluginTest.cs | 5 ++-- .../Utility/AsyncUtilsEngine.cs | 4 +-- 11 files changed, 52 insertions(+), 76 deletions(-) diff --git a/GamecraftModdingAPI/Blocks/RemovalEngine.cs b/GamecraftModdingAPI/Blocks/RemovalEngine.cs index 2aadaaa..629fd7e 100644 --- a/GamecraftModdingAPI/Blocks/RemovalEngine.cs +++ b/GamecraftModdingAPI/Blocks/RemovalEngine.cs @@ -20,7 +20,7 @@ namespace GamecraftModdingAPI.Blocks if (!entitiesDB.Exists(target)) return false; var connections = entitiesDB.QueryEntity(target); - for (int i = connections.connections.Length - 1; i >= 0; i--) + for (int i = connections.connections.Count() - 1; i >= 0; i--) _connectionFactory.RemoveConnection(connections, i, entitiesDB); _entityFunctions.RemoveEntity(target); return true; diff --git a/GamecraftModdingAPI/Blocks/SignalEngine.cs b/GamecraftModdingAPI/Blocks/SignalEngine.cs index 36716af..b36e708 100644 --- a/GamecraftModdingAPI/Blocks/SignalEngine.cs +++ b/GamecraftModdingAPI/Blocks/SignalEngine.cs @@ -44,7 +44,7 @@ namespace GamecraftModdingAPI.Blocks public bool SetSignal(uint signalID, float signal, bool input = true) { var array = GetSignalStruct(signalID, out uint index, input); - if (array != null) array[index].valueAsFloat = signal; + if (array.count > 0) array[index].valueAsFloat = signal; return false; } @@ -57,7 +57,7 @@ namespace GamecraftModdingAPI.Blocks public float AddSignal(uint signalID, float signal, bool clamp = true, bool input = true) { var array = GetSignalStruct(signalID, out uint index, input); - if (array != null) + if (array.count > 0) { ref var channelData = ref array[index]; channelData.valueAsFloat += signal; @@ -88,7 +88,7 @@ namespace GamecraftModdingAPI.Blocks public float GetSignal(uint signalID, bool input = true) { var array = GetSignalStruct(signalID, out uint index, input); - return array?[index].valueAsFloat ?? 0f; + return array.count > 0 ? array[index].valueAsFloat : 0f; } public uint[] GetSignalIDs(EGID blockID, bool input = true) @@ -136,8 +136,8 @@ namespace GamecraftModdingAPI.Blocks public ref WireEntityStruct MatchPortToWire(EGID portID, EGID blockID, out bool exists) { ref PortEntityStruct port = ref entitiesDB.QueryEntity(portID); - WireEntityStruct[] wires = entitiesDB.QueryEntities(NamedExclusiveGroup.Group).ToFastAccess(out uint count); - for (uint i = 0; i < count; i++) + var wires = entitiesDB.QueryEntities(NamedExclusiveGroup.Group); + for (uint i = 0; i < wires.count; i++) { if ((wires[i].destinationPortUsage == port.usage && wires[i].destinationBlockEGID == blockID) || (wires[i].sourcePortUsage == port.usage && wires[i].sourceBlockEGID == blockID)) @@ -154,8 +154,8 @@ namespace GamecraftModdingAPI.Blocks public ref ChannelDataStruct GetChannelDataStruct(EGID portID, out bool exists) { ref PortEntityStruct port = ref entitiesDB.QueryEntity(portID); - ChannelDataStruct[] channels = entitiesDB.QueryEntities(NamedExclusiveGroup.Group).ToFastAccess(out uint count); - if (port.firstChannelIndexCachedInSim < count) + var channels = entitiesDB.QueryEntities(NamedExclusiveGroup.Group); + if (port.firstChannelIndexCachedInSim < channels.count) { exists = true; return ref channels[port.firstChannelIndexCachedInSim]; @@ -183,7 +183,7 @@ namespace GamecraftModdingAPI.Blocks return res; } - private ChannelDataStruct[] GetSignalStruct(uint signalID, out uint index, bool input = true) + private EntityCollection GetSignalStruct(uint signalID, out uint index, bool input = true) { ExclusiveGroup group = input ? NamedExclusiveGroup.Group @@ -191,14 +191,13 @@ namespace GamecraftModdingAPI.Blocks if (entitiesDB.Exists(signalID, group)) { index = entitiesDB.QueryEntity(signalID, group).anyChannelIndex; - ChannelDataStruct[] channelData = entitiesDB - .QueryEntities(NamedExclusiveGroup.Group) - .ToFastAccess(out uint _); + var channelData = + entitiesDB.QueryEntities(NamedExclusiveGroup.Group); return channelData; } index = 0; - return null; + return default; //count: 0 } } } diff --git a/GamecraftModdingAPI/Commands/CommandPatch.cs b/GamecraftModdingAPI/Commands/CommandPatch.cs index 9cd3020..ab90e6e 100644 --- a/GamecraftModdingAPI/Commands/CommandPatch.cs +++ b/GamecraftModdingAPI/Commands/CommandPatch.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -9,9 +8,6 @@ using HarmonyLib; using Svelto.Context; using Svelto.ECS; using RobocraftX; -using RobocraftX.Multiplayer; -using RobocraftX.StateSync; -using Unity.Entities; using GamecraftModdingAPI.Utility; @@ -27,7 +23,7 @@ namespace GamecraftModdingAPI.Commands //[HarmonyPatch("Compose", new Type[] { typeof(UnityContext), typeof(EnginesRoot), typeof(World), typeof(Action), typeof(MultiplayerInitParameters), typeof(StateSyncRegistrationHelper)})] static class CommandPatch { - public static void Postfix(object contextHolder, EnginesRoot enginesRoot, World physicsWorld, Action reloadGame, MultiplayerInitParameters multiplayerParameters, ref StateSyncRegistrationHelper stateSyncReg) + public static void Postfix(EnginesRoot enginesRoot) { // When a game is loaded, register the command engines CommandManager.RegisterEngines(enginesRoot); diff --git a/GamecraftModdingAPI/GamecraftModdingAPI.csproj b/GamecraftModdingAPI/GamecraftModdingAPI.csproj index 559ddd8..d8d84fe 100644 --- a/GamecraftModdingAPI/GamecraftModdingAPI.csproj +++ b/GamecraftModdingAPI/GamecraftModdingAPI.csproj @@ -327,10 +327,6 @@ ..\ref\Gamecraft_Data\Managed\Blocks.HUDFeedbackBlocks.dll ..\..\ref\Gamecraft_Data\Managed\Blocks.HUDFeedbackBlocks.dll - - ..\ref\Gamecraft_Data\Managed\ChannelsCommon.dll - ..\..\ref\Gamecraft_Data\Managed\ChannelsCommon.dll - ..\ref\Gamecraft_Data\Managed\ClusterToWireConversion.Mock.dll ..\..\ref\Gamecraft_Data\Managed\ClusterToWireConversion.Mock.dll @@ -643,14 +639,6 @@ ..\ref\Gamecraft_Data\Managed\Svelto.Common_3.dll ..\..\ref\Gamecraft_Data\Managed\Svelto.Common_3.dll - - ..\ref\Gamecraft_Data\Managed\Svelto.ECS.Debugger.dll - ..\..\ref\Gamecraft_Data\Managed\Svelto.ECS.Debugger.dll - - - ..\ref\Gamecraft_Data\Managed\Svelto.ECS.Debugger.Internal.dll - ..\..\ref\Gamecraft_Data\Managed\Svelto.ECS.Debugger.Internal.dll - ..\ref\Gamecraft_Data\Managed\Svelto.ECS.dll ..\..\ref\Gamecraft_Data\Managed\Svelto.ECS.dll diff --git a/GamecraftModdingAPI/Input/FakeInput.cs b/GamecraftModdingAPI/Input/FakeInput.cs index 918531b..df6c3ce 100644 --- a/GamecraftModdingAPI/Input/FakeInput.cs +++ b/GamecraftModdingAPI/Input/FakeInput.cs @@ -17,7 +17,7 @@ namespace GamecraftModdingAPI.Input /// /// The custom input. /// The player. Omit this to use the local player. - public static void CustomInput(InputEntityStruct input, uint playerID = uint.MaxValue) + public static void CustomInput(LocalInputEntityStruct input, uint playerID = uint.MaxValue) { if (playerID == uint.MaxValue) { @@ -26,7 +26,7 @@ namespace GamecraftModdingAPI.Input inputEngine.SendCustomInput(input, playerID); } - public static InputEntityStruct GetInput(uint playerID = uint.MaxValue) + public static LocalInputEntityStruct GetInput(uint playerID = uint.MaxValue) { if (playerID == uint.MaxValue) { @@ -42,9 +42,7 @@ namespace GamecraftModdingAPI.Input /// /// The player. Omit this to use the local player. /// Select the hotbar slot by number. - /// Select the hotbar hand. /// Toggle the command line? - /// Open inventory? /// Open escape menu? /// Page return? /// Toggle debug display? @@ -55,13 +53,13 @@ namespace GamecraftModdingAPI.Input /// Select the hotbar page by number? /// Quicksave? /// Paste? - public static void GuiInput(uint playerID = uint.MaxValue, int hotbar = -1, bool hotbarHand = false, bool commandLine = false, bool inventory = false, bool escape = false, bool enter = false, bool debug = false, bool next = false, bool previous = false, bool tab = false, bool colour = false, int hotbarPage = -1, bool quickSave = false, bool paste = false) + public static void GuiInput(uint playerID = uint.MaxValue, int hotbar = -1, bool commandLine = false, bool escape = false, bool enter = false, bool debug = false, bool next = false, bool previous = false, bool tab = false, bool colour = false, int hotbarPage = -1, bool quickSave = false, bool paste = false) { if (playerID == uint.MaxValue) { playerID = inputEngine.GetLocalPlayerID(); } - ref InputEntityStruct currentInput = ref inputEngine.GetInputRef(playerID); + ref LocalInputEntityStruct currentInput = ref inputEngine.GetInputRef(playerID); //Utility.Logging.CommandLog($"Current sim frame {currentInput.frame}"); // set inputs switch(hotbar) @@ -76,19 +74,15 @@ namespace GamecraftModdingAPI.Input case 7: currentInput.guiMask |= RobocraftX.Common.Input.GuiInput.Hotbar_7; break; case 8: currentInput.guiMask |= RobocraftX.Common.Input.GuiInput.Hotbar_8; break; case 9: currentInput.guiMask |= RobocraftX.Common.Input.GuiInput.Hotbar_9; break; - case 10: currentInput.guiMask |= RobocraftX.Common.Input.GuiInput.Hotbar_Hand; break; default: break; } - if (hotbarHand) currentInput.guiMask |= RobocraftX.Common.Input.GuiInput.Hotbar_Hand; if (commandLine) currentInput.guiMask |= RobocraftX.Common.Input.GuiInput.ToggleCommandLine; - if (inventory) currentInput.guiMask |= RobocraftX.Common.Input.GuiInput.Inventory; if (escape) currentInput.guiMask |= RobocraftX.Common.Input.GuiInput.Escape; if (enter) currentInput.guiMask |= RobocraftX.Common.Input.GuiInput.Return; if (debug) currentInput.guiMask |= RobocraftX.Common.Input.GuiInput.ToggleDebugDisplay; if (next) currentInput.guiMask |= RobocraftX.Common.Input.GuiInput.SelectNext; if (previous) currentInput.guiMask |= RobocraftX.Common.Input.GuiInput.SelectPrev; if (tab) currentInput.guiMask |= RobocraftX.Common.Input.GuiInput.Tab; - if (colour) currentInput.guiMask |= RobocraftX.Common.Input.GuiInput.Hotbar_Colour; switch (hotbarPage) { case 1: currentInput.guiMask |= RobocraftX.Common.Input.GuiInput.HotbarPage1; break; @@ -107,16 +101,16 @@ namespace GamecraftModdingAPI.Input if (paste) currentInput.guiMask |= RobocraftX.Common.Input.GuiInput.PasteSelection; } - public static void ActionInput(uint playerID = uint.MaxValue, bool toggleMode = false, bool forward = false, bool backward = false, bool up = false, bool down = false, bool left = false, bool right = false, bool sprint = false, bool toggleFly = false, bool alt = false, bool primary = false, bool secondary = false, bool tertiary = false, bool primaryRelease = false, bool primaryHeld = false, bool secondaryHeld = false, bool toggleUnitGrid = false, bool ctrl = false, bool toggleColourMode = false, bool scaleBlockUp = false, bool scaleBlockDown = false, bool rotateBlockClockwise = false, bool rotateBlockCounterclockwise = false, bool cutSelection = false, bool copySelection = false, bool deleteSelection = false) + public static void ActionInput(uint playerID = uint.MaxValue, bool toggleMode = false, bool forward = false, bool backward = false, bool up = false, bool down = false, bool left = false, bool right = false, bool sprint = false, bool toggleFly = false, bool alt = false, bool primary = false, bool secondary = false, bool tertiary = false, bool primaryHeld = false, bool secondaryHeld = false, bool toggleUnitGrid = false, bool ctrl = false, bool toggleColourMode = false, bool scaleBlockUp = false, bool scaleBlockDown = false, bool rotateBlockClockwise = false, bool rotateBlockCounterclockwise = false, bool cutSelection = false, bool copySelection = false, bool deleteSelection = false) { if (playerID == uint.MaxValue) { playerID = inputEngine.GetLocalPlayerID(); } - ref InputEntityStruct currentInput = ref inputEngine.GetInputRef(playerID); + ref LocalInputEntityStruct currentInput = ref inputEngine.GetInputRef(playerID); //Utility.Logging.CommandLog($"Current sim frame {currentInput.frame}"); // set inputs - if (toggleMode) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.ToggleSimulation; + if (toggleMode) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.ToggleTimeRunningMode; if (forward) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.Forward; if (backward) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.Backward; if (up) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.Up; @@ -129,7 +123,6 @@ namespace GamecraftModdingAPI.Input if (primary) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.PrimaryAction; if (secondary) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.SecondaryAction; if (tertiary) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.TertiaryAction; - if (primaryRelease) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.PrimaryActionRelease; if (primaryHeld) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.PrimaryActionHeld; if (secondaryHeld) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.SecondaryActionHeld; if (toggleUnitGrid) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.ToggleUnitGrid; diff --git a/GamecraftModdingAPI/Input/FakeInputEngine.cs b/GamecraftModdingAPI/Input/FakeInputEngine.cs index bc9aaa8..11d5f3a 100644 --- a/GamecraftModdingAPI/Input/FakeInputEngine.cs +++ b/GamecraftModdingAPI/Input/FakeInputEngine.cs @@ -29,32 +29,32 @@ namespace GamecraftModdingAPI.Input IsReady = true; } - public bool SendCustomInput(InputEntityStruct input, uint playerID, bool remote = false) + public bool SendCustomInput(LocalInputEntityStruct input, uint playerID, bool remote = false) { EGID egid = new EGID(playerID, remote ? InputExclusiveGroups.RemotePlayers : InputExclusiveGroups.LocalPlayers); - if (entitiesDB.Exists(egid)) + if (entitiesDB.Exists(egid)) { - ref InputEntityStruct ies = ref entitiesDB.QueryEntity(egid); + ref LocalInputEntityStruct ies = ref entitiesDB.QueryEntity(egid); ies = input; return true; } else return false; } - public InputEntityStruct GetInput(uint playerID, bool remote = false) + public LocalInputEntityStruct GetInput(uint playerID, bool remote = false) { EGID egid = new EGID(playerID, remote ? InputExclusiveGroups.RemotePlayers : InputExclusiveGroups.LocalPlayers); - if (entitiesDB.Exists(egid)) + if (entitiesDB.Exists(egid)) { - return entitiesDB.QueryEntity(egid); + return entitiesDB.QueryEntity(egid); } - else return default(InputEntityStruct); + else return default(LocalInputEntityStruct); } - public ref InputEntityStruct GetInputRef(uint playerID, bool remote = false) + public ref LocalInputEntityStruct GetInputRef(uint playerID, bool remote = false) { EGID egid = new EGID(playerID, remote ? InputExclusiveGroups.RemotePlayers : InputExclusiveGroups.LocalPlayers); - return ref entitiesDB.QueryEntity(egid); + return ref entitiesDB.QueryEntity(egid); } public uint GetLocalPlayerID() diff --git a/GamecraftModdingAPI/Inventory/HotbarEngine.cs b/GamecraftModdingAPI/Inventory/HotbarEngine.cs index 2079fb1..d5eb2d8 100644 --- a/GamecraftModdingAPI/Inventory/HotbarEngine.cs +++ b/GamecraftModdingAPI/Inventory/HotbarEngine.cs @@ -36,9 +36,9 @@ namespace GamecraftModdingAPI.Inventory public bool SelectBlock(int block, uint playerID, bool cubeSelectedByPick = false) { - InputEntityStruct[] inputs = entitiesDB.QueryEntities(InputExclusiveGroups.LocalPlayers).ToFastAccess(out uint count); - if (count == 0) return false; - for (int i = 0; i < count; i++) + var inputs = entitiesDB.QueryEntities(InputExclusiveGroups.LocalPlayers); + if (inputs.count == 0) return false; + for (int i = 0; i < inputs.count; i++) { if (inputs[i].ID.entityID == playerID) { inputs[i].cubeSelectedByPick = cubeSelectedByPick; diff --git a/GamecraftModdingAPI/Inventory/HotbarSlotSelectionHandlerEnginePatch.cs b/GamecraftModdingAPI/Inventory/HotbarSlotSelectionHandlerEnginePatch.cs index 530184b..dd8a375 100644 --- a/GamecraftModdingAPI/Inventory/HotbarSlotSelectionHandlerEnginePatch.cs +++ b/GamecraftModdingAPI/Inventory/HotbarSlotSelectionHandlerEnginePatch.cs @@ -17,7 +17,7 @@ namespace GamecraftModdingAPI.Inventory public static BlockIDs EquippedPartID { get => (BlockIDs)selectedBlockInt; } - private static MethodInfo PatchedMethod { get; } = AccessTools.Method(AccessTools.TypeByName("RobocraftX.GUI.Hotbar.HotbarSlotSelectionHandlerEngine"), "HandleEquippedCubeChanged", parameters: new Type[] { typeof(uint), typeof(int), typeof(ExclusiveGroupStruct) }); + private static MethodInfo PatchedMethod { get; } = AccessTools.Method(AccessTools.TypeByName("RobocraftX.GUI.Hotbar.HotbarSlotSelectionHandlerEngine"), "ActivateSlotForCube", parameters: new Type[] { typeof(uint), typeof(int), typeof(ExclusiveGroupStruct) }); public static void Prefix(uint playerID, int selectedDBPartID, ExclusiveGroupStruct groupID) { diff --git a/GamecraftModdingAPI/Players/PlayerEngine.cs b/GamecraftModdingAPI/Players/PlayerEngine.cs index 4ab5ed9..2bb29a7 100644 --- a/GamecraftModdingAPI/Players/PlayerEngine.cs +++ b/GamecraftModdingAPI/Players/PlayerEngine.cs @@ -46,8 +46,8 @@ namespace GamecraftModdingAPI.Players public uint GetLocalPlayer() { if (!isReady) return uint.MaxValue; - PlayerIDStruct[] localPlayers = entitiesDB.QueryEntities(PlayersExclusiveGroups.LocalPlayers).ToFastAccess(out uint count); - if (count > 0) + var localPlayers = entitiesDB.QueryEntities(PlayersExclusiveGroups.LocalPlayers); + if (localPlayers.count > 0) { return localPlayers[0].ID.entityID; } @@ -57,8 +57,8 @@ namespace GamecraftModdingAPI.Players public uint GetRemotePlayer() { if (!isReady) return uint.MaxValue; - PlayerIDStruct[] localPlayers = entitiesDB.QueryEntities(PlayersExclusiveGroups.RemotePlayers).ToFastAccess(out uint count); - if (count > 0) + var localPlayers = entitiesDB.QueryEntities(PlayersExclusiveGroups.RemotePlayers); + if (localPlayers.count > 0) { return localPlayers[0].ID.entityID; } @@ -83,8 +83,8 @@ namespace GamecraftModdingAPI.Players public bool SetLocation(uint playerId, float3 location, bool exitSeat = true) { - ExclusiveGroup[] characterGroups = CharacterExclusiveGroups.AllCharacters; - for (int i = 0; i < characterGroups.Length; i++) + var characterGroups = CharacterExclusiveGroups.AllCharacters; + for (int i = 0; i < characterGroups.count; i++) { EGID egid = new EGID(playerId, characterGroups[i]); if (entitiesDB.Exists(egid)) @@ -328,7 +328,7 @@ namespace GamecraftModdingAPI.Players public bool IsDead(uint playerId) { - return entitiesDB.Exists(playerId, CharacterExclusiveGroups.DeadGroup); + return entitiesDB.Exists(playerId, CharacterExclusiveGroups.DeadCharacters); } public int GetSelectedBlock(uint playerId) @@ -362,8 +362,8 @@ namespace GamecraftModdingAPI.Players [MethodImpl(MethodImplOptions.AggressiveInlining)] public ref T GetCharacterStruct(uint playerId, out bool exists) where T : unmanaged, IEntityComponent { - ExclusiveGroup[] characterGroups = CharacterExclusiveGroups.AllCharacters; - for (int i = 0; i < characterGroups.Length; i++) + var characterGroups = CharacterExclusiveGroups.AllCharacters; + for (int i = 0; i < characterGroups.count; i++) { EGID egid = new EGID(playerId, characterGroups[i]); if (entitiesDB.Exists(egid)) @@ -381,8 +381,8 @@ namespace GamecraftModdingAPI.Players [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool GetPlayerStruct(uint playerId, out T s) where T : unmanaged, IEntityComponent { - ExclusiveGroup[] playerGroups = PlayersExclusiveGroups.AllPlayers; - for (int i = 0; i < playerGroups.Length; i++) + var playerGroups = PlayersExclusiveGroups.AllPlayers; + for (int i = 0; i < playerGroups.count; i++) { EGID egid = new EGID(playerId, playerGroups[i]); if (entitiesDB.Exists(egid)) @@ -394,7 +394,7 @@ namespace GamecraftModdingAPI.Players s = default; return false; } - + public EGID? GetThingLookedAt(uint playerId, float maxDistance = -1f) { if (!entitiesDB.TryQueryMappedEntities( @@ -402,7 +402,8 @@ namespace GamecraftModdingAPI.Players return null; mapper.TryGetEntity(playerId, out CharacterCameraRayCastEntityStruct rayCast); float distance = maxDistance < 0 - ? GhostBlockUtils.GetBuildInteractionDistance(entitiesDB, rayCast) + ? GhostBlockUtils.GetBuildInteractionDistance(entitiesDB, rayCast, + GhostBlockUtils.GhostCastMethod.GhostCastProportionalToBlockSize) : maxDistance; if (rayCast.hit && rayCast.distance <= distance) return rayCast.hitEgid; diff --git a/GamecraftModdingAPI/Tests/GamecraftModdingAPIPluginTest.cs b/GamecraftModdingAPI/Tests/GamecraftModdingAPIPluginTest.cs index d505806..dc07e1e 100644 --- a/GamecraftModdingAPI/Tests/GamecraftModdingAPIPluginTest.cs +++ b/GamecraftModdingAPI/Tests/GamecraftModdingAPIPluginTest.cs @@ -308,15 +308,14 @@ namespace GamecraftModdingAPI.Tests [HarmonyPatch] public class MinimumSpecsPatch { - public static bool Prefix(ref bool __result) + public static bool Prefix() { - __result = true; return false; } public static MethodInfo TargetMethod() { - return ((Func)MinimumSpecsCheck.CheckRequirementsMet).Method; + return ((Action) MinimumSpecsCheck.CheckRequirementsMet).Method; } } } diff --git a/GamecraftModdingAPI/Utility/AsyncUtilsEngine.cs b/GamecraftModdingAPI/Utility/AsyncUtilsEngine.cs index f46bd6c..56aab89 100644 --- a/GamecraftModdingAPI/Utility/AsyncUtilsEngine.cs +++ b/GamecraftModdingAPI/Utility/AsyncUtilsEngine.cs @@ -31,14 +31,14 @@ namespace GamecraftModdingAPI.Utility public Task WaitForSubmission() { var task = new TaskCompletionSource(); - WaitForSubmissionInternal(_efu, _efa, entitiesDB, task).RunOn(ExtraLean.EveryFrameStepRunner); + WaitForSubmissionInternal(_efu, _efa, entitiesDB, task).RunOn(ExtraLean.EveryFrameStepRunner_TimeStopped); return task.Task; } public Task WaitForNextFrame() { var task = new TaskCompletionSource(); - WaitForNextFrameInternal(task).RunOn(ExtraLean.EveryFrameStepRunner); + WaitForNextFrameInternal(task).RunOn(ExtraLean.EveryFrameStepRunner_TimeStopped); return task.Task; }