Added ability to make batch functions in the shell, and did some reworking of the event system in gamebase to allow it

This commit is contained in:
Patrick Marsee 2019-02-06 18:29:43 -05:00
parent 9055d8b257
commit bc70bad1c7
3 changed files with 130 additions and 54 deletions

View file

@ -54,7 +54,7 @@ class GameShell(Shell):
def man(self, args):
super(GameShell, self).man(args)
heapq.heappush(self.gameBase.eventQueue, (self.gameBase.gameTime, gameevents.NoOpEvent()))
#heapq.heappush(self.gameBase.eventQueue, (self.gameBase.gameTime, gameevents.NoOpEvent()))
def options(self, args):
i = 0
@ -182,7 +182,7 @@ If -l is given, a map legend will be printed under the map."""
for i in doors:
legend.append(' {0}D{1}{2} - {3}'.format(self.color(doors[i][1][1:]), i, self.clearColor(), doors[i][0]))
print('\n'.join(legend))
heapq.heappush(self.gameBase.eventQueue, (self.gameBase.gameTime, gameevents.NoOpEvent()))
#heapq.heappush(self.gameBase.eventQueue, (self.gameBase.gameTime, gameevents.NoOpEvent()))
return
def status(self, args):
@ -199,7 +199,7 @@ If -l is given, a map legend will be printed under the map."""
ret.append("Player position:{0:.>64}".format("{0}{1}".format(self.gameBase.numberToLetter(self.gameBase.playerx), self.gameBase.playery)))
ret.append("Prev. position:{0:.>65}".format("{0}{1}".format(self.gameBase.numberToLetter(self.gameBase.prevx), self.gameBase.prevy)))
print('\n'.join(ret))
heapq.heappush(self.gameBase.eventQueue, (self.gameBase.gameTime, gameevents.NoOpEvent()))
#heapq.heappush(self.gameBase.eventQueue, (self.gameBase.gameTime, gameevents.NoOpEvent()))
return
def inv(self, args):