Browse Source

Update block IDs

tags/v2.0
NorbiPeti 3 years ago
parent
commit
0b2ffef0d3
3 changed files with 71 additions and 12 deletions
  1. +41
    -11
      TechbloxModdingAPI/Blocks/BlockIDs.cs
  2. +1
    -1
      TechbloxModdingAPI/Blocks/BlockTests.cs
  3. +29
    -0
      TechbloxModdingAPI/Tests/TechbloxModdingAPIPluginTest.cs

+ 41
- 11
TechbloxModdingAPI/Blocks/BlockIDs.cs View File

@@ -36,11 +36,8 @@ namespace TechbloxModdingAPI.Blocks
FrameWedgeS2,
FrameWedgeS3,
FrameWedgeS4,
SideS0S1,
SideS0S2,
SideS0S3,
SideS0S4,
SideS0S5,
SideS0S3 = 29,
SideS0S5 = 31,
SideS1S1,
SideS1S2,
SideS1S3,
@@ -51,11 +48,8 @@ namespace TechbloxModdingAPI.Blocks
SideS2S3,
SideS2S4,
SideS2S5,
WindscreenS1,
WindscreenS2,
WindscreenS3,
WindscreenS4,
WindscreenS5,
WindscreenS3 = 44,
WindscreenS5 = 46,
CarWheelArch,
CarArchSmallFlare,
CarArchFlare,
@@ -106,7 +100,43 @@ namespace TechbloxModdingAPI.Blocks
WideCylinderDiagonal,
NarrowCylinderDiagonal,
HeadlampTetrahedron,
CarWheelWideProfile = 200,
GoKartEngine,
Screen5X2Y2Z,
Screen5X2Y3Z,
Screen5X2Y5Z,
Screen9X2Y2Z,
Screen9X3Y2Z,
Screen9X2Y3Z,
Screen9X3Y3Z,
Screen9X2Y5Z,
Screen9X3Y5Z,
Screen11X3Y2Z,
Screen11X3Y3Z,
Screen11X3Y5Z,
Window6X2Y2Z,
Window6X3Y2Z,
Window6X2Y2ZS1,
Window6X3Y2ZS1,
Window6X2Y2ZS2,
Window6X3Y2ZS2,
Window6X2Y2ZS4,
Window6X3Y2ZS4,
FrameSquare,
FrameSkewedSquare,
FrameTriangle,
FrameSkewedTriangle,
GlassFrameSquare,
GlassFrameSkewedSquare,
GlassFrameTriangle,
GlassFrameSkewedTriangle,
GlassPlate,
GlassPlateTriangle,
GoKartWheelRigNoSteering,
GoKartWheelRigWithSteering,
GoKartSeat,
CarWheelWideProfile,
CarWheel,
GoKartWheelWideProfile,
GoKartWheel,
}
}

+ 1
- 1
TechbloxModdingAPI/Blocks/BlockTests.cs View File

@@ -140,7 +140,7 @@ namespace TechbloxModdingAPI.Blocks
Block newBlock = Block.PlaceNew(BlockIDs.DampedSpring, Unity.Mathematics.float3.zero + 1);
DampedSpring b = null; // Note: the assignment operation is a lambda, which slightly confuses the compiler
Assert.Errorless(() => { b = (DampedSpring) newBlock; }, "Casting block to DampedSpring raised an exception: ", "Casting block to DampedSpring completed without issue.");
if (!Assert.CloseTo(b.SpringFrequency, 30f, $"DampedSpring.SpringFrequency {b.SpringFrequency} does not equal default value, possibly because it failed silently.", "DampedSpring.SpringFrequency is close enough to default.")) return;
if (!Assert.CloseTo(b.Stiffness, 30f, $"DampedSpring.Stiffness {b.Stiffness} does not equal default value, possibly because it failed silently.", "DampedSpring.Stiffness is close enough to default.")) return;
if (!Assert.CloseTo(b.Damping, 30f, $"DampedSpring.Damping {b.Damping} does not equal default value, possibly because it failed silently.", "DampedSpring.Damping is close enough to default.")) return;
if (!Assert.CloseTo(b.MaxExtension, 0.3f, $"DampedSpring.MaxExtension {b.MaxExtension} does not equal default value, possibly because it failed silently.", "DampedSpring.MaxExtension is close enough to default.")) return;
}


+ 29
- 0
TechbloxModdingAPI/Tests/TechbloxModdingAPIPluginTest.cs View File

@@ -1,7 +1,11 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using DataLoader;
using TechbloxModdingAPI.App;
using HarmonyLib;
using IllusionInjector;
@@ -10,6 +14,7 @@ using RobocraftX.FrontEnd;
using Unity.Mathematics;
using UnityEngine;
using RobocraftX.Common.Input;
using ServiceLayer;
using TechbloxModdingAPI.Blocks;
using TechbloxModdingAPI.Commands;
using TechbloxModdingAPI.Input;
@@ -247,6 +252,30 @@ namespace TechbloxModdingAPI.Tests
/*((FasterList<GuiInputMap.GuiInputMapElement>)AccessTools.Property(typeof(GuiInputMap), "GuiInputsButtonDown").GetValue(null))
.Add(new GuiInputMap.GuiInputMapElement(RewiredConsts.Action.ToggleCommandLine, GuiIn))*/

/*Game.Enter += (sender, e) =>
{
ushort lastKey = ushort.MaxValue;
foreach (var kv in FullGameFields._dataDb.GetValues<CubeListData>()
.OrderBy(kv=>ushort.Parse(kv.Key)))
{
var data = (CubeListData) kv.Value;
ushort currentKey = ushort.Parse(kv.Key);
var toReplace = new Dictionary<string, string>
{
{"Scalable", ""}, {"Qtr", "Quarter"}, {"RNeg", "Rounded Negative"},
{"Neg", "Negative"}, {"Tetra", "Tetrahedron"},
{"RWedge", "Rounded Wedge"}, {"RTetra", "Rounded Tetrahedron"}
};
string name = LocalizationService.Localize(data.CubeNameKey).Replace(" ", "");
foreach (var rkv in toReplace)
{
name = Regex.Replace(name, "([^A-Za-z])" + rkv.Key + "([^A-Za-z])", "$1" + rkv.Value + "$2");
}
Console.WriteLine($"{name}{(currentKey != lastKey + 1 ? $" = {currentKey}" : "")},");
lastKey = currentKey;
}
};*/
#if TEST
TestRoot.RunTests();
#endif


Loading…
Cancel
Save