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.

73 lines
1.6KB

  1. using System;
  2. using RobocraftX.Blocks;
  3. using RobocraftX.Common;
  4. using Svelto.ECS;
  5. using Unity.Mathematics;
  6. using GamecraftModdingAPI.Utility;
  7. namespace GamecraftModdingAPI.Blocks
  8. {
  9. public class Motor : SignalingBlock
  10. {
  11. public Motor(EGID id) : base(id)
  12. {
  13. }
  14. public Motor(uint id): base(new EGID(id, CommonExclusiveGroups.BUILD_MOTOR_BLOCK_GROUP))
  15. {
  16. }
  17. // custom motor properties
  18. /// <summary>
  19. /// The motor's maximum rotational velocity.
  20. /// </summary>
  21. public float TopSpeed
  22. {
  23. get
  24. {
  25. return BlockEngine.GetBlockInfo(this, (MotorReadOnlyStruct st) => st.maxVelocity);
  26. }
  27. set
  28. {
  29. BlockEngine.SetBlockInfo(this, (ref MotorReadOnlyStruct st, float val) => st.maxVelocity = val, value);
  30. }
  31. }
  32. /// <summary>
  33. /// The motor's maximum rotational force.
  34. /// </summary>
  35. public float Torque
  36. {
  37. get
  38. {
  39. return BlockEngine.GetBlockInfo(this, (MotorReadOnlyStruct st) => st.maxForce);
  40. }
  41. set
  42. {
  43. BlockEngine.SetBlockInfo(this, (ref MotorReadOnlyStruct st, float val) => st.maxForce = val, value);
  44. }
  45. }
  46. /// <summary>
  47. /// The motor's direction.
  48. /// </summary>
  49. public bool Reverse
  50. {
  51. get
  52. {
  53. return BlockEngine.GetBlockInfo(this, (MotorReadOnlyStruct st) => st.reverse);
  54. }
  55. set
  56. {
  57. BlockEngine.SetBlockInfo(this, (ref MotorReadOnlyStruct st, bool val) => st.reverse = val, value);
  58. }
  59. }
  60. }
  61. }