Files
tidewall/tools/provenance.gd
T
claudeandClaude Opus 5.5 aa797580a7 #72: The packet ship, the lifeline mortar and the gull-kite
Eric chose option B on #72. The drop is now the GDD's launch:

- A packet ship sails a seeded straight line past the island, offshore,
  as close in as it can while keeping 45 m of open water from any land
  (eight-way probes; up to 32 headings, then the four world sides).
- Jump fires the lifeline mortar along the look heading. How high the
  player aims sets the charge (-10 to 45 degrees: 16 to 110 m/s over
  the ground; every shot climbs at 75 m/s). The climb can't be steered
  and the kite can't open until the arc tops out. Riders still aboard at
  the end are fired towards the middle of the island.
- Drop.reach() mirrors the fall for both ways down (kite at the top, or
  a fall with the kite opening by itself); bots, the soak and autoplay
  clients and the tutorial pilot aim with Drop.aim_charge().
- Bots fire at their landing spot once abeam of it, when in easy reach
  at their own staggered moment, or just before the route ends, and open
  the kite early only when the spot is beyond the rest of a fall.
- Art: VesselModels.ship() (two-masted packet, tanned square sails, a
  salt-white boot-top, a bowsprit and the mortar on its bed, mirrored to
  face the island), the figure's gull-kite (figure.py), and a lifeline
  cord from the muzzle to each player still climbing.
- Renamed barge to ship and wing-sail to gull-kite throughout code,
  tests, captures, docs and the tutorial text. make match now defaults to
  seed 2, where the scripted player still harvests and builds.

Closes #72

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 12:49:21 -05:00

101 lines
4.5 KiB
GDScript

## R4: traces every file under assets/ to the script that makes it, or to its original
## hand-written source, and writes the per-file table in docs/ASSET_PROVENANCE.md.
## `test_asset_provenance` fails if a file has no rule, a rule names a generator that
## doesn't exist, or the document is out of date.
## tools/godot.sh --script res://tools/provenance.gd
extends SceneTree
const ASSETS: String = "res://assets"
const DOC: String = "res://docs/ASSET_PROVENANCE.md"
## Path pattern (relative to assets/, `*` wildcards) -> [source, how]. First match wins.
const RULES: Array[Array] = [
["PROVENANCE.md", "written by hand", "The summary of how each kind of asset is made."],
["audio/manifest.json", "tools/audio/generate.gd", "Each sound's category, length, SHA-256, peak and loudness, written as the sounds are baked."],
["audio/music_*.wav", "tools/audio/score.gd", "A layer of the original score: note lists written for Tidewall, synthesized by tools/audio/dsp.gd."],
["audio/*.wav", "tools/audio/recipes.gd", "Synthesized from seeded noise, oscillators, filters and decaying modes (tools/audio/dsp.gd)."],
["models/items/*", "tools/models/items.py", "An item model (OBJ and MTL) and its grip data (JSON), built from primitives in headless Blender."],
["icons/items/*.png", "tools/models/items.py", "The item's model rendered with Cycles on the CPU in headless Blender."],
["models/figure/*", "tools/models/figure.py", "A part of the player figure (OBJ and MTL) or its joint data (JSON), built from primitives in headless Blender."],
["icons/app/tidewall.svg", "written by hand", "The application icon, an SVG written for Tidewall in Palette colours."],
["icons/app/tidewall-*.png", "tools/app_icon.gd", "The hand-written SVG rasterised by the engine's SVG loader."],
]
const HEADER: String = """# Asset provenance, file by file
Every file under `assets/` and where it comes from: the script in this repository that
generates it, or "written by hand" for an original source written for Tidewall. Nothing
is sampled, recorded, downloaded or taken from a third party. How each kind of asset is
made is described in [assets/PROVENANCE.md](../assets/PROVENANCE.md); the licence is
CC BY-SA 4.0 ([LICENSE-ASSETS](../LICENSE-ASSETS)).
Code-built art (terrain, sea, points of interest, props, build pieces, the ship, sea
chests and effects) isn't a file here: it's drawn by the scripts under `src/client/`.
This file is written by `tools/godot.sh --script res://tools/provenance.gd`, and
`test/test_asset_provenance.gd` fails if it falls out of date or a file has no source.
| File | Source | What it is |
|---|---|---|
"""
func _init() -> void:
var problems: Array[String] = problems_with(rows())
if not problems.is_empty():
for problem: String in problems:
push_error(problem)
quit(1)
return
var file: FileAccess = FileAccess.open(DOC, FileAccess.WRITE)
file.store_string(render())
file.close()
print("asset provenance: %d files in %s" % [rows().size(), DOC])
quit(0)
## Every file under assets/, sorted, without the engine's .import and .uid sidecars.
static func files(dir: String = ASSETS, prefix: String = "") -> Array[String]:
var found: Array[String] = []
for name: String in DirAccess.get_files_at(dir):
if name.ends_with(".import") or name.ends_with(".uid"):
continue
found.append(prefix + name)
for sub: String in DirAccess.get_directories_at(dir):
found.append_array(files(dir.path_join(sub), prefix + sub + "/"))
found.sort()
return found
## [path, source, how] for each file, with an empty source where no rule matches.
static func rows() -> Array[Array]:
var out: Array[Array] = []
for path: String in files():
var row: Array = [path, "", ""]
for rule: Array in RULES:
if path.match(rule[0]):
row = [path, rule[1], rule[2]]
break
out.append(row)
return out
static func problems_with(table: Array[Array]) -> Array[String]:
var found: Array[String] = []
for row: Array in table:
var source: String = row[1]
if source.is_empty():
found.append("assets/%s: no recorded source; add a rule to tools/provenance.gd" % row[0])
elif source != "written by hand" and not FileAccess.file_exists("res://" + source):
found.append("assets/%s: its generator %s doesn't exist" % [row[0], source])
return found
static func render() -> String:
var lines: Array[String] = []
for row: Array in rows():
var source: String = row[1]
var shown: String = source if source == "written by hand" else "`%s`" % source
lines.append("| `assets/%s` | %s | %s |" % [row[0], shown, row[2]])
return HEADER + "\n".join(lines) + "\n"