From 124ef410c737fe1f343e269ffc5666abe73817a7 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Tue, 13 Apr 2021 02:05:16 +0200 Subject: [PATCH] Attempt to bring console back and update block ID list --- GamecraftModdingAPI/Blocks/BlockIDs.cs | 487 +++++------------- GamecraftModdingAPI/Blocks/BlockTests.cs | 4 +- GamecraftModdingAPI/Blocks/CustomBlock.cs | 9 +- GamecraftModdingAPI/Input/FakeInput.cs | 8 +- GamecraftModdingAPI/Main.cs | 2 +- .../Tests/GamecraftModdingAPIPluginTest.cs | 40 +- 6 files changed, 176 insertions(+), 374 deletions(-) diff --git a/GamecraftModdingAPI/Blocks/BlockIDs.cs b/GamecraftModdingAPI/Blocks/BlockIDs.cs index ff08b51..07e4192 100644 --- a/GamecraftModdingAPI/Blocks/BlockIDs.cs +++ b/GamecraftModdingAPI/Blocks/BlockIDs.cs @@ -9,362 +9,145 @@ namespace GamecraftModdingAPI.Blocks /// Called "nothing" in Gamecraft. (DBID.NOTHING) /// Invalid = ushort.MaxValue, - AluminiumCube = 0, - AxleS, - HingeS = 3, - MotorS, - HingeM, - MotorM, - TyreM, - AxleM, - IronCube, - RubberCube, - OiledCube, - AluminiumConeSegment, //12 - AluminiumCorner, - AluminiumRoundedCorner, - AluminiumSlicedCube, - AluminiumRoundedSlicedCube, - AluminiumCylinder, - AluminiumPyramidSegment, - AluminiumSlope, - AluminiumRoundedSlope, - AluminiumSphere, - RubberConeSegment, //22 - RubberCorner, - RubberRoundedCorner, - RubberSlicedCube, - RubberRoundedSlicedCube, - RubberCylinder, - RubberPyramidSegment, - RubberSlope, - RubberRoundedSlope, - RubberSphere, - OiledConeSegment, //32 - OiledCorner, - OiledRoundedCorner, - OiledSlicedCube, - OiledRoundedSlicedCube, - OiledCylinder, - OiledPyramidSegment, - OiledSlope, - OiledRoundedSlope, - OiledSphere, - IronConeSegment, //42 - IronCorner, - IronRoundedCorner, - IronSlicedCube, - IronRoundedSlicedCube, - IronCylinder, - IronPyramidSegment, - IronSlope, - IronRoundedSlope, - IronSphere, - GlassCube, //52 - GlassSlicedCube, - GlassSlope, - GlassCorner, - GlassPyramidSegment, - GlassRoundedSlicedCube, - GlassRoundedSlope, - GlassRoundedCorner, - GlassConeSegment, - GlassCylinder, - GlassSphere, - Lever, //63 - WoodenSlatsDoor = 65, - PlayerSpawn, //Crashes without special handling - SmallSpawn, - MediumSpawn, - LargeSpawn, + Cube = 0, + Wedge, + QuarterPyramid, + Tetrahedron, + RoundedWedge, + RoundedQuarterPyramid, + RoundedTetrahedron, + NegativeQuarterPyramid, + NegativeTetrahedron, + RoundedNegativeQuarterPyramid, + RoundedNegativeTetrahedron, //10 + PlateCube, + PlateWedge, + PlateQuarterPyramid, + PlateTetrahedron, + Sphere, + Frame, + FrameS1, + FrameS2, + FrameS3, + FrameS4, //20 + FrameS5, + FrameWedge, + FrameWedgeS1, + FrameWedgeS2, + FrameWedgeS3, + FrameWedgeS4, + SideS0S1, + SideS0S2, + SideS0S3, + SideS0S4, //30 + SideS0S5, + SideS1S1, + SideS1S2, + SideS1S3, + SideS1S4, + SideS1S5, + SideS2S1, + SideS2S2, + SideS2S3, + SideS2S4, + SideS2S5, + WindscreenS1, //42 + WindscreenS2, + WindscreenS3, + WindscreenS4, + WindscreenS5, + CarWheelArch, + CarArchSmallFlare, + CarArchFlare, + CarArchExtrudedFlare, //50 + Cube1X1, + Cube1X2, + Cube1X3, + Cube1X4, + Cube1X6, + Cube2X2, + Cube2X3, + Cube2X4, + Cube2X6, + Wedge1X1, //60 + Wedge1X2, + Wedge1X3, + Wedge2X1, + Wedge2X2, + Wedge2X3, + RoundedWedge1X1, + RoundedWedge1X2, + RoundedWedge1X3, + RoundedWedge2X1, + RoundedWedge2X2, //70 + RoundedWedge2X3, + Plate1X1, + Plate1X2, + Plate1X3, + Plate1X4, + Plate2X2, + Plate2X3, + Plate2X4, + Plate3X3, + Plate3X4, //80 + Cube1X1S1, + Cube1X2S1, + Cube1X3S1, + Wedge1X1S1, + Wedge1X2S1, + Wedge1X3S1, + Wedge2X1S1, + Wedge2X2S1, + Wedge2X3S1, + Wedge3X1S1, //90 + Wedge3X2S1, + Wedge3X3S1, + NegativeTetrahedron1X1S1, + NegativeTetrahedron1X2S1, + NegativeTetrahedron1X3S1, + NegativeTetrahedron2X1S1, + NegativeTetrahedron2X2S1, + NegativeTetrahedron2X3S1, + NegativeTetrahedron3X1S1, + Axle, //100 + Hinge, BallJoint, UniversalJoint, - ServoAxle, - ServoHinge, - StepperAxle, - StepperHinge, TelescopicJoint, + HingeSpring, + AxleSpring, DampedSpring, - ServoPiston, - StepperPiston, - PneumaticPiston, //80 - PneumaticHinge, - PneumaticAxle, - WindowedDoor, - Bench, - Chair, - Stool, - DampedHingeSpring, - PlainGlassDoor, - PlainWoodenDoor, - PilotSeat, //Might crash + WheelRigNoSteering, + WheelRigWithSteering, + NegativeTetrahedron3X2S1, //110 + NegativeTetrahedron3X3S1, + Tetrahedron1X1S1, + Tetrahedron1X2S1, + Tetrahedron1X3S1, + Tetrahedron2X1S1, + Tetrahedron2X2S1, + Tetrahedron2X3S1, + Tetrahedron3X1S1, + Tetrahedron3X2S1, + Tetrahedron3X3S1, //120 + QuarterPyramid1X1S1, + QuarterPyramid1X2S1, + QuarterPyramid1X3S1, + QuarterPyramid2X1S1, + QuarterPyramid2X2S1, + QuarterPyramid2X3S1, + QuarterPyramid3X1S1, + QuarterPyramid3X2S1, + QuarterPyramid3X3S1, + PlateTriangle, //130 + PlateCircle, + PlateQtrCircle, + PlateRWedge, + PlateRTetrahedron, + DriverSeat = 150, PassengerSeat, - PilotControls, - GrassCube, - DirtCube, - GrassConeSegment, - GrassCorner, - GrassRoundedCorner, - GrassSlicedCube, - GrassRoundedSlicedCube, - GrassPyramidSegment, - GrassSlope, - GrassRoundedSlope, - DirtConeSegment, - DirtCorner, - DirtRoundedCorner, - DirtSlicedCube, - DirtRoundedSlicedCube, - DirtPyramidSegment, - DirtSlope, - DirtRoundedSlope, - RubberHemisphere, - AluminiumHemisphere, - GrassInnerCornerBulged, - DirtInnerCornerBulged, - IronHemisphere, - OiledHemisphere, - GlassHemisphere, - TyreS, - ThreeWaySwitch, - Dial, //120 - CharacterOnEnterTrigger, //Probably crashes - CharacterOnLeaveTrigger, - CharacterOnStayTrigger, - ObjectOnEnterTrigger, - ObjectOnLeaveTrigger, - ObjectOnStayTrigger, - Button, - Switch, - TextBlock, //Brings up a screen - ConsoleBlock, //Brings up a screen - Door, - GlassDoor, - PoweredDoor, - PoweredGlassDoor, - AluminiumTubeCorner, - IronTubeCorner, - WoodCube, - WoodSlicedCube, - WoodSlope, - WoodCorner, - WoodPyramidSegment, - WoodConeSegment, - WoodRoundedSlicedCube, - WoodRoundedSlope, - WoodRoundedCorner, - WoodCylinder, - WoodHemisphere, - WoodSphere, - BrickCube, - DampedAxleSpring, //150 - BrickSlicedCube, - BrickSlope, - BrickCorner, - ConcreteCube, - ConcreteSlicedCube, - ConcreteSlope, - ConcreteCorner, - RoadCarTyre, - OffRoadCarTyre, - RacingCarTyre, - BicycleTyre, - FrontBikeTyre, - RearBikeTyre, - ChopperBikeTyre, - TractorTyre, - MonsterTruckTyre, - MotocrossBikeTyre, - CartTyre, //168 - ObjectIdentifier, - ANDLogicBlock, - NANDLogicBlock, - NORLogicBlock, - NOTLogicBlock, - ORLogicBlock, - XNORLogicBlock, - XORLogicBlock, - AbsoluteMathsBlock, - AdderMathsBlock, - DividerMathsBlock, - SignMathsBlock, //180 - MaxMathsBlock, - MinMathsBlock, - MultiplierMathsBlock, - SubtractorMathsBlock, - SimpleConnector, - MeanMathsBlock, - Bit, - Counter, - Timer, - ObjectFilter, - PlayerFilter, - TeamFilter, - Number2Text, //193 - DestructionManager = 260, - ChunkHealthModifier, - ClusterHealthModifier, //262 - BeachTree1 = 200, - BeachTree2, - BeachTree3, - Rock1, - Rock2, - Rock3, - Rock4, - BirchTree1, - BirchTree2, - BirchTree3, - PineTree1, - PineTree2, - PineTree3, - Flower1, - Flower2, - Flower3, - Shrub1, - Shrub2, - Shrub3, - CliffCube, - CliffSlicedCorner, - CliffCornerA, - CliffCornerB, - CliffSlopeA, - CliffSlopeB, - GrassEdge, - GrassEdgeInnerCorner, - GrassEdgeCorner, - GrassEdgeSlope, - CentreHUD, - ObjectiveHUD, - GameStatsHUD, //231 - GameOverBlock, - SFXBlockGameplay = 240, - SFXBlock8Bit, - SFXBlockInstrument, - SFXBlockSciFi, - SFXBlockLoops, - SFXBlockVocal, - MovementConstrainer, //246 - RotationConstrainer, - AdvancedMovementDampener, - AdvancedRotationDampener, - Mover = 250, - Rotator, - MovementDampener, - RotationDampener, - AdvancedMover, - AdvancedRotator, - MusicBlock, //256 - PlasmaCannonBlock, - QuantumRiflePickup = 300, - QuantumRifleAmmoPickup, - AluminiumSlicedFraction, - AluminiumSlicedSlope, - AluminiumHalfPyramidLeft = 305, - AluminiumHalfPyramidRight, - AluminiumPyramidSliced, - AluminiumTubeCross, - AluminiumTubeT, - AluminiumPlateSquare, - AluminiumPlateCircle, - AluminiumPlateTriangle, //312 - OiledSlicedFraction = 314, - OiledSlicedSlope, - OiledHalfPyramidLeft, - OiledHalfPyramidRight, - OiledPyramidSliced, - GlassSlicedFraction, - GlassSlicedSlope, - GlassHalfPyramidLeft, - GlassHalfPyramidRight, - GlassPyramidSliced, - RubberSlicedFraction, - RubberSlicedSlope, - RubberHalfPyramidLeft, - RubberHalfPyramidRight, - RubberPyramidSliced, - WoodSlicedFraction, - WoodSlicedSlope, //330 - WoodHalfPyramidLeft, - WoodHalfPyramidRight, - WoodPyramidSliced, - HexNetSlicedFraction, - HexNetSlicedSlope, - HexNetHalfPyramidLeft, - HexNetHalfPyramidRight, - HexNetPyramidSliced, - OiledTubeCross, - OiledTubeT, //340 - GlassTubeCross, - GlassTubeT, - RubberTubeCross, - RubberTubeT, - WoodTubeCross, - WoodTubeT, - HexNetTubeCross, - HexNetTubeT, - BouncyCube, - BouncySlicedCube, //350 - BouncySlope, - BouncyCorner, - OiledTubeCorner, - GlassTubeCorner, - RubberTubeCorner, - WoodTubeCorner, - Basketball, - BowlingBall, - SoccerBall, - GolfBall, //360 - HockeyPuck, - PoolBall, - BouncyBall, - TennisBall, - UnlitCube, - IronSlicedFraction, - IronSlicedSlope, - IronHalfPyramidLeft, - IronHalfPyramidRight, - IronPyramidSliced, //370 - IronTubeCross, - IronTubeT, - SFXBlockMob = 374, - PointLight, - SpotLight, - SunLight, - AmbientLight, - UnlitGlowCube = 381, - PointLightInvisible, - SpotLightInvisible, - UnlitSlope, - UnlitGlowSlope, - Fog, - Sky, - GridCube, - GridSlicedCube, - GridSlope, - GridCorner, - MagmaRockCube = 777, - MagmaRockCubeSliced, - MagmaRockSlope, - MagmaRockCorner, - MagmaRockPyramidSegment, - MagmaRockConeSegment, - MagmaRockSlicedRounded, - MagmaRockSlopeRounded, - MagmaRockCornerRounded, - HexNetCube, - HexNetCubeSliced, - HexNetSlope, - HexNetCorner, - HexNetPyramidSegment, - HexNetConeSegment, - HexNetSlicedRounded, - HexNetSlopeRounded, - HexNetCornerRounded, //794 - MagmaRockBulgedInner, - HexNetCylinder = 797, - HexNetHemisphere, - HexNetSphere, - HexNetTubeCorner, //800 - CenterOfMassBlock = 1346 + Engine, + CarWheelWideProfile = 200, + CarWheel, } } \ No newline at end of file diff --git a/GamecraftModdingAPI/Blocks/BlockTests.cs b/GamecraftModdingAPI/Blocks/BlockTests.cs index dbcd39e..7aac012 100644 --- a/GamecraftModdingAPI/Blocks/BlockTests.cs +++ b/GamecraftModdingAPI/Blocks/BlockTests.cs @@ -19,14 +19,14 @@ namespace GamecraftModdingAPI.Blocks [APITestCase(TestType.EditMode)] public static void TestPlaceNew() { - Block newBlock = Block.PlaceNew(BlockIDs.AluminiumCube, Unity.Mathematics.float3.zero); + Block newBlock = Block.PlaceNew(BlockIDs.Cube, Unity.Mathematics.float3.zero); Assert.NotNull(newBlock.Id, "Newly placed block is missing Id. This should be populated when the block is placed.", "Newly placed block Id is not null, block successfully placed."); } [APITestCase(TestType.EditMode)] public static void TestInitProperty() { - Block newBlock = Block.PlaceNew(BlockIDs.AluminiumCube, Unity.Mathematics.float3.zero + 2); + Block newBlock = Block.PlaceNew(BlockIDs.Cube, Unity.Mathematics.float3.zero + 2); if (!Assert.CloseTo(newBlock.Position, (Unity.Mathematics.float3.zero + 2), $"Newly placed block at {newBlock.Position} is expected at {Unity.Mathematics.float3.zero + 2}.", "Newly placed block position matches.")) return; //Assert.Equal(newBlock.Exists, true, "Newly placed block does not exist, possibly because Sync() skipped/missed/failed.", "Newly placed block exists, Sync() successful."); } diff --git a/GamecraftModdingAPI/Blocks/CustomBlock.cs b/GamecraftModdingAPI/Blocks/CustomBlock.cs index 535ce7a..c979234 100644 --- a/GamecraftModdingAPI/Blocks/CustomBlock.cs +++ b/GamecraftModdingAPI/Blocks/CustomBlock.cs @@ -18,6 +18,7 @@ using UnityEngine.AddressableAssets; using Material = UnityEngine.Material; using GamecraftModdingAPI.Utility; +using ServiceLayer; namespace GamecraftModdingAPI.Blocks { @@ -114,7 +115,7 @@ namespace GamecraftModdingAPI.Blocks { public static void Prefix(IDataDB dataDB) { - //var abd = dataDB.GetValue((int) BlockIDs.AluminiumCube); + //var abd = dataDB.GetValue((int) BlockIDs.Cube); foreach (var (key, type) in CustomBlocks) { var attr = type.GetCustomAttribute(); @@ -146,6 +147,12 @@ namespace GamecraftModdingAPI.Blocks foreach (var (id, action) in BlockChangeActions) action(dataDB.GetValue(id)); + + /*foreach (var (key, value) in dataDB.GetValues()) + { + var data = (CubeListData) value; + Console.WriteLine($"ID: {key} - Name: {data.CubeNameKey}: {LocalizationService.Localize(data.CubeNameKey)}"); + }*/ _canRegister = false; } diff --git a/GamecraftModdingAPI/Input/FakeInput.cs b/GamecraftModdingAPI/Input/FakeInput.cs index a8129a9..1d5564d 100644 --- a/GamecraftModdingAPI/Input/FakeInput.cs +++ b/GamecraftModdingAPI/Input/FakeInput.cs @@ -53,7 +53,7 @@ namespace GamecraftModdingAPI.Input /// Select the hotbar page by number? /// Quicksave? /// Paste? - public static void GuiInput(uint playerID = uint.MaxValue, int hotbar = -1, bool commandLine = false, bool escape = false, bool enter = false, bool debug = false, bool next = false, bool previous = false, bool tab = false, bool colour = false, int hotbarPage = -1, bool quickSave = false, bool paste = false) + public static void GuiInput(uint playerID = uint.MaxValue, int hotbar = -1, bool escape = false, bool enter = false, bool debug = false, bool next = false, bool previous = false, bool tab = false, int hotbarPage = -1, bool quickSave = false, bool paste = false) { if (playerID == uint.MaxValue) { @@ -76,7 +76,6 @@ namespace GamecraftModdingAPI.Input case 9: currentInput.guiMask |= RobocraftX.Common.Input.GuiInput.Hotbar_9; break; default: break; } - //if (commandLine) currentInput.guiMask |= RobocraftX.Common.Input.GuiInput.ToggleCommandLine; - TODO if (escape) currentInput.guiMask |= RobocraftX.Common.Input.GuiInput.Escape; if (enter) currentInput.guiMask |= RobocraftX.Common.Input.GuiInput.Return; if (debug) currentInput.guiMask |= RobocraftX.Common.Input.GuiInput.ToggleDebugDisplay; @@ -97,6 +96,7 @@ namespace GamecraftModdingAPI.Input case 10: currentInput.guiMask |= RobocraftX.Common.Input.GuiInput.HotbarPage10; break; default: break; } + //RewiredConsts.Action if (quickSave) currentInput.guiMask |= RobocraftX.Common.Input.GuiInput.QuickSave; if (paste) currentInput.guiMask |= RobocraftX.Common.Input.GuiInput.PasteSelection; } @@ -118,8 +118,8 @@ namespace GamecraftModdingAPI.Input if (left) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.Left; if (right) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.Right; if (sprint) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.Sprint; - if (toggleFly) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.SwitchFlyMode; - if (alt) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.AltAction; + //if (toggleFly) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.SwitchFlyMode; + //if (alt) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.AltAction; if (primary) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.PrimaryAction; if (secondary) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.SecondaryAction; if (tertiary) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.TertiaryAction; diff --git a/GamecraftModdingAPI/Main.cs b/GamecraftModdingAPI/Main.cs index bfb382e..57349de 100644 --- a/GamecraftModdingAPI/Main.cs +++ b/GamecraftModdingAPI/Main.cs @@ -91,7 +91,7 @@ namespace GamecraftModdingAPI AsyncUtils.Init(); GamecraftModdingAPI.App.Client.Init(); GamecraftModdingAPI.App.Game.Init(); - CustomBlock.Init(); + //CustomBlock.Init(); // init UI Interface.IMGUI.Constants.Init(); Interface.IMGUI.IMGUIManager.Init(); diff --git a/GamecraftModdingAPI/Tests/GamecraftModdingAPIPluginTest.cs b/GamecraftModdingAPI/Tests/GamecraftModdingAPIPluginTest.cs index bf7c0d6..410c0a5 100644 --- a/GamecraftModdingAPI/Tests/GamecraftModdingAPIPluginTest.cs +++ b/GamecraftModdingAPI/Tests/GamecraftModdingAPIPluginTest.cs @@ -26,8 +26,11 @@ using GamecraftModdingAPI.Commands; using GamecraftModdingAPI.Events; using GamecraftModdingAPI.Utility; using GamecraftModdingAPI.Blocks; +using GamecraftModdingAPI.Input; using GamecraftModdingAPI.Interface.IMGUI; using GamecraftModdingAPI.Players; +using RobocraftX.Common.Input; +using Svelto.DataStructures; using UnityEngine.AddressableAssets; using UnityEngine.AddressableAssets.ResourceLocators; using UnityEngine.ResourceManagement.AsyncOperations; @@ -171,7 +174,7 @@ namespace GamecraftModdingAPI.Tests .Description("Place a block of aluminium at the given coordinates") .Action((float x, float y, float z) => { - var block = Block.PlaceNew(BlockIDs.AluminiumCube, new float3(x, y, z)); + var block = Block.PlaceNew(BlockIDs.Cube, new float3(x, y, z)); Logging.CommandLog("Block placed with type: " + block.Type); }) .Build(); @@ -185,7 +188,7 @@ namespace GamecraftModdingAPI.Tests var sw = Stopwatch.StartNew(); for (int i = 0; i < 100; i++) for (int j = 0; j < 100; j++) - Block.PlaceNew(BlockIDs.AluminiumCube, new float3(x + i, y, z + j)); + Block.PlaceNew(BlockIDs.Cube, new float3(x + i, y, z + j)); //Block.Sync(); sw.Stop(); Logging.CommandLog("Finished in " + sw.ElapsedMilliseconds + "ms"); @@ -264,7 +267,7 @@ namespace GamecraftModdingAPI.Tests }) .Build();*/ - CommandBuilder.Builder() + /*CommandBuilder.Builder() .Name("WireTest") .Description("Place two blocks and then wire them together") .Action(() => @@ -275,7 +278,7 @@ namespace GamecraftModdingAPI.Tests Wire conn = notBlock.Connect(0, andBlock, 1); Logging.CommandLog(conn.ToString()); }) - .Build(); + .Build();*/ CommandBuilder.Builder("TestChunkHealth", "Sets the chunk looked at to the given health.") .Action((float val, float max) => @@ -291,13 +294,13 @@ namespace GamecraftModdingAPI.Tests .Action((float x, float y, float z) => { var pos = new float3(x, y, z); - var group = BlockGroup.Create(Block.PlaceNew(BlockIDs.AluminiumCube, pos, + var group = BlockGroup.Create(Block.PlaceNew(BlockIDs.Cube, pos, color: BlockColors.Aqua)); - Block.PlaceNew(BlockIDs.AluminiumCube, pos += new float3(1, 0, 0), color: BlockColors.Blue) + Block.PlaceNew(BlockIDs.Cube, pos += new float3(1, 0, 0), color: BlockColors.Blue) .BlockGroup = group; - Block.PlaceNew(BlockIDs.AluminiumCube, pos += new float3(1, 0, 0), color: BlockColors.Green) + Block.PlaceNew(BlockIDs.Cube, pos += new float3(1, 0, 0), color: BlockColors.Green) .BlockGroup = group; - Block.PlaceNew(BlockIDs.AluminiumCube, pos += new float3(1, 0, 0), color: BlockColors.Lime) + Block.PlaceNew(BlockIDs.Cube, pos += new float3(1, 0, 0), color: BlockColors.Lime) .BlockGroup = group; }).Build(); @@ -328,7 +331,7 @@ namespace GamecraftModdingAPI.Tests } }, "MoveLastBlock", "Move the most-recently-placed block, and any connected blocks by the given offset")); CommandManager.AddCommand(new SimpleCustomCommandEngine( - (x, y, z) => { Blocks.Placement.PlaceBlock(Blocks.BlockIDs.AluminiumCube, new Unity.Mathematics.float3(x, y, z)); }, + (x, y, z) => { Blocks.Placement.PlaceBlock(Blocks.BlockIDs.Cube, new Unity.Mathematics.float3(x, y, z)); }, "PlaceAluminium", "Place a block of aluminium at the given coordinates")); System.Random random = new System.Random(); // for command below CommandManager.AddCommand(new SimpleCustomCommandEngine( @@ -368,7 +371,7 @@ namespace GamecraftModdingAPI.Tests Logging.Log("Compatible GamecraftScripting detected"); } // Interface test - Interface.IMGUI.Group uiGroup = new Group(new Rect(20, 20, 200, 500), "GamecraftModdingAPI_UITestGroup", true); + /*Interface.IMGUI.Group uiGroup = new Group(new Rect(20, 20, 200, 500), "GamecraftModdingAPI_UITestGroup", true); Interface.IMGUI.Button button = new Button("TEST"); button.OnClick += (b, __) => { Logging.MetaDebugLog($"Click on {((Interface.IMGUI.Button)b).Name}");}; Interface.IMGUI.Button button2 = new Button("TEST2"); @@ -382,16 +385,16 @@ namespace GamecraftModdingAPI.Tests uiGroup.AddElement(button2); uiGroup.AddElement(uiText); uiGroup.AddElement(uiLabel); - uiGroup.AddElement(uiImg); + uiGroup.AddElement(uiImg);*/ - Addressables.LoadAssetAsync("Assets/Art/Textures/UI/FrontEndMap/RCX_Blue_Background_5k.jpg") + /*Addressables.LoadAssetAsync("Assets/Art/Textures/UI/FrontEndMap/RCX_Blue_Background_5k.jpg") .Completed += handle => { uiImg.Texture = handle.Result; uiImg.Enabled = true; Logging.MetaDebugLog($"Got blue bg asset {handle.Result}"); - }; + };*/ CommandBuilder.Builder("enableCompletions") @@ -414,8 +417,11 @@ namespace GamecraftModdingAPI.Tests Logging.MetaDebugLog("Test custom block catalog not found"); } - CustomBlock.ChangeExistingBlock((ushort) BlockIDs.TyreS, + CustomBlock.ChangeExistingBlock((ushort) BlockIDs.CarWheel, cld => cld.scalingPermission = ScalingPermission.NonUniform); + + /*((FasterList)AccessTools.Property(typeof(GuiInputMap), "GuiInputsButtonDown").GetValue(null)) + .Add(new GuiInputMap.GuiInputMapElement(RewiredConsts.Action.ToggleCommandLine, GuiIn))*/ #if TEST TestRoot.RunTests(); #endif @@ -465,6 +471,12 @@ namespace GamecraftModdingAPI.Tests } } + public override void OnUpdate() + { + if(UnityEngine.Input.GetKeyDown(KeyCode.Backslash)) + FakeInput.CustomInput(new LocalInputEntityStruct{commandLineToggleInput = true}); + } + [HarmonyPatch] public class MinimumSpecsPatch {