Browse Source

Add block types, run tests, remove unintended properties

tags/v2.1.0
NorbiPeti 2 years ago
parent
commit
9693341d7a
3 changed files with 18 additions and 23 deletions
  1. +10
    -1
      TechbloxModdingAPI/Block.cs
  2. +3
    -22
      TechbloxModdingAPI/Blocks/Engine.cs
  3. +5
    -0
      TechbloxModdingAPI/Blocks/WheelRig.cs

+ 10
- 1
TechbloxModdingAPI/Block.cs View File

@@ -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;


+ 3
- 22
TechbloxModdingAPI/Blocks/Engine.cs View File

@@ -324,17 +324,13 @@ namespace TechbloxModdingAPI.Blocks
}
/// <summary>
/// Gets or sets the Engine's GearDownRpms property. May not be saved.
/// Gets the Engine's GearDownRpms property. May not be saved.
/// </summary>
public Svelto.ECS.DataStructures.NativeDynamicArray GearDownRpms
public float[] GearDownRpms
{
get
{
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockReadonlyComponent>(this).gearDownRpms;
}
set
{
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockReadonlyComponent>(this).gearDownRpms = value;
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockReadonlyComponent>(this).gearDownRpms.ToManagedArray<float>();
}
}
@@ -382,20 +378,5 @@ namespace TechbloxModdingAPI.Blocks
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockReadonlyComponent>(this).manualToAutoGearCoolOffTime = value;
}
}
/// <summary>
/// Gets or sets the Engine's EngineBlockDataId property. May not be saved.
/// </summary>
public int EngineBlockDataId
{
get
{
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockReadonlyComponent>(this).engineBlockDataId;
}
set
{
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockReadonlyComponent>(this).engineBlockDataId = value;
}
}
}
}

+ 5
- 0
TechbloxModdingAPI/Blocks/WheelRig.cs View File

@@ -1,3 +1,5 @@
using TechbloxModdingAPI.Tests;

namespace TechbloxModdingAPI.Blocks
{
using RobocraftX.Common;
@@ -56,6 +58,7 @@ namespace TechbloxModdingAPI.Blocks
/// <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
@@ -71,6 +74,7 @@ namespace TechbloxModdingAPI.Blocks
/// <summary>
/// Gets or sets the WheelRig's VelocityForMinAngle property. May not be saved.
/// </summary>
[TestValue(0f)]
public float VelocityForMinAngle
{
get
@@ -86,6 +90,7 @@ namespace TechbloxModdingAPI.Blocks
/// <summary>
/// Gets or sets the WheelRig's MinSteerAngleFactor property. May not be saved.
/// </summary>
[TestValue(0f)]
public float MinSteerAngleFactor
{
get


Loading…
Cancel
Save