class_name TileDef extends RefCounted ## A single tile definition (palette entry) within a tile layer. ## ## Maps a tile ID to its asset reference and gameplay flags. See ## docs/architecture/world.md ยง3.2. ## Tile ID (index into the layer palette). 0 is reserved for empty/air. var id: int = 0 ## Reference to the tile/terrain asset. var asset_id: String = "" ## Whether this tile has collision. var solid: bool = false ## Bitmask flags: bit 0 = walkable, bit 1 = climbable, bit 2 = liquid. var flags: int = 0 ## Number of visual variants for this tile. var variants: int = 1 func _init(p_id: int = 0, p_asset_id: String = "", p_solid: bool = false, p_flags: int = 0, p_variants: int = 1) -> void: id = p_id asset_id = p_asset_id solid = p_solid flags = p_flags variants = p_variants func is_walkable() -> bool: return (flags & 0x01) != 0 func is_climbable() -> bool: return (flags & 0x02) != 0 func is_liquid() -> bool: return (flags & 0x04) != 0