diff --git a/extracommands/ExtraCommands.csproj b/extracommands/ExtraCommands.csproj
index c51e9b7..069e0d4 100644
--- a/extracommands/ExtraCommands.csproj
+++ b/extracommands/ExtraCommands.csproj
@@ -44,7 +44,7 @@
..\ref\Gamecraft_Data\Managed\RobocraftX.Input.dll
- ..\ref\RobocraftX.MachineEditor.dll
+ ..\ref\Gamecraft_Data\Managed\RobocraftX.MachineEditor.dll
..\ref\Gamecraft_Data\Managed\RobocraftX.MainGame.dll
@@ -62,7 +62,7 @@
..\ref\Gamecraft_Data\Managed\RobocraftX.Physics.dll
- ..\ref\RobocraftX.Services.dll
+ ..\ref\Gamecraft_Data\Managed\RobocraftX.Services.dll
..\ref\Gamecraft_Data\Managed\RobocraftX.StateSync.dll
diff --git a/extracommands/RotatePlayerCommandEngine.cs b/extracommands/RotatePlayerCommandEngine.cs
index 3a0da6e..a3a4122 100644
--- a/extracommands/RotatePlayerCommandEngine.cs
+++ b/extracommands/RotatePlayerCommandEngine.cs
@@ -9,7 +9,6 @@ using UnityEngine;
using uREPL;
using Svelto.Context;
using RobocraftX;
-using Svelto.ECS.EntityStructs;
using Unity.Mathematics;
using RobocraftX.Character.Camera;
using RobocraftX.Character.Factories;
@@ -36,10 +35,9 @@ namespace ExtraCommands.Basics
private void RotateAbsoluteCommand(float vertical, float horizontal)
{
- uint count;
- CharacterCameraEntityStruct[] cameras = entitiesDB.QueryEntities(CameraExclusiveGroups.VisualCameraGroup, out count);
+ EntityCollection cameras = entitiesDB.QueryEntities(CameraExclusiveGroups.VisualCameraGroup);
int num2 = 0;
- while ((long)num2 < (long)((ulong)count))
+ while (num2 < cameras.length)
{
cameras[num2].eulerRotation.x = vertical;
cameras[num2].eulerRotation.y = horizontal;
@@ -60,12 +58,11 @@ namespace ExtraCommands.Basics
private void RotateRelativeCommand(float vertical, float horizontal)
{
float2 angleDelta = new float2(vertical, horizontal);
- uint count;
- ValueTuple tuple = this.entitiesDB.QueryEntities(CameraExclusiveGroups.VisualCameraGroup, out count);
- CharacterCameraSettingsEntityStruct[] settings = tuple.Item1;
- CharacterCameraEntityStruct[] cameras = tuple.Item2;
+ EntityCollection tuple = this.entitiesDB.QueryEntities(CameraExclusiveGroups.VisualCameraGroup);
+ EntityCollection settings = tuple.Item1;
+ EntityCollection cameras = tuple.Item2;
int num2 = 0;
- while ((long)num2 < (long)((ulong)count))
+ while (num2 < cameras.length)
{
CharacterCameraMovementUtility.UpdateCameraRotationFromDelta(ref cameras[num2], in settings[num2], angleDelta);
// TODO: Multiplayer compatibility
diff --git a/extracommands/SetScaleCommandEngine.cs b/extracommands/SetScaleCommandEngine.cs
index 211f3b5..529d099 100644
--- a/extracommands/SetScaleCommandEngine.cs
+++ b/extracommands/SetScaleCommandEngine.cs
@@ -1,6 +1,7 @@
using System;
using System.Linq;
using System.Reflection;
+using GamecraftModdingAPI.Commands;
using Harmony;
using RobocraftX.GUI.CommandLine;
using RobocraftX.Multiplayer;
@@ -22,16 +23,15 @@ using Unity.Mathematics;
namespace ExtraCommands.Basics
{
[CustomCommand("SetScale")]
- class SetScaleCommandEngine : CustomCommandEngine
+ class SetScaleCommandEngine : ICustomCommandEngine
{
- public SetScaleCommandEngine(UnityContext ctxHolder, EnginesRoot enginesRoot, World physW, Action reloadGame, MultiplayerInitParameters mpParams) : base(ctxHolder, enginesRoot, physW, reloadGame, mpParams)
+
+ public void Ready()
{
+ CommandRegistrationHelper.Register("SetScale", SetScaleCommand, "Set the scale for the next block. Use 0 0 0 to reset. The displayed cube is uniformly scaled until placed.");
}
- public override void Ready()
- {
- CustomCommandUtility.Register("SetScale", SetScaleCommand, "Set the scale for the next block. Use 0 0 0 to reset. The displayed cube is uniformly scaled until placed.");
- }
+ public IEntitiesDB entitiesDB { get; set; }
private static float3 _scale;
//private HarmonyInstance harmony;
@@ -49,19 +49,17 @@ namespace ExtraCommands.Basics
}*/
_scale = new float3(x, y, z);
- GhostScalingEntityStruct[] scalings =
+ EntityCollection scalings =
entitiesDB.QueryEntities(
- (ExclusiveGroup.ExclusiveGroupStruct) NamedExclusiveGroup.Group, out uint count);
- Console.WriteLine("Found " + count + "/" + scalings.Length + " scalings.");
+ (ExclusiveGroupStruct) NamedExclusiveGroup.Group);
+ Console.WriteLine("Found " + scalings.length + " scalings.");
var egid = new EGID(0, NamedExclusiveGroup.Group);
- for (int index = 0; index < count; index++)
+ for (int index = 0; index < scalings.length; index++)
{
Console.WriteLine("G scaling " + index + ": " + scalings[index].ghostScale);
- ref var scaling = ref entitiesDB.QueryEntities(
- (ExclusiveGroup.ExclusiveGroupStruct) NamedExclusiveGroup.Group, out _)[index];
+ ref var scaling = ref entitiesDB.QueryEntity(egid);
Console.WriteLine("Scaling " + index + ": " + scaling);
- ref var scale = ref entitiesDB.QueryEntities(
- (ExclusiveGroup.ExclusiveGroupStruct) NamedExclusiveGroup.Group, out _)[index];
+ ref var scale = ref entitiesDB.QueryEntity(egid);
Console.WriteLine("Scale " + index + ": " + scale.snapGridScale);
UpdateScale(ref scale, ref scaling, ref scalings[index], egid);
}
@@ -87,9 +85,9 @@ namespace ExtraCommands.Basics
Console.WriteLine("Scale updated (" + scaling.scale + ")");
}
- public override void Dispose()
+ public void Dispose()
{
- CustomCommandUtility.Unregister("SetScale");
+ CommandRegistrationHelper.Unregister("SetScale");
}
/*public void Add(ref GhostScalingEntityStruct entityView, EGID egid)
@@ -153,5 +151,8 @@ namespace ExtraCommands.Basics
.First(m => m.Name.Contains("UpdatePlacementCursorScales"));
}
}
+
+ public string Name { get; } = "SetScale";
+ public string Description { get; } = "Set the scale for the next block to be placed.";
}
}
\ No newline at end of file
diff --git a/extracommands/TeleportWaypointCommandEngine.cs b/extracommands/TeleportWaypointCommandEngine.cs
index d1a96b8..07654d7 100644
--- a/extracommands/TeleportWaypointCommandEngine.cs
+++ b/extracommands/TeleportWaypointCommandEngine.cs
@@ -34,7 +34,17 @@ namespace ExtraCommands.Waypoints
private void CreateWaypointCommand(object name)
{
- ref RigidBodyEntityStruct reference = ref entitiesDB.QueryEntity(0u, CharacterExclusiveGroups.CharacterGroup);
+ RigidBodyEntityStruct reference;
+ if (entitiesDB.TryQueryEntitiesAndIndex(0u, CharacterExclusiveGroups.OnFootGroup, out uint index,
+ out RigidBodyEntityStruct[] array)
+ || entitiesDB.TryQueryEntitiesAndIndex(0u, CharacterExclusiveGroups.InPilotSeatGroup, out index,
+ out array))
+ reference = array[index];
+ else
+ {
+ Log.Output("Player not found!");
+ return;
+ }
_waypoints[name] = new float[3] { reference.position.x, reference.position.y, reference.position.z };
uREPL.Log.Output("Saved " + name.ToString());
}
@@ -46,7 +56,13 @@ namespace ExtraCommands.Waypoints
uREPL.Log.Error("Waypoint not found");
return;
}
- float[] loc = _waypoints[name];
+
+ if (entitiesDB.Exists(0u, CharacterExclusiveGroups.InPilotSeatGroup))
+ {
+ Log.Error("Cannot teleport from a pilot seat");
+ return;
+ }
+ float[] loc = _waypoints[name];
uREPL.RuntimeCommands.Call("TeleportPlayerAbsolute", loc[0], loc[1], loc[2]);
}