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.

52 lines
1.2KB

  1. using System;
  2. using RobocraftX.Blocks;
  3. using Svelto.ECS;
  4. using Unity.Mathematics;
  5. using GamecraftModdingAPI.Utility;
  6. using RobocraftX.Common;
  7. namespace GamecraftModdingAPI.Blocks
  8. {
  9. public class Piston : SignalingBlock
  10. {
  11. public Piston(EGID id) : base(id)
  12. {
  13. }
  14. public Piston(uint id) : base(new EGID(id, CommonExclusiveGroups.PISTON_BLOCK_GROUP))
  15. {
  16. }
  17. // custom piston properties
  18. /// <summary>
  19. /// The piston's max extension distance.
  20. /// </summary>
  21. public float MaximumExtension
  22. {
  23. get => BlockEngine.GetBlockInfo(this, (PistonReadOnlyStruct st) => st.maxDeviation);
  24. set
  25. {
  26. BlockEngine.SetBlockInfo(this, (ref PistonReadOnlyStruct st, float val) => st.maxDeviation = val,
  27. value);
  28. }
  29. }
  30. /// <summary>
  31. /// The piston's max extension force.
  32. /// </summary>
  33. public float MaximumForce
  34. {
  35. get => BlockEngine.GetBlockInfo(this, (PistonReadOnlyStruct st) => st.maxForce);
  36. set
  37. {
  38. BlockEngine.SetBlockInfo(this, (ref PistonReadOnlyStruct st, float val) => st.maxForce = val, value);
  39. }
  40. }
  41. }
  42. }