Moar Gamecraft commands!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.5KB

  1. using System;
  2. using System.Collections.Generic;
  3. using RobocraftX.Multiplayer;
  4. using RobocraftX.Common;
  5. using RobocraftX.Blocks;
  6. using Svelto.ECS;
  7. using Svelto.ECS.EntityStructs;
  8. using Unity.Entities;
  9. using Svelto.Context;
  10. using Svelto.Tasks;
  11. using RobocraftX;
  12. using RobocraftX.SimulationModeState;
  13. using RobocraftX.UECS;
  14. using Unity.Transforms;
  15. using Unity.Mathematics;
  16. using GamecraftModdingAPI.Blocks;
  17. using GamecraftModdingAPI.Commands;
  18. namespace ExtraCommands.Building
  19. {
  20. //[CustomCommand("MoveBlocks", "Move all blocks (including ground) from their original position")]
  21. [CustomCommand("MoveLastBlock", "Move last block from original position")]
  22. class MoveBlocksCommandEngine : ICustomCommandEngine
  23. {
  24. public string Description => "Move blocks";
  25. public string Name => "MoveBlocks";
  26. public IEntitiesDB entitiesDB { set; private get; }
  27. public void Ready()
  28. {
  29. //CustomCommandUtility.Register<float, float, float>("MoveBlocks", MoveBlocksCommand, "Move all blocks (including ground) from their original position");
  30. CommandRegistrationHelper.Register<float, float, float>("MoveLastBlock", MoveLastBlockCommand, "Move last block from original position");
  31. }
  32. private void MoveLastBlockCommand(float x, float y, float z)
  33. {
  34. float3 vector = new float3(x, y, z);
  35. Movement.MoveConnectedBlocks(BlockIdentifiers.LatestBlockID, vector);
  36. }
  37. public void Dispose()
  38. {
  39. //CommandRegistrationHelper.Unregister("MoveBlocks");
  40. CommandRegistrationHelper.Unregister("MoveLastBlock");
  41. }
  42. }
  43. }