mirror of
https://github.com/evennia/evennia.git
synced 2026-04-04 23:17:17 +02:00
As a side-effect of all of this, logging in more than once acts as behaves now. Also, this will allow things/rooms/exits (IE: not players) or un-logged in players to run commands or be forced to run them via @fo. All of this will bring us more in-line with MUX behavior.
45 lines
No EOL
1.4 KiB
Python
45 lines
No EOL
1.4 KiB
Python
"""
|
|
Contains commands for managing script parents.
|
|
"""
|
|
from src import scripthandler
|
|
|
|
def clear_cached_scripts(command):
|
|
"""
|
|
Show the currently cached scripts.
|
|
"""
|
|
cache_dict = scripthandler.CACHED_SCRIPTS
|
|
cache_size = len(cache_dict)
|
|
cache_dict.clear()
|
|
command.source_object.emit_to(
|
|
"Script parent cached cleared (%d previously in cache)." % cache_size)
|
|
|
|
def show_cached_scripts(command):
|
|
"""
|
|
Clears the cached scripts by deleting their keys from the script cache
|
|
dictionary. The next time an object needs the previously loaded scripts,
|
|
they are loaded again.
|
|
"""
|
|
cache_dict = scripthandler.CACHED_SCRIPTS
|
|
|
|
retval = "Currently Cached Script Parents\n"
|
|
retval += "-" * 78
|
|
for script in cache_dict.keys():
|
|
retval += "\n " + script
|
|
retval += "\n" + "-" * 78 + "\n"
|
|
retval += "%d cached parents" % len(cache_dict)
|
|
command.source_object.emit_to(retval)
|
|
|
|
def cmd_parent(command):
|
|
"""
|
|
Figure out what form of the command the user is using and branch off
|
|
accordingly.
|
|
"""
|
|
if "showcache" in command.command_switches:
|
|
show_cached_scripts(command)
|
|
return
|
|
|
|
if "clearcache" in command.command_switches:
|
|
clear_cached_scripts(command)
|
|
return
|
|
|
|
command.source_object.emit_to("Must be specified with one of the following switches: showcache, clearcache") |