Add optional settings to change game time measurement and units

This commit is contained in:
Vincent Le Goff 2017-02-12 15:33:36 -08:00 committed by Griatch
parent 175f4ed026
commit ab97f3674e

View file

@ -28,23 +28,23 @@ TIMEFACTOR = settings.TIME_FACTOR
# when defining in-game events. The words month, week and year can be # when defining in-game events. The words month, week and year can be
# used to mean whatever units of time are used in your game. # used to mean whatever units of time are used in your game.
SEC = 1 SEC = 1
MIN = 60 # seconds per minute MIN = getattr(settings, "SECS_PER_MIN", 60)
HOUR = MIN * 60 # minutes per hour HOUR = getattr(settings, "MINS_PER_HOUR", 60) * MIN
DAY = HOUR * 24 # hours per day DAY = getattr(settings, "HOURS_PER_DAY", 24) * HOUR
WEEK = DAY * 7 # days per week WEEK = getattr(settings, "DAYS_PER_WEEK", 7) * DAY
MONTH = WEEK * 4 # weeks per month MONTH = getattr(settings, "WEEKS_PER_MONTH", 4) * WEEK
YEAR = MONTH * 12 # months per year YEAR = getattr(settings, "MONTHS_PER_YEAR", 12) * MONTH
UNITS = { UNITS = getattr(settings, "TIME_UNITS", {
"sec": SEC, "sec": SEC,
"min": MIN, "min": MIN,
"hr": HOUR, "hr": HOUR,
"hour": HOUR, "hour": HOUR,
"day": DAY, "day": DAY,
"week": WEEK, "week": WEEK,
"month": MONTH, "month": MONTH,
"year": YEAR, "year": YEAR,
"yr": YEAR, "yr": YEAR,
} })
def time_to_tuple(seconds, *divisors): def time_to_tuple(seconds, *divisors):