Browse Source

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
tags/v2.1.0
NorbiPeti 3 years ago
parent
commit
aa947eaba1
5 changed files with 13 additions and 24 deletions
  1. +3
    -18
      TechbloxModdingAPI/App/Game.cs
  2. +2
    -2
      TechbloxModdingAPI/App/GameMenuEngine.cs
  3. +5
    -1
      TechbloxModdingAPI/Blocks/BlockIDs.cs
  4. +2
    -2
      TechbloxModdingAPI/Blocks/Engines/RemovalEngine.cs
  5. +1
    -1
      TechbloxModdingAPI/Tests/TechbloxModdingAPIPluginTest.cs

+ 3
- 18
TechbloxModdingAPI/App/Game.cs View File

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

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



+ 2
- 2
TechbloxModdingAPI/App/GameMenuEngine.cs View File

@@ -79,11 +79,11 @@ namespace TechbloxModdingAPI.App
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.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
AccessTools.Method(typeof(FullGameCompositionRoot), "SwitchToGame").Invoke(FullGameFields.Instance, Array.Empty<object>());
return true;


+ 5
- 1
TechbloxModdingAPI/Blocks/BlockIDs.cs View File

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

+ 2
- 2
TechbloxModdingAPI/Blocks/Engines/RemovalEngine.cs View File

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


+ 1
- 1
TechbloxModdingAPI/Tests/TechbloxModdingAPIPluginTest.cs View File

@@ -268,7 +268,7 @@ namespace TechbloxModdingAPI.Tests
string name = LocalizationService.Localize(data.CubeNameKey).Replace(" ", "");
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}" : "")},");
lastKey = currentKey;


Loading…
Cancel
Save