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 (!VerifyMode()) return null;
if (menuMode) return menuEngine.GetGameInfo(EGID).GameName; if (menuMode) return menuEngine.GetGameInfo(EGID).GameName;
return GameMode.SaveGameDetails.Name; return gameEngine.GetGameData().saveName;
} }
set set
@ -174,11 +174,7 @@ namespace TechbloxModdingAPI.App
if (menuMode) if (menuMode)
{ {
menuEngine.SetGameName(EGID, value); menuEngine.SetGameName(EGID, value);
} } // Save details are directly saved from user input or not changed at all when in game
else
{
GameMode.SaveGameDetails.Name = value;
}
} }
} }
@ -201,11 +197,7 @@ namespace TechbloxModdingAPI.App
if (menuMode) if (menuMode)
{ {
menuEngine.SetGameDescription(EGID, value); menuEngine.SetGameDescription(EGID, value);
} } // No description exists in-game
else
{
// No description exists in-game
}
} }
} }
@ -219,7 +211,7 @@ namespace TechbloxModdingAPI.App
{ {
if (!VerifyMode()) return null; if (!VerifyMode()) return null;
if (menuMode) return menuEngine.GetGameInfo(EGID).SavedGamePath; if (menuMode) return menuEngine.GetGameInfo(EGID).SavedGamePath;
return GameMode.SaveGameDetails.Folder; return gameEngine.GetGameData().gameID;
} }
set set
@ -229,12 +221,6 @@ namespace TechbloxModdingAPI.App
{ {
menuEngine.GetGameInfo(EGID).SavedGamePath.Set(value); 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) 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; return inputDeps;
} }
public JobHandle OnInitializeTimeStoppedMode(JobHandle 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; return inputDeps;
} }
} }

View file

@ -8,6 +8,7 @@ using Svelto.Tasks;
using Svelto.Tasks.Lean; using Svelto.Tasks.Lean;
using RobocraftX.Blocks; using RobocraftX.Blocks;
using RobocraftX.ScreenshotTaker; using RobocraftX.ScreenshotTaker;
using Techblox.GameSelection;
using TechbloxModdingAPI.Blocks; using TechbloxModdingAPI.Blocks;
using TechbloxModdingAPI.Engines; using TechbloxModdingAPI.Engines;
using TechbloxModdingAPI.Tasks; using TechbloxModdingAPI.Tasks;
@ -29,7 +30,7 @@ namespace TechbloxModdingAPI.App
public void Dispose() 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; IsInGame = false;
} }
@ -41,7 +42,7 @@ namespace TechbloxModdingAPI.App
private IEnumerator<TaskContract> EnteringGame() private IEnumerator<TaskContract> EnteringGame()
{ {
yield return new WaitForSubmissionEnumerator(GameLoadedEnginePatch.Scheduler).Continue(); 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; IsInGame = true;
} }
@ -132,5 +133,10 @@ namespace TechbloxModdingAPI.App
local.enabled = true; local.enabled = true;
entitiesDB.PublishEntityChange<ScreenshotModeEntityStruct>(ScreenshotTakerEgids.ScreenshotTaker); 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 RobocraftX.GUI.MyGamesScreen;
using Svelto.ECS; using Svelto.ECS;
using Svelto.ECS.Experimental; using Svelto.ECS.Experimental;
using Techblox.Services.Machines; using Techblox.GameSelection;
using TechbloxModdingAPI.Engines; using TechbloxModdingAPI.Engines;
using TechbloxModdingAPI.Utility; using TechbloxModdingAPI.Utility;
using GameMode = RobocraftX.Common.GameMode;
namespace TechbloxModdingAPI.App namespace TechbloxModdingAPI.App
{ {
@ -82,10 +83,16 @@ namespace TechbloxModdingAPI.App
public bool EnterGame(string gameName, string path, bool autoEnterSim = false) public bool EnterGame(string gameName, string path, bool autoEnterSim = false)
{ {
GameMode.CurrentMode = autoEnterSim ? RCXMode.Play : RCXMode.Build; GameMode.CurrentMode = autoEnterSim ? RCXMode.Play : RCXMode.Build;
GameMode.SaveGameDetails = new SaveGameDetails(MachineStorageId.CreateNew().ToString(), var data = new GameSelectionData
SaveGameMode.NewSave, gameName, path); {
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 // 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; return true;
} }

View file

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

View file

@ -151,22 +151,128 @@ namespace TechbloxModdingAPI.Blocks
HatchbackWheelArch, HatchbackWheelArch,
HatchbackArchSmallFlare, HatchbackArchSmallFlare,
HatchbackArchFlare, HatchbackArchFlare,
TruckWheel = 246, CeilingStripLight,
CardboardBox,
BarrierRail,
BarrierRailEnd,
TruckWheel,
HatchbackWheelWideProfile, HatchbackWheelWideProfile,
TruckWheelRigWithSteering = 249, TruckWheelRigWithSteering = 249,
TruckWheelRigNoSteering, TruckWheelRigNoSteering,
HatchbackDriverSeat, HatchbackDriverSeat,
HatchbackPassengerSeat, HatchbackPassengerSeat,
FormulaEngine, FormulaEngine,
TruckWheelDouble = 261, SmallGrass,
SmallGrassRoad,
GrassBridge,
SmallGrassTurn,
MediumGrassTurn,
LargeGrassTurn,
ExtraLargeGrassTurn,
TruckWheelDouble,
TruckWheelArch, TruckWheelArch,
TruckArchSingleFlare, TruckArchSingleFlare,
FormulaWheel = 270, WoodenDoorWithWindow,
TyreBarrierCorner,
TyreBarrierEdge,
TyreBarrierCenter,
AppleTree,
AppleForestTree,
FormulaWheel,
FormulaWheelRear, FormulaWheelRear,
FormulaSeat = 277, AppleSapling,
MonsterTruckWheel = 285, GrassHill,
MonsterTruckEngine = 290, GrassHillInnerCorner,
MonsterTruckWheelRigNoSteering = 350, 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, 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, SteelBodyworkRustedPaint,
SteelBodyworkHeavyRust, SteelBodyworkHeavyRust,
WoodVarnishedDark, 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 Gamecraft.GUI.Blueprints;
using HarmonyLib; using HarmonyLib;
using RobocraftX.Blocks; using RobocraftX.Blocks;
using RobocraftX.Blocks.Ghost;
using RobocraftX.Common; using RobocraftX.Common;
using RobocraftX.CR.MachineEditing.BoxSelect; using RobocraftX.CR.MachineEditing.BoxSelect;
using RobocraftX.CR.MachineEditing.BoxSelect.ClipboardOperations; using RobocraftX.CR.MachineEditing.BoxSelect.ClipboardOperations;
using RobocraftX.Physics;
using RobocraftX.Rendering;
using RobocraftX.Rendering.GPUI;
using Svelto.DataStructures; using Svelto.DataStructures;
using Svelto.ECS; using Svelto.ECS;
using Svelto.ECS.DataStructures; using Svelto.ECS.DataStructures;
using Svelto.ECS.EntityStructs; using Svelto.ECS.EntityStructs;
using Svelto.ECS.Native; using Svelto.ECS.Native;
using Svelto.ECS.Serialization; using Svelto.ECS.Serialization;
using Techblox.Blocks;
using TechbloxModdingAPI.Engines; using TechbloxModdingAPI.Engines;
using TechbloxModdingAPI.Utility; using TechbloxModdingAPI.Utility;
using Unity.Collections; using Unity.Collections;
@ -253,6 +258,76 @@ namespace TechbloxModdingAPI.Blocks.Engines
clipboardManager.DecrementRefCount(blueprintID); 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 string Name { get; } = "TechbloxModdingAPIBlueprintGameEngine";
public bool isRemovable { get; } = false; public bool isRemovable { get; } = false;

View file

@ -12,13 +12,12 @@ namespace TechbloxModdingAPI.Commands
{ {
/// <summary> /// <summary>
/// Patch of RobocraftX.CR.MainGame.MainGameCompositionRoot.DeterministicCompose<T>() /// Patch of RobocraftX.CR.MainGame.MainGameCompositionRoot.DeterministicCompose<T>()
/// Initializes existing and custom commands /// Initializes custom commands
/// </summary> /// </summary>
[HarmonyPatch] [HarmonyPatch]
static class CommandPatch static class CommandPatch
{ {
public static void Postfix(Action reloadGame, MultiplayerInitParameters multiplayerParameters, public static void Postfix(StateSyncRegistrationHelper stateSyncReg)
StateSyncRegistrationHelper stateSyncReg)
{ {
/*CommandLineCompositionRoot.Compose(contextHolder, stateSyncReg.enginesRoot, reloadGame, multiplayerParameters, /*CommandLineCompositionRoot.Compose(contextHolder, stateSyncReg.enginesRoot, reloadGame, multiplayerParameters,
stateSyncReg); - uREPL C# compilation not supported anymore */ stateSyncReg); - uREPL C# compilation not supported anymore */

View file

@ -314,7 +314,7 @@ namespace TechbloxModdingAPI
get get
{ {
var optstruct = playerEngine.GetCharacterStruct<EquippedPartStruct>(Id); 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>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Gamecraft.Blocks.GenericPhysicsBlocks.dll</HintPath> <HintPath>..\..\ref\TechbloxPreview_Data\Managed\Gamecraft.Blocks.GenericPhysicsBlocks.dll</HintPath>
</Reference> </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"> <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>
<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>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\RobocraftX.MainGame.dll</HintPath> <HintPath>..\..\ref\TechbloxPreview_Data\Managed\RobocraftX.MainGame.dll</HintPath>
</Reference> </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"> <Reference Include="RobocraftX.MainSimulation">
<HintPath>..\ref\TechbloxPreview_Data\Managed\RobocraftX.MainSimulation.dll</HintPath> <HintPath>..\ref\TechbloxPreview_Data\Managed\RobocraftX.MainSimulation.dll</HintPath>
<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>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Svelto.Tasks.dll</HintPath> <HintPath>..\..\ref\TechbloxPreview_Data\Managed\Svelto.Tasks.dll</HintPath>
</Reference> </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"> <Reference Include="Techblox.AutoForward">
<HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.AutoForward.dll</HintPath> <HintPath>..\ref\TechbloxPreview_Data\Managed\Techblox.AutoForward.dll</HintPath>
<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>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.Backend.dll</HintPath> <HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.Backend.dll</HintPath>
</Reference> </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"> <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>
<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>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.Environment.dll</HintPath> <HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.Environment.dll</HintPath>
</Reference> </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"> <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>
<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>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.dll</HintPath> <HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.dll</HintPath>
</Reference> </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"> <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>
<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>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Inventory.Common.dll</HintPath> <HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Inventory.Common.dll</HintPath>
</Reference> </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"> <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>
<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>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Login.dll</HintPath> <HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Login.dll</HintPath>
</Reference> </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"> <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>
<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>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Notifications.MockUps.dll</HintPath> <HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.GUI.Notifications.MockUps.dll</HintPath>
</Reference> </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"> <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>
<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>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.Pointer.dll</HintPath> <HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.Pointer.dll</HintPath>
</Reference> </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"> <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>
<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>
<HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.Services.Eos.dll</HintPath> <HintPath>..\..\ref\TechbloxPreview_Data\Managed\Techblox.Services.Eos.dll</HintPath>
</Reference> </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"> <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>
<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(); FileLog.Reset();
Harmony.DEBUG = true; Harmony.DEBUG = true;
Main.Init(); Main.Init();
Logging.MetaDebugLog($"Version group id {(uint)ApiExclusiveGroups.versionGroup}"); Logging.MetaDebugLog($"Version group id {ApiExclusiveGroups.versionGroup}");
// disable background music // disable background music
Logging.MetaDebugLog("Audio Mixers: " + string.Join(",", AudioTools.GetMixers())); 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 :( //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"}, {"Neg", "Negative"}, {"Tetra", "Tetrahedron"},
{"RWedge", "Rounded Wedge"}, {"RTetra", "Rounded 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) foreach (var rkv in toReplace)
{ {
name = Regex.Replace(name, rkv.Key + "([A-Z]|$)", rkv.Value + "$1"); name = Regex.Replace(name, rkv.Key + "([A-Z]|$)", rkv.Value + "$1");
@ -284,8 +286,16 @@ namespace TechbloxModdingAPI.Tests
};*/ };*/
/*Game.Enter += (sender, e) => /*Game.Enter += (sender, e) =>
{ {
ushort lastKey = ushort.MaxValue;
Console.WriteLine("Materials:\n" + FullGameFields._dataDb.GetValues<MaterialPropertiesData>() 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)); .Aggregate((a, b) => a + "\n" + b));
};*/ };*/

View file

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