using System.Collections.Generic; namespace Server.Tests.Terrain; /// /// Invented footprints for the multi IDs content looks up through /// (HouseFoundation, BaseBoat and the pathing tests). Only the IDs are real; the shapes are not. /// Needs tile data loaded first: masks IDs with TileData.MaxItemValue. /// public static class TestMultis { public const int GuildHouse = 0x74; public const int Tower = 0x7A; public const int SmallBoatNorth = 0x0; // MultiComponentList drops every entry after the first whose flags are 0. private const TileFlag Visible = TileFlag.Background; private const short HouseFloorZ = 1; public static void Seed() { MultiData.SetComponents(GuildHouse, WalledHouse(3, doorwayOnSouth: true)); MultiData.SetComponents(Tower, WalledHouse(4, doorwayOnSouth: false)); MultiData.SetComponents(SmallBoatNorth, Boat()); } // A square of Floor ringed by Wall, (2 * radius + 1) tiles a side, with a one-tile doorway of Floor // in the middle of the south wall, or of the east wall. The floor sits one Z above the multi so it is // clear of flat ground (MultiMaskCache.ComputeFootprintClean) yet still one step up from it. private static MultiComponentList WalledHouse(int radius, bool doorwayOnSouth) { var entries = new List(); for (var x = -radius; x <= radius; x++) { for (var y = -radius; y <= radius; y++) { var edge = x == -radius || x == radius || y == -radius || y == radius; var doorway = doorwayOnSouth ? x == 0 && y == radius : x == radius && y == 0; var id = edge && !doorway ? TestTiles.Wall : TestTiles.Floor; entries.Add(new MultiTileEntry(id, (short)x, (short)y, HouseFloorZ, Visible)); } } return new MultiComponentList(entries); } // A deck of Floor three tiles wide and seven long, with Wall rails down both sides. private static MultiComponentList Boat() { var entries = new List(); for (var x = -2; x <= 2; x++) { for (var y = -3; y <= 3; y++) { var id = x == -2 || x == 2 ? TestTiles.Wall : TestTiles.Floor; entries.Add(new MultiTileEntry(id, (short)x, (short)y, 0, Visible)); } } return new MultiComponentList(entries); } }