|
|
@@ -49,7 +49,7 @@ namespace BuildingTools |
|
|
|
block.Position = (float3) (reference + (block.Position - reference) * scale); |
|
|
|
} |
|
|
|
|
|
|
|
Logging.CommandLog("Blocks scaled."); |
|
|
|
Logging.CommandLog("Blocks scaled and moved."); |
|
|
|
}); |
|
|
|
_commandUtils.RegisterBlockCommand("scaleIndividually", "Scales the blocks you're looking at, but doesn't move them." + |
|
|
|
" The scale is relative, 1 means no change.", |
|
|
@@ -59,6 +59,7 @@ namespace BuildingTools |
|
|
|
float3 scale = new float3(scaleX, scaleY, scaleZ); |
|
|
|
foreach (var block in blocks) |
|
|
|
block.Scale *= scale; |
|
|
|
Logging.CommandLog("Blocks scaled individually."); |
|
|
|
}); |
|
|
|
_commandUtils.RegisterBlockCommand("moveBlocks", "Moves (teleports) the selected blocks around both in time stopped and running. The latter will be reset as expected.", (x, y, z, blocks, refBlock) => |
|
|
|
{ |
|
|
@@ -68,6 +69,7 @@ namespace BuildingTools |
|
|
|
else if (GameState.IsSimulationMode()) |
|
|
|
foreach (var body in GetSimBodies(blocks)) |
|
|
|
body.Position += new float3(x, y, z); |
|
|
|
Logging.CommandLog("Blocks moved."); |
|
|
|
}); |
|
|
|
_commandUtils.RegisterBlockCommand("colorBlocks", "Colors the selected blocks permanently both in time stopped and running. It won't be reset when stopping time.", |
|
|
|
(color, darkness, blocks, refBlock) => |
|
|
@@ -80,6 +82,7 @@ namespace BuildingTools |
|
|
|
|
|
|
|
foreach (var block in blocks) |
|
|
|
block.Color = new BlockColor {Color = clr, Darkness = darkness}; |
|
|
|
Logging.CommandLog("Blocks colored."); |
|
|
|
}); |
|
|
|
|
|
|
|
CommandBuilder.Builder("selectBlocksLookedAt", |
|
|
@@ -118,6 +121,22 @@ namespace BuildingTools |
|
|
|
_blockSelections.refBlock = _blockSelections.blocks.Length > 0 ? _blockSelections.blocks[0] : null; |
|
|
|
Logging.CommandLog(_blockSelections.blocks.Length + " blocks selected."); |
|
|
|
}).Build(); |
|
|
|
CommandBuilder.Builder("selectBlocksInGroup", |
|
|
|
"Selects the blocks in the block group you are looking at (the blocks currently highlighted when in blueprint mode).") |
|
|
|
.Action(() => |
|
|
|
{ |
|
|
|
var block = Player.LocalPlayer.GetBlockLookedAt(); |
|
|
|
if (block is null) |
|
|
|
{ |
|
|
|
Logging.CommandLogError("You need to look at a block first (and be close to it)."); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
var group = block.BlockGroup; |
|
|
|
_blockSelections.blocks = group is null ? new[] {block} : group.ToArray(); |
|
|
|
_blockSelections.refBlock = block; |
|
|
|
Logging.CommandLog(_blockSelections.blocks.Length + " blocks selected."); |
|
|
|
}).Build(); |
|
|
|
|
|
|
|
/*ConsoleCommands.RegisterWithChannel("selectSendSignal", ch => { }, ChannelType.Object, |
|
|
|
"Sends a signal for selecting a given object ID for a command block.");*/ |
|
|
@@ -132,6 +151,7 @@ namespace BuildingTools |
|
|
|
} |
|
|
|
foreach (var block in GetSimBodies(blocks)) |
|
|
|
block.Velocity += new float3(x, y, z); |
|
|
|
Logging.CommandLog("Blocks pushed."); |
|
|
|
}); |
|
|
|
_commandUtils.RegisterBlockCommand("pushRotateBlocks", |
|
|
|
"Adds angular velocity to the selected blocks. Only works in simulation.", |
|
|
@@ -144,25 +164,65 @@ namespace BuildingTools |
|
|
|
} |
|
|
|
foreach (var block in GetSimBodies(blocks)) |
|
|
|
block.AngularVelocity += new float3(x, y, z); |
|
|
|
Logging.CommandLog("Blocks pushed to rotate."); |
|
|
|
}); |
|
|
|
CommandBuilder.Builder("pushPlayer", "Adds velocity to the player.") |
|
|
|
.Action<float, float, float>((x, y, z) => |
|
|
|
{ |
|
|
|
Player.LocalPlayer.Velocity += new float3(x, y, z); |
|
|
|
Logging.CommandLog("Player pushed."); |
|
|
|
}).Build(); |
|
|
|
CommandBuilder.Builder("pushRotatePlayer", "Adds angular velocity to the player.") |
|
|
|
.Action<float, float, float>((x, y, z) => |
|
|
|
{ |
|
|
|
Player.LocalPlayer.AngularVelocity += new float3(x, y, z); |
|
|
|
Logging.CommandLog("Player pushed to rotate."); |
|
|
|
}).Build(); |
|
|
|
CommandBuilder.Builder("addBlocksToGroup", |
|
|
|
"Adds the selected blocks to the same group (they will be highlighted together)." + |
|
|
|
" This command recreates the blocks that are moved into the group, but block data is almost certainly preserved.") |
|
|
|
.Action(() => |
|
|
|
{ |
|
|
|
if (_blockSelections.blocks.Length == 0) |
|
|
|
{ |
|
|
|
Logging.CommandLogWarning("No blocks selected. Use a select command first."); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
var group = _blockSelections.refBlock.BlockGroup; |
|
|
|
uint refID = _blockSelections.refBlock.Id.entityID; |
|
|
|
if (group is null) |
|
|
|
{ |
|
|
|
var copy = _blockSelections.refBlock.Copy<Block>(); |
|
|
|
group = BlockGroup.Create(copy); |
|
|
|
_blockSelections.refBlock.Remove(); |
|
|
|
_blockSelections.refBlock = copy; |
|
|
|
} |
|
|
|
|
|
|
|
_blockSelections.blocks = _blockSelections.blocks.Where(block => block.Id.entityID != refID) |
|
|
|
.Select(block => |
|
|
|
{ |
|
|
|
if (block.BlockGroup == group) return block; |
|
|
|
var copy = block.Copy<Block>(); |
|
|
|
group.Add(copy); |
|
|
|
block.Remove(); |
|
|
|
return copy; |
|
|
|
}).ToArray(); |
|
|
|
}).Build(); |
|
|
|
|
|
|
|
var noClip = new NoClipCommand(); |
|
|
|
GameEngineManager.AddGameEngine(noClip); |
|
|
|
CommandBuilder.Builder("noClip", "Allows you to go through blocks. Run again to disable.") |
|
|
|
CommandBuilder.Builder("noclip", "Allows you to go through blocks. Run again to disable. Disable before entering the menu.") |
|
|
|
.Action(noClip.Toggle).Build(); |
|
|
|
CommandBuilder.Builder("freeScaling", "This command removes scaling restrictions on the selected block. Reselect block to apply.") |
|
|
|
.Action(() => |
|
|
|
{ |
|
|
|
var blockID = Player.LocalPlayer.SelectedBlock; |
|
|
|
if (blockID == BlockIDs.Invalid) |
|
|
|
{ |
|
|
|
Logging.CommandLogWarning("You don't have any blocks in your hand."); |
|
|
|
return; |
|
|
|
} |
|
|
|
FullGameFields._dataDb.GetValue<CubeListData>((int) blockID).scalingPermission = |
|
|
|
ScalingPermission.NonUniform; |
|
|
|
Logging.CommandLog("Free scaling enabled for " + blockID + " until the game is restarted."); |
|
|
@@ -191,7 +251,8 @@ namespace BuildingTools |
|
|
|
$"- Color: {block.Color.Color} darkness: {block.Color.Darkness}\n" + |
|
|
|
$"- Scale: {scale.x:F} {scale.y:F} {scale.z:F}\n" + |
|
|
|
$"- Label: {block.Label}\n" + |
|
|
|
$"- ID: {block.Id}"; |
|
|
|
$"- ID: {block.Id}\n" + |
|
|
|
$"- Group: {block.BlockGroup.Id}"; |
|
|
|
} |
|
|
|
|
|
|
|
private static string GetBodyInfoInSimMode() |
|
|
@@ -238,6 +299,6 @@ namespace BuildingTools |
|
|
|
public override void OnApplicationQuit() => Main.Shutdown(); |
|
|
|
|
|
|
|
public override string Name { get; } = "BuildingTools"; |
|
|
|
public override string Version { get; } = "v1.0.0"; |
|
|
|
public override string Version { get; } = "v1.1.0"; |
|
|
|
} |
|
|
|
} |