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.

48 lines
1.4KB

  1. using RobocraftX.Blocks;
  2. using RobocraftX.Common;
  3. using Svelto.ECS;
  4. namespace GamecraftModdingAPI.Blocks
  5. {
  6. public class DampedSpring : Block
  7. {
  8. public DampedSpring(EGID id) : base(id)
  9. {
  10. }
  11. public DampedSpring(uint id) : base(new EGID(id, CommonExclusiveGroups.DAMPEDSPRING_BLOCK_GROUP))
  12. {
  13. }
  14. /// <summary>
  15. /// The spring's maximum force. This is known as Stiffness in-game
  16. /// </summary>
  17. public float MaxForce
  18. {
  19. get => BlockEngine.GetBlockInfo(this, (DampedSpringReadOnlyStruct dsrs) => dsrs.springFrequency);
  20. set => BlockEngine.SetBlockInfo(this,
  21. (ref DampedSpringReadOnlyStruct dsrs, float val) => dsrs.springFrequency = val, value);
  22. }
  23. /// <summary>
  24. /// Alias of MaxForce.
  25. /// </summary>
  26. public float Stiffness
  27. {
  28. get => MaxForce;
  29. set => MaxForce = value;
  30. }
  31. /// <summary>
  32. /// The spring's maximum damping force.
  33. /// </summary>
  34. public float Damping
  35. {
  36. get => BlockEngine.GetBlockInfo(this, (DampedSpringReadOnlyStruct ljf) => ljf.springDamping);
  37. set => BlockEngine.SetBlockInfo(this,
  38. (ref DampedSpringReadOnlyStruct ljf, float val) => ljf.springDamping = val, value);
  39. }
  40. }
  41. }