P2 stone: stonecutter, cut stone, stone floors/walls/pillars/stairs/windows/doorway, hearth; wooden stairs, windows, posts, palisade and gate; stone support rules

This commit is contained in:
Paul Bailey
2026-11-05 01:14:07 +00:00
parent 24c280d885
commit 411bfef34a
16 changed files with 1123 additions and 21 deletions

View File

@@ -61,6 +61,40 @@ static func _define() -> Dictionary:
"snaps": [Vector3(-1, 0, 0), Vector3(0, 0, 0), Vector3(1, 0, 0), Vector3(1, 1, 0)],
"center": Vector3(0.33, 0.33, 0),
}
# --- P2 (docs/PROGRESSION_DESIGN.md §3) ---
# Pillar: a 0.4 m post standing on a floor corner or edge, carrying what's
# on top (a floor's corner meets its top).
# (The collider stops 0.2 m short of the top: that's where a floor resting
# on it has its slab, and the overlap check would count it as in the way.)
k["pillar"] = {
"shapes": [_box(Vector3(0, 0.9, 0), Vector3(0.4, 1.8, 0.4))],
"snaps": [Vector3(0, 0, 0), Vector3(0, 2, 0)],
"center": Vector3(0, 1, 0),
}
# Stairs: 2 m wide, climbing 2 m over 4 m toward -Z (the roof's slope):
# low edge on a floor's edge (or the ground), top edge at the next floor
# up. One smooth ramp to walk on; the steps are in the mesh.
var sn := Vector3(0, cos(ROOF_ANGLE), sin(ROOF_ANGLE))
k["stairs"] = {
"shapes": [{"type": "box", "center": Vector3(0, 1, -2) - sn * 0.1,
"size": Vector3(2, 0.2, sqrt(20.0)), "basis": Basis(Vector3.RIGHT, ROOF_ANGLE)}],
"snaps": [Vector3(-1, 0, 0), Vector3(0, 0, 0), Vector3(1, 0, 0),
Vector3(-1, 2, -4), Vector3(0, 2, -4), Vector3(1, 2, -4)],
"center": Vector3(0, 1, -2),
}
# Window: a wall with a 1 x 0.7 m opening, 1 m up.
k["window"] = {
"shapes": [_box(Vector3(0, 0.5, 0), Vector3(2, 1, 0.2)), _box(Vector3(0, 1.85, 0), Vector3(2, 0.3, 0.2)),
_box(Vector3(-0.75, 1.35, 0), Vector3(0.5, 0.7, 0.2)), _box(Vector3(0.75, 1.35, 0), Vector3(0.5, 0.7, 0.2))],
"snaps": wall_snaps,
"center": Vector3(0, 1, 0),
}
# Palisade: 2 m of sharpened logs, 3 m tall, for a ring round your camp.
k["palisade"] = {
"shapes": [_box(Vector3(0, 1.5, 0), Vector3(2, 3, 0.36))],
"snaps": [Vector3(-1, 0, 0), Vector3(0, 0, 0), Vector3(1, 0, 0)],
"center": Vector3(0, 1.5, 0),
}
var n := Vector3(0, cos(ROOF_ANGLE), sin(ROOF_ANGLE)) # panel normal (up and out)
# (Ends exactly at the ridge. The seam where two roofs meet is handled by
# build_system.roofed_at sampling several rays.)
@@ -109,8 +143,16 @@ static func make_shape(s: Dictionary, margin: float = 0.0) -> Array:
static func is_build(def: Dictionary) -> bool:
return def.has("place") and def.place.has("kind")
## "wood" or "stone" (items.json place.material). Stone loses less support
## going up and can't stand on wood (build_system.gd).
var material := "wood"
static func material_of(d: Dictionary) -> String:
return String(d.get("place", {}).get("material", "wood"))
func _make_collision(_mi: MeshInstance3D) -> void:
kind = def.place.kind
material = material_of(def)
collision_layer = 1 | BUILD_LAYER
add_to_group("build")
for s in kinds()[kind].shapes: