NotQuiteParadise2

Source code for nqp.effects.burn

"""

not in design docs, just testing.  maybe use later?

"""

from __future__ import annotations

from typing import TYPE_CHECKING

import snecs
from snecs import RegisteredComponent

from nqp.base_classes.effect_processor import EffectProcessor

if TYPE_CHECKING:
    from nqp.core.game import Game


[docs]class OnFireStatusEffect(RegisteredComponent):
[docs] def __init__(self, ttl=100): self.ttl = ttl
[docs]class OnFireStatusProcessor(EffectProcessor): burning = snecs.Query([OnFireStatusEffect])
[docs] def update(self, time_delta: float, game: Game): for eid, (burn,) in list(OnFireStatusProcessor.burning): burn.ttl -= time_delta if burn.ttl <= 0: snecs.remove_component(eid, OnFireStatusEffect)