extends "res://scenes/maps/shapes/param/param_shape.gd"
## BOX / CYLINDER / CONE / SPHERE as parametric types (docs/parametric-shapes-design.md
## §13: the create tool makes only parametric shapes).
##
## THE BAKED GENERATOR, IN THE LOCAL FRAME. Each BrushShape already builds its solids
## from bounds + a placement ctx. Handed the bounds 0..size with y = up (the surface
## normal) and x = the run, it IS a local-frame generator — so this wraps the one
## implementation instead of copying it, and a parametric cylinder is exactly the
## cylinder the old tool made.
##
## ⛔ VERSIONING: those BrushShape scripts are now gv 1 of these types. A change that
## alters their output must keep the old path and bump GV here, or every room's
## cylinders move on the next release (§2 "Versioned").
var _shape: BrushShape = null
var _id := ""
func _init(type_id: String = "", shape: BrushShape = null) -> void:
_id = type_id
_shape = shape
func id() -> String:
return _id
func label() -> String:
return _id.capitalize()
## The baked shape's own descriptors — sides, rings — unchanged, so a record's params
## mean what the old tool's sticky settings meant.
func params() -> Array:
return _shape.params() if _shape != null else []
## y up, run along +x: the frame the fold places (shape.create.frame).
static func local_ctx(p: Dictionary) -> Dictionary:
return {"axis": 1, "normal": Vector3.UP, "view": Vector3.RIGHT, "run_axis": 0,
"grid_step": 1.0, "grid_units": 1.0, "params": p}
func local_pieces(size: Vector3, p: Dictionary) -> Array:
return _shape.pieces(Vector3.ZERO, size, local_ctx(p)) if _shape != null else []
func local_clearance(size: Vector3, p: Dictionary) -> Array:
return _shape.clearance(Vector3.ZERO, size, local_ctx(p)) if _shape != null else []