game.environment.degradation

Environmental degradation system.

Classes

DegradationSystem

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:

  1. Applies degradation from every pig and villager to the tile they occupy.

  2. Recalculates overall_degradation as the mean degradation across all island (grass / forest) tiles.

  3. Applies natural recovery to every island tile.

  4. Spreads cascading degradation from heavily degraded tiles (> 0.8) to their 8 neighbours.

isometric_map[source]
overall_degradation = 0.0[source]
degradation_threshold_warnings[source]
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:

float

is_ecosystem_collapsed()[source]

Return whether the ecosystem has passed the collapse threshold.

Collapse is defined as overall_degradation exceeding ECOSYSTEM_COLLAPSE_THRESHOLD (see game.utils.constants). When this returns True the game triggers a loss condition.

Returns:

True if the ecosystem has collapsed.

Return type:

bool

get_degradation_status()[source]

Return a human-readable label for the current degradation level.

Returns:

One of "Healthy", "Slight Damage", "Moderate Damage", "Heavy Damage", or "Critical Damage".

Return type:

str