Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- r"""
- Evennia settings file.
- The available options are found in the default settings file found
- here:
- d:\muddev\evennia\evennia\settings_default.py
- Remember:
- Don't copy more from the default file than you actually intend to
- change; this will make sure that you don't overload upstream updates
- unnecessarily.
- When changing a setting requiring a file system path (like
- path/to/actual/file.py), use GAME_DIR and EVENNIA_DIR to reference
- your game folder and the Evennia library folders respectively. Python
- paths (path.to.module) should be given relative to the game's root
- folder (typeclasses.foo) whereas paths within the Evennia library
- needs to be given explicitly (evennia.foo).
- If you want to share your game dir, including its settings, you can
- put secret game- or server-specific settings in secret_settings.py.
- """
- # Use the defaults from Evennia unless explicitly overridden
- from evennia.settings_default import *
- ######################################################################
- # Evennia base server config
- ######################################################################
- # This is the name of your game. Make it catchy!
- SERVERNAME = "Hecate"
- GAME_SLOGAN = "This is where the fun begins."
- SEARCH_MULTIMATCH_REGEX = r"(?P<number>[0-9]+) (?P<name>.*)"
- SEARCH_MULTIMATCH_TEMPLATE = " {number} {name}{aliases}{info}\n"
- ######################################################################
- # Game Time setup
- ######################################################################
- # You don't actually have to use this, but it affects the routines in
- # evennia.utils.gametime.py and allows for a convenient measure to
- # determine the current in-game time. You can of course interpret
- # "week", "month" etc as your own in-game time units as desired.
- # The time factor dictates if the game world runs faster (timefactor>1)
- # or slower (timefactor<1) than the real world.
- TIME_FACTOR = 1.0
- # The starting point of your game time (the epoch), in seconds.
- # In Python a value of 0 means Jan 1 1970 (use negatives for earlier
- # start date). This will affect the returns from the utils.gametime
- # module. If None, the server's first start-time is used as the epoch.
- TIME_GAME_EPOCH = None
- # Normally, game time will only increase when the server runs. If this is True,
- # game time will not pause when the server reloads or goes offline. This setting
- # together with a time factor of 1 should keep the game in sync with
- # the real time (add a different epoch to shift time)
- TIME_IGNORE_DOWNTIMES = True
- WEBCLIENT_OPTIONS = {
- "gagprompt": True, # Gags prompt from the output window and keep them
- # together with the input bar
- "helppopup": False, # Shows help files in a new popup window
- "notification_popup": False, # Shows notifications of new messages as
- # popup windows
- "notification_sound": False # Plays a sound for notifications of new
- # messages
- }
- ######################################################################
- # Global Scripts
- ######################################################################
- # Global scripts started here will be available through
- # 'evennia.GLOBAL_SCRIPTS.key'. The scripts will survive a reload and be
- # recreated automatically if deleted. Each entry must have the script keys,
- # whereas all other fields in the specification are optional. If 'typeclass' is
- # not given, BASE_SCRIPT_TYPECLASS will be assumed. Note that if you change
- # typeclass for the same key, a new Script will replace the old one on
- # `evennia.GLOBAL_SCRIPTS`.
- GLOBAL_SCRIPTS = {
- # 'key': {'typeclass': 'typeclass.path.here',
- # 'repeats': -1, 'interval': 50, 'desc': 'Example script'},
- 'time_cycle': {
- 'typeclass': 'time_cycle.TimeCycle',
- 'repeats': -1,
- 'interval': 1,
- 'desc': 'Tracks global timed events.',
- 'persistent': True
- }
- }
- ######################################################################
- # Settings given in secret_settings.py override those in this file.
- ######################################################################
- try:
- from server.conf.secret_settings import *
- except ImportError:
- print("secret_settings.py file not found or failed to import.")
- """typeclasses.time_cycle.py"""
- import datetime
- from typeclasses.scripts import Script
- from typeclasses.rooms import Room
- class TimeCycle(Script):
- def at_script_creation(self):
- self.key = 'time_cycle'
- self.desc = "Tracks global timed events."
- self.interval = 1
- self.persistent = True
- def at_repeat(self):
- now = datetime.datetime.now()
- cur_hour = now.hour
- cur_min = now.minute
- cur_sec = now.second
- if cur_sec != 0:
- return
- if cur_min not in [0, 20, 40]:
- return
- # Daytime begins.
- if cur_hour in [2, 6, 10, 14, 18, 22]:
- if cur_min == 0:
- # Phase 1
- string = "The sun rises above the eastern horizon."
- elif cur_min == 20:
- # Phase 2
- string = "It's now mid-morning."
- elif cur_min == 40:
- # Phase 3
- string = "It's now early-noon."
- elif cur_hour in [3, 7, 11, 15, 19, 23]:
- if cur_min == 0:
- # Phase 4
- string = "It's now high-noon."
- elif cur_min == 20:
- # Phase 5
- string = "It's now mid-afternoon."
- elif cur_min == 40:
- # Phase 6
- string = "It's now dusk."
- # Nighttime begins.
- elif cur_hour in [0, 4, 8, 12, 16, 20]:
- if cur_min == 0:
- # Phase 1
- string = "The sun has set and the moon begins to glow."
- elif cur_min == 20:
- # Phase 2
- string = "It's now early-evening."
- elif cur_min == 40:
- # Phase 3
- string = "It's now late-evening."
- elif cur_hour in [1, 5, 9, 13, 17, 21]:
- if cur_min == 0:
- # Phase 4
- string = "It's now midnight."
- elif cur_min == 20:
- # Phase 5
- string = "It's now early-morning."
- elif cur_min == 40:
- # Phase 6
- string = "The break of dawn approaches."
- # Send out the string to all rooms.
- for room in Room.objects.all():
- room.msg_contents(string)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement