game.environment.degradation
Environmental degradation system.
Classes
Manages per-tile environmental degradation and island-wide recovery. |
Module Contents
- class game.environment.degradation.DegradationSystem(isometric_map)[source]
Manages per-tile environmental degradation and island-wide recovery.
Each game tick this system:
Applies degradation from every pig and villager to the tile they occupy.
Recalculates
overall_degradationas the mean degradation across all island (grass / forest) tiles.Applies natural recovery to every island tile.
Spreads cascading degradation from heavily degraded tiles (> 0.8) to their 8 neighbours.
- update(dt, entity_manager)[source]
Advance the degradation simulation by one time step.
Applies entity-driven degradation, recalculates
overall_degradation, runs natural recovery, and triggers cascading spread.- Parameters:
dt (float) – Elapsed time in seconds since the last frame.
entity_manager (EntityManager) – Provides access to the current lists of pigs and villagers whose positions are used to locate degradation sources.
- get_overall_degradation()[source]
Return the current island-wide degradation level.
- Returns:
Mean degradation across all island tiles, in [0, 1].
- Return type:
- is_ecosystem_collapsed()[source]
Return whether the ecosystem has passed the collapse threshold.
Collapse is defined as
overall_degradationexceedingECOSYSTEM_COLLAPSE_THRESHOLD(seegame.utils.constants). When this returnsTruethe game triggers a loss condition.- Returns:
Trueif the ecosystem has collapsed.- Return type: