Table of Contents

Class TerrainSaveData

Namespace
GridPlacement.GDScript
Assembly
MoonBark.GridPlacement.GDScript.dll

Resource holding serialized terrain cell data for a TileMapLayer.\n\nEach entry in [member terrain_cells] records one painted cell: {"x": int, "y": int, "terrain_set": int, "terrain": int}\n\nUsage: var data = TerrainSaveData.new() data.add_cell(cell, terrain_set, terrain) ResourceSaver.save(data, "user://terrain_save.res")

class TerrainSaveData extends Resource
TerrainSaveData

Properties

terrain_cells

Array of cell records. Each dictionary has keys: - "x" (int) — cell x coordinate - "y" (int) — cell y coordinate - "terrain_set" (int) — terrain set index in the TileSet - "terrain" (int) — terrain index within the terrain set

@export var terrain_cells: Array[Dictionary] = []

source_layer_path

TileMapLayer path (from the scene root) that these cells belong to. Stored for documentation / validation; not required for load.

@export var source_layer_path: String = ""

format_version

Save-format version for forward-compat. Increment this when the cell-record shape changes so loaders can branch on it (e.g. a future 6.x minor that adds per-cell metadata). [method TerrainPersistence.load_terrain] tolerates an absent field silently (treats pre-version saves as v1). Shipping an unversioned format would force a major version bump to evolve the schema; a one-line field now makes the contract additive/migratable within 6.x.

@export var format_version: int = 1

entry

var entry: Dictionary = {

Methods

add_cell

func add_cell(p_cell: Vector2i, p_terrain_set: int, p_terrain: int, p_layer: String = "") -> void:

Parameters

p_cell
p_terrain_set
p_terrain
p_layer

Returns

get_cell_count

func get_cell_count() -> int:

Returns

is_empty

func is_empty() -> bool:

Returns

clear

func clear() -> void:

Returns