refactor(packages): the mechanic packages use ludic_base only, and ask through ports

ludic.clock, .effects, .inventory, .wallet, .weather and .tracks say
'uses ludic_base' (ludic.base uses nothing). ClockWorld, PackRules,
WeatherWorld and TracksWorld are export ports whose defaults are the old
fallbacks; clock_bind, inv_bind, weather_bind and tracks_bind are gone,
and the tests bind their fakes. The base README's toy does the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-25 05:36:11 +03:00
parent f4062010e9
commit 63e29f024c
31 changed files with 130 additions and 149 deletions

View file

@ -16,18 +16,24 @@ the hour; another machine is told it (`clock_set_hours`, `clock_set_day`, `clock
## The port
```ludic
property ClockWorld {
owns_world: fn() -> bool # does this machine run the world? (unbound: yes)
rest_scale: fn() -> float # how much everyone's rest speeds the clock; 1 when nobody rests
seed: fn() -> int # a seed for a new trip's moon
export port ClockWorld {
owns_world: fn() -> bool = ... # does this machine run the world? (unbound: yes)
rest_scale: fn() -> float = ... # how much everyone's rest speeds the clock (unbound: 1)
seed: fn() -> int = ... # a seed for a new trip's moon (unbound: 1)
}
```
The game fills it once, where it is put together, and may leave any member out:
```ludic
bind ClockWorld { owns_world: fn ses_owns_world, rest_scale: fn rt_rest_scale, seed: fn rt_clock_seed }
```
## API
| | |
| --- | --- |
| `clock_bind(w)` | the port |
| `bind ClockWorld { ... }` | the port (a declaration, not a call) |
| `clock_config(start_hours, night_from, night_to)` | when a trip starts, and which hours are night |
| `clock_config_moon(days, lo, hi)` | the moon's month in days, and the part of it a new trip starts in |
| `clock_calendar(month_days, season_of_month)` | a month's length, and each month's season (the list's length is the year) |