Tools for building games mainly focused on changing block properties. And noclip.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

48 lignes
1.6KB

  1. using System;
  2. using Svelto.ECS;
  3. using Techblox.Building.Rules;
  4. using Techblox.Building.Rules.Entities;
  5. using TechbloxModdingAPI.Engines;
  6. using TechbloxModdingAPI.Utility;
  7. using Unity.Mathematics;
  8. namespace BuildingTools
  9. {
  10. public class SetLimitsCommandEngine : IApiEngine
  11. {
  12. public void Ready()
  13. {
  14. }
  15. public EntitiesDB entitiesDB { get; set; }
  16. public void Dispose()
  17. {
  18. }
  19. public void SetLimits(int cpu, int power, int clusters)
  20. {
  21. if (entitiesDB is null)
  22. {
  23. Logging.CommandLog("This command only works in build mode. If you're in build mode, well, report pls.");
  24. return;
  25. }
  26. ref var rules = ref entitiesDB.QueryUniqueEntity<MachineRulesComponent>(GroupCompound<MACHINE, LOCAL>.BuildGroup);
  27. Logging.CommandLog($"Old CPU limit: {rules.cpu.max}, power limit: {rules.power.max}, cluster limit: {rules.clusters.max}");
  28. rules.cpu.max = cpu;
  29. rules.power.max = power;
  30. rules.clusters.max = clusters;
  31. if (BuildRulesUtils.GetLocalMachine(entitiesDB, out var egid))
  32. {
  33. entitiesDB.QueryEntity<MachineVolumeLimitAabbComponent>(egid).aabb =
  34. new AABB { Center = 0, Extents = float.MaxValue };
  35. Logging.CommandLog("Removed volume limits");
  36. }
  37. Logging.CommandLog($"New CPU limit: {rules.cpu.max}, power limit: {rules.power.max}, cluster limit: {rules.clusters.max}");
  38. }
  39. public string Name => "SetLimitsEngine";
  40. public bool isRemovable => true;
  41. }
  42. }