This commit is contained in:
Auric Vente 2024-07-21 07:33:19 -06:00
parent ac9c7d5dba
commit d8cf12e20e
1 changed files with 12 additions and 2 deletions

View File

@ -60,6 +60,8 @@ class Ant:
tooltip += f"Updated: {Utils.to_date(self.updated)}" tooltip += f"Updated: {Utils.to_date(self.updated)}"
tooltip += f"\nCreated: {Utils.to_date(self.created)}" tooltip += f"\nCreated: {Utils.to_date(self.created)}"
tooltip += f"\nTriumph: {self.triumph} | Hits: {self.hits}" tooltip += f"\nTriumph: {self.triumph} | Hits: {self.hits}"
tooltip += "\nClick to Terminate"
tooltip += "\nMiddle Click to Merge"
return tooltip return tooltip
def get_status(self) -> str: def get_status(self) -> str:
@ -90,7 +92,7 @@ class Ants:
Ants.get() Ants.get()
@staticmethod @staticmethod
def hatch(num: int = 1) -> None: def hatch(num: int = 1, on_change: bool = True) -> None:
from .game import Game from .game import Game
now = Utils.now() now = Utils.now()
@ -104,6 +106,13 @@ class Ants:
Ants.ants.append(ant) Ants.ants.append(ant)
Game.add_update(ant) Game.add_update(ant)
if on_change:
Ants.on_change()
@staticmethod
def on_change() -> None:
from .game import Game
Ants.save() Ants.save()
Game.update_info() Game.update_info()
@ -270,8 +279,9 @@ class Ants:
if ant.method == "terminated": if ant.method == "terminated":
return return
Ants.hatch(on_change=False)
Ants.set_terminated(ant) Ants.set_terminated(ant)
Ants.hatch() Ants.on_change()
@staticmethod @staticmethod
def set_terminated(ant: Ant) -> None: def set_terminated(ant: Ant) -> None: