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.

DampedSpring.cs 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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.BUILD_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.maxForce);
  20. set => BlockEngine.SetBlockInfo(this,
  21. (ref DampedSpringReadOnlyStruct dsrs, float val) => dsrs.maxForce = 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, (LinearJointForcesReadOnlyStruct ljf) => ljf.dampingForceMagnitude);
  37. set => BlockEngine.SetBlockInfo(this,
  38. (ref LinearJointForcesReadOnlyStruct ljf, float val) => ljf.dampingForceMagnitude = val, value);
  39. }
  40. }
  41. }