Island: append should agent die check to also check if monkey is marked dead in configuration

This commit is contained in:
VakarisZ 2021-12-07 14:43:40 +02:00
parent ea621b49d1
commit 9031bfb888
1 changed files with 9 additions and 1 deletions

View File

@ -23,8 +23,16 @@ def set_stop_all(time: float):
agent_controls.save()
def was_monkey_killed(guid: int) -> bool:
def should_agent_die(guid: int) -> bool:
monkey = Monkey.objects(guid=guid).first()
return _is_monkey_marked_dead(monkey) or _is_monkey_killed_manually()
def _is_monkey_marked_dead(monkey: Monkey) -> bool:
return monkey.config.alive
def _is_monkey_killed_manually(monkey: Monkey) -> bool:
if monkey.has_parent():
launch_timestamp = monkey.get_parent().launch_time
else: