mirror of
https://github.com/evennia/evennia.git
synced 2026-03-30 20:47:17 +02:00
Looking through our command code after a long hiatus, I realized that it was pretty much awful. So here's part 1 of the command interpreter overhaul.
- The command handler has been drastically simplified. We were doing way too much processing in the handler that should have been done in the individual command functions themselves. - The 'cdat' dict we were previously passing around has been replaced with a Command object that has useful methods for performing some of the parsing command functions will probably want to do from time to time. - All commands were updated to use the new Command object, tested, and cleaned up in general. - A lot of formatting was cleaned up. - A lot of previously un-found bugs and limitations were fixed. - The 'page' command has been broken out into its own file, since it's going to have a number of functions that would otherwise clutter commands/general.py. Expect a commit (probably later today) that will clean up the second half of cmdhandler.py.
This commit is contained in:
parent
37d66093cc
commit
d58f4eb517
16 changed files with 818 additions and 698 deletions
|
|
@ -239,17 +239,16 @@ def get_cobj_from_name(cname):
|
|||
"""
|
||||
return CommChannel.objects.get(name=cname)
|
||||
|
||||
def create_channel(cdat):
|
||||
def create_channel(name, owner):
|
||||
"""
|
||||
Create a new channel. cdat is a dictionary that contains the following keys.
|
||||
REQUIRED KEYS:
|
||||
* name: The name of the new channel.
|
||||
* owner: The creator of the channel.
|
||||
Create a new channel.
|
||||
name: (string) Name of the new channel
|
||||
owner: (Object) Objec that owns the channel
|
||||
"""
|
||||
new_chan = CommChannel()
|
||||
new_chan.name = ansi.parse_ansi(cdat["name"], strip_ansi=True)
|
||||
new_chan.ansi_name = "[%s]" % (ansi.parse_ansi(cdat["name"]),)
|
||||
new_chan.set_owner(cdat["owner"])
|
||||
new_chan.name = ansi.parse_ansi(name, strip_ansi=True)
|
||||
new_chan.ansi_name = "[%s]" % (ansi.parse_ansi(name),)
|
||||
new_chan.set_owner(owner)
|
||||
new_chan.save()
|
||||
return new_chan
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue