Skip to content

Commit

Permalink
Create new requirements file to run abilities only if agent paw exists
Browse files Browse the repository at this point in the history
  • Loading branch information
kaylakraines committed Sep 28, 2023
1 parent 296a41d commit e28ec65
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions app/requirements/check_registered.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from plugins.stockpile.app.requirements.base_requirement import BaseRequirement


class Requirement(BaseRequirement):

async def enforce(self, link, operation):
"""
Given a link and the current operation, ensure will only run if the agent with the given ID/PAW is alive.
:param link
:param operation
:return: True if it complies, False if it doesn't
"""
print("\n\n*********************\nin check_registered.py")
agent_paws = [agent.paw for agent in await operation.active_agents()]
for uf in link.used:
print("id: ", uf.value ," agent_paws:", agent_paws)
if uf.value in agent_paws:
print("returning true - run this ability")
return True
print("returning false - don't run this ability")
return False

0 comments on commit e28ec65

Please sign in to comment.