From 0b2ffef0d3793bc479fcc046d1059a93ff512c67 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Wed, 9 Jun 2021 22:03:15 +0200 Subject: [PATCH] Update block IDs --- TechbloxModdingAPI/Blocks/BlockIDs.cs | 52 +++++++++++++++---- TechbloxModdingAPI/Blocks/BlockTests.cs | 2 +- .../Tests/TechbloxModdingAPIPluginTest.cs | 29 +++++++++++ 3 files changed, 71 insertions(+), 12 deletions(-) diff --git a/TechbloxModdingAPI/Blocks/BlockIDs.cs b/TechbloxModdingAPI/Blocks/BlockIDs.cs index fcb3e41..8d1d443 100644 --- a/TechbloxModdingAPI/Blocks/BlockIDs.cs +++ b/TechbloxModdingAPI/Blocks/BlockIDs.cs @@ -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, } } \ No newline at end of file diff --git a/TechbloxModdingAPI/Blocks/BlockTests.cs b/TechbloxModdingAPI/Blocks/BlockTests.cs index f69315e..42e8910 100644 --- a/TechbloxModdingAPI/Blocks/BlockTests.cs +++ b/TechbloxModdingAPI/Blocks/BlockTests.cs @@ -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; } diff --git a/TechbloxModdingAPI/Tests/TechbloxModdingAPIPluginTest.cs b/TechbloxModdingAPI/Tests/TechbloxModdingAPIPluginTest.cs index 8ed3050..6a06e42 100644 --- a/TechbloxModdingAPI/Tests/TechbloxModdingAPIPluginTest.cs +++ b/TechbloxModdingAPI/Tests/TechbloxModdingAPIPluginTest.cs @@ -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)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() + .OrderBy(kv=>ushort.Parse(kv.Key))) + { + var data = (CubeListData) kv.Value; + ushort currentKey = ushort.Parse(kv.Key); + var toReplace = new Dictionary + { + {"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