TruckLib 0.1.2

dotnet add package TruckLib --version 0.1.2                
NuGet\Install-Package TruckLib -Version 0.1.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TruckLib" Version="0.1.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TruckLib --version 0.1.2                
#r "nuget: TruckLib, 0.1.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install TruckLib as a Cake Addin
#addin nuget:?package=TruckLib&version=0.1.2

// Install TruckLib as a Cake Tool
#tool nuget:?package=TruckLib&version=0.1.2                

TruckLib

TruckLib is a C# library for programmatically creating and editing maps for Euro Truck Simulator 2 / American Truck Simulator without requiring the official editor. In addition to the ability to de/serialize the .mbd map format, the library also handles various mapping-adjacent tasks, such as reading prefab descriptors or .sii files.

The currently supported map format version is 901 (game version 1.51–1.53 beta).

(This project is pretty much a perpetual alpha, so you'll probably run into a few issues sooner or later, and breaking changes will happen on occasion.)

Install

dotnet add package TruckLib

Namespaces

TruckLib

TruckLib.ScsMap:
The main namespace of the library, containing classes for working with the map format.

Packages

The following packages are included in the main TruckLib package, but can also be used standalone.

TruckLib.Sii:
Parsers for .sii and .mat files. Encrypted and 3nK-encoded SII files are supported.

TruckLib.Models:
Rudimentary support for binary model files (.pm*), prefab descriptors (.ppd), and binary .tobj files.

TruckLib.HashFs:
A reader for HashFS (.scs) files, the asset archive format of the game.

Minimal example

using System.Numerics;
using TruckLib.ScsMap;

var map = new Map("example");
Model.Add(map, new Vector3(10, 0, 10), "dlc_no_471", "brick", "default");
map.Save(@"<ETS2 folder>\mod\user_map\map");

Documentation

Documentation and an API reference is available at https://sk-zk.github.io/trucklib/master/.

Known issues and limitations

  • The library does not calculate the bounding boxes of items, so you'll need to recalculate on load (Map > Recompute map).
  • Anything to do with prefabs may or may not break in unexpected ways.
  • The prefab object creator doesn't handle terrain points yet. Unless you need prefab terrain, this is also fixed by recalculating.
  • When adding a camera path, the positions of the control points in the Keyframe objects are not set to any default values and therefore left at (0, 0, 0).
  • Helper locators of curve items, if used by the model, are not placed automatically by the library because their coordinates are not known to it. Moving a locator node or a curve node which is tethered to a locator node will also cause issues. The editor will fix both of these once a curve node is moved or the properties dialog of the curve is closed.
  • External map data (which is how the Winter Wonderland map was included in the game) is not yet supported.

License

TruckLib is licensed under GPL v2.

Credits

Parts of TruckLib are based on ConverterPIX, SCS Blender Tools, and SII_Decrypt.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.1.2 101 11/18/2024
0.1.1 96 11/1/2024
0.1.0 102 10/24/2024