From 47d1f43495bd0dc5f2a8ab7d5c271a525c0cce21 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Mon, 8 Jun 2020 00:18:05 +0200 Subject: [PATCH] Add support for box select --- BlockMod/BlockMod.cs | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/BlockMod/BlockMod.cs b/BlockMod/BlockMod.cs index f08ed93..cf15d49 100644 --- a/BlockMod/BlockMod.cs +++ b/BlockMod/BlockMod.cs @@ -5,16 +5,10 @@ using Gamecraft.Wires.ChannelsCommon; using GamecraftModdingAPI; using GamecraftModdingAPI.Blocks; using GamecraftModdingAPI.Commands; -using GamecraftModdingAPI.Engines; using GamecraftModdingAPI.Players; using GamecraftModdingAPI.Utility; -using HarmonyLib; using IllusionPlugin; -using RobocraftX.Character.Weapons; using RobocraftX.CommandLine.Custom; -using RobocraftX.Common.Players; -using Svelto.ECS; -using Svelto.ECS.Internal; using Unity.Mathematics; using uREPL; using Main = GamecraftModdingAPI.Main; @@ -89,6 +83,12 @@ namespace BlockMod .Action(id => blocks = (refBlock = ObjectIdentifier.GetByID(id).FirstOrDefault())?.GetConnectedCubes() ?? new Block[0]).Build(); + CommandBuilder.Builder("selectSelectedBlocks", "Selects blocks that are box selected by the player.") + .Action(() => + { + blocks = new Player(PlayerType.Local).GetSelectedBlocks(); + refBlock = blocks.Length > 0 ? blocks[0] : null; + }).Build(); RegisterBlockCommand("pushBlocks", "Adds velocity to the selected blocks. Only works in simulation.", (x, y, z, blocks, refBlock) => @@ -167,19 +167,8 @@ namespace BlockMod return blocks; } - //private void RegisterBlockCommand(string name, string desc, T action) where T : Delegate private void RegisterBlockCommand(string name, string desc, Action action) { - /*switch (action) - { - case Action act - break; - case Action act: - break; - default: - Logging.LogWarning("Unexpected parameters for command: " + name); - break; - }*/ RuntimeCommands.Register(name, (a1, a2) => { if (CheckNoBlocks(blocks)) return;