class Game(object): def __init__(self): self.OOIs = OOIs() self.players = list() self.eventList = getMockEventList() self._epoch = int(time()) # real-time game start def time(self,t=None): # returns current in-game time representation as a string # if t is given, in-game time at given time t if t == None: t = time() secsPassed = int(t-self._epoch) #real-time yearsPassed = float(secsPassed)/self.getDeltaYearUpdate() #game-time month = int(yearsPassed%1*12) year = int(yearsPassed)+START_YEAR return month_abbr[month+1]+' '+str(year) def getDeltaYearUpdate(self): # returns time (in real seconds) between year changes in game-time return GAME_LEN*60/GAME_YEAR_SPAN # real-time sec / 1 game_year def addPlayer(self, player): # adds a player to the current game self.players.append(player) def addObject(self,object,ownerName=None): # adds object to track to OOIs self.OOIs.addObject(object,ownerName) def inGame(self, uName): # returns user obj if user is in game, else returns false for user in self.players: if user.name == uName: return user else: return False
def __init__(self): self.OOIs = OOIs() self.players = list() self.eventList = getMockEventList() self._epoch = int(time()) # real-time game start