game.environment.degradation ============================ .. py:module:: game.environment.degradation .. autoapi-nested-parse:: Environmental degradation system. Classes ------- .. autoapisummary:: game.environment.degradation.DegradationSystem Module Contents --------------- .. py:class:: DegradationSystem(isometric_map) 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 :attr:`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. .. py:attribute:: isometric_map .. py:attribute:: overall_degradation :value: 0.0 .. py:attribute:: degradation_threshold_warnings .. py:method:: update(dt, entity_manager) Advance the degradation simulation by one time step. Applies entity-driven degradation, recalculates :attr:`overall_degradation`, runs natural recovery, and triggers cascading spread. :param dt: Elapsed time in seconds since the last frame. :type dt: float :param entity_manager: Provides access to the current lists of pigs and villagers whose positions are used to locate degradation sources. :type entity_manager: EntityManager .. py:method:: get_overall_degradation() Return the current island-wide degradation level. :returns: Mean degradation across all island tiles, in [0, 1]. :rtype: float .. py:method:: is_ecosystem_collapsed() Return whether the ecosystem has passed the collapse threshold. Collapse is defined as :attr:`overall_degradation` exceeding ``ECOSYSTEM_COLLAPSE_THRESHOLD`` (see :mod:`game.utils.constants`). When this returns ``True`` the game triggers a loss condition. :returns: ``True`` if the ecosystem has collapsed. :rtype: bool .. py:method:: get_degradation_status() Return a human-readable label for the current degradation level. :returns: One of ``"Healthy"``, ``"Slight Damage"``, ``"Moderate Damage"``, ``"Heavy Damage"``, or ``"Critical Damage"``. :rtype: str