2020-05-21 19:04:55 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
using RobocraftX.Blocks;
|
|
|
|
|
using Svelto.ECS;
|
|
|
|
|
using Unity.Mathematics;
|
|
|
|
|
|
|
|
|
|
using GamecraftModdingAPI.Utility;
|
2020-07-10 22:30:58 +00:00
|
|
|
|
using RobocraftX.Common;
|
2020-05-21 19:04:55 +00:00
|
|
|
|
|
|
|
|
|
namespace GamecraftModdingAPI.Blocks
|
|
|
|
|
{
|
2020-08-23 13:59:13 +00:00
|
|
|
|
public class Piston : SignalingBlock
|
2020-05-21 19:04:55 +00:00
|
|
|
|
{
|
2020-07-13 19:55:48 +00:00
|
|
|
|
public Piston(EGID id) : base(id)
|
2020-05-21 19:04:55 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-10 22:30:58 +00:00
|
|
|
|
public Piston(uint id) : base(new EGID(id, CommonExclusiveGroups.BUILD_PISTON_BLOCK_GROUP))
|
2020-05-21 19:04:55 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// custom piston properties
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The piston's max extension distance.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public float MaximumExtension
|
2020-07-15 19:58:24 +00:00
|
|
|
|
{
|
|
|
|
|
get => BlockEngine.GetBlockInfo(this, (PistonReadOnlyStruct st) => st.maxDeviation);
|
2020-05-21 19:04:55 +00:00
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
2020-07-15 19:58:24 +00:00
|
|
|
|
BlockEngine.SetBlockInfo(this, (ref PistonReadOnlyStruct st, float val) => st.maxDeviation = val,
|
|
|
|
|
value);
|
2020-05-21 19:04:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The piston's max extension force.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public float MaximumForce
|
2020-07-15 19:58:24 +00:00
|
|
|
|
{
|
|
|
|
|
get => BlockEngine.GetBlockInfo(this, (PistonReadOnlyStruct st) => st.maxForce);
|
2020-05-21 19:04:55 +00:00
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
2020-07-15 19:58:24 +00:00
|
|
|
|
BlockEngine.SetBlockInfo(this, (ref PistonReadOnlyStruct st, float val) => st.maxForce = val, value);
|
2020-05-21 19:04:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|