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.

Servo.cs 1.8KB

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