Update to Techblox 2021.09.03.10.36
Removed old dependencies, including uREPL Added new block IDs Implemented basic command handling to support existing mod commands
This commit is contained in:
parent
033ebdb86d
commit
63295f82c9
17 changed files with 157 additions and 60 deletions
|
@ -232,7 +232,9 @@ namespace TechbloxModdingAPI.App
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// this likely breaks things
|
// this likely breaks things
|
||||||
GameMode.SaveGameDetails = new SaveGameDetails(GameMode.SaveGameDetails.Name, value, GameMode.SaveGameDetails.WorkshopId);
|
GameMode.SaveGameDetails = new SaveGameDetails(GameMode.SaveGameDetails.Id,
|
||||||
|
GameMode.SaveGameDetails.SaveMode, GameMode.SaveGameDetails.Name, value,
|
||||||
|
GameMode.SaveGameDetails.WorkshopId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -262,7 +264,9 @@ namespace TechbloxModdingAPI.App
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// this likely breaks things
|
// this likely breaks things
|
||||||
GameMode.SaveGameDetails = new SaveGameDetails(GameMode.SaveGameDetails.Name, GameMode.SaveGameDetails.Folder, value);
|
GameMode.SaveGameDetails = new SaveGameDetails(GameMode.SaveGameDetails.Id,
|
||||||
|
GameMode.SaveGameDetails.SaveMode, GameMode.SaveGameDetails.Name,
|
||||||
|
GameMode.SaveGameDetails.Folder, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ using RobocraftX.GUI;
|
||||||
using RobocraftX.GUI.MyGamesScreen;
|
using RobocraftX.GUI.MyGamesScreen;
|
||||||
using Svelto.ECS;
|
using Svelto.ECS;
|
||||||
using Svelto.ECS.Experimental;
|
using Svelto.ECS.Experimental;
|
||||||
using Svelto.DataStructures;
|
using Techblox.Services.Machines;
|
||||||
using TechbloxModdingAPI.Engines;
|
using TechbloxModdingAPI.Engines;
|
||||||
using TechbloxModdingAPI.Utility;
|
using TechbloxModdingAPI.Utility;
|
||||||
|
|
||||||
|
@ -82,9 +82,10 @@ namespace TechbloxModdingAPI.App
|
||||||
public bool EnterGame(string gameName, string path, ulong workshopId = 0uL, bool autoEnterSim = false)
|
public bool EnterGame(string gameName, string path, ulong workshopId = 0uL, bool autoEnterSim = false)
|
||||||
{
|
{
|
||||||
GameMode.CurrentMode = autoEnterSim ? RCXMode.Play : RCXMode.Build;
|
GameMode.CurrentMode = autoEnterSim ? RCXMode.Play : RCXMode.Build;
|
||||||
GameMode.SaveGameDetails = new SaveGameDetails(gameName, path, workshopId);
|
GameMode.SaveGameDetails = new SaveGameDetails(MachineStorageId.CreateNew().ToString(),
|
||||||
|
SaveGameMode.NewSave, gameName, path, workshopId);
|
||||||
// the private FullGameCompositionRoot.SwitchToGame() method gets passed to menu items for this reason
|
// the private FullGameCompositionRoot.SwitchToGame() method gets passed to menu items for this reason
|
||||||
AccessTools.Method(typeof(FullGameCompositionRoot), "SwitchToGame").Invoke(FullGameFields.Instance, new object[0]);
|
AccessTools.Method(typeof(FullGameCompositionRoot), "SwitchToGame").Invoke(FullGameFields.Instance, Array.Empty<object>());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -417,7 +417,7 @@ namespace TechbloxModdingAPI
|
||||||
if (e.ID != Id) return;
|
if (e.ID != Id) return;
|
||||||
Placed -= OnPlacedInit; //And we can reference it
|
Placed -= OnPlacedInit; //And we can reference it
|
||||||
InitData = default; //Remove initializer as it's no longer valid - if the block gets removed it shouldn't be used again
|
InitData = default; //Remove initializer as it's no longer valid - if the block gets removed it shouldn't be used again
|
||||||
if (copiedFrom != EGID.Empty)
|
if (copiedFrom != default)
|
||||||
BlockCloneEngine.CopyBlockStats(copiedFrom, Id);
|
BlockCloneEngine.CopyBlockStats(copiedFrom, Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,6 +150,19 @@ namespace TechbloxModdingAPI.Blocks
|
||||||
HatchbackWheel,
|
HatchbackWheel,
|
||||||
HatchbackWheelArch,
|
HatchbackWheelArch,
|
||||||
HatchbackArchSmallFlare,
|
HatchbackArchSmallFlare,
|
||||||
HatchbackArchFlare
|
HatchbackArchFlare,
|
||||||
|
TruckWheel = 246,
|
||||||
|
HatchbackWheelWideProfile,
|
||||||
|
TruckWheelRigWithSteering = 249,
|
||||||
|
TruckWheelRigNoSteering,
|
||||||
|
HatchbackDriverSeat,
|
||||||
|
HatchbackPassengerSeat,
|
||||||
|
FormulaEngine,
|
||||||
|
TruckWheelDouble = 261,
|
||||||
|
TruckWheelArch,
|
||||||
|
TruckArchSingleFlare,
|
||||||
|
FormulaWheel = 270,
|
||||||
|
FormulaWheelRear,
|
||||||
|
FormulaSeat = 277
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -48,7 +48,7 @@ namespace TechbloxModdingAPI.Blocks.Engines
|
||||||
// rendered position
|
// rendered position
|
||||||
transStruct.position = vector;
|
transStruct.position = vector;
|
||||||
// collision position
|
// collision position
|
||||||
if (phyStruct.ID != EGID.Empty)
|
if (phyStruct.ID != default)
|
||||||
{ //It exists
|
{ //It exists
|
||||||
FullGameFields._physicsWorld.EntityManager.SetComponentData(phyStruct.uecsEntity, new Translation
|
FullGameFields._physicsWorld.EntityManager.SetComponentData(phyStruct.uecsEntity, new Translation
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.Reflection;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using RobocraftX.Blocks;
|
using RobocraftX.Blocks;
|
||||||
using RobocraftX.Common;
|
using RobocraftX.Common;
|
||||||
|
using Svelto.Common;
|
||||||
using Svelto.ECS;
|
using Svelto.ECS;
|
||||||
using Svelto.ECS.Native;
|
using Svelto.ECS.Native;
|
||||||
|
|
||||||
|
@ -22,8 +23,8 @@ namespace TechbloxModdingAPI.Blocks.Engines
|
||||||
return false;
|
return false;
|
||||||
var connections = entitiesDB.QueryEntity<MachineGraphConnectionsEntityStruct>(target);
|
var connections = entitiesDB.QueryEntity<MachineGraphConnectionsEntityStruct>(target);
|
||||||
var groups = entitiesDB.FindGroups<MachineGraphConnectionsEntityStruct>();
|
var groups = entitiesDB.FindGroups<MachineGraphConnectionsEntityStruct>();
|
||||||
var connStructMapper =
|
using var connStructMapper =
|
||||||
entitiesDB.QueryNativeMappedEntities<MachineGraphConnectionsEntityStruct>(groups);
|
entitiesDB.QueryNativeMappedEntities<MachineGraphConnectionsEntityStruct>(groups, Allocator.Temp);
|
||||||
for (int i = connections.connections.Count<MachineConnectionStruct>() - 1; i >= 0; i--)
|
for (int i = connections.connections.Count<MachineConnectionStruct>() - 1; i >= 0; i--)
|
||||||
_connectionFactory.RemoveConnection(connections, i, connStructMapper);
|
_connectionFactory.RemoveConnection(connections, i, connStructMapper);
|
||||||
_entityFunctions.RemoveEntity<BlockEntityDescriptor>(target);
|
_entityFunctions.RemoveEntity<BlockEntityDescriptor>(target);
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace TechbloxModdingAPI.Blocks.Engines
|
||||||
// rendered rotation
|
// rendered rotation
|
||||||
transStruct.rotation = newRotation;
|
transStruct.rotation = newRotation;
|
||||||
// collision rotation
|
// collision rotation
|
||||||
if (phyStruct.ID != EGID.Empty)
|
if (phyStruct.ID != default)
|
||||||
{ //It exists
|
{ //It exists
|
||||||
FullGameFields._physicsWorld.EntityManager.SetComponentData(phyStruct.uecsEntity,
|
FullGameFields._physicsWorld.EntityManager.SetComponentData(phyStruct.uecsEntity,
|
||||||
new Unity.Transforms.Rotation
|
new Unity.Transforms.Rotation
|
||||||
|
|
|
@ -298,7 +298,7 @@ namespace TechbloxModdingAPI.Blocks.Engines
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return EGID.Empty;
|
return default;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OptionalRef<ChannelDataStruct> GetChannelDataStruct(EGID portID)
|
public OptionalRef<ChannelDataStruct> GetChannelDataStruct(EGID portID)
|
||||||
|
|
|
@ -83,7 +83,7 @@ namespace TechbloxModdingAPI.Blocks
|
||||||
bool flipped = false;
|
bool flipped = false;
|
||||||
// find block ports
|
// find block ports
|
||||||
EGID wire = signalEngine.MatchBlocksToWire(start.Id, end.Id, startPort, endPort);
|
EGID wire = signalEngine.MatchBlocksToWire(start.Id, end.Id, startPort, endPort);
|
||||||
if (wire == EGID.Empty)
|
if (wire == default)
|
||||||
{
|
{
|
||||||
// flip I/O around and try again
|
// flip I/O around and try again
|
||||||
wire = signalEngine.MatchBlocksToWire(end.Id, start.Id, endPort, startPort);
|
wire = signalEngine.MatchBlocksToWire(end.Id, start.Id, endPort, startPort);
|
||||||
|
@ -92,7 +92,7 @@ namespace TechbloxModdingAPI.Blocks
|
||||||
// This makes wire traversal easier, but makes logic in this class a bit more complex
|
// This makes wire traversal easier, but makes logic in this class a bit more complex
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wire != EGID.Empty)
|
if (wire != default)
|
||||||
{
|
{
|
||||||
Construct(start.Id, end.Id, startPort, endPort, wire, flipped);
|
Construct(start.Id, end.Id, startPort, endPort, wire, flipped);
|
||||||
}
|
}
|
||||||
|
@ -127,10 +127,10 @@ namespace TechbloxModdingAPI.Blocks
|
||||||
this.endBlockEGID = endBlock;
|
this.endBlockEGID = endBlock;
|
||||||
this.inputToOutput = inputToOutput;
|
this.inputToOutput = inputToOutput;
|
||||||
this.wireEGID = wire;
|
this.wireEGID = wire;
|
||||||
endPortEGID = signalEngine.MatchBlockIOToPort(startBlock, startPort, inputToOutput).Nullable()?.ID ?? EGID.Empty;
|
endPortEGID = signalEngine.MatchBlockIOToPort(startBlock, startPort, inputToOutput).Nullable()?.ID ?? default;
|
||||||
if (endPortEGID == EGID.Empty) throw new WireInvalidException("Wire end port not found");
|
if (endPortEGID == default) throw new WireInvalidException("Wire end port not found");
|
||||||
startPortEGID = signalEngine.MatchBlockIOToPort(endBlock, endPort, !inputToOutput).Nullable()?.ID ?? EGID.Empty;
|
startPortEGID = signalEngine.MatchBlockIOToPort(endBlock, endPort, !inputToOutput).Nullable()?.ID ?? default;
|
||||||
if (startPortEGID == EGID.Empty) throw new WireInvalidException("Wire start port not found");
|
if (startPortEGID == default) throw new WireInvalidException("Wire start port not found");
|
||||||
this.startPort = startPort;
|
this.startPort = startPort;
|
||||||
this.endPort = endPort;
|
this.endPort = endPort;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,6 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using uREPL;
|
|
||||||
|
|
||||||
namespace TechbloxModdingAPI.Commands
|
namespace TechbloxModdingAPI.Commands
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -16,7 +14,7 @@ namespace TechbloxModdingAPI.Commands
|
||||||
{
|
{
|
||||||
public static void Register(string name, Action action, string desc, bool noConsole = false)
|
public static void Register(string name, Action action, string desc, bool noConsole = false)
|
||||||
{
|
{
|
||||||
RuntimeCommands.Register(name, action, desc);
|
CustomCommands.Register(name, action, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Register(string name, Action<object> action, string desc, bool noConsole = false)
|
public static void Register(string name, Action<object> action, string desc, bool noConsole = false)
|
||||||
|
@ -36,42 +34,42 @@ namespace TechbloxModdingAPI.Commands
|
||||||
|
|
||||||
public static void Register<Param0>(string name, Action<Param0> action, string desc, bool noConsole = false)
|
public static void Register<Param0>(string name, Action<Param0> action, string desc, bool noConsole = false)
|
||||||
{
|
{
|
||||||
RuntimeCommands.Register<Param0>(name, action, desc);
|
CustomCommands.Register(name, action, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Register<Param0, Param1>(string name, Action<Param0, Param1> action, string desc, bool noConsole = false)
|
public static void Register<Param0, Param1>(string name, Action<Param0, Param1> action, string desc, bool noConsole = false)
|
||||||
{
|
{
|
||||||
RuntimeCommands.Register<Param0, Param1>(name, action, desc);
|
CustomCommands.Register(name, action, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Register<Param0, Param1, Param2>(string name, Action<Param0, Param1, Param2> action, string desc, bool noConsole = false)
|
public static void Register<Param0, Param1, Param2>(string name, Action<Param0, Param1, Param2> action, string desc, bool noConsole = false)
|
||||||
{
|
{
|
||||||
RuntimeCommands.Register<Param0, Param1, Param2>(name, action, desc);
|
CustomCommands.Register(name, action, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Unregister(string name, bool noConsole = false)
|
public static void Unregister(string name, bool noConsole = false)
|
||||||
{
|
{
|
||||||
RuntimeCommands.Unregister(name);
|
CustomCommands.Unregister(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Call(string name)
|
public static void Call(string name)
|
||||||
{
|
{
|
||||||
RuntimeCommands.Call(name);
|
CustomCommands.Call(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Call<Param0>(string name, Param0 param0)
|
public static void Call<Param0>(string name, Param0 param0)
|
||||||
{
|
{
|
||||||
RuntimeCommands.Call<Param0>(name, param0);
|
CustomCommands.Call(name, param0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Call<Param0, Param1>(string name, Param0 param0, Param1 param1)
|
public static void Call<Param0, Param1>(string name, Param0 param0, Param1 param1)
|
||||||
{
|
{
|
||||||
RuntimeCommands.Call<Param0, Param1>(name, param0, param1);
|
CustomCommands.Call(name, param0, param1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Call<Param0, Param1, Param2>(string name, Param0 param0, Param1 param1, Param2 param2)
|
public static void Call<Param0, Param1, Param2>(string name, Param0 param0, Param1 param1, Param2 param2)
|
||||||
{
|
{
|
||||||
RuntimeCommands.Call<Param0, Param1, Param2>(name, param0, param1, param2);
|
CustomCommands.Call(name, param0, param1, param2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
57
TechbloxModdingAPI/Commands/CustomCommands.cs
Normal file
57
TechbloxModdingAPI/Commands/CustomCommands.cs
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace TechbloxModdingAPI.Commands
|
||||||
|
{
|
||||||
|
internal static class CustomCommands
|
||||||
|
{
|
||||||
|
public struct CommandData
|
||||||
|
{
|
||||||
|
public string Name;
|
||||||
|
public string Description;
|
||||||
|
public Delegate Action;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Dictionary<string, CommandData> _commands = new Dictionary<string, CommandData>();
|
||||||
|
public static void Register(string name, Delegate action, string desc)
|
||||||
|
{
|
||||||
|
_commands.Add(name, new CommandData
|
||||||
|
{
|
||||||
|
Name = name,
|
||||||
|
Description = desc,
|
||||||
|
Action = action
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Call(string name, params object[] args)
|
||||||
|
{
|
||||||
|
if (_commands.TryGetValue(name, out var command))
|
||||||
|
{
|
||||||
|
var paramz = command.Action.Method.GetParameters();
|
||||||
|
if (paramz.Length > args.Length)
|
||||||
|
throw new CommandParameterMissingException(
|
||||||
|
$"This command requires {paramz.Length} arguments, {args.Length} given");
|
||||||
|
for (var index = 0; index < paramz.Length; index++)
|
||||||
|
{
|
||||||
|
args[index] = Convert.ChangeType(args[index], paramz[index].ParameterType);
|
||||||
|
}
|
||||||
|
|
||||||
|
command.Action.DynamicInvoke(args);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw new CommandNotFoundException($"Command {name} does not exist!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Unregister(string name)
|
||||||
|
{
|
||||||
|
_commands.Remove(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool Exists(string name) => _commands.ContainsKey(name);
|
||||||
|
|
||||||
|
public static ReadOnlyDictionary<string, CommandData> GetAllCommandData() =>
|
||||||
|
new ReadOnlyDictionary<string, CommandData>(_commands);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,39 +1,37 @@
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
using uREPL;
|
|
||||||
|
|
||||||
namespace TechbloxModdingAPI.Commands
|
namespace TechbloxModdingAPI.Commands
|
||||||
{
|
{
|
||||||
public static class ExistingCommands
|
public static class ExistingCommands
|
||||||
{
|
{
|
||||||
public static void Call(string commandName)
|
public static void Call(string commandName)
|
||||||
{
|
{
|
||||||
RuntimeCommands.Call(commandName);
|
CustomCommands.Call(commandName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Call<Arg0>(string commandName, Arg0 arg0)
|
public static void Call<Arg0>(string commandName, Arg0 arg0)
|
||||||
{
|
{
|
||||||
RuntimeCommands.Call<Arg0>(commandName, arg0);
|
CustomCommands.Call(commandName, arg0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Call<Arg0, Arg1>(string commandName, Arg0 arg0, Arg1 arg1)
|
public static void Call<Arg0, Arg1>(string commandName, Arg0 arg0, Arg1 arg1)
|
||||||
{
|
{
|
||||||
RuntimeCommands.Call<Arg0, Arg1>(commandName, arg0, arg1);
|
CustomCommands.Call(commandName, arg0, arg1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Call<Arg0, Arg1, Arg2>(string commandName, Arg0 arg0, Arg1 arg1, Arg2 arg2)
|
public static void Call<Arg0, Arg1, Arg2>(string commandName, Arg0 arg0, Arg1 arg1, Arg2 arg2)
|
||||||
{
|
{
|
||||||
RuntimeCommands.Call<Arg0, Arg1, Arg2>(commandName, arg0, arg1, arg2);
|
CustomCommands.Call(commandName, arg0, arg1, arg2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool Exists(string commandName)
|
public static bool Exists(string commandName)
|
||||||
{
|
{
|
||||||
return RuntimeCommands.HasRegistered(commandName);
|
return CustomCommands.Exists(commandName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static (string Name, string Description)[] GetCommandNamesAndDescriptions()
|
public static (string Name, string Description)[] GetCommandNamesAndDescriptions()
|
||||||
{
|
{
|
||||||
return RuntimeCommands.table.Values.Select(command => (command.name, command.description)).ToArray();
|
return CustomCommands.GetAllCommandData().Values.Select(command => (command.Name, command.Description)).ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -433,7 +433,7 @@ namespace TechbloxModdingAPI
|
||||||
public Block GetBlockLookedAt(float maxDistance = -1f)
|
public Block GetBlockLookedAt(float maxDistance = -1f)
|
||||||
{
|
{
|
||||||
var egid = playerEngine.GetThingLookedAt(Id, maxDistance);
|
var egid = playerEngine.GetThingLookedAt(Id, maxDistance);
|
||||||
return egid != EGID.Empty && egid.groupID != CommonExclusiveGroups.SIMULATION_BODIES_GROUP
|
return egid != default && egid.groupID != CommonExclusiveGroups.SIMULATION_BODIES_GROUP
|
||||||
&& egid.groupID != WiresGUIExclusiveGroups.WireGroup
|
&& egid.groupID != WiresGUIExclusiveGroups.WireGroup
|
||||||
? Block.New(egid)
|
? Block.New(egid)
|
||||||
: null;
|
: null;
|
||||||
|
@ -447,7 +447,7 @@ namespace TechbloxModdingAPI
|
||||||
public SimBody GetSimBodyLookedAt(float maxDistance = -1f)
|
public SimBody GetSimBodyLookedAt(float maxDistance = -1f)
|
||||||
{
|
{
|
||||||
var egid = playerEngine.GetThingLookedAt(Id, maxDistance);
|
var egid = playerEngine.GetThingLookedAt(Id, maxDistance);
|
||||||
return egid != EGID.Empty && egid.groupID == CommonExclusiveGroups.SIMULATION_BODIES_GROUP
|
return egid != default && egid.groupID == CommonExclusiveGroups.SIMULATION_BODIES_GROUP
|
||||||
? new SimBody(egid)
|
? new SimBody(egid)
|
||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
|
@ -460,7 +460,7 @@ namespace TechbloxModdingAPI
|
||||||
public Wire GetWireLookedAt(float maxDistance = -1f)
|
public Wire GetWireLookedAt(float maxDistance = -1f)
|
||||||
{
|
{
|
||||||
var egid = playerEngine.GetThingLookedAt(Id, maxDistance);
|
var egid = playerEngine.GetThingLookedAt(Id, maxDistance);
|
||||||
return egid != EGID.Empty && egid.groupID == WiresGUIExclusiveGroups.WireGroup
|
return egid != default && egid.groupID == WiresGUIExclusiveGroups.WireGroup
|
||||||
? new Wire(new EGID(egid.entityID, NamedExclusiveGroup<WiresGroup>.Group))
|
? new Wire(new EGID(egid.entityID, NamedExclusiveGroup<WiresGroup>.Group))
|
||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,16 +167,16 @@ namespace TechbloxModdingAPI.Players
|
||||||
public EGID GetThingLookedAt(uint playerId, float maxDistance = -1f)
|
public EGID GetThingLookedAt(uint playerId, float maxDistance = -1f)
|
||||||
{
|
{
|
||||||
var opt = GetCameraStruct<PhysicCameraRayCastEntityStruct>(playerId);
|
var opt = GetCameraStruct<PhysicCameraRayCastEntityStruct>(playerId);
|
||||||
if (!opt) return EGID.Empty;
|
if (!opt) return default;
|
||||||
PhysicCameraRayCastEntityStruct rayCast = opt;
|
PhysicCameraRayCastEntityStruct rayCast = opt;
|
||||||
float distance = maxDistance < 0
|
float distance = maxDistance < 0
|
||||||
? GhostBlockUtils.GetBuildInteractionDistance(entitiesDB, rayCast,
|
? GhostBlockUtils.GetBuildInteractionDistance(entitiesDB, rayCast,
|
||||||
GhostBlockUtils.GhostCastMethod.GhostCastProportionalToBlockSize)
|
GhostBlockUtils.GhostCastMethod.GhostCastProportionalToBlockSize)
|
||||||
: maxDistance;
|
: maxDistance;
|
||||||
if (rayCast.hit && rayCast.distance <= distance)
|
if (rayCast.hit && rayCast.distance <= distance)
|
||||||
return rayCast.hitEgid; //May be EGID.Empty
|
return rayCast.hitEgid; //May be EGID.Empty (default)
|
||||||
|
|
||||||
return EGID.Empty;
|
return default;
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe Block[] GetSelectedBlocks(uint playerid)
|
public unsafe Block[] GetSelectedBlocks(uint playerid)
|
||||||
|
|
|
@ -72,6 +72,10 @@
|
||||||
<HintPath>..\ref\TechbloxPreview_Data\Managed\DDNA.dll</HintPath>
|
<HintPath>..\ref\TechbloxPreview_Data\Managed\DDNA.dll</HintPath>
|
||||||
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\DDNA.dll</HintPath>
|
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\DDNA.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="EasyButtons">
|
||||||
|
<HintPath>..\ref\TechbloxPreview_Data\Managed\EasyButtons.dll</HintPath>
|
||||||
|
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\EasyButtons.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="EOSSDK">
|
<Reference Include="EOSSDK">
|
||||||
<HintPath>..\ref\TechbloxPreview_Data\Managed\EOSSDK.dll</HintPath>
|
<HintPath>..\ref\TechbloxPreview_Data\Managed\EOSSDK.dll</HintPath>
|
||||||
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\EOSSDK.dll</HintPath>
|
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\EOSSDK.dll</HintPath>
|
||||||
|
@ -524,10 +528,6 @@
|
||||||
<HintPath>..\ref\TechbloxPreview_Data\Managed\RobocraftX.Player.dll</HintPath>
|
<HintPath>..\ref\TechbloxPreview_Data\Managed\RobocraftX.Player.dll</HintPath>
|
||||||
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\RobocraftX.Player.dll</HintPath>
|
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\RobocraftX.Player.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="RobocraftX.Rendering">
|
|
||||||
<HintPath>..\ref\TechbloxPreview_Data\Managed\RobocraftX.Rendering.dll</HintPath>
|
|
||||||
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\RobocraftX.Rendering.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="RobocraftX.Rendering.Mock">
|
<Reference Include="RobocraftX.Rendering.Mock">
|
||||||
<HintPath>..\ref\TechbloxPreview_Data\Managed\RobocraftX.Rendering.Mock.dll</HintPath>
|
<HintPath>..\ref\TechbloxPreview_Data\Managed\RobocraftX.Rendering.Mock.dll</HintPath>
|
||||||
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\RobocraftX.Rendering.Mock.dll</HintPath>
|
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\RobocraftX.Rendering.Mock.dll</HintPath>
|
||||||
|
@ -660,10 +660,6 @@
|
||||||
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.MyGamesScreen.dll</HintPath>
|
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.MyGamesScreen.dll</HintPath>
|
||||||
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.MyGamesScreen.dll</HintPath>
|
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.MyGamesScreen.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Techblox.GUI.Notifications">
|
|
||||||
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Notifications.dll</HintPath>
|
|
||||||
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Notifications.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Techblox.GUI.Notifications.MockUps">
|
<Reference Include="Techblox.GUI.Notifications.MockUps">
|
||||||
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Notifications.MockUps.dll</HintPath>
|
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Notifications.MockUps.dll</HintPath>
|
||||||
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Notifications.MockUps.dll</HintPath>
|
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Notifications.MockUps.dll</HintPath>
|
||||||
|
@ -680,6 +676,26 @@
|
||||||
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.Pointer.dll</HintPath>
|
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.Pointer.dll</HintPath>
|
||||||
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.Pointer.dll</HintPath>
|
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.Pointer.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="Techblox.Rendering.Common">
|
||||||
|
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.Rendering.Common.dll</HintPath>
|
||||||
|
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.Rendering.Common.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Techblox.Rendering">
|
||||||
|
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.Rendering.dll</HintPath>
|
||||||
|
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.Rendering.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Techblox.Rendering.DOTS">
|
||||||
|
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.Rendering.DOTS.dll</HintPath>
|
||||||
|
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.Rendering.DOTS.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Techblox.Rendering.GPUI">
|
||||||
|
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.Rendering.GPUI.dll</HintPath>
|
||||||
|
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.Rendering.GPUI.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Techblox.Rendering.Unity">
|
||||||
|
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.Rendering.Unity.dll</HintPath>
|
||||||
|
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.Rendering.Unity.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="Techblox.SaveGamesConversion">
|
<Reference Include="Techblox.SaveGamesConversion">
|
||||||
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.SaveGamesConversion.dll</HintPath>
|
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.SaveGamesConversion.dll</HintPath>
|
||||||
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.SaveGamesConversion.dll</HintPath>
|
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.SaveGamesConversion.dll</HintPath>
|
||||||
|
@ -688,6 +704,10 @@
|
||||||
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.Services.Eos.dll</HintPath>
|
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.Services.Eos.dll</HintPath>
|
||||||
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.Services.Eos.dll</HintPath>
|
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.Services.Eos.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="Techblox.Services.Storage">
|
||||||
|
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.Services.Storage.dll</HintPath>
|
||||||
|
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.Services.Storage.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="Techblox.SwitchAnimation">
|
<Reference Include="Techblox.SwitchAnimation">
|
||||||
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.SwitchAnimation.dll</HintPath>
|
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.SwitchAnimation.dll</HintPath>
|
||||||
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.SwitchAnimation.dll</HintPath>
|
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.SwitchAnimation.dll</HintPath>
|
||||||
|
@ -820,6 +840,10 @@
|
||||||
<HintPath>..\ref\TechbloxPreview_Data\Managed\Unity.Recorder.dll</HintPath>
|
<HintPath>..\ref\TechbloxPreview_Data\Managed\Unity.Recorder.dll</HintPath>
|
||||||
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Unity.Recorder.dll</HintPath>
|
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Unity.Recorder.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="Unity.Rendering.Hybrid">
|
||||||
|
<HintPath>..\ref\TechbloxPreview_Data\Managed\Unity.Rendering.Hybrid.dll</HintPath>
|
||||||
|
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Unity.Rendering.Hybrid.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="Unity.RenderPipelines.Core.Runtime">
|
<Reference Include="Unity.RenderPipelines.Core.Runtime">
|
||||||
<HintPath>..\ref\TechbloxPreview_Data\Managed\Unity.RenderPipelines.Core.Runtime.dll</HintPath>
|
<HintPath>..\ref\TechbloxPreview_Data\Managed\Unity.RenderPipelines.Core.Runtime.dll</HintPath>
|
||||||
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Unity.RenderPipelines.Core.Runtime.dll</HintPath>
|
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Unity.RenderPipelines.Core.Runtime.dll</HintPath>
|
||||||
|
@ -1140,14 +1164,14 @@
|
||||||
<HintPath>..\ref\TechbloxPreview_Data\Managed\UnityEngine.XRModule.dll</HintPath>
|
<HintPath>..\ref\TechbloxPreview_Data\Managed\UnityEngine.XRModule.dll</HintPath>
|
||||||
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\UnityEngine.XRModule.dll</HintPath>
|
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\UnityEngine.XRModule.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="uREPL">
|
|
||||||
<HintPath>..\ref\TechbloxPreview_Data\Managed\uREPL.dll</HintPath>
|
|
||||||
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\uREPL.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="VisualProfiler">
|
<Reference Include="VisualProfiler">
|
||||||
<HintPath>..\ref\TechbloxPreview_Data\Managed\VisualProfiler.dll</HintPath>
|
<HintPath>..\ref\TechbloxPreview_Data\Managed\VisualProfiler.dll</HintPath>
|
||||||
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\VisualProfiler.dll</HintPath>
|
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\VisualProfiler.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="Whinarn.UnityMeshSimplifier.Runtime">
|
||||||
|
<HintPath>..\ref\TechbloxPreview_Data\Managed\Whinarn.UnityMeshSimplifier.Runtime.dll</HintPath>
|
||||||
|
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Whinarn.UnityMeshSimplifier.Runtime.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<!--End Dependencies-->
|
<!--End Dependencies-->
|
||||||
|
|
||||||
|
|
|
@ -354,14 +354,15 @@ namespace TechbloxModdingAPI.Tests
|
||||||
[HarmonyPatch]
|
[HarmonyPatch]
|
||||||
public class MinimumSpecsPatch
|
public class MinimumSpecsPatch
|
||||||
{
|
{
|
||||||
public static bool Prefix()
|
public static bool Prefix(ref bool __result)
|
||||||
{
|
{
|
||||||
|
__result = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MethodInfo TargetMethod()
|
public static MethodInfo TargetMethod()
|
||||||
{
|
{
|
||||||
return ((Action) MinimumSpecsCheck.CheckRequirementsMet).Method;
|
return ((Func<bool>) MinimumSpecsCheck.CheckRequirementsMet).Method;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,7 +163,7 @@ namespace TechbloxModdingAPI.Utility
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static void CommandLog(string msg)
|
public static void CommandLog(string msg)
|
||||||
{
|
{
|
||||||
uREPL.Log.Output(msg);
|
Log(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -179,7 +179,7 @@ namespace TechbloxModdingAPI.Utility
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static void CommandLogError(string msg)
|
public static void CommandLogError(string msg)
|
||||||
{
|
{
|
||||||
uREPL.Log.Error(msg);
|
LogError(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -195,7 +195,7 @@ namespace TechbloxModdingAPI.Utility
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static void CommandLogWarning(string msg)
|
public static void CommandLogWarning(string msg)
|
||||||
{
|
{
|
||||||
uREPL.Log.Warn(msg);
|
LogWarning(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue