diff --git a/src/settings_default.py b/src/settings_default.py index a03c0d8d10..ca46e0541c 100644 --- a/src/settings_default.py +++ b/src/settings_default.py @@ -307,7 +307,8 @@ TIME_HOUR_PER_DAY = 24 TIME_DAY_PER_WEEK = 7 TIME_WEEK_PER_MONTH = 4 TIME_MONTH_PER_YEAR = 12 - +# How often the game time is updated +TIME_UPDATE_INTERVAL = 60 ###################################################################### # Default Player setup and access diff --git a/src/utils/gametime.py b/src/utils/gametime.py index 8c5dc65812..8c2c5cb375 100644 --- a/src/utils/gametime.py +++ b/src/utils/gametime.py @@ -21,6 +21,10 @@ GAME_TIME_SCRIPT = "sys_game_time" TIMEFACTOR = settings.TIME_FACTOR +# How often this script runs and updates the game time + +UPDATE_INTERVAL = settings.TIME_UPDATE_INTERVAL + # Common real-life time measures, in seconds. # You should not change these. @@ -52,7 +56,7 @@ class GameTime(Script): """ self.key = "sys_game_time" self.desc = "Keeps track of the game time" - self.interval = REAL_MIN # update every minute + self.interval = UPDATE_INTERVAL self.persistent = True self.start_delay = True self.attributes.add("game_time", 0.0) # IC time @@ -67,9 +71,9 @@ class GameTime(Script): game_time = float(self.attributes.get("game_time")) run_time = float(self.attributes.get("run_time")) up_time = float(self.attributes.get("up_time")) - self.attributes.add("game_time", game_time + MIN) - self.attributes.add("run_time", run_time + REAL_MIN) - self.attributes.add("up_time", up_time + REAL_MIN) + self.attributes.add("game_time", game_time + UPDATE_INTERVAL * TIMEFACTOR) + self.attributes.add("run_time", run_time + UPDATE_INTERVAL) + self.attributes.add("up_time", up_time + UPDATE_INTERVAL) def at_start(self): """ @@ -77,6 +81,7 @@ class GameTime(Script): We reset the up time. """ self.attributes.add("up_time", 0.0) + self.interval = UPDATE_INTERVAL # Access routines