From 77d5e59ef6012660c26db5c6b161488554851b00 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Thu, 12 Aug 2021 00:44:23 +0200 Subject: [PATCH] Add Motor class --- CodeGenerator/Program.cs | 1 + TechbloxModdingAPI/Blocks/Motor.cs | 71 ++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 TechbloxModdingAPI/Blocks/Motor.cs diff --git a/CodeGenerator/Program.cs b/CodeGenerator/Program.cs index 0af44ab..0e9dea5 100644 --- a/CodeGenerator/Program.cs +++ b/CodeGenerator/Program.cs @@ -36,6 +36,7 @@ namespace CodeGenerator { {"pistonVelocity", "MaximumForce"} }, typeof(PistonReadOnlyStruct)); + bcg.Generate("Motor", null, null, typeof(MotorReadOnlyStruct)); } } } \ No newline at end of file diff --git a/TechbloxModdingAPI/Blocks/Motor.cs b/TechbloxModdingAPI/Blocks/Motor.cs new file mode 100644 index 0000000..233d5f6 --- /dev/null +++ b/TechbloxModdingAPI/Blocks/Motor.cs @@ -0,0 +1,71 @@ +namespace TechbloxModdingAPI.Blocks +{ + using RobocraftX.Common; + using Svelto.ECS; + + + public class Motor : SignalingBlock + { + + /// + /// Constructs a(n) Motor object representing an existing block. + /// + public Motor(EGID egid) : + base(egid) + { + } + + /// + /// Constructs a(n) Motor object representing an existing block. + /// + public Motor(uint id) : + base(new EGID(id, CommonExclusiveGroups.MOTOR_BLOCK_GROUP)) + { + } + + /// + /// Gets or sets the Motor's TopSpeed property. Tweakable stat. + /// + public float TopSpeed + { + get + { + return BlockEngine.GetBlockInfo(this).maxVelocity; + } + set + { + BlockEngine.GetBlockInfo(this).maxVelocity = value; + } + } + + /// + /// Gets or sets the Motor's Torque property. Tweakable stat. + /// + public float Torque + { + get + { + return BlockEngine.GetBlockInfo(this).maxForce; + } + set + { + BlockEngine.GetBlockInfo(this).maxForce = value; + } + } + + /// + /// Gets or sets the Motor's Reverse property. Tweakable stat. + /// + public bool Reverse + { + get + { + return BlockEngine.GetBlockInfo(this).reverse; + } + set + { + BlockEngine.GetBlockInfo(this).reverse = value; + } + } + } +}