Update to Gamecraft 2020.04.06.14.50

This commit is contained in:
NGnius 2020-04-07 13:05:00 -04:00
parent a9322a08dd
commit d1c0556b9c
10 changed files with 60 additions and 69 deletions

View file

@ -135,7 +135,7 @@ namespace GamecraftModdingAPI.Blocks
static MethodBase TargetMethod(HarmonyInstance instance) static MethodBase TargetMethod(HarmonyInstance instance)
{ {
return typeof(PlaceBlockEngine).GetConstructors()[0]; return AccessTools.TypeByName("RobocraftX.CR.MachineEditing.PlaceBlockEngine").GetConstructors()[0];
} }
} }
} }

View file

@ -59,7 +59,7 @@ namespace GamecraftModdingAPI.Blocks
ExclusiveGroup group = input ? NamedExclusiveGroup<InputPortsGroup>.Group : NamedExclusiveGroup<OutputPortsGroup>.Group; ExclusiveGroup group = input ? NamedExclusiveGroup<InputPortsGroup>.Group : NamedExclusiveGroup<OutputPortsGroup>.Group;
if (entitiesDB.Exists<PortEntityStruct>(signalID, group)) if (entitiesDB.Exists<PortEntityStruct>(signalID, group))
{ {
entitiesDB.QueryEntity<PortEntityStruct>(signalID, group).value = signal; entitiesDB.QueryEntity<PortEntityStruct>(signalID, group).anyChannel.valueAsFloat = signal;
return true; return true;
} }
return false; return false;
@ -77,18 +77,18 @@ namespace GamecraftModdingAPI.Blocks
if (entitiesDB.Exists<PortEntityStruct>(signalID, group)) if (entitiesDB.Exists<PortEntityStruct>(signalID, group))
{ {
ref PortEntityStruct pes = ref entitiesDB.QueryEntity<PortEntityStruct>(signalID, group); ref PortEntityStruct pes = ref entitiesDB.QueryEntity<PortEntityStruct>(signalID, group);
pes.value += signal; pes.anyChannel.valueAsFloat += signal;
if (clamp) if (clamp)
{ {
if (pes.value > Signals.POSITIVE_HIGH) if (pes.anyChannel.valueAsFloat > Signals.POSITIVE_HIGH)
{ {
pes.value = Signals.POSITIVE_HIGH; pes.anyChannel.valueAsFloat = Signals.POSITIVE_HIGH;
} }
else if (pes.value < Signals.NEGATIVE_HIGH) else if (pes.anyChannel.valueAsFloat < Signals.NEGATIVE_HIGH)
{ {
pes.value = Signals.NEGATIVE_HIGH; pes.anyChannel.valueAsFloat = Signals.NEGATIVE_HIGH;
} }
return pes.value; return pes.anyChannel.valueAsFloat;
} }
} }
return signal; return signal;
@ -105,7 +105,7 @@ namespace GamecraftModdingAPI.Blocks
ExclusiveGroup group = input ? NamedExclusiveGroup<InputPortsGroup>.Group : NamedExclusiveGroup<OutputPortsGroup>.Group; ExclusiveGroup group = input ? NamedExclusiveGroup<InputPortsGroup>.Group : NamedExclusiveGroup<OutputPortsGroup>.Group;
if (entitiesDB.Exists<PortEntityStruct>(signalID, group)) if (entitiesDB.Exists<PortEntityStruct>(signalID, group))
{ {
return entitiesDB.QueryEntity<PortEntityStruct>(signalID, group).value; return entitiesDB.QueryEntity<PortEntityStruct>(signalID, group).anyChannel.valueAsFloat;
} }
return 0f; return 0f;
} }

View file

@ -7,6 +7,7 @@ using System.Threading.Tasks;
using Harmony; using Harmony;
using Svelto.ECS; using Svelto.ECS;
using RobocraftX.Common;
using RobocraftX.StateSync; using RobocraftX.StateSync;
using GamecraftModdingAPI.Utility; using GamecraftModdingAPI.Utility;
@ -16,19 +17,30 @@ namespace GamecraftModdingAPI.Events
/// <summary> /// <summary>
/// Patch of RobocraftX.StateSync.DeterministicStepCompositionRoot.ComposeEnginesGroups(...) /// Patch of RobocraftX.StateSync.DeterministicStepCompositionRoot.ComposeEnginesGroups(...)
/// </summary> /// </summary>
[HarmonyPatch(typeof(DeterministicStepCompositionRoot), "ComposeEnginesGroups")] //[HarmonyPatch(typeof(DeterministicStepCompositionRoot), "DeterministicCompose")]
//[HarmonyPatch] [HarmonyPatch]
class DeterministicStepComposeEngineGroupsPatch class GameHostTransitionDeterministicGroupEnginePatch
{ {
public static readonly GameStateBuildEmitterEngine buildEngine = new GameStateBuildEmitterEngine(); public static readonly GameStateBuildEmitterEngine buildEngine = new GameStateBuildEmitterEngine();
public static readonly GameStateSimulationEmitterEngine simEngine = new GameStateSimulationEmitterEngine(); public static readonly GameStateSimulationEmitterEngine simEngine = new GameStateSimulationEmitterEngine();
public static void Prefix(ref StateSyncRegistrationHelper stateSyncReg) public static void Postfix()
{ {
stateSyncReg.buildModeInitializationEngines.Add(buildEngine); //stateSyncReg.buildModeInitializationEngines.Add(buildEngine);
stateSyncReg.simulationModeInitializationEngines.Add(simEngine); //stateSyncReg.simulationModeInitializationEngines.Add(simEngine);
//enginesRoot.AddEngine(buildEngine);
//enginesRoot.AddEngine(simEngine);
buildEngine.EmitIfBuildMode();
simEngine.EmitIfSimMode();
} }
[HarmonyTargetMethod]
public static MethodBase TargetMethod(HarmonyInstance harmonyInstance)
{
return AccessTools.Method(AccessTools.TypeByName("RobocraftX.StateSync.GameHostTransitionDeterministicGroupEngine"), "EndTransition");
//.MakeGenericMethod(typeof(CosmeticEnginesSequenceBuildOrder), typeof(CosmeticEnginesSequenceSimOrder), typeof(DeterministicToCosmeticSyncBuildOrder), typeof(DeterministicToCosmeticSyncSimOrder));
}
} }
} }

View file

@ -1,6 +1,7 @@
using System; using System;
using Unity.Jobs; using Unity.Jobs;
using RobocraftX.SimulationModeState;
using RobocraftX.StateSync; using RobocraftX.StateSync;
using Svelto.ECS; using Svelto.ECS;
@ -33,6 +34,15 @@ namespace GamecraftModdingAPI.Events
.Init(new ModEventEntityStruct { type = type }); .Init(new ModEventEntityStruct { type = type });
} }
public void EmitIfBuildMode()
{
//Logging.MetaDebugLog($"nextSimulationMode: {entitiesDB.QueryUniqueEntity<SimulationModeStateEntityStruct>(SimulationModeStateExclusiveGroups.GAME_STATE_GROUP).nextSimulationMode}");
if (entitiesDB.QueryUniqueEntity<SimulationModeStateEntityStruct>(SimulationModeStateExclusiveGroups.GAME_STATE_GROUP).nextSimulationMode == SimulationMode.Build)
{
Emit();
}
}
public JobHandle OnInitializeBuildMode() public JobHandle OnInitializeBuildMode()
{ {
Emit(); Emit();

View file

@ -1,6 +1,7 @@
using System; using System;
using Unity.Jobs; using Unity.Jobs;
using RobocraftX.SimulationModeState;
using RobocraftX.StateSync; using RobocraftX.StateSync;
using Svelto.ECS; using Svelto.ECS;
@ -33,6 +34,14 @@ namespace GamecraftModdingAPI.Events
.Init(new ModEventEntityStruct { type = type }); .Init(new ModEventEntityStruct { type = type });
} }
public void EmitIfSimMode()
{
if (entitiesDB.QueryUniqueEntity<SimulationModeStateEntityStruct>(SimulationModeStateExclusiveGroups.GAME_STATE_GROUP).nextSimulationMode == SimulationMode.Simulation)
{
Emit();
}
}
public JobHandle OnInitializeSimulationMode() public JobHandle OnInitializeSimulationMode()
{ {
Emit(); Emit();

View file

@ -88,9 +88,6 @@
<Reference Include="Havok.Physics.Hybrid"> <Reference Include="Havok.Physics.Hybrid">
<HintPath>..\ref\Gamecraft_Data\Managed\Havok.Physics.Hybrid.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Havok.Physics.Hybrid.dll</HintPath>
</Reference> </Reference>
<Reference Include="HdgRemoteDebugRuntime">
<HintPath>..\ref\Gamecraft_Data\Managed\HdgRemoteDebugRuntime.dll</HintPath>
</Reference>
<Reference Include="IllusionInjector"> <Reference Include="IllusionInjector">
<HintPath>..\ref\Gamecraft_Data\Managed\IllusionInjector.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\IllusionInjector.dll</HintPath>
</Reference> </Reference>
@ -121,9 +118,6 @@
<Reference Include="Rewired_Windows"> <Reference Include="Rewired_Windows">
<HintPath>..\ref\Gamecraft_Data\Managed\Rewired_Windows.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Rewired_Windows.dll</HintPath>
</Reference> </Reference>
<Reference Include="Robocraft.MainGame.AutoEnterSimulation">
<HintPath>..\ref\Gamecraft_Data\Managed\Robocraft.MainGame.AutoEnterSimulation.dll</HintPath>
</Reference>
<Reference Include="RobocraftX.AccountPreferences"> <Reference Include="RobocraftX.AccountPreferences">
<HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.AccountPreferences.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.AccountPreferences.dll</HintPath>
</Reference> </Reference>
@ -148,15 +142,9 @@
<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>
<Reference Include="RobocraftX.EntityStreamUtility">
<HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.EntityStreamUtility.dll</HintPath>
</Reference>
<Reference Include="RobocraftX.FrontEnd"> <Reference Include="RobocraftX.FrontEnd">
<HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.FrontEnd.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.FrontEnd.dll</HintPath>
</Reference> </Reference>
<Reference Include="RobocraftX.GameSignalHandling">
<HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.GameSignalHandling.dll</HintPath>
</Reference>
<Reference Include="RobocraftX.GUI.DebugDisplay"> <Reference Include="RobocraftX.GUI.DebugDisplay">
<HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.GUI.DebugDisplay.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.GUI.DebugDisplay.dll</HintPath>
</Reference> </Reference>
@ -169,18 +157,12 @@
<Reference Include="RobocraftX.GUI.ScaleGhost"> <Reference Include="RobocraftX.GUI.ScaleGhost">
<HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.GUI.ScaleGhost.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.GUI.ScaleGhost.dll</HintPath>
</Reference> </Reference>
<Reference Include="RobocraftX.GUI.SignalLabel">
<HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.GUI.SignalLabel.dll</HintPath>
</Reference>
<Reference Include="RobocraftX.GUIs.WorkshopPrefabs"> <Reference Include="RobocraftX.GUIs.WorkshopPrefabs">
<HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.GUIs.WorkshopPrefabs.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.GUIs.WorkshopPrefabs.dll</HintPath>
</Reference> </Reference>
<Reference Include="RobocraftX.Input"> <Reference Include="RobocraftX.Input">
<HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.Input.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.Input.dll</HintPath>
</Reference> </Reference>
<Reference Include="RobocraftX.Inventory">
<HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.Inventory.dll</HintPath>
</Reference>
<Reference Include="RobocraftX.MachineEditor"> <Reference Include="RobocraftX.MachineEditor">
<HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.MachineEditor.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.MachineEditor.dll</HintPath>
</Reference> </Reference>
@ -214,9 +196,6 @@
<Reference Include="RobocraftX.Player"> <Reference Include="RobocraftX.Player">
<HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.Player.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.Player.dll</HintPath>
</Reference> </Reference>
<Reference Include="RobocraftX.Priority">
<HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.Priority.dll</HintPath>
</Reference>
<Reference Include="RobocraftX.Rendering"> <Reference Include="RobocraftX.Rendering">
<HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.Rendering.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.Rendering.dll</HintPath>
</Reference> </Reference>
@ -286,12 +265,6 @@
<Reference Include="Unity.Entities.Hybrid"> <Reference Include="Unity.Entities.Hybrid">
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.Entities.Hybrid.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Unity.Entities.Hybrid.dll</HintPath>
</Reference> </Reference>
<Reference Include="Unity.Entities.Properties">
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.Entities.Properties.dll</HintPath>
</Reference>
<Reference Include="Unity.Entities.StaticTypeRegistry">
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.Entities.StaticTypeRegistry.dll</HintPath>
</Reference>
<Reference Include="Unity.Jobs"> <Reference Include="Unity.Jobs">
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.Jobs.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Unity.Jobs.dll</HintPath>
</Reference> </Reference>
@ -322,9 +295,6 @@
<Reference Include="Unity.RenderPipelines.Core.ShaderLibrary"> <Reference Include="Unity.RenderPipelines.Core.ShaderLibrary">
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.RenderPipelines.Core.ShaderLibrary.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Unity.RenderPipelines.Core.ShaderLibrary.dll</HintPath>
</Reference> </Reference>
<Reference Include="Unity.RenderPipelines.Lightweight.Runtime">
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.RenderPipelines.Lightweight.Runtime.dll</HintPath>
</Reference>
<Reference Include="Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary"> <Reference Include="Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary">
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary.dll</HintPath>
</Reference> </Reference>
@ -394,9 +364,6 @@
<Reference Include="UnityEngine.DSPGraphModule"> <Reference Include="UnityEngine.DSPGraphModule">
<HintPath>..\ref\Gamecraft_Data\Managed\UnityEngine.DSPGraphModule.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\UnityEngine.DSPGraphModule.dll</HintPath>
</Reference> </Reference>
<Reference Include="UnityEngine.FileSystemHttpModule">
<HintPath>..\ref\Gamecraft_Data\Managed\UnityEngine.FileSystemHttpModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.GameCenterModule"> <Reference Include="UnityEngine.GameCenterModule">
<HintPath>..\ref\Gamecraft_Data\Managed\UnityEngine.GameCenterModule.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\UnityEngine.GameCenterModule.dll</HintPath>
</Reference> </Reference>
@ -539,6 +506,12 @@
<HintPath>..\ref\Gamecraft_Data\Managed\VisualProfiler.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\VisualProfiler.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="Assembly-CSharp">
<HintPath>..\ref\Gamecraft_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\ref\Gamecraft_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
<!--End Dependencies--> <!--End Dependencies-->

View file

@ -56,8 +56,8 @@ namespace GamecraftModdingAPI
EventManager.AddEventEmitter(new SimpleEventEmitterEngine(EventType.Game, "GamecraftModdingAPIGameActivatedEventEmitter", false)); EventManager.AddEventEmitter(new SimpleEventEmitterEngine(EventType.Game, "GamecraftModdingAPIGameActivatedEventEmitter", false));
EventManager.AddEventEmitter(new SimpleEventEmitterEngine(EventType.GameReloaded, "GamecraftModdingAPIGameReloadedEventEmitter", false)); EventManager.AddEventEmitter(new SimpleEventEmitterEngine(EventType.GameReloaded, "GamecraftModdingAPIGameReloadedEventEmitter", false));
EventManager.AddEventEmitter(new SimpleEventEmitterEngine(EventType.GameSwitchedTo, "GamecraftModdingAPIGameSwitchedToEventEmitter", false)); EventManager.AddEventEmitter(new SimpleEventEmitterEngine(EventType.GameSwitchedTo, "GamecraftModdingAPIGameSwitchedToEventEmitter", false));
EventManager.AddEventEmitter(DeterministicStepComposeEngineGroupsPatch.buildEngine); EventManager.AddEventEmitter(GameHostTransitionDeterministicGroupEnginePatch.buildEngine);
EventManager.AddEventEmitter(DeterministicStepComposeEngineGroupsPatch.simEngine); EventManager.AddEventEmitter(GameHostTransitionDeterministicGroupEnginePatch.simEngine);
// init block implementors // init block implementors
Logging.MetaDebugLog($"Initializing Blocks"); Logging.MetaDebugLog($"Initializing Blocks");
Blocks.Movement.Init(); Blocks.Movement.Init();

View file

@ -41,6 +41,8 @@ namespace GamecraftModdingAPI.Tests
public void OnApplicationStart() public void OnApplicationStart()
{ {
FileLog.Reset();
HarmonyInstance.DEBUG = true;
GamecraftModdingAPI.Main.Init(); GamecraftModdingAPI.Main.Init();
// in case Steam is not installed/running // in case Steam is not installed/running
// this will crash the game slightly later during startup // this will crash the game slightly later during startup

View file

@ -7,7 +7,6 @@ using System.Threading.Tasks;
using DataLoader; using DataLoader;
using Harmony; using Harmony;
using RobocraftX; using RobocraftX;
using RobocraftX.Blocks.GUI;
using RobocraftX.Common.Utilities; using RobocraftX.Common.Utilities;
using RobocraftX.GUI; using RobocraftX.GUI;
using RobocraftX.Multiplayer; using RobocraftX.Multiplayer;
@ -137,22 +136,6 @@ namespace GamecraftModdingAPI.Utility
} }
} }
public static LabelResourceManager _textBlockLabelResourceManager
{
get
{
return (LabelResourceManager)fgcr?.Field("_textBlockLabelResourceManager").GetValue();
}
}
public static LabelResourceManager _labelResourceManager
{
get
{
return (LabelResourceManager)fgcr?.Field("_labelResourceManager").GetValue();
}
}
public static ECSGameObjectResourceManager _eCsGameObjectResourceManager public static ECSGameObjectResourceManager _eCsGameObjectResourceManager
{ {
get get

View file

@ -123,20 +123,22 @@ namespace GamecraftModdingAPI.Utility
Svelto.Console.LogWarning(obj.ToString()); Svelto.Console.LogWarning(obj.ToString());
} }
[Obsolete("SystemLog was removed from Svelto.Common")]
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void SystemLog(string msg) public static void SystemLog(string msg)
{ {
Svelto.Console.SystemLog(msg); Svelto.Console.Log(msg);
} }
/// <summary> /// <summary>
/// Write a message to stdout (ie the terminal, like Command Prompt or PowerShell) /// Write a message to stdout (ie the terminal, like Command Prompt or PowerShell)
/// </summary> /// </summary>
/// <param name="obj">The object to log</param> /// <param name="obj">The object to log</param>
[Obsolete("SystemLog was removed from Svelto.Common")]
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void SystemLog(object obj) public static void SystemLog(object obj)
{ {
Svelto.Console.SystemLog(obj.ToString()); Svelto.Console.Log(obj.ToString());
} }
// descriptive logging // descriptive logging