wobblyhead hg > minor_monsters
comparison tools/build.py @ 10:22b604680c5a
adjusted monster movement to be less uniform
| author | ark |
|---|---|
| date | 2026-10-19 16:56 +0200 |
| parents | 53f015966118 |
| children | 7fda634d15ad |
comparison
equal
deleted
inserted
replaced
| 9:53f015966118 | 10:22b604680c5a |
|---|---|
| 325 return v | 325 return v |
| 326 | 326 |
| 327 | 327 |
| 328 def check_config(cfg): | 328 def check_config(cfg): |
| 329 """raise ConfigError on missing or malformed settings.""" | 329 """raise ConfigError on missing or malformed settings.""" |
| 330 for sec in ("scale", "monster", "animation", "route_preference", "tower", "placement", | 330 for sec in ("scale", "monster", "animation", "movement", "route_preference", "tower", |
| 331 "economy", "waves", "hearts", "coins", "controls", "art", "debug", "sound", | 331 "placement", "economy", "waves", "hearts", "coins", "controls", "art", "debug", |
| 332 "map"): | 332 "sound", "map"): |
| 333 if sec not in cfg: | 333 if sec not in cfg: |
| 334 raise ConfigError(f"section [{sec}] missing") | 334 raise ConfigError(f"section [{sec}] missing") |
| 335 for mid, mon in cfg["monster"].items(): | 335 for mid, mon in cfg["monster"].items(): |
| 336 for k in ("hp", "coins", "speed"): | 336 for k in ("hp", "coins", "speed"): |
| 337 need(mon, k, float, f"monster.{mid}") | 337 need(mon, k, float, f"monster.{mid}") |
| 343 for k in ("cost", "attack_time", "projectile_speed"): | 343 for k in ("cost", "attack_time", "projectile_speed"): |
| 344 need(tw, k, float, f"tower.{tid}") | 344 need(tw, k, float, f"tower.{tid}") |
| 345 need(tw, "projectile", str, f"tower.{tid}") | 345 need(tw, "projectile", str, f"tower.{tid}") |
| 346 if "slow" in tw and len(tw["slow"]) != 5: | 346 if "slow" in tw and len(tw["slow"]) != 5: |
| 347 raise ConfigError(f"tower.{tid}: slow needs 5 levels") | 347 raise ConfigError(f"tower.{tid}: slow needs 5 levels") |
| 348 for k in ("speed_variation", "offset", "lean", "wander_step", "fade_in"): | |
| 349 need(cfg["movement"], k, float, "movement") | |
| 348 for k in ("footprint_radius", "max_gap", "min_tower_distance", "edge_distance", | 350 for k in ("footprint_radius", "max_gap", "min_tower_distance", "edge_distance", |
| 349 "snap_radius", "grid_cell"): | 351 "snap_radius", "grid_cell"): |
| 350 need(cfg["placement"], k, float, "placement") | 352 need(cfg["placement"], k, float, "placement") |
| 351 snd = cfg["sound"] | 353 snd = cfg["sound"] |
| 352 need(snd, "enabled", bool, "sound") | 354 need(snd, "enabled", bool, "sound") |
