mirror of
https://github.com/evennia/evennia.git
synced 2026-04-06 16:44:08 +02:00
Revamp how commands are loaded. This will now allow for easy addition of custom commands and over-riding existing Evennia-supplied commands.
This commit is contained in:
parent
848c7da075
commit
4ca5a4a7bf
12 changed files with 165 additions and 107 deletions
|
|
@ -7,6 +7,7 @@ import src.comsys
|
|||
from src import defines_global
|
||||
from src import ansi
|
||||
from src.util import functions_general
|
||||
from src.cmdtable import GLOBAL_CMD_TABLE
|
||||
|
||||
def cmd_addcom(command):
|
||||
"""
|
||||
|
|
@ -49,6 +50,7 @@ def cmd_addcom(command):
|
|||
src.comsys.send_cmessage(chan_name_parsed, join_msg)
|
||||
else:
|
||||
source_object.emit_to("Could not find channel %s." % (chan_name,))
|
||||
GLOBAL_CMD_TABLE.add_command("addcom", cmd_addcom),
|
||||
|
||||
def cmd_delcom(command):
|
||||
"""
|
||||
|
|
@ -75,6 +77,7 @@ def cmd_delcom(command):
|
|||
leave_msg = "[%s] %s has left the channel." % \
|
||||
(chan_name, source_object.get_name(show_dbref=False))
|
||||
src.comsys.send_cmessage(chan_name, leave_msg)
|
||||
GLOBAL_CMD_TABLE.add_command("delcom", cmd_delcom),
|
||||
|
||||
def cmd_comlist(command):
|
||||
"""
|
||||
|
|
@ -93,6 +96,7 @@ def cmd_comlist(command):
|
|||
source_object.emit_to("%-9.9s %-19.19s %s" %
|
||||
(chan, session.channels_subscribed[chan][0], chan_on))
|
||||
source_object.emit_to("-- End of comlist --")
|
||||
GLOBAL_CMD_TABLE.add_command("comlist", cmd_comlist),
|
||||
|
||||
def cmd_allcom(command):
|
||||
"""
|
||||
|
|
@ -129,6 +133,7 @@ def cmd_clist(command):
|
|||
('-', '-', chan.get_name(), chan.get_owner().get_name(),
|
||||
'No Description'))
|
||||
source_object.emit_to("-- End of Channel List --")
|
||||
GLOBAL_CMD_TABLE.add_command("@clist", cmd_clist),
|
||||
|
||||
def cmd_cdestroy(command):
|
||||
"""
|
||||
|
|
@ -155,6 +160,8 @@ def cmd_cdestroy(command):
|
|||
else:
|
||||
source_object.emit_to("Permission denied.")
|
||||
return
|
||||
GLOBAL_CMD_TABLE.add_command("@cdestroy", cmd_cdestroy,
|
||||
priv_tuple=("objects.delete_commchannel")),
|
||||
|
||||
def cmd_cset(command):
|
||||
"""
|
||||
|
|
@ -246,6 +253,7 @@ def cmd_cemit(command):
|
|||
if not "quiet" in command.command_switches:
|
||||
source_object.emit_to("Sent - %s" % (name_matches[0],))
|
||||
src.comsys.send_cmessage(cname_parsed, final_cmessage)
|
||||
GLOBAL_CMD_TABLE.add_command("@cemit", cmd_cemit),
|
||||
|
||||
def cmd_cwho(command):
|
||||
"""
|
||||
|
|
@ -283,6 +291,7 @@ def cmd_cwho(command):
|
|||
else:
|
||||
source_object.emit_to("No channel with that name was found.")
|
||||
return
|
||||
GLOBAL_CMD_TABLE.add_command("@cwho", cmd_cwho),
|
||||
|
||||
def cmd_ccreate(command):
|
||||
"""
|
||||
|
|
@ -310,6 +319,8 @@ def cmd_ccreate(command):
|
|||
# Create and set the object up.
|
||||
new_chan = src.comsys.create_channel(cname, source_object)
|
||||
source_object.emit_to("Channel %s created." % (new_chan.get_name(),))
|
||||
GLOBAL_CMD_TABLE.add_command("@ccreate", cmd_ccreate,
|
||||
priv_tuple=("objects.add_commchannel")),
|
||||
|
||||
def cmd_cchown(command):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@ Generic command module. Pretty much every command should go here for
|
|||
now.
|
||||
"""
|
||||
import time
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
from src.config.models import ConfigValue
|
||||
from src.helpsys.models import HelpEntry
|
||||
from src.objects.models import Object
|
||||
|
|
@ -13,6 +11,7 @@ from src import defines_global
|
|||
from src import session_mgr
|
||||
from src import ansi
|
||||
from src.util import functions_general
|
||||
from src.cmdtable import GLOBAL_CMD_TABLE
|
||||
|
||||
def cmd_password(command):
|
||||
"""
|
||||
|
|
@ -55,12 +54,14 @@ def cmd_password(command):
|
|||
uaccount.set_password(newpass)
|
||||
uaccount.save()
|
||||
source_object.emit_to("Password changed.")
|
||||
GLOBAL_CMD_TABLE.add_command("@password", cmd_password)
|
||||
|
||||
def cmd_pemit(command):
|
||||
"""
|
||||
Emits something to a player.
|
||||
"""
|
||||
# TODO: Implement cmd_pemit
|
||||
#GLOBAL_CMD_TABLE.add_command("@pemit", cmd_pemit)
|
||||
|
||||
def cmd_emit(command):
|
||||
"""
|
||||
|
|
@ -72,6 +73,8 @@ def cmd_emit(command):
|
|||
command.source_object.get_location().emit_to_contents(message)
|
||||
else:
|
||||
command.source_object.emit_to("Emit what?")
|
||||
GLOBAL_CMD_TABLE.add_command("@emit", cmd_emit,
|
||||
priv_tuple=("genperms.announce")),
|
||||
|
||||
def cmd_wall(command):
|
||||
"""
|
||||
|
|
@ -86,6 +89,8 @@ def cmd_wall(command):
|
|||
message = "%s shouts \"%s\"" % (
|
||||
command.source_object.get_name(show_dbref=False), wallstring)
|
||||
session_mgr.announce_all(message)
|
||||
GLOBAL_CMD_TABLE.add_command("@wall", cmd_wall,
|
||||
priv_tuple=("genperms.announce"))
|
||||
|
||||
def cmd_idle(command):
|
||||
"""
|
||||
|
|
@ -93,6 +98,7 @@ def cmd_idle(command):
|
|||
his screen.
|
||||
"""
|
||||
pass
|
||||
GLOBAL_CMD_TABLE.add_command("idle", cmd_idle)
|
||||
|
||||
def cmd_inventory(command):
|
||||
"""
|
||||
|
|
@ -111,6 +117,7 @@ def cmd_inventory(command):
|
|||
money_name = ConfigValue.objects.get_configvalue("MONEY_NAME_PLURAL")
|
||||
|
||||
source_object.emit_to("You have %d %s." % (money, money_name))
|
||||
GLOBAL_CMD_TABLE.add_command("inventory", cmd_inventory)
|
||||
|
||||
def cmd_look(command):
|
||||
"""
|
||||
|
|
@ -138,6 +145,7 @@ def cmd_look(command):
|
|||
target_obj.scriptlink.a_desc({
|
||||
"target_obj": source_object
|
||||
})
|
||||
GLOBAL_CMD_TABLE.add_command("look", cmd_look)
|
||||
|
||||
def cmd_get(command):
|
||||
"""
|
||||
|
|
@ -179,6 +187,7 @@ def cmd_get(command):
|
|||
target_obj.scriptlink.a_get({
|
||||
"pobject": source_object
|
||||
})
|
||||
GLOBAL_CMD_TABLE.add_command("get", cmd_get)
|
||||
|
||||
def cmd_drop(command):
|
||||
"""
|
||||
|
|
@ -212,6 +221,7 @@ def cmd_drop(command):
|
|||
target_obj.scriptlink.a_drop({
|
||||
"pobject": source_object
|
||||
})
|
||||
GLOBAL_CMD_TABLE.add_command("drop", cmd_drop),
|
||||
|
||||
def cmd_examine(command):
|
||||
"""
|
||||
|
|
@ -327,6 +337,7 @@ def cmd_examine(command):
|
|||
source_object.emit_to("Home: %s" % (target_obj.get_home(),))
|
||||
# This obviously isn't valid for rooms.
|
||||
source_object.emit_to("Location: %s" % (target_obj.get_location(),))
|
||||
GLOBAL_CMD_TABLE.add_command("examine", cmd_examine)
|
||||
|
||||
def cmd_quit(command):
|
||||
"""
|
||||
|
|
@ -336,6 +347,7 @@ def cmd_quit(command):
|
|||
session = command.session
|
||||
session.msg("Quitting!")
|
||||
session.handle_close()
|
||||
GLOBAL_CMD_TABLE.add_command("quit", cmd_quit)
|
||||
|
||||
def cmd_who(command):
|
||||
"""
|
||||
|
|
@ -391,6 +403,9 @@ def cmd_who(command):
|
|||
retval += '%d Players logged in.' % (len(session_list),)
|
||||
|
||||
source_object.emit_to(retval)
|
||||
GLOBAL_CMD_TABLE.add_command("doing", cmd_who,
|
||||
extra_vals={"show_session_data": False})
|
||||
GLOBAL_CMD_TABLE.add_command("who", cmd_who)
|
||||
|
||||
def cmd_say(command):
|
||||
"""
|
||||
|
|
@ -413,6 +428,7 @@ def cmd_say(command):
|
|||
|
||||
source_object.get_location().emit_to_contents(emit_string,
|
||||
exclude=source_object)
|
||||
GLOBAL_CMD_TABLE.add_command("say", cmd_say)
|
||||
|
||||
def cmd_pose(command):
|
||||
"""
|
||||
|
|
@ -436,6 +452,7 @@ def cmd_pose(command):
|
|||
pose_string)
|
||||
|
||||
source_object.get_location().emit_to_contents(sent_msg)
|
||||
GLOBAL_CMD_TABLE.add_command("pose", cmd_pose)
|
||||
|
||||
def cmd_help(command):
|
||||
"""
|
||||
|
|
@ -469,3 +486,4 @@ def cmd_help(command):
|
|||
else:
|
||||
topic = topics[0]
|
||||
source_object.emit_to("\n\r"+ topic.get_entrytext_ingame())
|
||||
GLOBAL_CMD_TABLE.add_command("help", cmd_help)
|
||||
|
|
@ -4,17 +4,16 @@ the server instance.
|
|||
"""
|
||||
import os
|
||||
import time
|
||||
|
||||
from src.util import functions_general
|
||||
if not functions_general.host_os_is('nt'):
|
||||
# Don't import the resource module if the host OS is Windows.
|
||||
import resource
|
||||
|
||||
import django
|
||||
from src.objects.models import Object
|
||||
from src import scheduler
|
||||
from src import defines_global
|
||||
from src import flags
|
||||
from src.cmdtable import GLOBAL_CMD_TABLE
|
||||
|
||||
def cmd_version(command):
|
||||
"""
|
||||
|
|
@ -25,6 +24,7 @@ def cmd_version(command):
|
|||
retval += " Django %s\n\r" % (django.get_version())
|
||||
retval += "-"*50
|
||||
command.source_object.emit_to(retval)
|
||||
GLOBAL_CMD_TABLE.add_command("version", cmd_version),
|
||||
|
||||
def cmd_time(command):
|
||||
"""
|
||||
|
|
@ -32,6 +32,7 @@ def cmd_time(command):
|
|||
"""
|
||||
command.source_object.emit_to('Current server time : %s' %
|
||||
(time.strftime('%a %b %d %H:%M:%S %Y (%Z)', time.localtime(),)))
|
||||
GLOBAL_CMD_TABLE.add_command("time", cmd_time),
|
||||
|
||||
def cmd_uptime(command):
|
||||
"""
|
||||
|
|
@ -53,6 +54,7 @@ def cmd_uptime(command):
|
|||
loadavg = os.getloadavg()
|
||||
source_object.emit_to('Server load (1 min) : %.2f' %
|
||||
loadavg[0])
|
||||
GLOBAL_CMD_TABLE.add_command("uptime", cmd_uptime),
|
||||
|
||||
def cmd_list(command):
|
||||
"""
|
||||
|
|
@ -95,6 +97,7 @@ def cmd_list(command):
|
|||
source_object.emit_to("Flags: "+" ".join(flags.SERVER_FLAGS))
|
||||
else:
|
||||
source_object.emit_to(msg_invalid)
|
||||
GLOBAL_CMD_TABLE.add_command("@list", cmd_list),
|
||||
|
||||
def cmd_ps(command):
|
||||
"""
|
||||
|
|
@ -109,6 +112,8 @@ def cmd_ps(command):
|
|||
scheduler.get_event_interval(event),
|
||||
scheduler.get_event_description(event)))
|
||||
source_object.emit_to("Totals: %d interval events" % (len(scheduler.schedule),))
|
||||
GLOBAL_CMD_TABLE.add_command("@ps", cmd_ps,
|
||||
priv_tuple=("genperms.process_control")),
|
||||
|
||||
def cmd_stats(command):
|
||||
"""
|
||||
|
|
@ -124,3 +129,4 @@ def cmd_stats(command):
|
|||
stats_dict["things"],
|
||||
stats_dict["players"],
|
||||
stats_dict["garbage"]))
|
||||
GLOBAL_CMD_TABLE.add_command("@stats", cmd_stats),
|
||||
|
|
@ -5,6 +5,7 @@ from src.objects.models import Object, Attribute
|
|||
# We'll import this as the full path to avoid local variable clashes.
|
||||
import src.flags
|
||||
from src import ansi
|
||||
from src.cmdtable import GLOBAL_CMD_TABLE
|
||||
|
||||
def cmd_teleport(command):
|
||||
"""
|
||||
|
|
@ -61,6 +62,8 @@ def cmd_teleport(command):
|
|||
source_object.emit_to("Teleported.")
|
||||
|
||||
source_object.move_to(target_obj, quiet=tel_quietly)
|
||||
GLOBAL_CMD_TABLE.add_command("@teleport", cmd_teleport,
|
||||
priv_tuple=("genperms.builder"))
|
||||
|
||||
def cmd_alias(command):
|
||||
"""
|
||||
|
|
@ -107,6 +110,7 @@ def cmd_alias(command):
|
|||
# Duplicates were found.
|
||||
source_object.emit_to("Alias '%s' is already in use." % (new_alias,))
|
||||
return
|
||||
GLOBAL_CMD_TABLE.add_command("@alias", cmd_alias)
|
||||
|
||||
def cmd_wipe(command):
|
||||
"""
|
||||
|
|
@ -158,6 +162,7 @@ def cmd_wipe(command):
|
|||
target_obj.clear_attribute(attr.get_name())
|
||||
source_object.emit_to("%s - %d attributes wiped." % (target_obj.get_name(),
|
||||
len(attr_matches)))
|
||||
GLOBAL_CMD_TABLE.add_command("@wipe", cmd_wipe)
|
||||
|
||||
def cmd_set(command):
|
||||
"""
|
||||
|
|
@ -224,11 +229,12 @@ def cmd_set(command):
|
|||
else:
|
||||
# We're setting the flag.
|
||||
if not src.flags.is_modifiable_flag(flag):
|
||||
source_object.emit_to("You can't set/unset the flag - %s." % (flag,))
|
||||
source_object.emit_to("You can't set/unset the flag - %s." % flag)
|
||||
else:
|
||||
source_object.emit_to('%s - %s set.' % (victim.get_name(),
|
||||
flag.upper(),))
|
||||
victim.set_flag(flag, True)
|
||||
GLOBAL_CMD_TABLE.add_command("@set", cmd_set)
|
||||
|
||||
def cmd_find(command):
|
||||
"""
|
||||
|
|
@ -251,6 +257,8 @@ def cmd_find(command):
|
|||
source_object.emit_to("%d matches returned." % (len(results),))
|
||||
else:
|
||||
source_object.emit_to("No name matches found for: %s" % (searchstring,))
|
||||
GLOBAL_CMD_TABLE.add_command("@find", cmd_find,
|
||||
priv_tuple=("genperms.builder"))
|
||||
|
||||
def cmd_create(command):
|
||||
"""
|
||||
|
|
@ -270,6 +278,8 @@ def cmd_create(command):
|
|||
new_object = Object.objects.create_object(odat)
|
||||
|
||||
source_object.emit_to("You create a new thing: %s" % (new_object,))
|
||||
GLOBAL_CMD_TABLE.add_command("@create", cmd_create,
|
||||
priv_tuple=("genperms.builder"))
|
||||
|
||||
def cmd_cpattr(command):
|
||||
"""
|
||||
|
|
@ -339,13 +349,17 @@ def cmd_cpattr(command):
|
|||
tar_obj.set_attribute(tar_attr_string, src_attr_contents)
|
||||
source_object.emit_to("%s - %s set." % (tar_obj.get_name(),
|
||||
tar_attr_string))
|
||||
GLOBAL_CMD_TABLE.add_command("@cpattr", cmd_cpattr,
|
||||
priv_tuple=("genperms.builder"))
|
||||
|
||||
def cmd_nextfree(command):
|
||||
"""
|
||||
Returns the next free object number.
|
||||
"""
|
||||
nextfree = Object.objects.get_nextfree_dbnum()
|
||||
command.source_object.emit_to("Next free object number: #%s" % (nextfree,))
|
||||
command.source_object.emit_to("Next free object number: #%s" % nextfree)
|
||||
GLOBAL_CMD_TABLE.add_command("@nextfree", cmd_nextfree,
|
||||
priv_tuple=("genperms.builder"))
|
||||
|
||||
def cmd_open(command):
|
||||
"""
|
||||
|
|
@ -415,7 +429,9 @@ def cmd_open(command):
|
|||
"home": None}
|
||||
new_object = Object.objects.create_object(odat)
|
||||
|
||||
source_object.emit_to("You open an unlinked exit - %s" % (new_object,))
|
||||
source_object.emit_to("You open an unlinked exit - %s" % new_object)
|
||||
GLOBAL_CMD_TABLE.add_command("@open", cmd_open,
|
||||
priv_tuple=("genperms.builder"))
|
||||
|
||||
def cmd_chown(command):
|
||||
"""
|
||||
|
|
@ -466,6 +482,7 @@ def cmd_chown(command):
|
|||
# We haven't provided a target.
|
||||
source_object.emit_to("Who should be the new owner of the object?")
|
||||
return
|
||||
GLOBAL_CMD_TABLE.add_command("@chown", cmd_chown)
|
||||
|
||||
def cmd_chzone(command):
|
||||
"""
|
||||
|
|
@ -517,6 +534,7 @@ def cmd_chzone(command):
|
|||
# We haven't provided a target zone.
|
||||
source_object.emit_to("What should the object's zone be set to?")
|
||||
return
|
||||
GLOBAL_CMD_TABLE.add_command("@chzone", cmd_chzone)
|
||||
|
||||
def cmd_link(command):
|
||||
"""
|
||||
|
|
@ -567,6 +585,8 @@ def cmd_link(command):
|
|||
# We haven't provided a target.
|
||||
source_object.emit_to("You must provide a destination to link to.")
|
||||
return
|
||||
GLOBAL_CMD_TABLE.add_command("@link", cmd_link,
|
||||
priv_tuple=("genperms.builder"))
|
||||
|
||||
def cmd_unlink(command):
|
||||
"""
|
||||
|
|
@ -590,7 +610,9 @@ def cmd_unlink(command):
|
|||
return
|
||||
|
||||
target_obj.set_home(None)
|
||||
source_object.emit_to("You have unlinked %s." % (target_obj.get_name(),))
|
||||
source_object.emit_to("You have unlinked %s." % target_obj.get_name())
|
||||
GLOBAL_CMD_TABLE.add_command("@unlink", cmd_unlink,
|
||||
priv_tuple=("genperms.builder"))
|
||||
|
||||
def cmd_dig(command):
|
||||
"""
|
||||
|
|
@ -612,6 +634,8 @@ def cmd_dig(command):
|
|||
new_object = Object.objects.create_object(odat)
|
||||
|
||||
source_object.emit_to("You create a new room: %s" % (new_object,))
|
||||
GLOBAL_CMD_TABLE.add_command("@dig", cmd_dig,
|
||||
priv_tuple=("genperms.builder"))
|
||||
|
||||
def cmd_name(command):
|
||||
"""
|
||||
|
|
@ -647,6 +671,7 @@ def cmd_name(command):
|
|||
source_object.emit_to("You have renamed %s to %s." % (target_obj,
|
||||
ansi_name))
|
||||
target_obj.set_name(new_name)
|
||||
GLOBAL_CMD_TABLE.add_command("@name", cmd_name)
|
||||
|
||||
def cmd_description(command):
|
||||
"""
|
||||
|
|
@ -680,6 +705,7 @@ def cmd_description(command):
|
|||
else:
|
||||
source_object.emit_to("%s - DESCRIPTION set." % target_obj)
|
||||
target_obj.set_description(new_desc)
|
||||
GLOBAL_CMD_TABLE.add_command("@describe", cmd_description)
|
||||
|
||||
def cmd_destroy(command):
|
||||
"""
|
||||
|
|
@ -717,3 +743,5 @@ def cmd_destroy(command):
|
|||
|
||||
source_object.emit_to("You destroy %s." % target_obj.get_name())
|
||||
target_obj.destroy()
|
||||
GLOBAL_CMD_TABLE.add_command("@destroy", cmd_destroy,
|
||||
priv_tuple=("genperms.builder"))
|
||||
|
|
@ -3,6 +3,7 @@ Paging command and support functions.
|
|||
"""
|
||||
from src.objects.models import Object
|
||||
from src import defines_global
|
||||
from src.cmdtable import GLOBAL_CMD_TABLE
|
||||
|
||||
def get_last_paged_objects(source_object):
|
||||
"""
|
||||
|
|
@ -125,4 +126,5 @@ def cmd_page(command):
|
|||
|
||||
# Now set the LASTPAGED attribute
|
||||
source_object.set_attribute("LASTPAGED", ','.join(
|
||||
["#%d" % (x.id) for x in targets]))
|
||||
["#%d" % (x.id) for x in targets]))
|
||||
GLOBAL_CMD_TABLE.add_command("page", cmd_page),
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
Contains commands for managing script parents.
|
||||
"""
|
||||
from src import scripthandler
|
||||
from src.cmdtable import GLOBAL_CMD_TABLE
|
||||
|
||||
def clear_cached_scripts(command):
|
||||
"""
|
||||
|
|
@ -42,4 +43,6 @@ def cmd_parent(command):
|
|||
clear_cached_scripts(command)
|
||||
return
|
||||
|
||||
command.source_object.emit_to("Must be specified with one of the following switches: showcache, clearcache")
|
||||
command.source_object.emit_to("Must be specified with one of the following switches: showcache, clearcache")
|
||||
GLOBAL_CMD_TABLE.add_command("@parent", cmd_parent,
|
||||
priv_tuple=("genperms.builder")),
|
||||
|
|
@ -7,12 +7,15 @@ from src import defines_global
|
|||
from src import ansi
|
||||
from src import session_mgr
|
||||
from src.util import functions_general
|
||||
from src.cmdtable import GLOBAL_CMD_TABLE
|
||||
|
||||
def cmd_reload(command):
|
||||
"""
|
||||
Reloads all modules.
|
||||
"""
|
||||
command.source_object.emit_to("To be implemented...")
|
||||
GLOBAL_CMD_TABLE.add_command("@reload", cmd_reload,
|
||||
priv_tuple=("genperms.process_control")),
|
||||
|
||||
def cmd_boot(command):
|
||||
"""
|
||||
|
|
@ -84,6 +87,8 @@ def cmd_boot(command):
|
|||
boot.disconnectClient()
|
||||
session_mgr.remove_session(boot)
|
||||
return
|
||||
GLOBAL_CMD_TABLE.add_command("@boot", cmd_boot,
|
||||
priv_tuple=("genperms.manage_players"))
|
||||
|
||||
def cmd_newpassword(command):
|
||||
"""
|
||||
|
|
@ -120,6 +125,8 @@ def cmd_newpassword(command):
|
|||
source_object.emit_to("%s - PASSWORD set." % (target_obj.get_name(),))
|
||||
target_obj.emit_to("%s has changed your password." %
|
||||
(source_object.get_name(show_dbref=False),))
|
||||
GLOBAL_CMD_TABLE.add_command("@newpassword", cmd_newpassword,
|
||||
priv_tuple=("genperms.manage_players"))
|
||||
|
||||
def cmd_shutdown(command):
|
||||
"""
|
||||
|
|
@ -128,3 +135,5 @@ def cmd_shutdown(command):
|
|||
command.source_object.emit_to('Shutting down...')
|
||||
print 'Server shutdown by %s' % (command.source_object.get_name(show_dbref=False),)
|
||||
command.session.server.shutdown()
|
||||
GLOBAL_CMD_TABLE.add_command("@shutdown", cmd_shutdown,
|
||||
priv_tuple=("genperms.process_control"))
|
||||
|
|
@ -4,6 +4,7 @@ Implementation of the @search command that resembles MUX2.
|
|||
from django.db.models import Q
|
||||
from src.objects.models import Object
|
||||
from src import defines_global
|
||||
from src.cmdtable import GLOBAL_CMD_TABLE
|
||||
|
||||
def _parse_restriction_split(source_object, restriction_split, search_low_dbnum,
|
||||
search_high_dbnum):
|
||||
|
|
@ -229,4 +230,6 @@ def cmd_search(command):
|
|||
if search_query is None:
|
||||
return
|
||||
|
||||
display_results(source_object, search_query)
|
||||
display_results(source_object, search_query)
|
||||
GLOBAL_CMD_TABLE.add_command("@search", cmd_search,
|
||||
priv_tuple=("genperms.builder")),
|
||||
|
|
@ -6,6 +6,7 @@ from django.contrib.auth.models import User
|
|||
from src.objects.models import Attribute, Object
|
||||
from src import defines_global
|
||||
from src.util import functions_general
|
||||
from src.cmdtable import GLOBAL_UNCON_CMD_TABLE
|
||||
|
||||
def cmd_connect(command):
|
||||
"""
|
||||
|
|
@ -44,6 +45,7 @@ def cmd_connect(command):
|
|||
else:
|
||||
uname = user.username
|
||||
session.login(user)
|
||||
GLOBAL_UNCON_CMD_TABLE.add_command("connect", cmd_connect)
|
||||
|
||||
def cmd_create(command):
|
||||
"""
|
||||
|
|
@ -95,6 +97,7 @@ def cmd_create(command):
|
|||
session.msg("Your password must be 3 characters or longer.")
|
||||
else:
|
||||
Object.objects.create_user(command, uname, email, password)
|
||||
GLOBAL_UNCON_CMD_TABLE.add_command("create", cmd_create)
|
||||
|
||||
def cmd_quit(command):
|
||||
"""
|
||||
|
|
@ -105,3 +108,4 @@ def cmd_quit(command):
|
|||
session = command.session
|
||||
session.msg("Disconnecting...")
|
||||
session.handle_close()
|
||||
GLOBAL_UNCON_CMD_TABLE.add_command("quit", cmd_quit)
|
||||
Loading…
Add table
Add a link
Reference in a new issue