Update to Techblox 2021.09.27.15.17

Fixed block name print regex
Made Game.WorkshopId obsolete as it's removed from the game
Fixed removing blocks
This commit is contained in:
Norbi Peti 2021-10-02 00:01:47 +02:00
parent 63295f82c9
commit aa947eaba1
5 changed files with 13 additions and 24 deletions

View file

@ -233,8 +233,7 @@ namespace TechbloxModdingAPI.App
{ {
// this likely breaks things // this likely breaks things
GameMode.SaveGameDetails = new SaveGameDetails(GameMode.SaveGameDetails.Id, GameMode.SaveGameDetails = new SaveGameDetails(GameMode.SaveGameDetails.Id,
GameMode.SaveGameDetails.SaveMode, GameMode.SaveGameDetails.Name, value, GameMode.SaveGameDetails.SaveMode, GameMode.SaveGameDetails.Name, value);
GameMode.SaveGameDetails.WorkshopId);
} }
} }
} }
@ -244,30 +243,16 @@ namespace TechbloxModdingAPI.App
/// In most cases this is invalid and returns 0, so this can be ignored. /// In most cases this is invalid and returns 0, so this can be ignored.
/// </summary> /// </summary>
/// <value>The workshop identifier.</value> /// <value>The workshop identifier.</value>
[Obsolete]
public ulong WorkshopId public ulong WorkshopId
{ {
get get
{ {
if (!VerifyMode()) return 0uL; return 0uL; // Not supported anymore
if (menuMode) return 0uL; // MyGames don't have workshop IDs
return GameMode.SaveGameDetails.WorkshopId;
} }
set set
{ {
VerifyMode();
if (menuMode)
{
// MyGames don't have workshop IDs
// menuEngine.GetGameInfo(EGID).GameName.Set(value);
}
else
{
// this likely breaks things
GameMode.SaveGameDetails = new SaveGameDetails(GameMode.SaveGameDetails.Id,
GameMode.SaveGameDetails.SaveMode, GameMode.SaveGameDetails.Name,
GameMode.SaveGameDetails.Folder, value);
}
} }
} }

View file

@ -79,11 +79,11 @@ namespace TechbloxModdingAPI.App
return EnterGame(mgdes.GameName, mgdes.SavedGamePath); return EnterGame(mgdes.GameName, mgdes.SavedGamePath);
} }
public bool EnterGame(string gameName, string path, ulong workshopId = 0uL, 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(), GameMode.SaveGameDetails = new SaveGameDetails(MachineStorageId.CreateNew().ToString(),
SaveGameMode.NewSave, gameName, path, workshopId); SaveGameMode.NewSave, gameName, 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, Array.Empty<object>());
return true; return true;

View file

@ -163,6 +163,10 @@ namespace TechbloxModdingAPI.Blocks
TruckArchSingleFlare, TruckArchSingleFlare,
FormulaWheel = 270, FormulaWheel = 270,
FormulaWheelRear, FormulaWheelRear,
FormulaSeat = 277 FormulaSeat = 277,
MonsterTruckWheel = 285,
MonsterTruckEngine = 290,
MonsterTruckWheelRigNoSteering = 350,
MonsterTruckWheelRigWithSteering,
} }
} }

View file

@ -23,8 +23,8 @@ namespace TechbloxModdingAPI.Blocks.Engines
return false; return false;
var connections = entitiesDB.QueryEntity<MachineGraphConnectionsEntityStruct>(target); var connections = entitiesDB.QueryEntity<MachineGraphConnectionsEntityStruct>(target);
var groups = entitiesDB.FindGroups<MachineGraphConnectionsEntityStruct>(); var groups = entitiesDB.FindGroups<MachineGraphConnectionsEntityStruct>();
using var connStructMapper = using var connStructMapper = //The allocator needs to be persistent because that's what is used in the Dispose() method
entitiesDB.QueryNativeMappedEntities<MachineGraphConnectionsEntityStruct>(groups, Allocator.Temp); entitiesDB.QueryNativeMappedEntities<MachineGraphConnectionsEntityStruct>(groups, Allocator.Persistent);
for (int i = connections.connections.Count<MachineConnectionStruct>() - 1; i >= 0; i--) for (int i = connections.connections.Count<MachineConnectionStruct>() - 1; i >= 0; i--)
_connectionFactory.RemoveConnection(connections, i, connStructMapper); _connectionFactory.RemoveConnection(connections, i, connStructMapper);
_entityFunctions.RemoveEntity<BlockEntityDescriptor>(target); _entityFunctions.RemoveEntity<BlockEntityDescriptor>(target);

View file

@ -268,7 +268,7 @@ namespace TechbloxModdingAPI.Tests
string name = LocalizationService.Localize(data.CubeNameKey).Replace(" ", ""); string name = LocalizationService.Localize(data.CubeNameKey).Replace(" ", "");
foreach (var rkv in toReplace) foreach (var rkv in toReplace)
{ {
name = Regex.Replace(name, "([^A-Za-z])" + rkv.Key + "([^A-Za-z])", "$1" + rkv.Value + "$2"); name = Regex.Replace(name, rkv.Key + "([A-Z]|$)", rkv.Value + "$1");
} }
Console.WriteLine($"{name}{(currentKey != lastKey + 1 ? $" = {currentKey}" : "")},"); Console.WriteLine($"{name}{(currentKey != lastKey + 1 ? $" = {currentKey}" : "")},");
lastKey = currentKey; lastKey = currentKey;