NorbiPeti
3592c6f464
Newly created blocks use the initializer to set properties, allowing the user to set per-block properties
51 lines
1.2 KiB
C#
51 lines
1.2 KiB
C#
using System;
|
|
|
|
using RobocraftX.Blocks;
|
|
using Svelto.ECS;
|
|
using Unity.Mathematics;
|
|
|
|
using GamecraftModdingAPI.Utility;
|
|
using RobocraftX.Common;
|
|
|
|
namespace GamecraftModdingAPI.Blocks
|
|
{
|
|
public class Piston : Block
|
|
{
|
|
public Piston(EGID id) : base(id)
|
|
{
|
|
}
|
|
|
|
public Piston(uint id) : base(new EGID(id, CommonExclusiveGroups.BUILD_PISTON_BLOCK_GROUP))
|
|
{
|
|
}
|
|
|
|
// custom piston properties
|
|
|
|
/// <summary>
|
|
/// The piston's max extension distance.
|
|
/// </summary>
|
|
public float MaximumExtension
|
|
{
|
|
get => BlockEngine.GetBlockInfo(this, (PistonReadOnlyStruct st) => st.maxDeviation);
|
|
|
|
set
|
|
{
|
|
BlockEngine.SetBlockInfo(this, (ref PistonReadOnlyStruct st, float val) => st.maxDeviation = val,
|
|
value);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// The piston's max extension force.
|
|
/// </summary>
|
|
public float MaximumForce
|
|
{
|
|
get => BlockEngine.GetBlockInfo(this, (PistonReadOnlyStruct st) => st.maxForce);
|
|
|
|
set
|
|
{
|
|
BlockEngine.SetBlockInfo(this, (ref PistonReadOnlyStruct st, float val) => st.maxForce = val, value);
|
|
}
|
|
}
|
|
}
|
|
}
|