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.5KB

  1. using System;
  2. using RobocraftX.Blocks;
  3. using RobocraftX.Common;
  4. using Svelto.ECS;
  5. using Unity.Mathematics;
  6. using TechbloxModdingAPI.Utility;
  7. namespace TechbloxModdingAPI.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.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<MotorReadOnlyStruct>(this).maxVelocity;
  26. }
  27. set
  28. {
  29. BlockEngine.GetBlockInfo<MotorReadOnlyStruct>(this).maxVelocity = 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<MotorReadOnlyStruct>(this).maxForce;
  40. }
  41. set
  42. {
  43. BlockEngine.GetBlockInfo<MotorReadOnlyStruct>(this).maxForce = value;
  44. }
  45. }
  46. /// <summary>
  47. /// The motor's direction.
  48. /// </summary>
  49. public bool Reverse
  50. {
  51. get
  52. {
  53. return BlockEngine.GetBlockInfo<MotorReadOnlyStruct>(this).reverse;
  54. }
  55. set
  56. {
  57. BlockEngine.GetBlockInfo<MotorReadOnlyStruct>(this).reverse = value;
  58. }
  59. }
  60. }
  61. }