2020-10-27 15:59:21 +00:00
|
|
|
using RobocraftX.Blocks;
|
|
|
|
using RobocraftX.Common;
|
|
|
|
using Svelto.ECS;
|
|
|
|
|
|
|
|
namespace GamecraftModdingAPI.Blocks
|
|
|
|
{
|
|
|
|
public class DampedSpring : Block
|
|
|
|
{
|
|
|
|
public DampedSpring(EGID id) : base(id)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-11-09 21:18:25 +00:00
|
|
|
public DampedSpring(uint id) : base(new EGID(id, CommonExclusiveGroups.DAMPEDSPRING_BLOCK_GROUP))
|
2020-10-27 15:59:21 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The spring's maximum force. This is known as Stiffness in-game
|
|
|
|
/// </summary>
|
|
|
|
public float MaxForce
|
|
|
|
{
|
2020-12-17 01:34:36 +00:00
|
|
|
get => BlockEngine.GetBlockInfo(this, (DampedSpringReadOnlyStruct dsrs) => dsrs.springFrequency);
|
2020-10-27 15:59:21 +00:00
|
|
|
|
|
|
|
set => BlockEngine.SetBlockInfo(this,
|
2020-12-17 01:34:36 +00:00
|
|
|
(ref DampedSpringReadOnlyStruct dsrs, float val) => dsrs.springFrequency = val, value);
|
2020-10-27 15:59:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Alias of MaxForce.
|
|
|
|
/// </summary>
|
|
|
|
public float Stiffness
|
|
|
|
{
|
|
|
|
get => MaxForce;
|
|
|
|
set => MaxForce = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The spring's maximum damping force.
|
|
|
|
/// </summary>
|
|
|
|
public float Damping
|
|
|
|
{
|
2020-12-17 01:34:36 +00:00
|
|
|
get => BlockEngine.GetBlockInfo(this, (DampedSpringReadOnlyStruct ljf) => ljf.springDamping);
|
2020-10-27 15:59:21 +00:00
|
|
|
|
|
|
|
set => BlockEngine.SetBlockInfo(this,
|
2020-12-17 01:34:36 +00:00
|
|
|
(ref DampedSpringReadOnlyStruct ljf, float val) => ljf.springDamping = val, value);
|
2020-10-27 15:59:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|