Fix breaking changes in Gamecraft v2019.12.17.15.48

This commit is contained in:
NGnius (Graham) 2019-12-19 11:46:32 -05:00
parent 8686aad507
commit f13d634a2c
5 changed files with 25 additions and 14 deletions

View file

@ -69,7 +69,7 @@ namespace GamecraftModdingAPI.Blocks
public float3 MoveConnectedBlocks(uint blockID, float3 vector) public float3 MoveConnectedBlocks(uint blockID, float3 vector)
{ {
Stack<uint> cubeStack = new Stack<uint>(); Stack<uint> cubeStack = new Stack<uint>();
Svelto.DataStructures.FasterList<uint> cubesToMove = new Svelto.DataStructures.FasterList<uint>(); Gamecraft.DataStructures.FasterList<uint> cubesToMove = new Gamecraft.DataStructures.FasterList<uint>();
ConnectedCubesUtility.TreeTraversal.GetConnectedCubes(entitiesDB, blockID, cubeStack, cubesToMove, (in GridConnectionsEntityStruct g) => { return false; }); ConnectedCubesUtility.TreeTraversal.GetConnectedCubes(entitiesDB, blockID, cubeStack, cubesToMove, (in GridConnectionsEntityStruct g) => { return false; });
for (int i = 0; i < cubesToMove.Count; i++) for (int i = 0; i < cubesToMove.Count; i++)
{ {

View file

@ -10,6 +10,7 @@ using Svelto.Context;
using Svelto.ECS; using Svelto.ECS;
using RobocraftX; using RobocraftX;
using RobocraftX.Multiplayer; using RobocraftX.Multiplayer;
using RobocraftX.StateSync;
using Unity.Entities; using Unity.Entities;
using GamecraftModdingAPI.Utility; using GamecraftModdingAPI.Utility;
@ -19,10 +20,13 @@ namespace GamecraftModdingAPI.Commands
/// <summary> /// <summary>
/// Patch of RobocraftX.GUI.CommandLine.CommandLineCompositionRoot.Compose<T>() /// Patch of RobocraftX.GUI.CommandLine.CommandLineCompositionRoot.Compose<T>()
/// </summary> /// </summary>
[HarmonyPatch] // TODO: fix
//[HarmonyPatch]
//[HarmonyPatch(typeof(RobocraftX.GUI.CommandLine.CommandLineCompositionRoot))]
//[HarmonyPatch("Compose", new Type[] { typeof(UnityContext<FullGameCompositionRoot>), typeof(EnginesRoot), typeof(World), typeof(Action), typeof(MultiplayerInitParameters), typeof(StateSyncRegistrationHelper)})]
public static class CommandPatch public static class CommandPatch
{ {
public static void Postfix(UnityContext<FullGameCompositionRoot> contextHolder, EnginesRoot enginesRoot, World physicsWorld, Action reloadGame, MultiplayerInitParameters multiplayerParameters) public static void Postfix(object contextHolder, EnginesRoot enginesRoot, World physicsWorld, Action reloadGame, MultiplayerInitParameters multiplayerParameters, StateSyncRegistrationHelper stateSyncReg)
{ {
Logging.MetaDebugLog("Command Line was loaded"); Logging.MetaDebugLog("Command Line was loaded");
// When a game is loaded, register the command engines // When a game is loaded, register the command engines
@ -31,8 +35,9 @@ namespace GamecraftModdingAPI.Commands
public static MethodBase TargetMethod(HarmonyInstance instance) public static MethodBase TargetMethod(HarmonyInstance instance)
{ {
var func = (Action<UnityContext<FullGameCompositionRoot>, EnginesRoot, World, Action, MultiplayerInitParameters>)RobocraftX.GUI.CommandLine.CommandLineCompositionRoot.Compose<UnityContext<FullGameCompositionRoot>>; return typeof(RobocraftX.GUI.CommandLine.CommandLineCompositionRoot).GetMethod("Compose").MakeGenericMethod(typeof(object));
return func.Method;
//return func.Method;
} }
} }
} }

View file

@ -22,6 +22,8 @@ namespace GamecraftModdingAPI.Events
{ {
// register custom game engines // register custom game engines
GameEngineManager.RegisterEngines(____mainGameEnginesRoot); GameEngineManager.RegisterEngines(____mainGameEnginesRoot);
// register custom command engines
GamecraftModdingAPI.Commands.CommandManager.RegisterEngines(____mainGameEnginesRoot);
// A new EnginesRoot is always created when ActivateGame is called // A new EnginesRoot is always created when ActivateGame is called
// so all event emitters and handlers must be re-registered. // so all event emitters and handlers must be re-registered.
EventManager.RegisterEngines(____mainGameEnginesRoot); EventManager.RegisterEngines(____mainGameEnginesRoot);

View file

@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net48</TargetFramework> <TargetFramework>net48</TargetFramework>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Version>0.1.0.0</Version> <Version>0.1.1.0</Version>
<Authors>Exmods</Authors> <Authors>Exmods</Authors>
<PackageLicenseExpression>GNU General Public Licence 3+</PackageLicenseExpression> <PackageLicenseExpression>GNU General Public Licence 3+</PackageLicenseExpression>
<PackageProjectUrl>https://git.exmods.org/modtainers/GamecraftModdingAPI</PackageProjectUrl> <PackageProjectUrl>https://git.exmods.org/modtainers/GamecraftModdingAPI</PackageProjectUrl>
@ -124,6 +124,9 @@
<Reference Include="RobocraftX.Common"> <Reference Include="RobocraftX.Common">
<HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.Common.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.Common.dll</HintPath>
</Reference> </Reference>
<Reference Include="RobocraftX.ControlsScreen">
<HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.ControlsScreen.dll</HintPath>
</Reference>
<Reference Include="RobocraftX.Crosshair"> <Reference Include="RobocraftX.Crosshair">
<HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.Crosshair.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.Crosshair.dll</HintPath>
</Reference> </Reference>
@ -529,16 +532,10 @@
<Reference Include="UserReporting"> <Reference Include="UserReporting">
<HintPath>..\ref\Gamecraft_Data\Managed\UserReporting.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\UserReporting.dll</HintPath>
</Reference> </Reference>
<Reference Include="Utf8Json">
<HintPath>..\ref\Gamecraft_Data\Managed\Utf8Json.dll</HintPath>
</Reference>
<Reference Include="VisualProfiler"> <Reference Include="VisualProfiler">
<HintPath>..\ref\Gamecraft_Data\Managed\VisualProfiler.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\VisualProfiler.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<!--End Dependencies--> <!--End Dependencies-->
</Project> </Project>

View file

@ -45,6 +45,12 @@ namespace GamecraftModdingAPI.Tests
// disable background music // disable background music
AudioTools.SetVolume(0.0f, "Music"); AudioTools.SetVolume(0.0f, "Music");
/*if (!FMODUnity.RuntimeManager.HasBankLoaded("Modded"))
{
FMODUnity.RuntimeManager.LoadBank("Modded", true);
}
FMODUnity.RuntimeManager.PlayOneShot("event:/ModEvents/KillDashNine3D");*/
// debug/test handlers // debug/test handlers
EventManager.AddEventHandler(new SimpleEventHandlerEngine(() => { Logging.Log("App Inited event!"); }, () => { }, EventManager.AddEventHandler(new SimpleEventHandlerEngine(() => { Logging.Log("App Inited event!"); }, () => { },
EventType.ApplicationInitialized, "appinit API debug")); EventType.ApplicationInitialized, "appinit API debug"));
@ -76,7 +82,8 @@ namespace GamecraftModdingAPI.Tests
GamecraftModdingAPI.Utility.Logging.CommandLogError("Blocks can only be moved in Build mode!"); GamecraftModdingAPI.Utility.Logging.CommandLogError("Blocks can only be moved in Build mode!");
} }
}, "MoveLastBlock", "Move the most-recently-placed block, and any connected blocks by the given offset")); }, "MoveLastBlock", "Move the most-recently-placed block, and any connected blocks by the given offset"));
/*CommandManager.AddCommand(new SimpleCustomCommandEngine(() => { FMODUnity.RuntimeManager.PlayOneShot("event:/ModEvents/KillDashNine2D"); },
"Monzy", "Rap"));*/
} }
public void OnFixedUpdate() { } public void OnFixedUpdate() { }