Add damped spring
This commit is contained in:
parent
4701b3577d
commit
c6a1ea35cc
3 changed files with 691 additions and 625 deletions
|
@ -139,6 +139,7 @@ namespace GamecraftModdingAPI
|
||||||
CommonExclusiveGroups.BUILD_LOOPEDSFX_BLOCK_GROUP
|
CommonExclusiveGroups.BUILD_LOOPEDSFX_BLOCK_GROUP
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{typeof(DampedSpring), new [] {CommonExclusiveGroups.BUILD_DAMPEDSPRING_BLOCK_GROUP}},
|
||||||
{typeof(TextBlock), new[] {CommonExclusiveGroups.BUILD_TEXT_BLOCK_GROUP}},
|
{typeof(TextBlock), new[] {CommonExclusiveGroups.BUILD_TEXT_BLOCK_GROUP}},
|
||||||
{typeof(Timer), new[] {CommonExclusiveGroups.BUILD_TIMER_BLOCK_GROUP}}
|
{typeof(Timer), new[] {CommonExclusiveGroups.BUILD_TIMER_BLOCK_GROUP}}
|
||||||
};
|
};
|
||||||
|
|
48
GamecraftModdingAPI/Blocks/DampedSpring.cs
Normal file
48
GamecraftModdingAPI/Blocks/DampedSpring.cs
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
using RobocraftX.Blocks;
|
||||||
|
using RobocraftX.Common;
|
||||||
|
using Svelto.ECS;
|
||||||
|
|
||||||
|
namespace GamecraftModdingAPI.Blocks
|
||||||
|
{
|
||||||
|
public class DampedSpring : Block
|
||||||
|
{
|
||||||
|
public DampedSpring(EGID id) : base(id)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public DampedSpring(uint id) : base(new EGID(id, CommonExclusiveGroups.BUILD_DAMPEDSPRING_BLOCK_GROUP))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The spring's maximum force. This is known as Stiffness in-game
|
||||||
|
/// </summary>
|
||||||
|
public float MaxForce
|
||||||
|
{
|
||||||
|
get => BlockEngine.GetBlockInfo(this, (DampedSpringReadOnlyStruct dsrs) => dsrs.maxForce);
|
||||||
|
|
||||||
|
set => BlockEngine.SetBlockInfo(this,
|
||||||
|
(ref DampedSpringReadOnlyStruct dsrs, float val) => dsrs.maxForce = val, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Alias of MaxForce.
|
||||||
|
/// </summary>
|
||||||
|
public float Stiffness
|
||||||
|
{
|
||||||
|
get => MaxForce;
|
||||||
|
set => MaxForce = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The spring's maximum damping force.
|
||||||
|
/// </summary>
|
||||||
|
public float Damping
|
||||||
|
{
|
||||||
|
get => BlockEngine.GetBlockInfo(this, (LinearJointForcesReadOnlyStruct ljf) => ljf.dampingForceMagnitude);
|
||||||
|
|
||||||
|
set => BlockEngine.SetBlockInfo(this,
|
||||||
|
(ref LinearJointForcesReadOnlyStruct ljf, float val) => ljf.dampingForceMagnitude = val, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue