|
|
@@ -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"; |
|
|
|