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.

77 lines
1.6KB

  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 Servo : SignalingBlock
  10. {
  11. public Servo(EGID id) : base(id)
  12. {
  13. }
  14. public Servo(uint id) : base(new EGID(id, CommonExclusiveGroups.SERVO_BLOCK_GROUP))
  15. {
  16. }
  17. // custom servo properties
  18. /// <summary>
  19. /// The servo's minimum angle.
  20. /// </summary>
  21. public float MinimumAngle
  22. {
  23. get => BlockEngine.GetBlockInfo<ServoReadOnlyStruct>(this).minDeviation;
  24. set
  25. {
  26. BlockEngine.GetBlockInfo<ServoReadOnlyStruct>(this).minDeviation = value;
  27. }
  28. }
  29. /// <summary>
  30. /// The servo's maximum angle.
  31. /// </summary>
  32. public float MaximumAngle
  33. {
  34. get => BlockEngine.GetBlockInfo<ServoReadOnlyStruct>(this).maxDeviation;
  35. set
  36. {
  37. BlockEngine.GetBlockInfo<ServoReadOnlyStruct>(this).maxDeviation = value;
  38. }
  39. }
  40. /// <summary>
  41. /// The servo's maximum force.
  42. /// </summary>
  43. public float MaximumForce
  44. {
  45. get => BlockEngine.GetBlockInfo<ServoReadOnlyStruct>(this).servoVelocity;
  46. set
  47. {
  48. BlockEngine.GetBlockInfo<ServoReadOnlyStruct>(this).servoVelocity = value;
  49. }
  50. }
  51. /// <summary>
  52. /// The servo's direction.
  53. /// </summary>
  54. public bool Reverse
  55. {
  56. get => BlockEngine.GetBlockInfo<ServoReadOnlyStruct>(this).reverse;
  57. set
  58. {
  59. BlockEngine.GetBlockInfo<ServoReadOnlyStruct>(this).reverse = value;
  60. }
  61. }
  62. }
  63. }