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) { if (!BlockEngine.GetBlockInfoExists(this.Id)) { throw new BlockTypeException($"Block is not a {this.GetType().Name} block"); } } public Piston(uint id) : base(new EGID(id, CommonExclusiveGroups.BUILD_PISTON_BLOCK_GROUP)) { if (!BlockEngine.GetBlockInfoExists(this.Id)) { throw new BlockTypeException($"Block is not a {this.GetType().Name} block"); } } // custom piston properties /// /// The piston's max extension distance. /// public float MaximumExtension { get => BlockEngine.GetBlockInfo(Id).maxDeviation; set { ref PistonReadOnlyStruct piston = ref BlockEngine.GetBlockInfo(Id); piston.maxDeviation = value; } } /// /// The piston's max extension force. /// public float MaximumForce { get => BlockEngine.GetBlockInfo(Id).maxForce; set { ref PistonReadOnlyStruct piston = ref BlockEngine.GetBlockInfo(Id); piston.maxForce = value; } } } }