From 619a5003cf9e1b771ee857895dec68d80cd53cfa Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Thu, 4 Nov 2021 20:45:21 +0100 Subject: [PATCH] Update to Techblox 2021.11.03.15.56 Save game details were changed, they may not work properly Game mode change event no longer sends game data, needs fixing --- TechbloxModdingAPI/App/Game.cs | 22 +--- .../App/GameBuildSimEventEngine.cs | 4 +- TechbloxModdingAPI/App/GameGameEngine.cs | 10 +- TechbloxModdingAPI/App/GameMenuEngine.cs | 15 ++- TechbloxModdingAPI/Block.cs | 9 +- TechbloxModdingAPI/Blocks/BlockIDs.cs | 120 +++++++++++++++++- TechbloxModdingAPI/Blocks/BlockMaterial.cs | 17 ++- .../Blocks/Engines/BlueprintEngine.cs | 75 +++++++++++ TechbloxModdingAPI/Commands/CommandPatch.cs | 5 +- TechbloxModdingAPI/Player.cs | 2 +- TechbloxModdingAPI/TechbloxModdingAPI.csproj | 68 +++++++++- .../Tests/TechbloxModdingAPIPluginTest.cs | 16 ++- .../Utility/NativeApiExtensions.cs | 5 + 13 files changed, 321 insertions(+), 47 deletions(-) diff --git a/TechbloxModdingAPI/App/Game.cs b/TechbloxModdingAPI/App/Game.cs index ad7ba33..56854b6 100644 --- a/TechbloxModdingAPI/App/Game.cs +++ b/TechbloxModdingAPI/App/Game.cs @@ -165,7 +165,7 @@ namespace TechbloxModdingAPI.App { if (!VerifyMode()) return null; if (menuMode) return menuEngine.GetGameInfo(EGID).GameName; - return GameMode.SaveGameDetails.Name; + return gameEngine.GetGameData().saveName; } set @@ -174,11 +174,7 @@ namespace TechbloxModdingAPI.App if (menuMode) { menuEngine.SetGameName(EGID, value); - } - else - { - GameMode.SaveGameDetails.Name = value; - } + } // Save details are directly saved from user input or not changed at all when in game } } @@ -201,11 +197,7 @@ namespace TechbloxModdingAPI.App if (menuMode) { menuEngine.SetGameDescription(EGID, value); - } - else - { - // No description exists in-game - } + } // No description exists in-game } } @@ -219,7 +211,7 @@ namespace TechbloxModdingAPI.App { if (!VerifyMode()) return null; if (menuMode) return menuEngine.GetGameInfo(EGID).SavedGamePath; - return GameMode.SaveGameDetails.Folder; + return gameEngine.GetGameData().gameID; } set @@ -229,12 +221,6 @@ namespace TechbloxModdingAPI.App { menuEngine.GetGameInfo(EGID).SavedGamePath.Set(value); } - else - { - // this likely breaks things - GameMode.SaveGameDetails = new SaveGameDetails(GameMode.SaveGameDetails.Id, - GameMode.SaveGameDetails.SaveMode, GameMode.SaveGameDetails.Name, value); - } } } diff --git a/TechbloxModdingAPI/App/GameBuildSimEventEngine.cs b/TechbloxModdingAPI/App/GameBuildSimEventEngine.cs index d4697ff..67e6769 100644 --- a/TechbloxModdingAPI/App/GameBuildSimEventEngine.cs +++ b/TechbloxModdingAPI/App/GameBuildSimEventEngine.cs @@ -27,13 +27,13 @@ namespace TechbloxModdingAPI.App public JobHandle OnInitializeTimeRunningMode(JobHandle inputDeps) { - SimulationMode.Invoke(this, new GameEventArgs { GameName = GameMode.SaveGameDetails.Name, GamePath = GameMode.SaveGameDetails.Folder }); + SimulationMode.Invoke(this, new GameEventArgs { GameName = "", GamePath = "" }); // TODO return inputDeps; } public JobHandle OnInitializeTimeStoppedMode(JobHandle inputDeps) { - BuildMode.Invoke(this, new GameEventArgs { GameName = GameMode.SaveGameDetails.Name, GamePath = GameMode.SaveGameDetails.Folder }); + BuildMode.Invoke(this, new GameEventArgs { GameName = "", GamePath = "" }); return inputDeps; } } diff --git a/TechbloxModdingAPI/App/GameGameEngine.cs b/TechbloxModdingAPI/App/GameGameEngine.cs index 9ec648e..f1ec8e7 100644 --- a/TechbloxModdingAPI/App/GameGameEngine.cs +++ b/TechbloxModdingAPI/App/GameGameEngine.cs @@ -8,6 +8,7 @@ using Svelto.Tasks; using Svelto.Tasks.Lean; using RobocraftX.Blocks; using RobocraftX.ScreenshotTaker; +using Techblox.GameSelection; using TechbloxModdingAPI.Blocks; using TechbloxModdingAPI.Engines; using TechbloxModdingAPI.Tasks; @@ -29,7 +30,7 @@ namespace TechbloxModdingAPI.App public void Dispose() { - ExitGame.Invoke(this, new GameEventArgs { GameName = GameMode.SaveGameDetails.Name, GamePath = GameMode.SaveGameDetails.Folder }); + ExitGame.Invoke(this, new GameEventArgs { GameName = GetGameData().saveName, GamePath = GetGameData().gameID }); IsInGame = false; } @@ -41,7 +42,7 @@ namespace TechbloxModdingAPI.App private IEnumerator EnteringGame() { yield return new WaitForSubmissionEnumerator(GameLoadedEnginePatch.Scheduler).Continue(); - EnterGame.Invoke(this, new GameEventArgs { GameName = GameMode.SaveGameDetails.Name, GamePath = GameMode.SaveGameDetails.Folder }); + EnterGame.Invoke(this, new GameEventArgs { GameName = GetGameData().saveName, GamePath = GetGameData().gameID }); IsInGame = true; } @@ -132,5 +133,10 @@ namespace TechbloxModdingAPI.App local.enabled = true; entitiesDB.PublishEntityChange(ScreenshotTakerEgids.ScreenshotTaker); } + + public GameSelectionComponent GetGameData() + { + return entitiesDB.QueryEntity(GameSelectionConstants.GameSelectionEGID); + } } } diff --git a/TechbloxModdingAPI/App/GameMenuEngine.cs b/TechbloxModdingAPI/App/GameMenuEngine.cs index 9d8e448..2f65016 100644 --- a/TechbloxModdingAPI/App/GameMenuEngine.cs +++ b/TechbloxModdingAPI/App/GameMenuEngine.cs @@ -7,9 +7,10 @@ using RobocraftX.GUI; using RobocraftX.GUI.MyGamesScreen; using Svelto.ECS; using Svelto.ECS.Experimental; -using Techblox.Services.Machines; +using Techblox.GameSelection; using TechbloxModdingAPI.Engines; using TechbloxModdingAPI.Utility; +using GameMode = RobocraftX.Common.GameMode; namespace TechbloxModdingAPI.App { @@ -82,10 +83,16 @@ namespace TechbloxModdingAPI.App public bool EnterGame(string gameName, string path, bool autoEnterSim = false) { GameMode.CurrentMode = autoEnterSim ? RCXMode.Play : RCXMode.Build; - GameMode.SaveGameDetails = new SaveGameDetails(MachineStorageId.CreateNew().ToString(), - SaveGameMode.NewSave, gameName, path); + var data = new GameSelectionData + { + gameMode = Techblox.GameSelection.GameMode.PlayGame, + gameType = GameType.MachineEditor, + saveName = gameName, + saveType = SaveType.ExistingSave, + gameID = path + }; // the private FullGameCompositionRoot.SwitchToGame() method gets passed to menu items for this reason - AccessTools.Method(typeof(FullGameCompositionRoot), "SwitchToGame").Invoke(FullGameFields.Instance, Array.Empty()); + AccessTools.Method(typeof(FullGameCompositionRoot), "SwitchToGame").Invoke(FullGameFields.Instance, new object[]{data}); return true; } diff --git a/TechbloxModdingAPI/Block.cs b/TechbloxModdingAPI/Block.cs index d94817f..c2f8dd8 100644 --- a/TechbloxModdingAPI/Block.cs +++ b/TechbloxModdingAPI/Block.cs @@ -74,6 +74,11 @@ namespace TechbloxModdingAPI return egid.HasValue ? New(egid.Value) : null; } + /*public static Block CreateGhostBlock() + { + return BlockGroup._engine.BuildGhostChild(); + }*/ + /// /// An event that fires each time a block is placed. /// @@ -381,8 +386,8 @@ namespace TechbloxModdingAPI /// public bool Static { - get => BlockEngine.GetBlockInfo(this).staticIfUnconnected; - set => BlockEngine.GetBlockInfo(this).staticIfUnconnected = value; + get => false; + set { } } /// diff --git a/TechbloxModdingAPI/Blocks/BlockIDs.cs b/TechbloxModdingAPI/Blocks/BlockIDs.cs index 09016aa..e454c40 100644 --- a/TechbloxModdingAPI/Blocks/BlockIDs.cs +++ b/TechbloxModdingAPI/Blocks/BlockIDs.cs @@ -151,22 +151,128 @@ namespace TechbloxModdingAPI.Blocks HatchbackWheelArch, HatchbackArchSmallFlare, HatchbackArchFlare, - TruckWheel = 246, + CeilingStripLight, + CardboardBox, + BarrierRail, + BarrierRailEnd, + TruckWheel, HatchbackWheelWideProfile, TruckWheelRigWithSteering = 249, TruckWheelRigNoSteering, HatchbackDriverSeat, HatchbackPassengerSeat, FormulaEngine, - TruckWheelDouble = 261, + SmallGrass, + SmallGrassRoad, + GrassBridge, + SmallGrassTurn, + MediumGrassTurn, + LargeGrassTurn, + ExtraLargeGrassTurn, + TruckWheelDouble, TruckWheelArch, TruckArchSingleFlare, - FormulaWheel = 270, + WoodenDoorWithWindow, + TyreBarrierCorner, + TyreBarrierEdge, + TyreBarrierCenter, + AppleTree, + AppleForestTree, + FormulaWheel, FormulaWheelRear, - FormulaSeat = 277, - MonsterTruckWheel = 285, - MonsterTruckEngine = 290, - MonsterTruckWheelRigNoSteering = 350, + AppleSapling, + GrassHill, + GrassHillInnerCorner, + GrassHillOuterCorner, + GrassRoadHill, + FormulaSeat, + SmallDirt, + SmallDirtRoad, + SmallDirtTurn, + MediumDirtTurn, + LargeDirtTurn, + ExtraLargeDirtTurn, + SmallGrid, + MonsterTruckWheel, + SmallGrassGridStart, + SmallGrassRumbleStripRoad, + SmallGrassRumbleStripEndRoad, + SmallGrassStartLine, + MonsterTruckEngine, + DirtHill, + DirtHillInnerCorner, + DirtHillOuterCorner, + BuildingWindowEdge, + BuildingWindowCorner, + BuildingWindowStraight, + BuildingWindowTJunction, + BuildingWindowCross, + BuildingWindowEdgeSill, + BuildingWindowCornerSill, + BuildingWindowTJunctionSill, + Broadleaf, + ForestBroadleaf, + AzaleaBush, + AzaleaFlowers1, + AzaleaFlowers2, + TreeStump1, + TreeStump2, + FieldJuniper, + ForestJuniper, + JuniperSapling, + JuniperSeedling, + FieldRedMaple, + RedMapleForest1, + RedMapleForest2, + RedMapleSapling, + FieldWhiteSpruce, + ForestWhiteSpruce, + WhiteSpruceSapling, + GirderBase, + GirderStraight, + GirderDiagonal, + GirderCorner, + PostBase, + PostStraight, + PostLShape, + PostTJunction, + PostCross, + PostCorner, + PostDiagonal, + DirtRock1, + DirtRock2, + DirtRock3, + DirtRock4, + DirtRoadHill, + WoodenPalette, + ElderberryBush, + BarrelCactus, + KnapweedFlower, + MarigoldFlowers, + TrampledBushyBluestep, + RoughGrass, + DogRose, + WesternSwordFern, + BackyardGrass, + ThickGrass, + FireExtinguisher, + DirtLowRamp, + DirtTabletopRamp, + MonsterTruckWheelRigNoSteering, MonsterTruckWheelRigWithSteering, + MeadowCloudyDayAtmosphere, + BarrierRailDiagonal, + DirtHighRamp, + GrassRock1, + GrassRock2, + GrassRock3, + GrassRock4, + GreenFieldsSunnyDayAtmosphere, + RedMountainsDawnAtmosphere, + HighFantasySunriseAtmosphere, + /// + /// The grid block used by the world editor, named Small Grid like the other one + /// + SmallGridInWorldEditor } } \ No newline at end of file diff --git a/TechbloxModdingAPI/Blocks/BlockMaterial.cs b/TechbloxModdingAPI/Blocks/BlockMaterial.cs index 7093066..777845a 100644 --- a/TechbloxModdingAPI/Blocks/BlockMaterial.cs +++ b/TechbloxModdingAPI/Blocks/BlockMaterial.cs @@ -15,6 +15,21 @@ namespace TechbloxModdingAPI.Blocks SteelBodyworkRustedPaint, SteelBodyworkHeavyRust, WoodVarnishedDark, - Chrome + Chrome, + FenceChainLink, + ConcreteUnpainted, + Grid9x9, + CeramicTileFloor, + PlasticBumpy, + PlasticDustySmeared, + AluminiumGarageDoor, + SteelRigidScratched, + AluminiumBrushedTinted, + AluminiumSheetStained, + ConcretePaintedGrooves, + PlasticSpecklySatin, + SteelBodyworkPaintedChipped, + WoodPainted, + WoodRoughGrungy, } } \ No newline at end of file diff --git a/TechbloxModdingAPI/Blocks/Engines/BlueprintEngine.cs b/TechbloxModdingAPI/Blocks/Engines/BlueprintEngine.cs index 4bc5f5d..51b9f4c 100644 --- a/TechbloxModdingAPI/Blocks/Engines/BlueprintEngine.cs +++ b/TechbloxModdingAPI/Blocks/Engines/BlueprintEngine.cs @@ -5,15 +5,20 @@ using Gamecraft.Blocks.BlockGroups; using Gamecraft.GUI.Blueprints; using HarmonyLib; using RobocraftX.Blocks; +using RobocraftX.Blocks.Ghost; using RobocraftX.Common; using RobocraftX.CR.MachineEditing.BoxSelect; using RobocraftX.CR.MachineEditing.BoxSelect.ClipboardOperations; +using RobocraftX.Physics; +using RobocraftX.Rendering; +using RobocraftX.Rendering.GPUI; using Svelto.DataStructures; using Svelto.ECS; using Svelto.ECS.DataStructures; using Svelto.ECS.EntityStructs; using Svelto.ECS.Native; using Svelto.ECS.Serialization; +using Techblox.Blocks; using TechbloxModdingAPI.Engines; using TechbloxModdingAPI.Utility; using Unity.Collections; @@ -252,6 +257,76 @@ namespace TechbloxModdingAPI.Blocks.Engines { clipboardManager.DecrementRefCount(blueprintID); } + + + //GhostChildUtility.BuildGhostChild + public Block BuildGhostChild() + { + var sourceId = new EGID(Player.LocalPlayer.Id, GHOST_BLOCKS_ENABLED.Group); + var positionEntityStruct = entitiesDB.QueryEntity(sourceId); + var rotationEntityStruct = entitiesDB.QueryEntity(sourceId); + var scalingEntityStruct = entitiesDB.QueryEntity(sourceId); + var dbStruct = entitiesDB.QueryEntity(sourceId); + var colliderStruct = entitiesDB.QueryEntity(sourceId); + var colorStruct = entitiesDB.QueryEntity(sourceId); + uint ghostChildBlockId = CommonExclusiveGroups.GetNewGhostChildBlockID(); + var ghostEntityReference = GhostBlockUtils.GetGhostEntityReference(sourceId.entityID, entitiesDB); + var entityInitializer = BuildGhostBlueprintFactory.Build( + new EGID(ghostChildBlockId, BoxSelectExclusiveGroups.GhostChildEntitiesExclusiveGroup), /*dbStruct.DBID*/ (uint)BlockIDs.Cube); + entityInitializer.Init(dbStruct); + entityInitializer.Init(new GFXPrefabEntityStructGPUI( + PrefabsID.GetOrCreatePrefabID((ushort)entityInitializer.Get().prefabAssetID, + entitiesDB.QueryEntity(sourceId).materialId, 7, + FlippedBlockUtils.IsFlipped(in scalingEntityStruct.scale)), true)); + entityInitializer.Init(entitiesDB.QueryEntity(sourceId)); + entityInitializer.Init(new GhostParentEntityStruct + { + ghostBlockParentEntityReference = ghostEntityReference, + ownerMustSerializeOnAdd = false + }); + entityInitializer.Init(colorStruct); + entityInitializer.Init(colliderStruct); + entityInitializer.Init(new RigidBodyEntityStruct + { + position = positionEntityStruct.position, + rotation = rotationEntityStruct.rotation + }); + entityInitializer.Init(new ScalingEntityStruct + { + scale = scalingEntityStruct.scale + }); + entityInitializer.Init(new LocalTransformEntityStruct + { + position = positionEntityStruct.position, + rotation = rotationEntityStruct.rotation + }); + entityInitializer.Init(new RotationEntityStruct + { + rotation = rotationEntityStruct.rotation + }); + entityInitializer.Init(new PositionEntityStruct + { + position = positionEntityStruct.position + }); + entityInitializer.Init(new SkewComponent + { + skewMatrix = entitiesDB.QueryEntity(sourceId).skewMatrix + }); + entityInitializer.Init(new BlockPlacementInfoStruct + { + placedByBuildingDrone = entitiesDB + .QueryEntityOptional(new EGID(Player.LocalPlayer.Id, + BoxSelectExclusiveGroups.BoxSelectVolumeExclusiveGroup)).Get().buildingDroneReference + }); + entityInitializer.Init(new GridRotationStruct + { + position = float3.zero, + rotation = quaternion.identity + }); + var block = Block.New(entityInitializer.EGID); + block.InitData = entityInitializer; + return block; + } public string Name { get; } = "TechbloxModdingAPIBlueprintGameEngine"; public bool isRemovable { get; } = false; diff --git a/TechbloxModdingAPI/Commands/CommandPatch.cs b/TechbloxModdingAPI/Commands/CommandPatch.cs index 169891a..b928c1d 100644 --- a/TechbloxModdingAPI/Commands/CommandPatch.cs +++ b/TechbloxModdingAPI/Commands/CommandPatch.cs @@ -12,13 +12,12 @@ namespace TechbloxModdingAPI.Commands { /// /// Patch of RobocraftX.CR.MainGame.MainGameCompositionRoot.DeterministicCompose() - /// Initializes existing and custom commands + /// Initializes custom commands /// [HarmonyPatch] static class CommandPatch { - public static void Postfix(Action reloadGame, MultiplayerInitParameters multiplayerParameters, - StateSyncRegistrationHelper stateSyncReg) + public static void Postfix(StateSyncRegistrationHelper stateSyncReg) { /*CommandLineCompositionRoot.Compose(contextHolder, stateSyncReg.enginesRoot, reloadGame, multiplayerParameters, stateSyncReg); - uREPL C# compilation not supported anymore */ diff --git a/TechbloxModdingAPI/Player.cs b/TechbloxModdingAPI/Player.cs index 4f5607a..b3b0536 100644 --- a/TechbloxModdingAPI/Player.cs +++ b/TechbloxModdingAPI/Player.cs @@ -314,7 +314,7 @@ namespace TechbloxModdingAPI get { var optstruct = playerEngine.GetCharacterStruct(Id); - return optstruct ? (BlockIDs) optstruct.Get().SelectedDBPartID : BlockIDs.Invalid; + return optstruct ? (BlockIDs) optstruct.Get().selectedDBPartID : BlockIDs.Invalid; } } diff --git a/TechbloxModdingAPI/TechbloxModdingAPI.csproj b/TechbloxModdingAPI/TechbloxModdingAPI.csproj index 015c897..95927f8 100644 --- a/TechbloxModdingAPI/TechbloxModdingAPI.csproj +++ b/TechbloxModdingAPI/TechbloxModdingAPI.csproj @@ -116,10 +116,6 @@ ..\ref\TechbloxPreview_Data\Managed\Gamecraft.Blocks.GenericPhysicsBlocks.dll ..\..\ref\TechbloxPreview_Data\Managed\Gamecraft.Blocks.GenericPhysicsBlocks.dll - - ..\ref\TechbloxPreview_Data\Managed\Gamecraft.Blocks.LightBlock.dll - ..\..\ref\TechbloxPreview_Data\Managed\Gamecraft.Blocks.LightBlock.dll - ..\ref\TechbloxPreview_Data\Managed\Gamecraft.Blocks.LogicBlock.dll ..\..\ref\TechbloxPreview_Data\Managed\Gamecraft.Blocks.LogicBlock.dll @@ -480,6 +476,10 @@ ..\ref\TechbloxPreview_Data\Managed\RobocraftX.MainGame.dll ..\..\ref\TechbloxPreview_Data\Managed\RobocraftX.MainGame.dll + + ..\ref\TechbloxPreview_Data\Managed\RobocraftX.MainGameMock.dll + ..\..\ref\TechbloxPreview_Data\Managed\RobocraftX.MainGameMock.dll + ..\ref\TechbloxPreview_Data\Managed\RobocraftX.MainSimulation.dll ..\..\ref\TechbloxPreview_Data\Managed\RobocraftX.MainSimulation.dll @@ -592,6 +592,10 @@ ..\ref\TechbloxPreview_Data\Managed\Svelto.Tasks.dll ..\..\ref\TechbloxPreview_Data\Managed\Svelto.Tasks.dll + + ..\ref\TechbloxPreview_Data\Managed\Techblox.AtmosphereBlock.dll + ..\..\ref\TechbloxPreview_Data\Managed\Techblox.AtmosphereBlock.dll + ..\ref\TechbloxPreview_Data\Managed\Techblox.AutoForward.dll ..\..\ref\TechbloxPreview_Data\Managed\Techblox.AutoForward.dll @@ -600,6 +604,10 @@ ..\ref\TechbloxPreview_Data\Managed\Techblox.Backend.dll ..\..\ref\TechbloxPreview_Data\Managed\Techblox.Backend.dll + + ..\ref\TechbloxPreview_Data\Managed\Techblox.Blocks.LightBlock.dll + ..\..\ref\TechbloxPreview_Data\Managed\Techblox.Blocks.LightBlock.dll + ..\ref\TechbloxPreview_Data\Managed\Techblox.Building.Rules.dll ..\..\ref\TechbloxPreview_Data\Managed\Techblox.Building.Rules.dll @@ -624,6 +632,22 @@ ..\ref\TechbloxPreview_Data\Managed\Techblox.Environment.dll ..\..\ref\TechbloxPreview_Data\Managed\Techblox.Environment.dll + + ..\ref\TechbloxPreview_Data\Managed\Techblox.EnvironmentBlocks.BuildingEnvironment.dll + ..\..\ref\TechbloxPreview_Data\Managed\Techblox.EnvironmentBlocks.BuildingEnvironment.dll + + + ..\ref\TechbloxPreview_Data\Managed\Techblox.EnvironmentBlocks.dll + ..\..\ref\TechbloxPreview_Data\Managed\Techblox.EnvironmentBlocks.dll + + + ..\ref\TechbloxPreview_Data\Managed\Techblox.EnvironmentBlocks.SimulationWorldEnvironment.dll + ..\..\ref\TechbloxPreview_Data\Managed\Techblox.EnvironmentBlocks.SimulationWorldEnvironment.dll + + + ..\ref\TechbloxPreview_Data\Managed\Techblox.GameSelection.dll + ..\..\ref\TechbloxPreview_Data\Managed\Techblox.GameSelection.dll + ..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Building.dll ..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Building.dll @@ -640,6 +664,18 @@ ..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.dll ..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.dll + + ..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.GamePortal.dll + ..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.GamePortal.dll + + + ..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.GamePortal.MockUps.dll + ..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.GamePortal.MockUps.dll + + + ..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Hotbar.Landscapes.dll + ..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Hotbar.Landscapes.dll + ..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Hotbar.Materials.dll ..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Hotbar.Materials.dll @@ -648,6 +684,10 @@ ..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Inventory.Common.dll ..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Inventory.Common.dll + + ..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Inventory.Landscapes.dll + ..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Inventory.Landscapes.dll + ..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Inventory.Materials.dll ..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Inventory.Materials.dll @@ -656,6 +696,14 @@ ..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Login.dll ..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Login.dll + + ..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Mocks.dll + ..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Mocks.dll + + + ..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Mocks.DynamicListBuild.dll + ..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Mocks.DynamicListBuild.dll + ..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.MyGamesScreen.dll ..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.MyGamesScreen.dll @@ -664,6 +712,10 @@ ..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Notifications.MockUps.dll ..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Notifications.MockUps.dll + + ..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.TabsBar.Landscapes.dll + ..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.TabsBar.Landscapes.dll + ..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.TabsBar.Materials.dll ..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.TabsBar.Materials.dll @@ -676,6 +728,10 @@ ..\ref\TechbloxPreview_Data\Managed\Techblox.Pointer.dll ..\..\ref\TechbloxPreview_Data\Managed\Techblox.Pointer.dll + + ..\ref\TechbloxPreview_Data\Managed\Techblox.ProceduralReflectionProbes.dll + ..\..\ref\TechbloxPreview_Data\Managed\Techblox.ProceduralReflectionProbes.dll + ..\ref\TechbloxPreview_Data\Managed\Techblox.Rendering.Common.dll ..\..\ref\TechbloxPreview_Data\Managed\Techblox.Rendering.Common.dll @@ -704,6 +760,10 @@ ..\ref\TechbloxPreview_Data\Managed\Techblox.Services.Eos.dll ..\..\ref\TechbloxPreview_Data\Managed\Techblox.Services.Eos.dll + + ..\ref\TechbloxPreview_Data\Managed\Techblox.Services.GameDetails.dll + ..\..\ref\TechbloxPreview_Data\Managed\Techblox.Services.GameDetails.dll + ..\ref\TechbloxPreview_Data\Managed\Techblox.Services.Storage.dll ..\..\ref\TechbloxPreview_Data\Managed\Techblox.Services.Storage.dll diff --git a/TechbloxModdingAPI/Tests/TechbloxModdingAPIPluginTest.cs b/TechbloxModdingAPI/Tests/TechbloxModdingAPIPluginTest.cs index 4c648eb..1557f53 100644 --- a/TechbloxModdingAPI/Tests/TechbloxModdingAPIPluginTest.cs +++ b/TechbloxModdingAPI/Tests/TechbloxModdingAPIPluginTest.cs @@ -49,7 +49,7 @@ namespace TechbloxModdingAPI.Tests FileLog.Reset(); Harmony.DEBUG = true; Main.Init(); - Logging.MetaDebugLog($"Version group id {(uint)ApiExclusiveGroups.versionGroup}"); + Logging.MetaDebugLog($"Version group id {ApiExclusiveGroups.versionGroup}"); // disable background music Logging.MetaDebugLog("Audio Mixers: " + string.Join(",", AudioTools.GetMixers())); //AudioTools.SetVolume(0.0f, "Music"); // The game now sets this from settings again after this is called :( @@ -273,7 +273,9 @@ namespace TechbloxModdingAPI.Tests {"Neg", "Negative"}, {"Tetra", "Tetrahedron"}, {"RWedge", "Rounded Wedge"}, {"RTetra", "Rounded Tetrahedron"} }; - string name = LocalizationService.Localize(data.CubeNameKey).Replace(" ", ""); + string name = LocalizationService.Localize(data.CubeNameKey).Split(' ').Select(str => + str.Length > 0 ? char.ToUpper(str[0]) + str.Substring(1) : str).Aggregate((a, b) => a + b) + .Replace("-", ""); foreach (var rkv in toReplace) { name = Regex.Replace(name, rkv.Key + "([A-Z]|$)", rkv.Value + "$1"); @@ -284,8 +286,16 @@ namespace TechbloxModdingAPI.Tests };*/ /*Game.Enter += (sender, e) => { + ushort lastKey = ushort.MaxValue; Console.WriteLine("Materials:\n" + FullGameFields._dataDb.GetValues() - .Select(kv => $"{kv.Key}: {((MaterialPropertiesData) kv.Value).Name}") + .OrderBy(kv => ushort.Parse(kv.Key)) + .Select(kv => + { + ushort currentKey = ushort.Parse(kv.Key); + string result = $"{((MaterialPropertiesData)kv.Value).Name}{(currentKey != lastKey + 1 ? $" = {kv.Key}" : "")},"; + lastKey = currentKey; + return result; + }) .Aggregate((a, b) => a + "\n" + b)); };*/ diff --git a/TechbloxModdingAPI/Utility/NativeApiExtensions.cs b/TechbloxModdingAPI/Utility/NativeApiExtensions.cs index 8ccb251..ff5ca45 100644 --- a/TechbloxModdingAPI/Utility/NativeApiExtensions.cs +++ b/TechbloxModdingAPI/Utility/NativeApiExtensions.cs @@ -51,6 +51,11 @@ namespace TechbloxModdingAPI.Utility var opt = QueryEntityOptional(entitiesDB, id); if (opt) return ref opt.Get(); if (obj.InitData.Valid) return ref obj.InitData.Initializer(id).GetOrCreate(); + /*if (!obj.InitData.Valid) return ref opt.Get(); //Default value + var init = obj.InitData.Initializer(id); + // Do not create the component if missing, as that can trigger Add() listeners that, in some cases, may be + // invalid if (ab)using the classes in an unusual way - TODO: Check entity descriptor or something + if (init.Has()) return ref init.Get();*/ return ref opt.Get(); //Default value } }