Skip to content

Commit

Permalink
Fix Bug #134 - Issue with Limiting Fire in Hunger Baubles
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkerm committed Jun 3, 2016
1 parent 6b544f4 commit 7fdfc74
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions SBA_Serv/World/Messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,26 @@ def __repr__(self):
class OneTimeCommand(Command):
def __init__(self, obj, msg, executefirst=False, ttl=4, required=0):
super(OneTimeCommand, self).__init__(obj, msg, ttl, block=True, required=required)
self.__pre_execute = executefirst
self.__executed = False
self.__done = False
if executefirst:
self.__executed = True
self.onetime()

def isComplete(self):
return self.__done and self.__executed

def isExpired(self):
self.__done = super(OneTimeCommand, self).isExpired()
if not self.__executed:
# execute when expiring if tail end
if self.__done and not self.__executed:
self.__executed = True
self.onetime()

def execute(self, t):
# check if execute now if front end
if not self.__executed and self.__pre_execute:
self.__executed = True
self.onetime()

self.isExpired()

def onetime(self):
Expand Down

0 comments on commit 7fdfc74

Please sign in to comment.