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
This commit is contained in:
Norbi Peti 2021-11-04 20:45:21 +01:00
parent 6204b226d1
commit 619a5003cf
13 changed files with 321 additions and 47 deletions

View file

@ -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);
}
}
}

View file

@ -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;
}
}

View file

@ -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<TaskContract> 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<ScreenshotModeEntityStruct>(ScreenshotTakerEgids.ScreenshotTaker);
}
public GameSelectionComponent GetGameData()
{
return entitiesDB.QueryEntity<GameSelectionComponent>(GameSelectionConstants.GameSelectionEGID);
}
}
}

View file

@ -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<object>());
AccessTools.Method(typeof(FullGameCompositionRoot), "SwitchToGame").Invoke(FullGameFields.Instance, new object[]{data});
return true;
}

View file

@ -74,6 +74,11 @@ namespace TechbloxModdingAPI
return egid.HasValue ? New(egid.Value) : null;
}
/*public static Block CreateGhostBlock()
{
return BlockGroup._engine.BuildGhostChild();
}*/
/// <summary>
/// An event that fires each time a block is placed.
/// </summary>
@ -381,8 +386,8 @@ namespace TechbloxModdingAPI
/// </summary>
public bool Static
{
get => BlockEngine.GetBlockInfo<OverrideStaticComponent>(this).staticIfUnconnected;
set => BlockEngine.GetBlockInfo<OverrideStaticComponent>(this).staticIfUnconnected = value;
get => false;
set { }
}
/// <summary>

View file

@ -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,
/// <summary>
/// The grid block used by the world editor, named Small Grid like the other one
/// </summary>
SmallGridInWorldEditor
}
}

View file

@ -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,
}
}

View file

@ -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<PositionEntityStruct>(sourceId);
var rotationEntityStruct = entitiesDB.QueryEntity<RotationEntityStruct>(sourceId);
var scalingEntityStruct = entitiesDB.QueryEntity<ScalingEntityStruct>(sourceId);
var dbStruct = entitiesDB.QueryEntity<DBEntityStruct>(sourceId);
var colliderStruct = entitiesDB.QueryEntity<ColliderAabb>(sourceId);
var colorStruct = entitiesDB.QueryEntity<ColourParameterEntityStruct>(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<PrefabAssetIDComponent>().prefabAssetID,
entitiesDB.QueryEntity<CubeMaterialStruct>(sourceId).materialId, 7,
FlippedBlockUtils.IsFlipped(in scalingEntityStruct.scale)), true));
entityInitializer.Init(entitiesDB.QueryEntity<CubeMaterialStruct>(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<SkewComponent>(sourceId).skewMatrix
});
entityInitializer.Init(new BlockPlacementInfoStruct
{
placedByBuildingDrone = entitiesDB
.QueryEntityOptional<BoxSelectStateEntityStruct>(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;

View file

@ -12,13 +12,12 @@ namespace TechbloxModdingAPI.Commands
{
/// <summary>
/// Patch of RobocraftX.CR.MainGame.MainGameCompositionRoot.DeterministicCompose<T>()
/// Initializes existing and custom commands
/// Initializes custom commands
/// </summary>
[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 */

View file

@ -314,7 +314,7 @@ namespace TechbloxModdingAPI
get
{
var optstruct = playerEngine.GetCharacterStruct<EquippedPartStruct>(Id);
return optstruct ? (BlockIDs) optstruct.Get().SelectedDBPartID : BlockIDs.Invalid;
return optstruct ? (BlockIDs) optstruct.Get().selectedDBPartID : BlockIDs.Invalid;
}
}

View file

@ -116,10 +116,6 @@
<HintPath>..\ref\TechbloxPreview_Data\Managed\Gamecraft.Blocks.GenericPhysicsBlocks.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Gamecraft.Blocks.GenericPhysicsBlocks.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.Blocks.LightBlock">
<HintPath>..\ref\TechbloxPreview_Data\Managed\Gamecraft.Blocks.LightBlock.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Gamecraft.Blocks.LightBlock.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.Blocks.LogicBlock">
<HintPath>..\ref\TechbloxPreview_Data\Managed\Gamecraft.Blocks.LogicBlock.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Gamecraft.Blocks.LogicBlock.dll</HintPath>
@ -480,6 +476,10 @@
<HintPath>..\ref\TechbloxPreview_Data\Managed\RobocraftX.MainGame.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\RobocraftX.MainGame.dll</HintPath>
</Reference>
<Reference Include="RobocraftX.MainGameMock">
<HintPath>..\ref\TechbloxPreview_Data\Managed\RobocraftX.MainGameMock.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\RobocraftX.MainGameMock.dll</HintPath>
</Reference>
<Reference Include="RobocraftX.MainSimulation">
<HintPath>..\ref\TechbloxPreview_Data\Managed\RobocraftX.MainSimulation.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\RobocraftX.MainSimulation.dll</HintPath>
@ -592,6 +592,10 @@
<HintPath>..\ref\TechbloxPreview_Data\Managed\Svelto.Tasks.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Svelto.Tasks.dll</HintPath>
</Reference>
<Reference Include="Techblox.AtmosphereBlock">
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.AtmosphereBlock.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.AtmosphereBlock.dll</HintPath>
</Reference>
<Reference Include="Techblox.AutoForward">
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.AutoForward.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.AutoForward.dll</HintPath>
@ -600,6 +604,10 @@
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.Backend.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.Backend.dll</HintPath>
</Reference>
<Reference Include="Techblox.Blocks.LightBlock">
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.Blocks.LightBlock.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.Blocks.LightBlock.dll</HintPath>
</Reference>
<Reference Include="Techblox.Building.Rules">
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.Building.Rules.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.Building.Rules.dll</HintPath>
@ -624,6 +632,22 @@
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.Environment.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.Environment.dll</HintPath>
</Reference>
<Reference Include="Techblox.EnvironmentBlocks.BuildingEnvironment">
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.EnvironmentBlocks.BuildingEnvironment.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.EnvironmentBlocks.BuildingEnvironment.dll</HintPath>
</Reference>
<Reference Include="Techblox.EnvironmentBlocks">
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.EnvironmentBlocks.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.EnvironmentBlocks.dll</HintPath>
</Reference>
<Reference Include="Techblox.EnvironmentBlocks.SimulationWorldEnvironment">
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.EnvironmentBlocks.SimulationWorldEnvironment.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.EnvironmentBlocks.SimulationWorldEnvironment.dll</HintPath>
</Reference>
<Reference Include="Techblox.GameSelection">
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.GameSelection.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GameSelection.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.Building">
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Building.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Building.dll</HintPath>
@ -640,6 +664,18 @@
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.GamePortal">
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.GamePortal.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.GamePortal.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.GamePortal.MockUps">
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.GamePortal.MockUps.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.GamePortal.MockUps.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.Hotbar.Landscapes">
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Hotbar.Landscapes.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Hotbar.Landscapes.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.Hotbar.Materials">
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Hotbar.Materials.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Hotbar.Materials.dll</HintPath>
@ -648,6 +684,10 @@
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Inventory.Common.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Inventory.Common.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.Inventory.Landscapes">
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Inventory.Landscapes.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Inventory.Landscapes.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.Inventory.Materials">
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Inventory.Materials.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Inventory.Materials.dll</HintPath>
@ -656,6 +696,14 @@
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Login.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Login.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.Mocks">
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Mocks.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Mocks.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.Mocks.DynamicListBuild">
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Mocks.DynamicListBuild.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Mocks.DynamicListBuild.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.MyGamesScreen">
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.MyGamesScreen.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.MyGamesScreen.dll</HintPath>
@ -664,6 +712,10 @@
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Notifications.MockUps.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Notifications.MockUps.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.TabsBar.Landscapes">
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.TabsBar.Landscapes.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.TabsBar.Landscapes.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.TabsBar.Materials">
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.TabsBar.Materials.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.TabsBar.Materials.dll</HintPath>
@ -676,6 +728,10 @@
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.Pointer.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.Pointer.dll</HintPath>
</Reference>
<Reference Include="Techblox.ProceduralReflectionProbes">
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.ProceduralReflectionProbes.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.ProceduralReflectionProbes.dll</HintPath>
</Reference>
<Reference Include="Techblox.Rendering.Common">
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.Rendering.Common.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.Rendering.Common.dll</HintPath>
@ -704,6 +760,10 @@
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.Services.Eos.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.Services.Eos.dll</HintPath>
</Reference>
<Reference Include="Techblox.Services.GameDetails">
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.Services.GameDetails.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.Services.GameDetails.dll</HintPath>
</Reference>
<Reference Include="Techblox.Services.Storage">
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.Services.Storage.dll</HintPath>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.Services.Storage.dll</HintPath>

View file

@ -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<MaterialPropertiesData>()
.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));
};*/

View file

@ -51,6 +51,11 @@ namespace TechbloxModdingAPI.Utility
var opt = QueryEntityOptional<T>(entitiesDB, id);
if (opt) return ref opt.Get();
if (obj.InitData.Valid) return ref obj.InitData.Initializer(id).GetOrCreate<T>();
/*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<T>()) return ref init.Get<T>();*/
return ref opt.Get(); //Default value
}
}