|
|
@@ -7,6 +7,7 @@ using TechbloxModdingAPI.Blocks; |
|
|
|
using TechbloxModdingAPI.Commands; |
|
|
|
using TechbloxModdingAPI.Utility; |
|
|
|
using IllusionPlugin; |
|
|
|
using TechbloxModdingAPI.App; |
|
|
|
using Unity.Mathematics; |
|
|
|
using Main = TechbloxModdingAPI.Main; |
|
|
|
|
|
|
@@ -26,8 +27,8 @@ namespace BuildingTools |
|
|
|
public override void OnApplicationStart() |
|
|
|
{ |
|
|
|
Main.Init(); |
|
|
|
GameClient.SetDebugInfo("PlayerInfo", GetPlayerInfo); |
|
|
|
GameClient.SetDebugInfo("BlockModInfo", GetBlockInfo); |
|
|
|
Game.AddPersistentDebugInfo("PlayerInfo", GetPlayerInfo); |
|
|
|
Game.AddPersistentDebugInfo("BlockModInfo", GetBlockInfo); |
|
|
|
_commandUtils.RegisterBlockCommand("scaleBlocks", |
|
|
|
"Scales the selected blocks, relative to current size (current scale * new scale)." + |
|
|
|
" The block you're looking at stays where it is, everything else is moved next to it.", |
|
|
@@ -106,14 +107,14 @@ namespace BuildingTools |
|
|
|
var blocks = _blockSelections.blocks; |
|
|
|
Logging.CommandLog(blocks.Length + " blocks selected."); |
|
|
|
}).Build(); |
|
|
|
CommandBuilder.Builder("selectBlocksWithID", "Selects blocks with a specific object ID.") |
|
|
|
/*CommandBuilder.Builder("selectBlocksWithID", "Selects blocks with a specific object ID.") |
|
|
|
.Action<char>(id => |
|
|
|
{ |
|
|
|
_blockSelections.blocks = |
|
|
|
(_blockSelections.refBlock = ObjectIdentifier.GetByID(id).FirstOrDefault()) |
|
|
|
?.GetConnectedCubes() ?? new Block[0]; |
|
|
|
Logging.CommandLog(_blockSelections.blocks.Length + " blocks selected."); |
|
|
|
}).Build(); |
|
|
|
}).Build();*/ |
|
|
|
CommandBuilder.Builder("selectSelectedBlocks", "Selects blocks that are box selected by the player.") |
|
|
|
.Action(() => |
|
|
|
{ |
|
|
@@ -193,7 +194,7 @@ namespace BuildingTools |
|
|
|
uint refID = _blockSelections.refBlock.Id.entityID; |
|
|
|
if (group is null) |
|
|
|
{ |
|
|
|
var copy = _blockSelections.refBlock.Copy<Block>(); |
|
|
|
var copy = _blockSelections.refBlock.Copy(); |
|
|
|
group = BlockGroup.Create(copy); |
|
|
|
_blockSelections.refBlock.Remove(); |
|
|
|
_blockSelections.refBlock = copy; |
|
|
@@ -203,7 +204,7 @@ namespace BuildingTools |
|
|
|
.Select(block => |
|
|
|
{ |
|
|
|
if (block.BlockGroup == group) return block; |
|
|
|
var copy = block.Copy<Block>(); |
|
|
|
var copy = block.Copy(); |
|
|
|
group.Add(copy); |
|
|
|
block.Remove(); |
|
|
|
return copy; |
|
|
@@ -282,12 +283,12 @@ namespace BuildingTools |
|
|
|
{ |
|
|
|
var player = Player.LocalPlayer; |
|
|
|
if (player == null) return ""; |
|
|
|
TechbloxModdingAPI.FlyCam cam = GameState.IsBuildMode() ? player.BuildCamera : null; |
|
|
|
//float3 pos = cam?.Position ?? player.Position; |
|
|
|
float3 rot = cam?.Rotation ?? player.Rotation; |
|
|
|
float3 vel = cam?.Velocity ?? player.Velocity; |
|
|
|
float3 ave = cam?.AngularVelocity ?? player.AngularVelocity; |
|
|
|
return $"Player rotation: {rot.x:F}° {rot.y:F}° {rot.z:F}°\n" + |
|
|
|
float3 pos = player.Position; |
|
|
|
float3 rot = player.Rotation; |
|
|
|
float3 vel = player.Velocity; |
|
|
|
float3 ave = player.AngularVelocity; |
|
|
|
return $"Player position: {pos.x:F} {pos.y:F} {pos.z:F}\n" + |
|
|
|
$"- Rotation: {rot.x:F}° {rot.y:F}° {rot.z:F}°\n" + |
|
|
|
$"- Velocity: {vel.x:F} {vel.y:F} {vel.z:F}\n" + |
|
|
|
$"- Angular velocity: {ave.x:F} {ave.y:F} {ave.z:F}\n" + |
|
|
|
$"- Mass: {player.Mass:F}\n" + |
|
|
|