This commit is contained in:
Auric Vente
2024-07-21 01:13:00 -06:00
parent 857dd9dd92
commit 1fd742ea8a
4 changed files with 39 additions and 30 deletions

View File

@@ -61,7 +61,8 @@ class Ants:
@staticmethod
def prepare() -> None:
Ants.get_ants()
Ants.get()
Ants.fill()
@staticmethod
def hatch(num: int = 1) -> None:
@@ -184,10 +185,11 @@ class Ants:
ant.updated = Utils.now()
Game.add_status(ant)
Game.update_info()
Ants.save()
@staticmethod
def get_ants() -> None:
def get() -> None:
objs = Storage.get_ants()
changed = False
@@ -203,6 +205,15 @@ class Ants:
if changed:
Ants.save()
@staticmethod
def fill() -> None:
diff = Config.max_ants - len(Ants.ants)
if diff <= 0:
return
Ants.hatch(diff)
@staticmethod
def random_name() -> str:
return Utils.random_name(Ants.get_names())
@@ -315,3 +326,7 @@ class Ants:
image_path = Config.terminated_image_path
Game.add_message("Terminated", f"{ant.name} is gone", image_path)
@staticmethod
def clear() -> None:
Ants.ants = []