Browse Source

Add support for setting cluster limit and remove the volume limit

tags/v1.2.0
NorbiPeti 2 years ago
parent
commit
08a0badd37
4 changed files with 22 additions and 13 deletions
  1. +2
    -2
      BuildingTools/BuildingTools.cs
  2. +1
    -1
      BuildingTools/BuildingTools.csproj
  3. +19
    -3
      BuildingTools/SetLimitsCommandEngine.cs
  4. +0
    -7
      README.md

+ 2
- 2
BuildingTools/BuildingTools.cs View File

@@ -114,7 +114,7 @@ namespace BuildingTools
});

CommandBuilder.Builder("selectBlocksLookedAt",
"Selects blocks (1 or more) to change. Only works in time stopped mode, however the blocks can be changed afterwards in both modes." +
"Selects blocks (1 or more) to change. Only works in time stopped mode." +
" Parameter: whether one (true) or all connected (false) blocks should be selected.")
.Action<bool>(single =>
{
@@ -238,7 +238,7 @@ namespace BuildingTools
}).ToArray();
}).Build();
var setLimits = new SetLimitsCommandEngine();
CommandBuilder.Builder("setBuildLimits", "Set build limits").Action((Action<int, int>)setLimits.SetLimits).Build();
CommandBuilder.Builder("setBuildLimits", "Set build limits").Action((Action<int, int, int>)setLimits.SetLimits).Build();
GameEngineManager.AddGameEngine(setLimits);

CommandBuilder.Builder("freeScaling", "This command removes scaling restrictions on the selected block. Reselect block to apply.")


+ 1
- 1
BuildingTools/BuildingTools.csproj View File

@@ -11,7 +11,7 @@
<TargetFramework>net48</TargetFramework>
<FileAlignment>512</FileAlignment>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Version>1.1.0</Version>
<Version>1.2.0</Version>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>


+ 19
- 3
BuildingTools/SetLimitsCommandEngine.cs View File

@@ -1,8 +1,10 @@
using System;
using Svelto.ECS;
using Techblox.Building.Rules;
using Techblox.Building.Rules.Entities;
using TechbloxModdingAPI.Engines;
using TechbloxModdingAPI.Utility;
using Unity.Mathematics;

namespace BuildingTools
{
@@ -17,13 +19,27 @@ namespace BuildingTools
{
}

public void SetLimits(int cpu, int power)
public void SetLimits(int cpu, int power, int clusters)
{
if (entitiesDB is null)
{
Logging.CommandLog("This command only works in build mode. If you're in build mode, well, report pls.");
return;
}

ref var rules = ref entitiesDB.QueryUniqueEntity<MachineRulesComponent>(GroupCompound<MACHINE, LOCAL>.BuildGroup);
Logging.CommandLog($"Old CPU limit: {rules.cpu.max}, power limit: {rules.power.max}");
Logging.CommandLog($"Old CPU limit: {rules.cpu.max}, power limit: {rules.power.max}, cluster limit: {rules.clusters.max}");
rules.cpu.max = cpu;
rules.power.max = power;
Logging.CommandLog($"New CPU limit: {rules.cpu.max}, power limit: {rules.power.max}");
rules.clusters.max = clusters;
if (BuildRulesUtils.GetLocalMachine(entitiesDB, out var egid))
{
entitiesDB.QueryEntity<MachineVolumeLimitAabbComponent>(egid).aabb =
new AABB { Center = 0, Extents = float.MaxValue };
Logging.CommandLog("Removed volume limits");
}

Logging.CommandLog($"New CPU limit: {rules.cpu.max}, power limit: {rules.power.max}, cluster limit: {rules.clusters.max}");
}

public string Name => "SetLimitsEngine";


+ 0
- 7
README.md View File

@@ -1,7 +1,6 @@
# BuildingTools

Tools for building games, mainly focused on changing and displaying (F3) block properties.
And no clip.

## Commands
### Selection commands
@@ -59,12 +58,6 @@ Only works in time running mode.
### Push player
The `pushPlayer` and `pushRotatePlayer` commands will apply a specified (regular or angular) force to the player in any mode.

### No clip
The `noClip` command allows you to go through blocks. Run to toggle.
It works in both time stopped and running modes.

**Always exit noClip before leaving a game save or it will crash the game at the moment.**

### Examples
* Select and move box selected blocks by 5 blocks in the +X direction:
```


Loading…
Cancel
Save