Add code generator and new block classes
Block classes are generated with all of the properties from the given structs Properties can be renamed, their name is pulled from TweakableStat attributes if possible Added support for getting the wire being looked at
This commit is contained in:
commit
2513040343
18 changed files with 2339 additions and 53 deletions
142
CodeGenerator/BlockClassGenerator.cs
Normal file
142
CodeGenerator/BlockClassGenerator.cs
Normal file
|
@ -0,0 +1,142 @@
|
|||
using System;
|
||||
using System.CodeDom;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Gamecraft.Tweaks;
|
||||
using RobocraftX.Common;
|
||||
using Svelto.ECS;
|
||||
using Techblox.EngineBlock;
|
||||
|
||||
namespace CodeGenerator
|
||||
{
|
||||
public class BlockClassGenerator
|
||||
{
|
||||
public void Generate(string name, string group = null, Dictionary<string, string> renames = null, params Type[] types)
|
||||
{
|
||||
if (group is null)
|
||||
{
|
||||
group = GetGroup(name) + "_BLOCK_GROUP";
|
||||
if (typeof(CommonExclusiveGroups).GetFields().All(field => field.Name != group))
|
||||
group = GetGroup(name) + "_BLOCK_BUILD_GROUP";
|
||||
}
|
||||
|
||||
if (!group.Contains("."))
|
||||
group = "CommonExclusiveGroups." + group;
|
||||
|
||||
var codeUnit = new CodeCompileUnit();
|
||||
var ns = new CodeNamespace("TechbloxModdingAPI.Blocks");
|
||||
ns.Imports.Add(new CodeNamespaceImport("RobocraftX.Common"));
|
||||
ns.Imports.Add(new CodeNamespaceImport("Svelto.ECS"));
|
||||
var cl = new CodeTypeDeclaration(name);
|
||||
//cl.BaseTypes.Add(baseClass != null ? new CodeTypeReference(baseClass) : new CodeTypeReference("Block"));
|
||||
cl.BaseTypes.Add(new CodeTypeReference("SignalingBlock"));
|
||||
cl.Members.Add(new CodeConstructor
|
||||
{
|
||||
Parameters = {new CodeParameterDeclarationExpression("EGID", "egid")},
|
||||
Comments =
|
||||
{
|
||||
_start, new CodeCommentStatement($"Constructs a(n) {name} object representing an existing block.", true), _end
|
||||
},
|
||||
BaseConstructorArgs = {new CodeVariableReferenceExpression("egid")},
|
||||
Attributes = MemberAttributes.Public | MemberAttributes.Final
|
||||
});
|
||||
cl.Members.Add(new CodeConstructor
|
||||
{
|
||||
Parameters =
|
||||
{
|
||||
new CodeParameterDeclarationExpression(typeof(uint), "id")
|
||||
},
|
||||
Comments =
|
||||
{
|
||||
_start, new CodeCommentStatement($"Constructs a(n) {name} object representing an existing block.", true), _end
|
||||
},
|
||||
BaseConstructorArgs =
|
||||
{
|
||||
new CodeObjectCreateExpression("EGID", new CodeVariableReferenceExpression("id"),
|
||||
new CodeVariableReferenceExpression(group))
|
||||
},
|
||||
Attributes = MemberAttributes.Public | MemberAttributes.Final
|
||||
});
|
||||
foreach (var type in types)
|
||||
{
|
||||
GenerateProperties(cl, type, name, renames);
|
||||
}
|
||||
ns.Types.Add(cl);
|
||||
codeUnit.Namespaces.Add(ns);
|
||||
|
||||
var provider = CodeDomProvider.CreateProvider("CSharp");
|
||||
var path = $@"..\..\..\TechbloxModdingAPI\Blocks\{name}.cs";
|
||||
using (var sw = new StreamWriter(path))
|
||||
{
|
||||
provider.GenerateCodeFromCompileUnit(codeUnit, sw, new CodeGeneratorOptions {BracingStyle = "C"});
|
||||
}
|
||||
|
||||
File.WriteAllLines(path,
|
||||
File.ReadAllLines(path).SkipWhile(line => line.StartsWith("//") || line.Length == 0));
|
||||
}
|
||||
|
||||
private static string GetGroup(string name)
|
||||
{
|
||||
var ret = "";
|
||||
foreach (var ch in name)
|
||||
{
|
||||
if (char.IsUpper(ch) && ret.Length > 0)
|
||||
ret += "_" + ch;
|
||||
else
|
||||
ret += char.ToUpper(ch);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
private void GenerateProperties(CodeTypeDeclaration cl, Type type, string baseClass,
|
||||
Dictionary<string, string> renames)
|
||||
{
|
||||
if (!typeof(IEntityComponent).IsAssignableFrom(type))
|
||||
throw new ArgumentException("Type must be an entity component");
|
||||
foreach (var field in type.GetFields())
|
||||
{
|
||||
var attr = field.GetCustomAttribute<TweakableStatAttribute>();
|
||||
if (renames == null || !renames.TryGetValue(field.Name, out var propName))
|
||||
{
|
||||
propName = field.Name;
|
||||
if (attr != null)
|
||||
propName = attr.propertyName;
|
||||
}
|
||||
|
||||
propName = char.ToUpper(propName[0]) + propName.Substring(1);
|
||||
var structFieldReference = new CodeFieldReferenceExpression(new CodeMethodInvokeExpression(
|
||||
new CodeMethodReferenceExpression(new CodeSnippetExpression("BlockEngine"),
|
||||
"GetBlockInfo", new CodeTypeReference(type)),
|
||||
new CodeThisReferenceExpression()), field.Name);
|
||||
cl.Members.Add(new CodeMemberProperty
|
||||
{
|
||||
Name = propName,
|
||||
HasGet = true,
|
||||
HasSet = true,
|
||||
GetStatements =
|
||||
{
|
||||
new CodeMethodReturnStatement(structFieldReference)
|
||||
},
|
||||
SetStatements =
|
||||
{
|
||||
new CodeAssignStatement(structFieldReference, new CodePropertySetValueReferenceExpression())
|
||||
},
|
||||
Type = new CodeTypeReference(field.FieldType),
|
||||
Attributes = MemberAttributes.Public | MemberAttributes.Final,
|
||||
Comments =
|
||||
{
|
||||
_start, new CodeCommentStatement($"Gets or sets the {baseClass}'s {propName} property." +
|
||||
$" {(attr != null ? "Tweakable stat." : "May not be saved.")}", true), _end
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly CodeCommentStatement _start = new CodeCommentStatement("<summary>", true);
|
||||
private static readonly CodeCommentStatement _end = new CodeCommentStatement("</summary>", true);
|
||||
}
|
||||
}
|
1176
CodeGenerator/CodeGenerator.csproj
Normal file
1176
CodeGenerator/CodeGenerator.csproj
Normal file
File diff suppressed because it is too large
Load diff
42
CodeGenerator/Program.cs
Normal file
42
CodeGenerator/Program.cs
Normal file
|
@ -0,0 +1,42 @@
|
|||
using System.Collections.Generic;
|
||||
using RobocraftX.Blocks;
|
||||
using RobocraftX.PilotSeat;
|
||||
using Techblox.EngineBlock;
|
||||
using Techblox.WheelRigBlock;
|
||||
|
||||
namespace CodeGenerator
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var bcg = new BlockClassGenerator();
|
||||
bcg.Generate("Engine", null, new Dictionary<string, string>
|
||||
{
|
||||
{ "engineOn", "On" }
|
||||
}, typeof(EngineBlockComponent), // Simulation time properties
|
||||
typeof(EngineBlockTweakableComponent), typeof(EngineBlockReadonlyComponent));
|
||||
bcg.Generate("DampedSpring", "DAMPEDSPRING_BLOCK_GROUP", new Dictionary<string, string>
|
||||
{
|
||||
{"maxExtent", "MaxExtension"}
|
||||
},
|
||||
typeof(TweakableJointDampingComponent), typeof(DampedSpringReadOnlyStruct));
|
||||
bcg.Generate("LogicGate", "LOGIC_BLOCK_GROUP");
|
||||
bcg.Generate("Servo", types: typeof(ServoReadOnlyStruct), renames: new Dictionary<string, string>
|
||||
{
|
||||
{"minDeviation", "MinimumAngle"},
|
||||
{"maxDeviation", "MaximumAngle"},
|
||||
{"servoVelocity", "MaximumForce"}
|
||||
});
|
||||
bcg.Generate("WheelRig", "WHEELRIG_BLOCK_BUILD_GROUP", null,
|
||||
typeof(WheelRigTweakableStruct), typeof(WheelRigReadOnlyStruct),
|
||||
typeof(WheelRigSteerableTweakableStruct), typeof(WheelRigSteerableReadOnlyStruct));
|
||||
bcg.Generate("Seat", "RobocraftX.PilotSeat.SeatGroups.PILOTSEAT_BLOCK_BUILD_GROUP", null, typeof(SeatFollowCamComponent), typeof(SeatReadOnlySettingsComponent));
|
||||
bcg.Generate("Piston", null, new Dictionary<string, string>
|
||||
{
|
||||
{"pistonVelocity", "MaximumForce"}
|
||||
}, typeof(PistonReadOnlyStruct));
|
||||
bcg.Generate("Motor", null, null, typeof(MotorReadOnlyStruct));
|
||||
}
|
||||
}
|
||||
}
|
35
CodeGenerator/Properties/AssemblyInfo.cs
Normal file
35
CodeGenerator/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("CodeGenerator")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("CodeGenerator")]
|
||||
[assembly: AssemblyCopyright("Copyright © ExMods 2021")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("0EBB6400-95A7-4A3D-B2ED-BF31E364CC10")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.29411.108
|
|||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TechbloxModdingAPI", "TechbloxModdingAPI\TechbloxModdingAPI.csproj", "{7FD5A7D8-4F3E-426A-B07D-7DC70442A4DF}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeGenerator", "CodeGenerator\CodeGenerator.csproj", "{0EBB6400-95A7-4A3D-B2ED-BF31E364CC10}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -18,6 +20,12 @@ Global
|
|||
{7FD5A7D8-4F3E-426A-B07D-7DC70442A4DF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{7FD5A7D8-4F3E-426A-B07D-7DC70442A4DF}.Test|Any CPU.ActiveCfg = Test|Any CPU
|
||||
{7FD5A7D8-4F3E-426A-B07D-7DC70442A4DF}.Test|Any CPU.Build.0 = Test|Any CPU
|
||||
{0EBB6400-95A7-4A3D-B2ED-BF31E364CC10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0EBB6400-95A7-4A3D-B2ED-BF31E364CC10}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0EBB6400-95A7-4A3D-B2ED-BF31E364CC10}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0EBB6400-95A7-4A3D-B2ED-BF31E364CC10}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0EBB6400-95A7-4A3D-B2ED-BF31E364CC10}.Test|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0EBB6400-95A7-4A3D-B2ED-BF31E364CC10}.Test|Any CPU.Build.0 = Debug|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using HarmonyLib;
|
||||
|
||||
using RobocraftX;
|
||||
using RobocraftX.Common;
|
||||
using RobocraftX.Schedulers;
|
||||
using RobocraftX.SimulationModeState;
|
||||
|
|
|
@ -10,6 +10,7 @@ using RobocraftX.Blocks;
|
|||
using Unity.Mathematics;
|
||||
using Gamecraft.Blocks.GUI;
|
||||
using HarmonyLib;
|
||||
using RobocraftX.PilotSeat;
|
||||
|
||||
using TechbloxModdingAPI.Blocks;
|
||||
using TechbloxModdingAPI.Blocks.Engines;
|
||||
|
@ -93,7 +94,13 @@ namespace TechbloxModdingAPI
|
|||
new Dictionary<ExclusiveBuildGroup, (Func<EGID, Block>, Type)>
|
||||
{
|
||||
{CommonExclusiveGroups.DAMPEDSPRING_BLOCK_GROUP, (id => new DampedSpring(id), typeof(DampedSpring))},
|
||||
{CommonExclusiveGroups.ENGINE_BLOCK_BUILD_GROUP, (id => new Engine(id), typeof(Engine))}
|
||||
{CommonExclusiveGroups.ENGINE_BLOCK_BUILD_GROUP, (id => new Engine(id), typeof(Engine))},
|
||||
{CommonExclusiveGroups.LOGIC_BLOCK_GROUP, (id => new LogicGate(id), typeof(LogicGate))},
|
||||
{CommonExclusiveGroups.PISTON_BLOCK_GROUP, (id => new Piston(id), typeof(Piston))},
|
||||
{SeatGroups.PASSENGER_BLOCK_BUILD_GROUP, (id => new Seat(id), typeof(Seat))},
|
||||
{SeatGroups.PILOTSEAT_BLOCK_BUILD_GROUP, (id => new Seat(id), typeof(Seat))},
|
||||
{CommonExclusiveGroups.SERVO_BLOCK_GROUP, (id => new Servo(id), typeof(Servo))},
|
||||
{CommonExclusiveGroups.WHEELRIG_BLOCK_BUILD_GROUP, (id => new WheelRig(id), typeof(WheelRig))}
|
||||
};
|
||||
|
||||
internal static Block New(EGID egid)
|
||||
|
@ -340,6 +347,8 @@ namespace TechbloxModdingAPI
|
|||
return;
|
||||
}
|
||||
blockGroup?.RemoveInternal(this);
|
||||
if (!InitData.Valid)
|
||||
return;
|
||||
BlockEngine.GetBlockInfo<BlockGroupEntityComponent>(this).currentBlockGroup = (int?) value?.Id.entityID ?? -1;
|
||||
value?.AddInternal(this);
|
||||
blockGroup = value;
|
||||
|
|
|
@ -1,47 +1,71 @@
|
|||
using RobocraftX.Blocks;
|
||||
namespace TechbloxModdingAPI.Blocks
|
||||
{
|
||||
using RobocraftX.Common;
|
||||
using Svelto.ECS;
|
||||
|
||||
namespace TechbloxModdingAPI.Blocks
|
||||
{
|
||||
public class DampedSpring : Block
|
||||
{
|
||||
public DampedSpring(EGID id) : base(id)
|
||||
{
|
||||
}
|
||||
|
||||
public DampedSpring(uint id) : base(new EGID(id, CommonExclusiveGroups.DAMPEDSPRING_BLOCK_GROUP))
|
||||
public class DampedSpring : SignalingBlock
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a(n) DampedSpring object representing an existing block.
|
||||
/// </summary>
|
||||
public DampedSpring(EGID egid) :
|
||||
base(egid)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The spring's stiffness.
|
||||
/// Constructs a(n) DampedSpring object representing an existing block.
|
||||
/// </summary>
|
||||
public DampedSpring(uint id) :
|
||||
base(new EGID(id, CommonExclusiveGroups.DAMPEDSPRING_BLOCK_GROUP))
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the DampedSpring's Stiffness property. Tweakable stat.
|
||||
/// </summary>
|
||||
public float Stiffness
|
||||
{
|
||||
get => BlockEngine.GetBlockInfo<TweakableJointDampingComponent>(this).stiffness;
|
||||
|
||||
set => BlockEngine.GetBlockInfo<TweakableJointDampingComponent>(this).stiffness = value;
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<RobocraftX.Blocks.TweakableJointDampingComponent>(this).stiffness;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<RobocraftX.Blocks.TweakableJointDampingComponent>(this).stiffness = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The spring's maximum damping force.
|
||||
/// Gets or sets the DampedSpring's Damping property. Tweakable stat.
|
||||
/// </summary>
|
||||
public float Damping
|
||||
{
|
||||
get => BlockEngine.GetBlockInfo<TweakableJointDampingComponent>(this).damping;
|
||||
|
||||
set => BlockEngine.GetBlockInfo<TweakableJointDampingComponent>(this).damping = value;
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<RobocraftX.Blocks.TweakableJointDampingComponent>(this).damping;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<RobocraftX.Blocks.TweakableJointDampingComponent>(this).damping = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The spring's maximum extension.
|
||||
/// Gets or sets the DampedSpring's MaxExtension property. Tweakable stat.
|
||||
/// </summary>
|
||||
public float MaxExtension
|
||||
{
|
||||
get => BlockEngine.GetBlockInfo<DampedSpringReadOnlyStruct>(this).maxExtent;
|
||||
|
||||
set => BlockEngine.GetBlockInfo<DampedSpringReadOnlyStruct>(this).maxExtent = value;
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<RobocraftX.Blocks.DampedSpringReadOnlyStruct>(this).maxExtent;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<RobocraftX.Blocks.DampedSpringReadOnlyStruct>(this).maxExtent = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,35 +1,382 @@
|
|||
using RobocraftX.Common;
|
||||
using Svelto.ECS;
|
||||
using Techblox.EngineBlock;
|
||||
|
||||
namespace TechbloxModdingAPI.Blocks
|
||||
{
|
||||
using RobocraftX.Common;
|
||||
using Svelto.ECS;
|
||||
|
||||
|
||||
public class Engine : SignalingBlock
|
||||
{
|
||||
public Engine(EGID id) : base(id)
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a(n) Engine object representing an existing block.
|
||||
/// </summary>
|
||||
public Engine(EGID egid) :
|
||||
base(egid)
|
||||
{
|
||||
}
|
||||
|
||||
public Engine(uint id) : base(new EGID(id, CommonExclusiveGroups.ENGINE_BLOCK_BUILD_GROUP))
|
||||
/// <summary>
|
||||
/// Constructs a(n) Engine object representing an existing block.
|
||||
/// </summary>
|
||||
public Engine(uint id) :
|
||||
base(new EGID(id, CommonExclusiveGroups.ENGINE_BLOCK_BUILD_GROUP))
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Engine's On property. May not be saved.
|
||||
/// </summary>
|
||||
public bool On
|
||||
{
|
||||
get => BlockEngine.GetBlockInfo<EngineBlockComponent>(this).engineOn;
|
||||
set => BlockEngine.GetBlockInfo<EngineBlockComponent>(this).engineOn = value;
|
||||
}
|
||||
|
||||
public float CurrentTorque
|
||||
get
|
||||
{
|
||||
get => BlockEngine.GetBlockInfo<EngineBlockComponent>(this).currentTorque;
|
||||
set => BlockEngine.GetBlockInfo<EngineBlockComponent>(this).currentTorque = value;
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).engineOn;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).engineOn = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Engine's CurrentGear property. May not be saved.
|
||||
/// </summary>
|
||||
public int CurrentGear
|
||||
{
|
||||
get => BlockEngine.GetBlockInfo<EngineBlockComponent>(this).currentGear;
|
||||
set => BlockEngine.GetBlockInfo<EngineBlockComponent>(this).currentGear = value;
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).currentGear;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).currentGear = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Engine's GearChangeCountdown property. May not be saved.
|
||||
/// </summary>
|
||||
public float GearChangeCountdown
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).gearChangeCountdown;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).gearChangeCountdown = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Engine's CurrentRpmAV property. May not be saved.
|
||||
/// </summary>
|
||||
public float CurrentRpmAV
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).currentRpmAV;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).currentRpmAV = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Engine's CurrentRpmLV property. May not be saved.
|
||||
/// </summary>
|
||||
public float CurrentRpmLV
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).currentRpmLV;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).currentRpmLV = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Engine's TargetRpmAV property. May not be saved.
|
||||
/// </summary>
|
||||
public float TargetRpmAV
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).targetRpmAV;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).targetRpmAV = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Engine's TargetRpmLV property. May not be saved.
|
||||
/// </summary>
|
||||
public float TargetRpmLV
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).targetRpmLV;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).targetRpmLV = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Engine's CurrentTorque property. May not be saved.
|
||||
/// </summary>
|
||||
public float CurrentTorque
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).currentTorque;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).currentTorque = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Engine's TotalWheelVelocityAV property. May not be saved.
|
||||
/// </summary>
|
||||
public float TotalWheelVelocityAV
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).totalWheelVelocityAV;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).totalWheelVelocityAV = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Engine's TotalWheelVelocityLV property. May not be saved.
|
||||
/// </summary>
|
||||
public float TotalWheelVelocityLV
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).totalWheelVelocityLV;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).totalWheelVelocityLV = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Engine's TotalWheelCount property. May not be saved.
|
||||
/// </summary>
|
||||
public int TotalWheelCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).totalWheelCount;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).totalWheelCount = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Engine's LastGearUpInput property. May not be saved.
|
||||
/// </summary>
|
||||
public bool LastGearUpInput
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).lastGearUpInput;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).lastGearUpInput = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Engine's LastGearDownInput property. May not be saved.
|
||||
/// </summary>
|
||||
public bool LastGearDownInput
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).lastGearDownInput;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).lastGearDownInput = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Engine's ManualToAutoGearCoolOffCounter property. May not be saved.
|
||||
/// </summary>
|
||||
public float ManualToAutoGearCoolOffCounter
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).manualToAutoGearCoolOffCounter;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).manualToAutoGearCoolOffCounter = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Engine's Load property. May not be saved.
|
||||
/// </summary>
|
||||
public float Load
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).load;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).load = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Engine's Power property. Tweakable stat.
|
||||
/// </summary>
|
||||
public float Power
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockTweakableComponent>(this).power;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockTweakableComponent>(this).power = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Engine's AutomaticGears property. Tweakable stat.
|
||||
/// </summary>
|
||||
public bool AutomaticGears
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockTweakableComponent>(this).automaticGears;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockTweakableComponent>(this).automaticGears = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Engine's GearChangeTime property. May not be saved.
|
||||
/// </summary>
|
||||
public float GearChangeTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockReadonlyComponent>(this).gearChangeTime;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockReadonlyComponent>(this).gearChangeTime = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Engine's MinRpm property. May not be saved.
|
||||
/// </summary>
|
||||
public float MinRpm
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockReadonlyComponent>(this).minRpm;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockReadonlyComponent>(this).minRpm = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Engine's MaxRpm property. May not be saved.
|
||||
/// </summary>
|
||||
public float MaxRpm
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockReadonlyComponent>(this).maxRpm;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockReadonlyComponent>(this).maxRpm = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Engine's GearDownRpms property. May not be saved.
|
||||
/// </summary>
|
||||
public float[] GearDownRpms
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockReadonlyComponent>(this).gearDownRpms.ToManagedArray<float>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Engine's GearUpRpm property. May not be saved.
|
||||
/// </summary>
|
||||
public float GearUpRpm
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockReadonlyComponent>(this).gearUpRpm;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockReadonlyComponent>(this).gearUpRpm = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Engine's MaxRpmChange property. May not be saved.
|
||||
/// </summary>
|
||||
public float MaxRpmChange
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockReadonlyComponent>(this).maxRpmChange;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockReadonlyComponent>(this).maxRpmChange = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Engine's ManualToAutoGearCoolOffTime property. May not be saved.
|
||||
/// </summary>
|
||||
public float ManualToAutoGearCoolOffTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockReadonlyComponent>(this).manualToAutoGearCoolOffTime;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockReadonlyComponent>(this).manualToAutoGearCoolOffTime = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
26
TechbloxModdingAPI/Blocks/LogicGate.cs
Normal file
26
TechbloxModdingAPI/Blocks/LogicGate.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
namespace TechbloxModdingAPI.Blocks
|
||||
{
|
||||
using RobocraftX.Common;
|
||||
using Svelto.ECS;
|
||||
|
||||
|
||||
public class LogicGate : SignalingBlock
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a(n) LogicGate object representing an existing block.
|
||||
/// </summary>
|
||||
public LogicGate(EGID egid) :
|
||||
base(egid)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a(n) LogicGate object representing an existing block.
|
||||
/// </summary>
|
||||
public LogicGate(uint id) :
|
||||
base(new EGID(id, CommonExclusiveGroups.LOGIC_BLOCK_GROUP))
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
71
TechbloxModdingAPI/Blocks/Motor.cs
Normal file
71
TechbloxModdingAPI/Blocks/Motor.cs
Normal file
|
@ -0,0 +1,71 @@
|
|||
namespace TechbloxModdingAPI.Blocks
|
||||
{
|
||||
using RobocraftX.Common;
|
||||
using Svelto.ECS;
|
||||
|
||||
|
||||
public class Motor : SignalingBlock
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a(n) Motor object representing an existing block.
|
||||
/// </summary>
|
||||
public Motor(EGID egid) :
|
||||
base(egid)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a(n) Motor object representing an existing block.
|
||||
/// </summary>
|
||||
public Motor(uint id) :
|
||||
base(new EGID(id, CommonExclusiveGroups.MOTOR_BLOCK_GROUP))
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Motor's TopSpeed property. Tweakable stat.
|
||||
/// </summary>
|
||||
public float TopSpeed
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<RobocraftX.Blocks.MotorReadOnlyStruct>(this).maxVelocity;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<RobocraftX.Blocks.MotorReadOnlyStruct>(this).maxVelocity = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Motor's Torque property. Tweakable stat.
|
||||
/// </summary>
|
||||
public float Torque
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<RobocraftX.Blocks.MotorReadOnlyStruct>(this).maxForce;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<RobocraftX.Blocks.MotorReadOnlyStruct>(this).maxForce = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Motor's Reverse property. Tweakable stat.
|
||||
/// </summary>
|
||||
public bool Reverse
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<RobocraftX.Blocks.MotorReadOnlyStruct>(this).reverse;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<RobocraftX.Blocks.MotorReadOnlyStruct>(this).reverse = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
71
TechbloxModdingAPI/Blocks/Piston.cs
Normal file
71
TechbloxModdingAPI/Blocks/Piston.cs
Normal file
|
@ -0,0 +1,71 @@
|
|||
namespace TechbloxModdingAPI.Blocks
|
||||
{
|
||||
using RobocraftX.Common;
|
||||
using Svelto.ECS;
|
||||
|
||||
|
||||
public class Piston : SignalingBlock
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a(n) Piston object representing an existing block.
|
||||
/// </summary>
|
||||
public Piston(EGID egid) :
|
||||
base(egid)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a(n) Piston object representing an existing block.
|
||||
/// </summary>
|
||||
public Piston(uint id) :
|
||||
base(new EGID(id, CommonExclusiveGroups.PISTON_BLOCK_GROUP))
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Piston's MaximumForce property. Tweakable stat.
|
||||
/// </summary>
|
||||
public float MaximumForce
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<RobocraftX.Blocks.PistonReadOnlyStruct>(this).pistonVelocity;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<RobocraftX.Blocks.PistonReadOnlyStruct>(this).pistonVelocity = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Piston's MaxExtension property. Tweakable stat.
|
||||
/// </summary>
|
||||
public float MaxExtension
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<RobocraftX.Blocks.PistonReadOnlyStruct>(this).maxDeviation;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<RobocraftX.Blocks.PistonReadOnlyStruct>(this).maxDeviation = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Piston's InputIsExtension property. Tweakable stat.
|
||||
/// </summary>
|
||||
public bool InputIsExtension
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<RobocraftX.Blocks.PistonReadOnlyStruct>(this).hasProportionalInput;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<RobocraftX.Blocks.PistonReadOnlyStruct>(this).hasProportionalInput = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
56
TechbloxModdingAPI/Blocks/Seat.cs
Normal file
56
TechbloxModdingAPI/Blocks/Seat.cs
Normal file
|
@ -0,0 +1,56 @@
|
|||
namespace TechbloxModdingAPI.Blocks
|
||||
{
|
||||
using RobocraftX.Common;
|
||||
using Svelto.ECS;
|
||||
|
||||
|
||||
public class Seat : SignalingBlock
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a(n) Seat object representing an existing block.
|
||||
/// </summary>
|
||||
public Seat(EGID egid) :
|
||||
base(egid)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a(n) Seat object representing an existing block.
|
||||
/// </summary>
|
||||
public Seat(uint id) :
|
||||
base(new EGID(id, RobocraftX.PilotSeat.SeatGroups.PILOTSEAT_BLOCK_BUILD_GROUP))
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Seat's FollowCam property. Tweakable stat.
|
||||
/// </summary>
|
||||
public bool FollowCam
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<RobocraftX.PilotSeat.SeatFollowCamComponent>(this).followCam;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<RobocraftX.PilotSeat.SeatFollowCamComponent>(this).followCam = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Seat's CharacterColliderHeight property. May not be saved.
|
||||
/// </summary>
|
||||
public float CharacterColliderHeight
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<RobocraftX.PilotSeat.SeatReadOnlySettingsComponent>(this).characterColliderHeight;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<RobocraftX.PilotSeat.SeatReadOnlySettingsComponent>(this).characterColliderHeight = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
146
TechbloxModdingAPI/Blocks/Servo.cs
Normal file
146
TechbloxModdingAPI/Blocks/Servo.cs
Normal file
|
@ -0,0 +1,146 @@
|
|||
namespace TechbloxModdingAPI.Blocks
|
||||
{
|
||||
using RobocraftX.Common;
|
||||
using Svelto.ECS;
|
||||
|
||||
|
||||
public class Servo : SignalingBlock
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a(n) Servo object representing an existing block.
|
||||
/// </summary>
|
||||
public Servo(EGID egid) :
|
||||
base(egid)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a(n) Servo object representing an existing block.
|
||||
/// </summary>
|
||||
public Servo(uint id) :
|
||||
base(new EGID(id, CommonExclusiveGroups.SERVO_BLOCK_GROUP))
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Servo's MaximumForce property. Tweakable stat.
|
||||
/// </summary>
|
||||
public float MaximumForce
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<RobocraftX.Blocks.ServoReadOnlyStruct>(this).servoVelocity;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<RobocraftX.Blocks.ServoReadOnlyStruct>(this).servoVelocity = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Servo's MinimumAngle property. Tweakable stat.
|
||||
/// </summary>
|
||||
public float MinimumAngle
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<RobocraftX.Blocks.ServoReadOnlyStruct>(this).minDeviation;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<RobocraftX.Blocks.ServoReadOnlyStruct>(this).minDeviation = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Servo's MaximumAngle property. Tweakable stat.
|
||||
/// </summary>
|
||||
public float MaximumAngle
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<RobocraftX.Blocks.ServoReadOnlyStruct>(this).maxDeviation;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<RobocraftX.Blocks.ServoReadOnlyStruct>(this).maxDeviation = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Servo's Reverse property. Tweakable stat.
|
||||
/// </summary>
|
||||
public bool Reverse
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<RobocraftX.Blocks.ServoReadOnlyStruct>(this).reverse;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<RobocraftX.Blocks.ServoReadOnlyStruct>(this).reverse = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Servo's InputIsAngle property. Tweakable stat.
|
||||
/// </summary>
|
||||
public bool InputIsAngle
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<RobocraftX.Blocks.ServoReadOnlyStruct>(this).hasProportionalInput;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<RobocraftX.Blocks.ServoReadOnlyStruct>(this).hasProportionalInput = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Servo's DirectionVector property. May not be saved.
|
||||
/// </summary>
|
||||
public Unity.Mathematics.float3 DirectionVector
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<RobocraftX.Blocks.ServoReadOnlyStruct>(this).directionVector;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<RobocraftX.Blocks.ServoReadOnlyStruct>(this).directionVector = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Servo's RotationAxis property. May not be saved.
|
||||
/// </summary>
|
||||
public Unity.Mathematics.float3 RotationAxis
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<RobocraftX.Blocks.ServoReadOnlyStruct>(this).rotationAxis;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<RobocraftX.Blocks.ServoReadOnlyStruct>(this).rotationAxis = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Servo's ForceAxis property. May not be saved.
|
||||
/// </summary>
|
||||
public Unity.Mathematics.float3 ForceAxis
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<RobocraftX.Blocks.ServoReadOnlyStruct>(this).forceAxis;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<RobocraftX.Blocks.ServoReadOnlyStruct>(this).forceAxis = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
106
TechbloxModdingAPI/Blocks/WheelRig.cs
Normal file
106
TechbloxModdingAPI/Blocks/WheelRig.cs
Normal file
|
@ -0,0 +1,106 @@
|
|||
using TechbloxModdingAPI.Tests;
|
||||
|
||||
namespace TechbloxModdingAPI.Blocks
|
||||
{
|
||||
using RobocraftX.Common;
|
||||
using Svelto.ECS;
|
||||
|
||||
|
||||
public class WheelRig : SignalingBlock
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a(n) WheelRig object representing an existing block.
|
||||
/// </summary>
|
||||
public WheelRig(EGID egid) :
|
||||
base(egid)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a(n) WheelRig object representing an existing block.
|
||||
/// </summary>
|
||||
public WheelRig(uint id) :
|
||||
base(new EGID(id, CommonExclusiveGroups.WHEELRIG_BLOCK_BUILD_GROUP))
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the WheelRig's BrakingStrength property. Tweakable stat.
|
||||
/// </summary>
|
||||
public float BrakingStrength
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<Techblox.WheelRigBlock.WheelRigTweakableStruct>(this).brakingStrength;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<Techblox.WheelRigBlock.WheelRigTweakableStruct>(this).brakingStrength = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the WheelRig's MaxVelocity property. May not be saved.
|
||||
/// </summary>
|
||||
public float MaxVelocity
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<Techblox.WheelRigBlock.WheelRigReadOnlyStruct>(this).maxVelocity;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<Techblox.WheelRigBlock.WheelRigReadOnlyStruct>(this).maxVelocity = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the WheelRig's SteerAngle property. Tweakable stat.
|
||||
/// </summary>
|
||||
[TestValue(0f)] // Can be 0 for no steer variant
|
||||
public float SteerAngle
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<Techblox.WheelRigBlock.WheelRigSteerableTweakableStruct>(this).steerAngle;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<Techblox.WheelRigBlock.WheelRigSteerableTweakableStruct>(this).steerAngle = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the WheelRig's VelocityForMinAngle property. May not be saved.
|
||||
/// </summary>
|
||||
[TestValue(0f)]
|
||||
public float VelocityForMinAngle
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<Techblox.WheelRigBlock.WheelRigSteerableReadOnlyStruct>(this).velocityForMinAngle;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<Techblox.WheelRigBlock.WheelRigSteerableReadOnlyStruct>(this).velocityForMinAngle = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the WheelRig's MinSteerAngleFactor property. May not be saved.
|
||||
/// </summary>
|
||||
[TestValue(0f)]
|
||||
public float MinSteerAngleFactor
|
||||
{
|
||||
get
|
||||
{
|
||||
return BlockEngine.GetBlockInfo<Techblox.WheelRigBlock.WheelRigSteerableReadOnlyStruct>(this).minSteerAngleFactor;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.GetBlockInfo<Techblox.WheelRigBlock.WheelRigSteerableReadOnlyStruct>(this).minSteerAngleFactor = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@ using RobocraftX.Character.Movement;
|
|||
using Unity.Mathematics;
|
||||
using RobocraftX.Common;
|
||||
using RobocraftX.Common.Players;
|
||||
using RobocraftX.GUI.Wires;
|
||||
using RobocraftX.Physics;
|
||||
using Svelto.ECS;
|
||||
using Techblox.BuildingDrone;
|
||||
|
@ -432,6 +433,7 @@ namespace TechbloxModdingAPI
|
|||
{
|
||||
var egid = playerEngine.GetThingLookedAt(Id, maxDistance);
|
||||
return egid != EGID.Empty && egid.groupID != CommonExclusiveGroups.SIMULATION_BODIES_GROUP
|
||||
&& egid.groupID != WiresGUIExclusiveGroups.WireGroup
|
||||
? Block.New(egid)
|
||||
: null;
|
||||
}
|
||||
|
@ -449,6 +451,19 @@ namespace TechbloxModdingAPI
|
|||
: null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the wire the player is currently looking at in build mode.
|
||||
/// </summary>
|
||||
/// <param name="maxDistance">The maximum distance from the player (default is the player's building reach)</param>
|
||||
/// <returns>The wire or null if not found</returns>
|
||||
public Wire GetWireLookedAt(float maxDistance = -1f)
|
||||
{
|
||||
var egid = playerEngine.GetThingLookedAt(Id, maxDistance);
|
||||
return egid != EGID.Empty && egid.groupID == WiresGUIExclusiveGroups.WireGroup
|
||||
? new Wire(egid)
|
||||
: null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the blocks that are in the player's current selection.
|
||||
/// </summary>
|
||||
|
|
|
@ -312,6 +312,21 @@ namespace TechbloxModdingAPI.Tests
|
|||
|
||||
Loop().RunOn(Scheduler.leanRunner);
|
||||
}).Build();
|
||||
|
||||
CommandBuilder.Builder("importAssetBundle")
|
||||
.Action(() =>
|
||||
{
|
||||
Logging.CommandLog("Importing asset bundle...");
|
||||
var ab = AssetBundle.LoadFromFile(
|
||||
@"filepath");
|
||||
Logging.CommandLog("Imported asset bundle: " + ab);
|
||||
var assets = ab.LoadAllAssets();
|
||||
Logging.CommandLog("Loaded " + assets.Length + " assets");
|
||||
foreach (var asset in assets)
|
||||
{
|
||||
Logging.CommandLog(asset);
|
||||
}
|
||||
}).Build();
|
||||
#if TEST
|
||||
TestRoot.RunTests();
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Svelto.DataStructures;
|
||||
using Svelto.ECS;
|
||||
|
||||
|
|
Loading…
Reference in a new issue