Palette picks a whole object on a click; mod documentation

This commit is contained in:
cthangover committed 2026-10-29 09:26:11 +01:00
1 parent c585960c61
commit bbdfe95de3
41 files changed
+1114 -179

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
using System.Collections.Generic;
using Cthangover.Core.Mods.Testing;
using Cthangover.Mods.Rpg;
using Godot;
namespace Cthangover.Tools.RpgEditor.Tests
{
/// <summary>Palette rectangles resolve physical cells back to stable logical map ids.</summary>
public class RpgTileStampTests
{
[ModTest("stamp/atlas_rectangle_resolves_packed_ids_and_padding")]
static void PackedRectangle(ModTestContext ctx)
{
var tileset = new RpgTileset { Columns = 3, Tiles = new List<RpgTileInfo>
{
new() { Index = 64, AtlasIndex = 1 }, new() { Index = 65, AtlasIndex = 2 },
new() { Index = 67, AtlasIndex = 4 }
}};
var stamp = RpgTileStamp.FromAtlas(tileset, new Rect2I(1, 0, 2, 2));
ModAssert.Equal(2, stamp.Width, "rectangle width");
ModAssert.Equal(2, stamp.Height, "rectangle height");
ModAssert.Equal(64, stamp.TileAt(0, 0), "top left logical id");
ModAssert.Equal(65, stamp.TileAt(1, 0), "top right logical id");
ModAssert.Equal(67, stamp.TileAt(0, 1), "bottom left logical id");
ModAssert.Equal(-1, stamp.TileAt(1, 1), "an empty physical slot stays a gap");
ModAssert.Equal(-1, stamp.TileAt(-1, 0), "outside selection is empty");
ModAssert.Equal(40, RpgTileStamp.Single(40).TileAt(0, 0), "surface brushes also retain logical ids");
var values = new[] { 11 };
var copied = new RpgTileStamp(1, 1, values);
values[0] = 99;
ModAssert.Equal(11, copied.TileAt(0, 0), "the brush owns its tile snapshot");
}
}
}