Resolve all compile-time and patching errors, remove anticheat in singleplayer
This commit is contained in:
parent
2a1782cd82
commit
f817becc6e
13 changed files with 99 additions and 85 deletions
|
@ -175,7 +175,7 @@ namespace TechbloxModdingAPI.App
|
||||||
|
|
||||||
public static MethodBase TargetMethod()
|
public static MethodBase TargetMethod()
|
||||||
{
|
{
|
||||||
return AccessTools.Method(typeof(FullGameCompositionRoot), "GoToMenu");
|
return AccessTools.Method(typeof(FullGameCompositionRoot), "SwitchToMenu");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace TechbloxModdingAPI.Blocks
|
||||||
base(new EGID(id, CommonExclusiveGroups.ENGINE_BLOCK_BUILD_GROUP))
|
base(new EGID(id, CommonExclusiveGroups.ENGINE_BLOCK_BUILD_GROUP))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Engine's On property. May not be saved.
|
/// Gets or sets the Engine's On property. May not be saved.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -34,6 +34,7 @@ namespace TechbloxModdingAPI.Blocks
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
Techblox.BlockColours.BlockColoursCompositionRoot
|
||||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).engineOn = value;
|
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).engineOn = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -377,6 +378,6 @@ namespace TechbloxModdingAPI.Blocks
|
||||||
{
|
{
|
||||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockReadonlyComponent>(this).manualToAutoGearCoolOffTime = value;
|
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockReadonlyComponent>(this).manualToAutoGearCoolOffTime = value;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,7 +173,8 @@ namespace TechbloxModdingAPI.Blocks.Engines
|
||||||
foreach (var block in blocks)
|
foreach (var block in blocks)
|
||||||
{
|
{
|
||||||
GhostChildUtility.BuildGhostChild(in playerID, block.Id, in pos, in rot, entitiesDB,
|
GhostChildUtility.BuildGhostChild(in playerID, block.Id, in pos, in rot, entitiesDB,
|
||||||
BuildGhostBlueprintFactory, false, bssesopt.Get().buildingDroneReference);
|
BuildGhostBlueprintFactory, false, bssesopt.Get().buildingDroneReference,
|
||||||
|
FullGameFields._managers.blockLabelResourceManager);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,7 +273,8 @@ namespace TechbloxModdingAPI.Blocks.Engines
|
||||||
uint ghostChildBlockId = CommonExclusiveGroups.GetNewGhostChildBlockID();
|
uint ghostChildBlockId = CommonExclusiveGroups.GetNewGhostChildBlockID();
|
||||||
var ghostEntityReference = GhostBlockUtils.GetGhostEntityReference(sourceId.entityID, entitiesDB);
|
var ghostEntityReference = GhostBlockUtils.GetGhostEntityReference(sourceId.entityID, entitiesDB);
|
||||||
var entityInitializer = BuildGhostBlueprintFactory.Build(
|
var entityInitializer = BuildGhostBlueprintFactory.Build(
|
||||||
new EGID(ghostChildBlockId, BoxSelectExclusiveGroups.GhostChildEntitiesExclusiveGroup), /*dbStruct.DBID*/ (uint)BlockIDs.Cube);
|
new EGID(ghostChildBlockId, BoxSelectExclusiveGroups.GhostChildEntitiesExclusiveGroup), /*dbStruct.DBID*/ (uint)BlockIDs.Cube,
|
||||||
|
FullGameFields._managers.blockLabelResourceManager);
|
||||||
entityInitializer.Init(dbStruct);
|
entityInitializer.Init(dbStruct);
|
||||||
entityInitializer.Init(new GFXPrefabEntityStructGPUI(
|
entityInitializer.Init(new GFXPrefabEntityStructGPUI(
|
||||||
PrefabsID.GetOrCreatePrefabID((ushort)entityInitializer.Get<PrefabAssetIDComponent>().prefabAssetID,
|
PrefabsID.GetOrCreatePrefabID((ushort)entityInitializer.Get<PrefabAssetIDComponent>().prefabAssetID,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using RobocraftX.Common;
|
using RobocraftX.Common;
|
||||||
|
using RobocraftX.DOTS;
|
||||||
using Svelto.ECS;
|
using Svelto.ECS;
|
||||||
using Svelto.ECS.EntityStructs;
|
using Svelto.ECS.EntityStructs;
|
||||||
using Unity.Mathematics;
|
using Unity.Mathematics;
|
||||||
|
@ -39,7 +40,7 @@ namespace TechbloxModdingAPI.Blocks.Engines
|
||||||
ref PositionEntityStruct posStruct = ref this.entitiesDB.QueryEntityOrDefault<PositionEntityStruct>(block);
|
ref PositionEntityStruct posStruct = ref this.entitiesDB.QueryEntityOrDefault<PositionEntityStruct>(block);
|
||||||
ref GridRotationStruct gridStruct = ref this.entitiesDB.QueryEntityOrDefault<GridRotationStruct>(block);
|
ref GridRotationStruct gridStruct = ref this.entitiesDB.QueryEntityOrDefault<GridRotationStruct>(block);
|
||||||
ref LocalTransformEntityStruct transStruct = ref this.entitiesDB.QueryEntityOrDefault<LocalTransformEntityStruct>(block);
|
ref LocalTransformEntityStruct transStruct = ref this.entitiesDB.QueryEntityOrDefault<LocalTransformEntityStruct>(block);
|
||||||
ref UECSPhysicsEntityStruct phyStruct = ref this.entitiesDB.QueryEntityOrDefault<UECSPhysicsEntityStruct>(block);
|
ref DOTSPhysicsEntityStruct phyStruct = ref this.entitiesDB.QueryEntityOrDefault<DOTSPhysicsEntityStruct>(block);
|
||||||
// main (persistent) position
|
// main (persistent) position
|
||||||
posStruct.position = vector;
|
posStruct.position = vector;
|
||||||
// placement grid position
|
// placement grid position
|
||||||
|
@ -49,7 +50,7 @@ namespace TechbloxModdingAPI.Blocks.Engines
|
||||||
// collision position
|
// collision position
|
||||||
if (phyStruct.ID != default)
|
if (phyStruct.ID != default)
|
||||||
{ //It exists
|
{ //It exists
|
||||||
FullGameFields._physicsWorld.EntityManager.SetComponentData(phyStruct.uecsEntity, new Translation
|
FullGameFields._physicsWorld.EntityManager.SetComponentData(phyStruct.dotsEntity, new Translation
|
||||||
{
|
{
|
||||||
Value = posStruct.position
|
Value = posStruct.position
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
using RobocraftX.Common;
|
using RobocraftX.Common;
|
||||||
using RobocraftX.UECS;
|
using RobocraftX.DOTS;
|
||||||
using Svelto.ECS;
|
using Svelto.ECS;
|
||||||
using Svelto.ECS.EntityStructs;
|
using Svelto.ECS.EntityStructs;
|
||||||
using Unity.Mathematics;
|
using Unity.Mathematics;
|
||||||
|
@ -40,7 +40,7 @@ namespace TechbloxModdingAPI.Blocks.Engines
|
||||||
ref RotationEntityStruct rotStruct = ref this.entitiesDB.QueryEntityOrDefault<RotationEntityStruct>(block);
|
ref RotationEntityStruct rotStruct = ref this.entitiesDB.QueryEntityOrDefault<RotationEntityStruct>(block);
|
||||||
ref GridRotationStruct gridStruct = ref this.entitiesDB.QueryEntityOrDefault<GridRotationStruct>(block);
|
ref GridRotationStruct gridStruct = ref this.entitiesDB.QueryEntityOrDefault<GridRotationStruct>(block);
|
||||||
ref LocalTransformEntityStruct transStruct = ref this.entitiesDB.QueryEntityOrDefault<LocalTransformEntityStruct>(block);
|
ref LocalTransformEntityStruct transStruct = ref this.entitiesDB.QueryEntityOrDefault<LocalTransformEntityStruct>(block);
|
||||||
ref UECSPhysicsEntityStruct phyStruct = ref this.entitiesDB.QueryEntityOrDefault<UECSPhysicsEntityStruct>(block);
|
ref DOTSPhysicsEntityStruct phyStruct = ref this.entitiesDB.QueryEntityOrDefault<DOTSPhysicsEntityStruct>(block);
|
||||||
// main (persistent) rotation
|
// main (persistent) rotation
|
||||||
Quaternion newRotation = rotStruct.rotation;
|
Quaternion newRotation = rotStruct.rotation;
|
||||||
newRotation.eulerAngles = vector;
|
newRotation.eulerAngles = vector;
|
||||||
|
@ -52,7 +52,7 @@ namespace TechbloxModdingAPI.Blocks.Engines
|
||||||
// collision rotation
|
// collision rotation
|
||||||
if (phyStruct.ID != default)
|
if (phyStruct.ID != default)
|
||||||
{ //It exists
|
{ //It exists
|
||||||
FullGameFields._physicsWorld.EntityManager.SetComponentData(phyStruct.uecsEntity,
|
FullGameFields._physicsWorld.EntityManager.SetComponentData(phyStruct.dotsEntity,
|
||||||
new Unity.Transforms.Rotation
|
new Unity.Transforms.Rotation
|
||||||
{
|
{
|
||||||
Value = rotStruct.rotation
|
Value = rotStruct.rotation
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using RobocraftX.Common;
|
using RobocraftX.Common;
|
||||||
using RobocraftX.UECS;
|
using RobocraftX.DOTS;
|
||||||
using Svelto.ECS;
|
using Svelto.ECS;
|
||||||
using Unity.Entities;
|
using Unity.Entities;
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ namespace TechbloxModdingAPI.Blocks.Engines
|
||||||
{
|
{
|
||||||
public class ScalingEngine : IApiEngine
|
public class ScalingEngine : IApiEngine
|
||||||
{
|
{
|
||||||
private static IReactOnAddAndRemove<UECSPhysicsEntityCreationStruct> physicsEngine;
|
private static IReactOnAddAndRemove<DOTSPhysicsEntityCreationStruct> physicsEngine;
|
||||||
|
|
||||||
public void Ready()
|
public void Ready()
|
||||||
{
|
{
|
||||||
|
@ -34,16 +34,16 @@ namespace TechbloxModdingAPI.Blocks.Engines
|
||||||
if (_entityManager == default)
|
if (_entityManager == default)
|
||||||
_entityManager = FullGameFields._physicsWorld.EntityManager;
|
_entityManager = FullGameFields._physicsWorld.EntityManager;
|
||||||
//Assuming the block exists
|
//Assuming the block exists
|
||||||
var entity = entitiesDB.QueryEntity<UECSPhysicsEntityStruct>(egid).uecsEntity;
|
var entity = entitiesDB.QueryEntity<DOTSPhysicsEntityStruct>(egid).dotsEntity;
|
||||||
var pes = new UECSPhysicsEntityCreationStruct();
|
var pes = new DOTSPhysicsEntityCreationStruct();
|
||||||
physicsEngine.Add(ref pes, egid); //Create new UECS entity
|
physicsEngine.Add(ref pes, egid); //Create new DOTS entity
|
||||||
_entityManager.DestroyEntity(entity);
|
_entityManager.DestroyEntity(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPatch]
|
[HarmonyPatch]
|
||||||
class PhysicsEnginePatch
|
class PhysicsEnginePatch
|
||||||
{
|
{
|
||||||
static void Postfix(IReactOnAddAndRemove<UECSPhysicsEntityCreationStruct> __instance)
|
static void Postfix(IReactOnAddAndRemove<DOTSPhysicsEntityCreationStruct> __instance)
|
||||||
{
|
{
|
||||||
physicsEngine = __instance;
|
physicsEngine = __instance;
|
||||||
Logging.MetaDebugLog("Physics engine injected.");
|
Logging.MetaDebugLog("Physics engine injected.");
|
||||||
|
@ -51,7 +51,7 @@ namespace TechbloxModdingAPI.Blocks.Engines
|
||||||
|
|
||||||
static MethodBase TargetMethod(Harmony instance)
|
static MethodBase TargetMethod(Harmony instance)
|
||||||
{
|
{
|
||||||
return AccessTools.Method("RobocraftX.StateSync.HandleUECSPhysicEntitiesWithPrefabCreationEngine" +
|
return AccessTools.Method("RobocraftX.StateSync.HandleDOTSPhysicEntitiesWithPrefabCreationEngine" +
|
||||||
":Ready");
|
":Ready");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Reflection;
|
|
||||||
|
|
||||||
using HarmonyLib;
|
|
||||||
using Svelto.ECS;
|
|
||||||
using RobocraftX.CR.MainGame;
|
|
||||||
using RobocraftX.Multiplayer;
|
|
||||||
using RobocraftX.StateSync;
|
|
||||||
using TechbloxModdingAPI.Utility;
|
|
||||||
|
|
||||||
namespace TechbloxModdingAPI.Commands
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Patch of RobocraftX.CR.MainGame.MainGameCompositionRoot.DeterministicCompose<T>()
|
|
||||||
/// Initializes custom commands
|
|
||||||
/// </summary>
|
|
||||||
[HarmonyPatch]
|
|
||||||
static class CommandPatch
|
|
||||||
{
|
|
||||||
public static void Postfix(StateSyncRegistrationHelper stateSyncReg)
|
|
||||||
{
|
|
||||||
/*CommandLineCompositionRoot.Compose(contextHolder, stateSyncReg.enginesRoot, reloadGame, multiplayerParameters,
|
|
||||||
stateSyncReg); - uREPL C# compilation not supported anymore */
|
|
||||||
var enginesRoot = stateSyncReg.enginesRoot;
|
|
||||||
CommandManager.RegisterEngines(enginesRoot);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MethodInfo TargetMethod()
|
|
||||||
{
|
|
||||||
return AccessTools.Method(typeof(MainGameCompositionRoot), "DeterministicCompose")
|
|
||||||
.MakeGenericMethod(typeof(object));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -6,12 +6,13 @@ using RobocraftX.FrontEnd;
|
||||||
using RobocraftX.StateSync;
|
using RobocraftX.StateSync;
|
||||||
using Svelto.ECS;
|
using Svelto.ECS;
|
||||||
using Svelto.ECS.Schedulers;
|
using Svelto.ECS.Schedulers;
|
||||||
|
using TechbloxModdingAPI.Commands;
|
||||||
using TechbloxModdingAPI.Utility;
|
using TechbloxModdingAPI.Utility;
|
||||||
|
|
||||||
namespace TechbloxModdingAPI.Engines
|
namespace TechbloxModdingAPI.Engines
|
||||||
{
|
{
|
||||||
[HarmonyPatch]
|
[HarmonyPatch]
|
||||||
class GameLoadedEnginePatch
|
static class GameLoadedTimeStoppedEnginePatch
|
||||||
{
|
{
|
||||||
public static EntitiesSubmissionScheduler Scheduler { get; private set; }
|
public static EntitiesSubmissionScheduler Scheduler { get; private set; }
|
||||||
public static void Postfix(StateSyncRegistrationHelper stateSyncReg)
|
public static void Postfix(StateSyncRegistrationHelper stateSyncReg)
|
||||||
|
@ -19,11 +20,30 @@ namespace TechbloxModdingAPI.Engines
|
||||||
// register all game engines, including deterministic
|
// register all game engines, including deterministic
|
||||||
GameEngineManager.RegisterEngines(stateSyncReg);
|
GameEngineManager.RegisterEngines(stateSyncReg);
|
||||||
Scheduler = stateSyncReg.enginesRoot.scheduler;
|
Scheduler = stateSyncReg.enginesRoot.scheduler;
|
||||||
|
// register command engines
|
||||||
|
/*CommandLineCompositionRoot.Compose(contextHolder, stateSyncReg.enginesRoot, reloadGame, multiplayerParameters,
|
||||||
|
stateSyncReg); - uREPL C# compilation not supported anymore */
|
||||||
|
CommandManager.RegisterEngines(stateSyncReg.enginesRoot);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MethodBase TargetMethod()
|
public static MethodBase TargetMethod()
|
||||||
{
|
{
|
||||||
return AccessTools.Method(typeof(MainGameCompositionRoot), "DeterministicCompose").MakeGenericMethod(typeof(object));
|
return AccessTools.Method(typeof(MainGameCompositionRoot), "DeterministicTimeStoppedCompose").MakeGenericMethod(typeof(object));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch]
|
||||||
|
static class GameLoadedTimeRunningEnginePatch
|
||||||
|
{
|
||||||
|
public static EntitiesSubmissionScheduler Scheduler { get; private set; }
|
||||||
|
public static void Postfix(StateSyncRegistrationHelper stateSyncReg)
|
||||||
|
{
|
||||||
|
GameLoadedTimeStoppedEnginePatch.Postfix(stateSyncReg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MethodBase TargetMethod()
|
||||||
|
{
|
||||||
|
return AccessTools.Method(typeof(MainGameCompositionRoot), "DeterministicTimeRunningCompose").MakeGenericMethod(typeof(object));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
|
||||||
using RobocraftX;
|
using RobocraftX;
|
||||||
using RobocraftX.Schedulers;
|
|
||||||
using RobocraftX.Services;
|
using RobocraftX.Services;
|
||||||
using Svelto.Context;
|
using Svelto.Context;
|
||||||
using Svelto.Tasks.ExtraLean;
|
using Svelto.Tasks;
|
||||||
|
|
||||||
using TechbloxModdingAPI.App;
|
using TechbloxModdingAPI.App;
|
||||||
using TechbloxModdingAPI.Blocks;
|
using TechbloxModdingAPI.Blocks;
|
||||||
using TechbloxModdingAPI.Events;
|
|
||||||
using TechbloxModdingAPI.Tasks;
|
using TechbloxModdingAPI.Tasks;
|
||||||
using TechbloxModdingAPI.Utility;
|
using TechbloxModdingAPI.Utility;
|
||||||
|
|
||||||
|
@ -78,9 +78,20 @@ namespace TechbloxModdingAPI
|
||||||
// init UI
|
// init UI
|
||||||
Interface.IMGUI.Constants.Init();
|
Interface.IMGUI.Constants.Init();
|
||||||
Interface.IMGUI.IMGUIManager.Init();
|
Interface.IMGUI.IMGUIManager.Init();
|
||||||
|
Logging.MetaDebugLog("Initializing anti-anticheat");
|
||||||
|
var type = AccessTools.TypeByName("Techblox.Services.Eos.Anticheat.Client.Services.AnticheatClientService");
|
||||||
|
harmony.Patch(type.GetConstructors()[0], new HarmonyMethod(((Func<bool>) AntiAntiCheat).Method));
|
||||||
|
harmony.Patch(AccessTools.Method(type, "Shutdown"), new HarmonyMethod(((Func<bool>) AntiAntiCheat).Method));
|
||||||
|
harmony.Patch(AccessTools.Method(type, "StartProtectedSession"), new HarmonyMethod(((AntiAnticheatDelegate) AntiAntiCheat).Method));
|
||||||
|
harmony.Patch(AccessTools.Method(type, "StopProtectedSession"), new HarmonyMethod(((AntiAnticheatDelegateBool) AntiAntiCheat).Method));
|
||||||
|
harmony.Patch(AccessTools.Method("Techblox.Services.Eos.Anticheat.Client.EosGetPendingMessagesToSendServiceRequest:Execute"), new HarmonyMethod(((AntiAnticheatDelegateTask)AntiAntiCheatTask).Method));
|
||||||
Logging.MetaLog($"{currentAssembly.GetName().Name} v{currentAssembly.GetName().Version} initialized");
|
Logging.MetaLog($"{currentAssembly.GetName().Name} v{currentAssembly.GetName().Version} initialized");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public delegate bool AntiAnticheatDelegate(ref object __result);
|
||||||
|
public delegate bool AntiAnticheatDelegateBool(ref bool __result);
|
||||||
|
public delegate bool AntiAnticheatDelegateTask(ref IEnumerator<TaskContract> __result);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shuts down & cleans up the TechbloxModdingAPI.
|
/// Shuts down & cleans up the TechbloxModdingAPI.
|
||||||
/// Call this as late as possible before Techblox quits.
|
/// Call this as late as possible before Techblox quits.
|
||||||
|
@ -109,5 +120,34 @@ namespace TechbloxModdingAPI
|
||||||
ErrorBuilder.DisplayMustQuitError("Failed to patch Techblox!\n" +
|
ErrorBuilder.DisplayMustQuitError("Failed to patch Techblox!\n" +
|
||||||
"Make sure you're using the latest version of TechbloxModdingAPI or disable mods if the API isn't released yet.");
|
"Make sure you're using the latest version of TechbloxModdingAPI or disable mods if the API isn't released yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool AntiAntiCheat() => false;
|
||||||
|
|
||||||
|
private static bool AntiAntiCheat(ref object __result)
|
||||||
|
{
|
||||||
|
var targetType =
|
||||||
|
AccessTools.TypeByName("Techblox.Services.Eos.Anticheat.Client.Services.StartProtectedSessionResult");
|
||||||
|
var target = Activator.CreateInstance(targetType);
|
||||||
|
targetType.GetField("Success").SetValue(target, true);
|
||||||
|
__result = target;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool AntiAntiCheat(ref bool __result)
|
||||||
|
{
|
||||||
|
__result = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool AntiAntiCheatTask(ref IEnumerator<TaskContract> __result)
|
||||||
|
{
|
||||||
|
IEnumerator<TaskContract> Func()
|
||||||
|
{
|
||||||
|
yield return Yield.It;
|
||||||
|
}
|
||||||
|
|
||||||
|
__result = Func();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,8 +187,6 @@ namespace TechbloxModdingAPI
|
||||||
public float Mass =>
|
public float Mass =>
|
||||||
1f / playerEngine.GetCharacterStruct<RigidBodyEntityStruct>(Id).Get().physicsMass.InverseMass;
|
1f / playerEngine.GetCharacterStruct<RigidBodyEntityStruct>(Id).Get().physicsMass.InverseMass;
|
||||||
|
|
||||||
private float _ping = -1f;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The player's latest network ping time.
|
/// The player's latest network ping time.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -197,12 +195,7 @@ namespace TechbloxModdingAPI
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var opt = playerEngine.GetPlayerStruct<PlayerNetworkStatsEntityStruct>(Id, Type);
|
return playerEngine.GetPing() / 1000f;
|
||||||
if (opt)
|
|
||||||
{
|
|
||||||
_ping = opt.Get().lastPingTimeSinceLevelLoad ?? _ping;
|
|
||||||
}
|
|
||||||
return _ping;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ using RobocraftX.Physics;
|
||||||
using RobocraftX.Blocks.Ghost;
|
using RobocraftX.Blocks.Ghost;
|
||||||
using Gamecraft.GUI.HUDFeedbackBlocks;
|
using Gamecraft.GUI.HUDFeedbackBlocks;
|
||||||
using RobocraftX.Blocks;
|
using RobocraftX.Blocks;
|
||||||
|
using RobocraftX.Multiplayer;
|
||||||
using RobocraftX.PilotSeat;
|
using RobocraftX.PilotSeat;
|
||||||
using Svelto.ECS;
|
using Svelto.ECS;
|
||||||
using Techblox.Camera;
|
using Techblox.Camera;
|
||||||
|
@ -227,5 +228,12 @@ namespace TechbloxModdingAPI.Players
|
||||||
opt.Get().instantExit = true;
|
opt.Get().instantExit = true;
|
||||||
entitiesDB.PublishEntityChange<CharacterPilotSeatEntityStruct>(egid);
|
entitiesDB.PublishEntityChange<CharacterPilotSeatEntityStruct>(egid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public uint GetPing()
|
||||||
|
{
|
||||||
|
return entitiesDB
|
||||||
|
.QueryUniqueEntity<NetworkStatsEntityStruct>(MultiplayerExclusiveGroups.MultiplayerStateGroup)
|
||||||
|
.networkStats.PingMs;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -360,15 +360,6 @@ namespace TechbloxModdingAPI.Tests
|
||||||
return modsString = sb.ToString();
|
return modsString = sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnUpdate()
|
|
||||||
{
|
|
||||||
if (UnityEngine.Input.GetKeyDown(KeyCode.End))
|
|
||||||
{
|
|
||||||
Console.WriteLine("Pressed button to toggle console");
|
|
||||||
FakeInput.CustomInput(new LocalCosmeticInputEntityComponent {commandLineToggleInput = true});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[HarmonyPatch]
|
[HarmonyPatch]
|
||||||
public class MinimumSpecsPatch
|
public class MinimumSpecsPatch
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,20 +1,12 @@
|
||||||
using System;
|
using DataLoader;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
using DataLoader;
|
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using RobocraftX;
|
using RobocraftX;
|
||||||
using RobocraftX.Common.Utilities;
|
using RobocraftX.CR.MainGame;
|
||||||
using RobocraftX.GUI;
|
using RobocraftX.GUI;
|
||||||
using RobocraftX.Multiplayer;
|
using RobocraftX.Multiplayer;
|
||||||
using RobocraftX.Rendering;
|
|
||||||
using Svelto.Context;
|
using Svelto.Context;
|
||||||
using Svelto.DataStructures;
|
using Svelto.DataStructures;
|
||||||
using Svelto.ECS;
|
using Svelto.ECS;
|
||||||
using Svelto.ECS.Schedulers;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Unity.Entities;
|
using Unity.Entities;
|
||||||
using Unity.Physics.Systems;
|
using Unity.Physics.Systems;
|
||||||
|
@ -128,11 +120,11 @@ namespace TechbloxModdingAPI.Utility
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ECSGameObjectResourceManager _eCsGameObjectResourceManager
|
public static ECSResourceManagers _managers
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return (ECSGameObjectResourceManager)fgcr?.Field("_eCsGameObjectResourceManager").GetValue();
|
return (ECSResourceManagers)fgcr?.Field("_managers").GetValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue