mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-15 14:52:35 +02:00
* Un-hardcode behavior to make a component not saved to map file. MapSaveId is a special component that can't be saved to map files due to a hardcoded type check. This behavior can now be applied to any component with [UnsavedComponent]. Moved "component registration" attributes into a single file because they don't deserve their own (poorly organized) .cs files. * Add ITileDefinitionManager.TryGetDefinition Try-pattern version of the existing indexers. * Preserve tile maps when saving maps This changes the map saver and loader code so that the "tilemap" can be preserved between map modifications as much as possible. The tile map from the loaded map gets stored onto MapSaveTileMapComponent components on all loaded grids. This tile map is then used when saving, meaning that changes to the engine's internal tile IDs do not cause diffs. Fixes #5000 * Changelog * Fix tests
25 lines
924 B
C#
25 lines
924 B
C#
using System.Collections.Generic;
|
|
using Robust.Shared.GameObjects;
|
|
|
|
namespace Robust.Server.GameObjects;
|
|
|
|
/// <summary>
|
|
/// Used by <see cref="MapLoaderSystem"/> to track the original tile map from when a map was loaded.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// This component is used to reduce differences on map saving, by making it so that a tile map can be re-used between map saves even if internal engine IDs change.
|
|
/// </para>
|
|
/// <para>
|
|
/// This component is created on every grid entity read during map load.
|
|
/// This means loading a multi-grid map will create multiple of these components.
|
|
/// When re-saving the map, the map loader will arbitrarily choose which available <see cref="MapSaveTileMapComponent"/>
|
|
/// to use.
|
|
/// </para>
|
|
/// </remarks>
|
|
[RegisterComponent, UnsavedComponent]
|
|
internal sealed partial class MapSaveTileMapComponent : Component
|
|
{
|
|
public Dictionary<int, string> TileMap = [];
|
|
}
|