Skip to content

refactor: extract world-process functions from engine into world_processes.py#71

Merged
biosynthart merged 1 commit into
hellolifeforms:mainfrom
biosynthart:refactor/world-process-extraction
Jun 2, 2026
Merged

refactor: extract world-process functions from engine into world_processes.py#71
biosynthart merged 1 commit into
hellolifeforms:mainfrom
biosynthart:refactor/world-process-extraction

Conversation

@biosynthart
Copy link
Copy Markdown
Member

Summary

Extract deposit_organic_matter, init_water_source_moisture, and rain effects logic out of EcosystemEngine into standalone functions in world_processes.py. The engine now delegates to these pure functions and only handles its own bookkeeping (tick counters, event log).

Changes

  • New: deposit_organic_matter(entity, params, voxel_grid) — OM deposit on entity death
  • New: init_water_source_moisture(source, voxel_grid) — water source moisture footprint seeding at init
  • New: apply_rain_effects(intensity, voxel_grid, water_sources, entities, get_params_fn) — core rain logic returning event dict for caller to log

Engine Impact

  • engine.py slimmed by ~80 lines (782 → 703)
  • Removed 12 unused constant imports (OM_DEPOSIT_*, most RAIN_*)
  • apply_rain() is now a thin wrapper: delegates core effects, handles engine-level bookkeeping only

Verification

  • All 150 tests pass
  • Ruff lint clean

…esses.py

Move deposit_organic_matter, init_water_source_moisture, and rain
effects logic out of EcosystemEngine into standalone functions in
world_processes.py. The engine now delegates to these pure functions
and only handles its own bookkeeping (tick counters, event log).

- Add deposit_organic_matter(entity, params, voxel_grid) — OM deposit on death
- Add init_water_source_moisture(source, voxel_grid) — water source footprint seeding
- Add apply_rain_effects(...) — core rain logic returning event dict for caller
- Slim engine.py by ~80 lines, remove 12 unused constant imports

All 150 tests pass, ruff lint clean.
@biosynthart biosynthart merged commit 415750e into hellolifeforms:main Jun 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant