A stable modding interface between Techblox and mods https://mod.exmods.org/
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.

54 lines
2.4KB

  1. using System.Collections.Generic;
  2. using HarmonyLib;
  3. using RobocraftX.Blocks;
  4. using RobocraftX.Common;
  5. using RobocraftX.GroupTags;
  6. using RobocraftX.PilotSeat;
  7. using Svelto.ECS;
  8. using Techblox.EngineBlock;
  9. using Techblox.ServoBlocksServer;
  10. using Techblox.WheelRigBlock;
  11. namespace CodeGenerator
  12. {
  13. internal class Program
  14. {
  15. public static void Main(string[] args)
  16. {
  17. //GenerateBlockClasses();
  18. ECSClassGenerator.Generate(typeof(EngineBlockEntityDescriptor));
  19. }
  20. private static void GenerateBlockClasses()
  21. {
  22. var bcg = new BlockClassGenerator();
  23. bcg.Generate("Engine", null, new Dictionary<string, string>
  24. {
  25. { "engineOn", "On" }
  26. }, AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), // Simulation time properties
  27. typeof(EngineBlockTweakableComponent), typeof(EngineBlockReadonlyComponent));
  28. bcg.Generate("DampedSpring", "DAMPEDSPRING_BLOCK_GROUP", new Dictionary<string, string>
  29. {
  30. {"maxExtent", "MaxExtension"}
  31. },
  32. typeof(TweakableJointDampingComponent), typeof(DampedSpringReadOnlyStruct));
  33. bcg.Generate("LogicGate", "LOGIC_BLOCK_GROUP");
  34. bcg.Generate("Servo", types: typeof(ServoReadOnlyTweakableComponent), renames: new Dictionary<string, string>
  35. {
  36. {"minDeviation", "MinimumAngle"},
  37. {"maxDeviation", "MaximumAngle"},
  38. {"servoVelocity", "MaximumForce"}
  39. });
  40. bcg.Generate("WheelRig", "WHEELRIG_BLOCK_BUILD_GROUP", null,
  41. typeof(WheelRigTweakableStruct), typeof(WheelRigReadOnlyStruct),
  42. typeof(WheelRigSteerableTweakableStruct), typeof(WheelRigSteerableReadOnlyStruct));
  43. bcg.Generate("Seat", "RobocraftX.PilotSeat.SeatGroups.PILOTSEAT_BLOCK_BUILD_GROUP", null, typeof(SeatFollowCamComponent), typeof(SeatReadOnlySettingsComponent));
  44. bcg.Generate("Piston", null, new Dictionary<string, string>
  45. {
  46. {"pistonVelocity", "MaximumForce"}
  47. }, typeof(PistonReadOnlyStruct));
  48. bcg.Generate("Motor", null, null, typeof(MotorReadOnlyStruct));
  49. //bcg.Generate("ObjectID", "ObjectIDBlockExclusiveGroups.OBJECT_ID_BLOCK_GROUP", null, typeof(ObjectIDTweakableComponent));
  50. }
  51. }
  52. }