From 5c1fe34f46629fb341fd7acea982c0cb3f249293 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Wed, 15 Dec 2021 02:13:55 +0100 Subject: [PATCH] Bump version and restore displayed block fix attempt It doesn't work but anyway Also remove parameter that allowed placing blocks in sim --- Automation/bump_version.py | 10 +++++----- TechbloxModdingAPI/Block.cs | 11 ++++------- TechbloxModdingAPI/Blocks/Engines/BlockEngine.cs | 8 +++++++- TechbloxModdingAPI/TechbloxModdingAPI.csproj | 2 +- .../Tests/TechbloxModdingAPIPluginTest.cs | 2 +- doxygen.conf | 2 +- 6 files changed, 19 insertions(+), 16 deletions(-) diff --git a/Automation/bump_version.py b/Automation/bump_version.py index d3de051..a6d07b2 100755 --- a/Automation/bump_version.py +++ b/Automation/bump_version.py @@ -5,7 +5,7 @@ import re # this assumes a mostly semver-complient version number if __name__ == "__main__": - parser = argparse.ArgumentParser(description="Increment GamecraftModdingAPI version") + parser = argparse.ArgumentParser(description="Increment TechbloxModdingAPI version") parser.add_argument('version', metavar="VN", type=str, help="The version number to increment, or the index of the number (zero-indexed).") args = parser.parse_args() @@ -28,12 +28,12 @@ if __name__ == "__main__": old_version = "" new_version = "" - with open("../GamecraftModdingAPI/GamecraftModdingAPI.csproj", "r") as xmlFile: - print("Parsing GamecraftModdingAPI.csproj") + with open("../TechbloxModdingAPI/TechbloxModdingAPI.csproj", "r") as xmlFile: + print("Parsing TechbloxModdingAPI.csproj") fileStr = xmlFile.read() versionMatch = re.search(r"(.+)", fileStr) if versionMatch is None: - print("Unable to find version number in GamecraftModdingAPI.csproj") + print("Unable to find version number in TechbloxModdingAPI.csproj") exit(1) old_version = versionMatch.group(1) versionList = old_version.split(".") @@ -53,7 +53,7 @@ if __name__ == "__main__": print(new_version) newFileContents = fileStr.replace(""+old_version+"", ""+new_version+"") - with open("../GamecraftModdingAPI/GamecraftModdingAPI.csproj", "w") as xmlFile: + with open("../TechbloxModdingAPI/TechbloxModdingAPI.csproj", "w") as xmlFile: print("Writing new version to project file") xmlFile.write(newFileContents) diff --git a/TechbloxModdingAPI/Block.cs b/TechbloxModdingAPI/Block.cs index ec1147a..d752584 100644 --- a/TechbloxModdingAPI/Block.cs +++ b/TechbloxModdingAPI/Block.cs @@ -45,12 +45,10 @@ namespace TechbloxModdingAPI /// The block's position - default block size is 0.2 /// Whether the block should be auto-wired (if functional) /// The player who placed the block - /// /// The placed block or null if failed - public static Block PlaceNew(BlockIDs block, float3 position, bool autoWire = false, Player player = null, - bool force = false) + public static Block PlaceNew(BlockIDs block, float3 position, bool autoWire = false, Player player = null) { - if (PlacementEngine.IsInGame && (GameState.IsBuildMode() || force)) + if (PlacementEngine.IsInGame && GameState.IsBuildMode()) { var initializer = PlacementEngine.PlaceBlock(block, position, player, autoWire); var egid = initializer.EGID; @@ -162,11 +160,10 @@ namespace TechbloxModdingAPI /// The block's position (a block is 0.2 wide in terms of position) /// Whether the block should be auto-wired (if functional) /// The player who placed the block - /// Place even if not in build mode - public Block(BlockIDs type, float3 position, bool autoWire = false, Player player = null, bool force = false) + public Block(BlockIDs type, float3 position, bool autoWire = false, Player player = null) : base(block => { - if (!PlacementEngine.IsInGame || !GameState.IsBuildMode() && !force) + if (!PlacementEngine.IsInGame || !GameState.IsBuildMode()) throw new BlockException("Blocks can only be placed in build mode."); var initializer = PlacementEngine.PlaceBlock(type, position, player, autoWire); block.InitData = initializer; diff --git a/TechbloxModdingAPI/Blocks/Engines/BlockEngine.cs b/TechbloxModdingAPI/Blocks/Engines/BlockEngine.cs index c7c84cf..c305f93 100644 --- a/TechbloxModdingAPI/Blocks/Engines/BlockEngine.cs +++ b/TechbloxModdingAPI/Blocks/Engines/BlockEngine.cs @@ -13,6 +13,7 @@ using RobocraftX.Rendering; using RobocraftX.Rendering.GPUI; using Svelto.DataStructures; using Svelto.ECS; +using Svelto.ECS.EntityStructs; using Svelto.ECS.Hybrid; using Techblox.BuildingDrone; using Unity.Mathematics; @@ -94,7 +95,12 @@ namespace TechbloxModdingAPI.Blocks.Engines public void UpdateDisplayedBlock(EGID id) { if (!BlockExists(id)) return; - RenderingPatch.UpdateBlocks(); + var pos = entitiesDB.QueryEntity(id); + var rot = entitiesDB.QueryEntity(id); + var scale = entitiesDB.QueryEntity(id); + var skew = entitiesDB.QueryEntity(id); + entitiesDB.QueryEntity(id).matrix = + math.mul(float4x4.TRS(pos.position, rot.rotation, scale.scale), skew.skewMatrix); } internal void UpdatePrefab(Block block, byte material, bool flipped) diff --git a/TechbloxModdingAPI/TechbloxModdingAPI.csproj b/TechbloxModdingAPI/TechbloxModdingAPI.csproj index cf3a157..6fe520b 100644 --- a/TechbloxModdingAPI/TechbloxModdingAPI.csproj +++ b/TechbloxModdingAPI/TechbloxModdingAPI.csproj @@ -2,7 +2,7 @@ net472 true - 2.0.0 + 2.1.0 Exmods GNU General Public Licence 3+ https://git.exmods.org/modtainers/GamecraftModdingAPI diff --git a/TechbloxModdingAPI/Tests/TechbloxModdingAPIPluginTest.cs b/TechbloxModdingAPI/Tests/TechbloxModdingAPIPluginTest.cs index 75d0cc4..754d588 100644 --- a/TechbloxModdingAPI/Tests/TechbloxModdingAPIPluginTest.cs +++ b/TechbloxModdingAPI/Tests/TechbloxModdingAPIPluginTest.cs @@ -99,7 +99,7 @@ namespace TechbloxModdingAPI.Tests .Description("Place a block of aluminium at the given coordinates") .Action((float x, float y, float z) => { - var block = Block.PlaceNew(BlockIDs.Cube, new float3(x, y, z), force: true); + var block = Block.PlaceNew(BlockIDs.Cube, new float3(x, y, z)); Logging.CommandLog("Block placed with type: " + block.Type); }) .Build(); diff --git a/doxygen.conf b/doxygen.conf index 2747deb..4a0bdd5 100644 --- a/doxygen.conf +++ b/doxygen.conf @@ -38,7 +38,7 @@ PROJECT_NAME = "TechbloxModdingAPI" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = "v2.0.0" +PROJECT_NUMBER = "v2.1.0" # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a