50 lines
1.5 KiB
C#
50 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using RobocraftX.Multiplayer;
|
|
using RobocraftX.Common;
|
|
using Svelto.ECS;
|
|
using Svelto.ECS.EntityStructs;
|
|
using Unity.Entities;
|
|
using Svelto.Context;
|
|
using Svelto.Tasks;
|
|
using RobocraftX;
|
|
using RobocraftX.SimulationModeState;
|
|
using RobocraftX.UECS;
|
|
using Unity.Transforms;
|
|
using Unity.Mathematics;
|
|
using UnityEngine;
|
|
|
|
using GamecraftModdingAPI.Commands;
|
|
using GamecraftModdingAPI.Blocks;
|
|
|
|
namespace ExtraCommands.Building
|
|
{
|
|
//[CustomCommand("RotateBlocks", "Rotate all blocks (including ground) from their original position")]
|
|
[CustomCommand("RotateLastBlock", "Rotate last block from original position")]
|
|
class RotateBlocksCommandEngine : ICustomCommandEngine
|
|
{
|
|
public string Description => "Rotate last block from original position";
|
|
|
|
public string Name => "RotateLastBlock";
|
|
|
|
public IEntitiesDB entitiesDB { set; private get; }
|
|
|
|
public void Ready()
|
|
{
|
|
CommandRegistrationHelper.Register<float, float, float>(Name, RotateLastBlockCommand, Description);
|
|
}
|
|
|
|
// Move block with highest index by vector (x,y,z)
|
|
private void RotateLastBlockCommand(float x, float y, float z)
|
|
{
|
|
float3 eulerAngles = new float3(x, y, z);
|
|
GamecraftModdingAPI.Blocks.Rotation.RotateBlock(BlockIdentifiers.LatestBlockID, eulerAngles);
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
//CustomCommandUtility.Unregister("RotateBlocks");
|
|
CommandRegistrationHelper.Unregister("RotateLastBlock");
|
|
}
|
|
}
|
|
}
|