| … | … | @@ -47,6 +47,17 @@ def map_params(): |
| 47 | 47 | raise SystemExit(f"cannot read {name} from {MAP_GD}") |
| 48 | 48 | return float(m.group(1)) |
| 49 | 49 | |
| 50 | # The BLOCK, read from the map too. Hardcoding it here is how the two |
| 51 | # halves end up on different terrain — the same class of bug as the |
| 52 | # parameters this function exists to read. |
| 53 | m = re.search(r'^const HEIGHTFIELD\s*:=\s*"res://([^"]+)"', src, re.M) |
| 54 | if not m: |
| 55 | raise SystemExit("cannot read HEIGHTFIELD from " + MAP_GD) |
| 56 | global HBLK |
| 57 | HBLK = os.path.abspath(os.path.join(os.path.dirname(MAP_GD), "..", "..", m.group(1))) |
| 58 | if not os.path.exists(HBLK): |
| 59 | raise SystemExit("map's heightfield not on disk: " + HBLK) |
| 60 | |
| 50 | 61 | floor_y, ceil_y = const("FLOOR_Y"), const("CEILING_Y") |
| 51 | 62 | th, cell = const("TERRAIN_HEIGHT"), const("EROSION_CELL_SCALE") |
| 52 | 63 | gully, depth = const("EROSION_GULLY_METRES"), const("EROSION_DEPTH_METRES") |