Browse Source

Fix breaking changes in Gamecraft v2019.12.17.15.48

tags/v0.1.1.0
NGnius (Graham) 4 years ago
parent
commit
f13d634a2c
5 changed files with 25 additions and 14 deletions
  1. +1
    -1
      GamecraftModdingAPI/Blocks/MovementEngine.cs
  2. +9
    -4
      GamecraftModdingAPI/Commands/CommandPatch.cs
  3. +2
    -0
      GamecraftModdingAPI/Events/GameActivatedPatch.cs
  4. +5
    -8
      GamecraftModdingAPI/GamecraftModdingAPI.csproj
  5. +8
    -1
      GamecraftModdingAPI/Tests/GamecraftModdingAPIPluginTest.cs

+ 1
- 1
GamecraftModdingAPI/Blocks/MovementEngine.cs View File

@@ -69,7 +69,7 @@ namespace GamecraftModdingAPI.Blocks
public float3 MoveConnectedBlocks(uint blockID, float3 vector)
{
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; });
for (int i = 0; i < cubesToMove.Count; i++)
{


+ 9
- 4
GamecraftModdingAPI/Commands/CommandPatch.cs View File

@@ -10,6 +10,7 @@ using Svelto.Context;
using Svelto.ECS;
using RobocraftX;
using RobocraftX.Multiplayer;
using RobocraftX.StateSync;
using Unity.Entities;

using GamecraftModdingAPI.Utility;
@@ -19,10 +20,13 @@ namespace GamecraftModdingAPI.Commands
/// <summary>
/// Patch of RobocraftX.GUI.CommandLine.CommandLineCompositionRoot.Compose<T>()
/// </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 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");
// When a game is loaded, register the command engines
@@ -31,8 +35,9 @@ namespace GamecraftModdingAPI.Commands

public static MethodBase TargetMethod(HarmonyInstance instance)
{
var func = (Action<UnityContext<FullGameCompositionRoot>, EnginesRoot, World, Action, MultiplayerInitParameters>)RobocraftX.GUI.CommandLine.CommandLineCompositionRoot.Compose<UnityContext<FullGameCompositionRoot>>;
return func.Method;
return typeof(RobocraftX.GUI.CommandLine.CommandLineCompositionRoot).GetMethod("Compose").MakeGenericMethod(typeof(object));

//return func.Method;
}
}
}

+ 2
- 0
GamecraftModdingAPI/Events/GameActivatedPatch.cs View File

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


+ 5
- 8
GamecraftModdingAPI/GamecraftModdingAPI.csproj View File

@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

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

</Project>

+ 8
- 1
GamecraftModdingAPI/Tests/GamecraftModdingAPIPluginTest.cs View File

@@ -45,6 +45,12 @@ namespace GamecraftModdingAPI.Tests
// disable background 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
EventManager.AddEventHandler(new SimpleEventHandlerEngine(() => { Logging.Log("App Inited event!"); }, () => { },
EventType.ApplicationInitialized, "appinit API debug"));
@@ -76,7 +82,8 @@ namespace GamecraftModdingAPI.Tests
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"));

/*CommandManager.AddCommand(new SimpleCustomCommandEngine(() => { FMODUnity.RuntimeManager.PlayOneShot("event:/ModEvents/KillDashNine2D"); },
"Monzy", "Rap"));*/
}

public void OnFixedUpdate() { }


Loading…
Cancel
Save