changed cmdset_default -> cmdset_character and changed the class names to match. Added migrations to properly update default-set cmdset_stores to the new positions (objects created from custom types are not migrated, these should see errors and need to re-point their imports to the new defaults)
This commit is contained in:
parent
c152202082
commit
a6544f2848
15 changed files with 193 additions and 81 deletions
2
ev.py
2
ev.py
|
|
@ -211,7 +211,7 @@ class DefaultCmds(_EvContainer):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from src.commands.default.cmdset_default import DefaultCmdSet
|
from src.commands.default.cmdset_character import CharacterCmdSet
|
||||||
from src.commands.default.cmdset_player import PlayerCmdSet
|
from src.commands.default.cmdset_player import PlayerCmdSet
|
||||||
from src.commands.default.cmdset_unloggedin import UnloggedinCmdSet
|
from src.commands.default.cmdset_unloggedin import UnloggedinCmdSet
|
||||||
from src.commands.default.muxcommand import MuxCommand, MuxPlayerCommand
|
from src.commands.default.muxcommand import MuxCommand, MuxPlayerCommand
|
||||||
|
|
|
||||||
|
|
@ -425,14 +425,15 @@ def error_check_python_modules():
|
||||||
for path in settings.LOCK_FUNC_MODULES:
|
for path in settings.LOCK_FUNC_MODULES:
|
||||||
imp(path, split=False)
|
imp(path, split=False)
|
||||||
# cmdsets
|
# cmdsets
|
||||||
|
|
||||||
|
deprstring = "settings.%s should be renamed to %s. If defaults are used, their path/classname must be updated (see src/settings_default.py)."
|
||||||
|
if hasattr(settings, "CMDSET_DEFAULT"): raise DeprecationWarning(deprstring % ("CMDSET_DEFAULT", "CMDSET_CHARACTER"))
|
||||||
|
if hasattr(settings, "CMDSET_OOC"): raise DeprecationWarning(deprstring % ("CMDSET_OOC", "CMDSET_PLAYER"))
|
||||||
|
|
||||||
from src.commands import cmdsethandler
|
from src.commands import cmdsethandler
|
||||||
cmdsethandler.import_cmdset(settings.CMDSET_UNLOGGEDIN, None)
|
if not cmdsethandler.import_cmdset(settings.CMDSET_UNLOGGEDIN, None): print "Warning: CMDSET_UNLOGGED failed to load!"
|
||||||
cmdsethandler.import_cmdset(settings.CMDSET_DEFAULT, None)
|
if not cmdsethandler.import_cmdset(settings.CMDSET_CHARACTER, None): print "Warning: CMDSET_CHARACTER failed to load"
|
||||||
if hasattr(settings, "CMDSET_OOC"):
|
if not cmdsethandler.import_cmdset(settings.CMDSET_PLAYER, None): print "Warning: CMDSET_PLAYER failed to load"
|
||||||
string = "settings.CMDSET_OOC was renamed to CMDSET_PLAYER."
|
|
||||||
string += "Also default cmdset location in src was renamed (see src.settings_default.py)."
|
|
||||||
raise DeprecationWarning(string)
|
|
||||||
cmdsethandler.import_cmdset(settings.CMDSET_PLAYER, None)
|
|
||||||
# typeclasses
|
# typeclasses
|
||||||
imp(settings.BASE_PLAYER_TYPECLASS)
|
imp(settings.BASE_PLAYER_TYPECLASS)
|
||||||
imp(settings.BASE_OBJECT_TYPECLASS)
|
imp(settings.BASE_OBJECT_TYPECLASS)
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,15 @@ Example command set template module.
|
||||||
To create new commands to populate the cmdset, see
|
To create new commands to populate the cmdset, see
|
||||||
examples/command.py.
|
examples/command.py.
|
||||||
|
|
||||||
To extend the default command set:
|
To extend the character command set:
|
||||||
- copy this file up one level to gamesrc/commands and name it
|
- copy this file up one level to gamesrc/commands and name it
|
||||||
something fitting.
|
something fitting.
|
||||||
- change settings.CMDSET_DEFAULT to point to the new module's
|
- change settings.CMDSET_CHARACTER to point to the new module's
|
||||||
DefaultCmdSet
|
CharacterCmdSet class
|
||||||
- import/add commands at the end of DefaultCmdSet's add() method.
|
- import/add commands at the end of CharacterCmdSet's add() method.
|
||||||
|
|
||||||
To extend OOC cmdset:
|
To extend Player cmdset:
|
||||||
- like default set, but point settings.CMDSET_OOC on your new cmdset.
|
- like character set, but point settings.PLAYER on your new cmdset.
|
||||||
|
|
||||||
To extend Unloggedin cmdset:
|
To extend Unloggedin cmdset:
|
||||||
- like default set, but point settings.CMDSET_UNLOGGEDIN on your new cmdset.
|
- like default set, but point settings.CMDSET_UNLOGGEDIN on your new cmdset.
|
||||||
|
|
@ -44,29 +44,29 @@ class ExampleCmdSet(CmdSet):
|
||||||
This is the only method defined in a cmdset, called during
|
This is the only method defined in a cmdset, called during
|
||||||
its creation. It should populate the set with command instances.
|
its creation. It should populate the set with command instances.
|
||||||
|
|
||||||
Here we just add the empty base Command object. It prints some info.
|
As and example we just add the empty base Command object. It prints some info.
|
||||||
"""
|
"""
|
||||||
self.add(Command())
|
self.add(Command())
|
||||||
|
|
||||||
|
|
||||||
class DefaultCmdSet(default_cmds.DefaultCmdSet):
|
class CharacterCmdSet(default_cmds.CharacterCmdSet):
|
||||||
"""
|
"""
|
||||||
This is an example of how to overload the default command
|
This is an example of how to overload the default command
|
||||||
set defined in src/commands/default/cmdset_default.py.
|
set defined in src/commands/default/cmdset_character.py.
|
||||||
|
|
||||||
Here we copy everything by calling the parent, but you can
|
Here we copy everything by calling the parent, but you can
|
||||||
copy&paste any combination of the default command to customize
|
copy&paste any combination of the default command to customize
|
||||||
your default set. Next you change settings.CMDSET_DEFAULT to point
|
your default set. Next you change settings.CMDSET_CHARACTER to point
|
||||||
to this class.
|
to this class.
|
||||||
"""
|
"""
|
||||||
key = "DefaultMUX"
|
key = "DefaultCharacter"
|
||||||
|
|
||||||
def at_cmdset_creation(self):
|
def at_cmdset_creation(self):
|
||||||
"""
|
"""
|
||||||
Populates the cmdset
|
Populates the cmdset
|
||||||
"""
|
"""
|
||||||
# calling setup in src.commands.default.cmdset_default
|
# calling setup in src.commands.default.cmdset_character
|
||||||
super(DefaultCmdSet, self).at_cmdset_creation()
|
super(CharacterCmdSet, self).at_cmdset_creation()
|
||||||
|
|
||||||
#
|
#
|
||||||
# any commands you add below will overload the default ones.
|
# any commands you add below will overload the default ones.
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,19 @@
|
||||||
"""
|
"""
|
||||||
This module ties together all the commands of the default command
|
This module ties together all the commands default Character objects have
|
||||||
set. Note that some commands, such as communication-commands are
|
available (i.e. IC commands). Note that some commands, such as communication-commands are
|
||||||
instead put in the OOC cmdset.
|
instead put on the player level, in the Player cmdset. Player commands remain
|
||||||
|
available also to Characters.
|
||||||
"""
|
"""
|
||||||
from src.commands.cmdset import CmdSet
|
from src.commands.cmdset import CmdSet
|
||||||
from src.commands.default import general, help, admin, system
|
from src.commands.default import general, help, admin, system
|
||||||
from src.commands.default import building
|
from src.commands.default import building
|
||||||
from src.commands.default import batchprocess
|
from src.commands.default import batchprocess
|
||||||
|
|
||||||
class DefaultCmdSet(CmdSet):
|
class CharacterCmdSet(CmdSet):
|
||||||
"""
|
"""
|
||||||
Implements the default command set.
|
Implements the default command set.
|
||||||
"""
|
"""
|
||||||
key = "DefaultMUX"
|
key = "DefaultCharacter"
|
||||||
priority = 0
|
priority = 0
|
||||||
|
|
||||||
def at_cmdset_creation(self):
|
def at_cmdset_creation(self):
|
||||||
|
|
@ -21,7 +22,6 @@ class DefaultCmdSet(CmdSet):
|
||||||
# The general commands
|
# The general commands
|
||||||
self.add(general.CmdLook())
|
self.add(general.CmdLook())
|
||||||
self.add(general.CmdHome())
|
self.add(general.CmdHome())
|
||||||
self.add(general.CmdWho())
|
|
||||||
self.add(general.CmdInventory())
|
self.add(general.CmdInventory())
|
||||||
self.add(general.CmdPose())
|
self.add(general.CmdPose())
|
||||||
self.add(general.CmdNick())
|
self.add(general.CmdNick())
|
||||||
|
|
@ -30,8 +30,6 @@ class DefaultCmdSet(CmdSet):
|
||||||
self.add(general.CmdGive())
|
self.add(general.CmdGive())
|
||||||
self.add(general.CmdSay())
|
self.add(general.CmdSay())
|
||||||
self.add(general.CmdAccess())
|
self.add(general.CmdAccess())
|
||||||
self.add(general.CmdColorTest())
|
|
||||||
self.add(general.CmdSessions())
|
|
||||||
|
|
||||||
# The help system
|
# The help system
|
||||||
self.add(help.CmdHelp())
|
self.add(help.CmdHelp())
|
||||||
|
|
@ -21,7 +21,7 @@ class PlayerCmdSet(CmdSet):
|
||||||
def at_cmdset_creation(self):
|
def at_cmdset_creation(self):
|
||||||
"Populates the cmdset"
|
"Populates the cmdset"
|
||||||
|
|
||||||
# General commands
|
# Player-specific commands
|
||||||
self.add(player.CmdOOCLook())
|
self.add(player.CmdOOCLook())
|
||||||
self.add(player.CmdIC())
|
self.add(player.CmdIC())
|
||||||
self.add(player.CmdOOC())
|
self.add(player.CmdOOC())
|
||||||
|
|
@ -30,6 +30,7 @@ class PlayerCmdSet(CmdSet):
|
||||||
self.add(player.CmdQuit())
|
self.add(player.CmdQuit())
|
||||||
self.add(player.CmdPassword())
|
self.add(player.CmdPassword())
|
||||||
self.add(player.CmdColorTest())
|
self.add(player.CmdColorTest())
|
||||||
|
self.add(player.CmdSessions())
|
||||||
|
|
||||||
# testing
|
# testing
|
||||||
self.add(building.CmdExamine())
|
self.add(building.CmdExamine())
|
||||||
|
|
|
||||||
|
|
@ -377,47 +377,6 @@ class CmdSay(MuxCommand):
|
||||||
speech)
|
speech)
|
||||||
caller.location.msg_contents(emit_string,
|
caller.location.msg_contents(emit_string,
|
||||||
exclude=caller)
|
exclude=caller)
|
||||||
class CmdSessions(MuxCommand):
|
|
||||||
"""
|
|
||||||
check connected session(s)
|
|
||||||
|
|
||||||
Usage:
|
|
||||||
@sessions
|
|
||||||
|
|
||||||
Lists the sessions currently connected to your account.
|
|
||||||
|
|
||||||
"""
|
|
||||||
key = "@sessions"
|
|
||||||
locks = "cmd:all()"
|
|
||||||
help_category = "General"
|
|
||||||
|
|
||||||
def func(self):
|
|
||||||
"Implement function"
|
|
||||||
|
|
||||||
# make sure we work on the player, not on the character
|
|
||||||
player = self.caller
|
|
||||||
if hasattr(player, "player"):
|
|
||||||
player = player.player
|
|
||||||
|
|
||||||
sessions = player.get_all_sessions()
|
|
||||||
|
|
||||||
table = [["sessid"], ["host"], ["character"], ["location"]]
|
|
||||||
for sess in sorted(sessions, key=lambda x:x.sessid):
|
|
||||||
sessid = sess.sessid
|
|
||||||
char = player.get_puppet(sessid)
|
|
||||||
table[0].append(str(sess.sessid))
|
|
||||||
table[1].append(str(sess.address[0]))
|
|
||||||
table[2].append(char and str(char) or "None")
|
|
||||||
table[3].append(char and str(char.location) or "N/A")
|
|
||||||
ftable = utils.format_table(table, 5)
|
|
||||||
string = ""
|
|
||||||
for ir, row in enumerate(ftable):
|
|
||||||
if ir == 0:
|
|
||||||
string += "\n" + "{w%s{n" % ("".join(row))
|
|
||||||
else:
|
|
||||||
string += "\n" + "".join(row)
|
|
||||||
self.msg(string)
|
|
||||||
|
|
||||||
|
|
||||||
class CmdPose(MuxCommand):
|
class CmdPose(MuxCommand):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ from src.utils import utils
|
||||||
from src.commands.command import Command
|
from src.commands.command import Command
|
||||||
|
|
||||||
# limit symbol import for API
|
# limit symbol import for API
|
||||||
__all__ = ("MuxCommand",)
|
__all__ = ("MuxCommand", "MuxPlayerCommand")
|
||||||
|
|
||||||
class MuxCommand(Command):
|
class MuxCommand(Command):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,8 @@ from src.utils import utils, create, search
|
||||||
|
|
||||||
from settings import MAX_NR_CHARACTERS, MULTISESSION_MODE
|
from settings import MAX_NR_CHARACTERS, MULTISESSION_MODE
|
||||||
# limit symbol import for API
|
# limit symbol import for API
|
||||||
__all__ = ("CmdOOCLook", "CmdIC", "CmdOOC", "CmdPassword", "CmdQuit", "CmdEncoding", "CmdWho", "CmdColorTest")
|
__all__ = ("CmdOOCLook", "CmdIC", "CmdOOC", "CmdPassword", "CmdQuit",
|
||||||
|
"CmdEncoding", "CmdSessions", "CmdWho", "CmdColorTest")
|
||||||
|
|
||||||
# force max nr chars to 1 if mode is 0 or 1
|
# force max nr chars to 1 if mode is 0 or 1
|
||||||
MAX_NR_CHARACTERS = MULTISESSION_MODE < 2 and 1 or MAX_NR_CHARACTERS
|
MAX_NR_CHARACTERS = MULTISESSION_MODE < 2 and 1 or MAX_NR_CHARACTERS
|
||||||
|
|
@ -281,6 +282,47 @@ class CmdOOC(MuxPlayerCommand):
|
||||||
else:
|
else:
|
||||||
raise RuntimeError("Could not unpuppet!")
|
raise RuntimeError("Could not unpuppet!")
|
||||||
|
|
||||||
|
class CmdSessions(MuxPlayerCommand):
|
||||||
|
"""
|
||||||
|
check connected session(s)
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
@sessions
|
||||||
|
|
||||||
|
Lists the sessions currently connected to your account.
|
||||||
|
|
||||||
|
"""
|
||||||
|
key = "@sessions"
|
||||||
|
locks = "cmd:all()"
|
||||||
|
help_category = "General"
|
||||||
|
|
||||||
|
def func(self):
|
||||||
|
"Implement function"
|
||||||
|
|
||||||
|
# make sure we work on the player, not on the character
|
||||||
|
player = self.caller
|
||||||
|
if hasattr(player, "player"):
|
||||||
|
player = player.player
|
||||||
|
|
||||||
|
sessions = player.get_all_sessions()
|
||||||
|
|
||||||
|
table = [["sessid"], ["host"], ["character"], ["location"]]
|
||||||
|
for sess in sorted(sessions, key=lambda x:x.sessid):
|
||||||
|
sessid = sess.sessid
|
||||||
|
char = player.get_puppet(sessid)
|
||||||
|
table[0].append(str(sess.sessid))
|
||||||
|
table[1].append(str(sess.address[0]))
|
||||||
|
table[2].append(char and str(char) or "None")
|
||||||
|
table[3].append(char and str(char.location) or "N/A")
|
||||||
|
ftable = utils.format_table(table, 5)
|
||||||
|
string = ""
|
||||||
|
for ir, row in enumerate(ftable):
|
||||||
|
if ir == 0:
|
||||||
|
string += "\n" + "{w%s{n" % ("".join(row))
|
||||||
|
else:
|
||||||
|
string += "\n" + "".join(row)
|
||||||
|
self.msg(string)
|
||||||
|
|
||||||
class CmdWho(MuxPlayerCommand):
|
class CmdWho(MuxPlayerCommand):
|
||||||
"""
|
"""
|
||||||
who
|
who
|
||||||
|
|
|
||||||
|
|
@ -122,14 +122,14 @@ class TestGeneral(CommandTest):
|
||||||
#self.call(general.CmdQuit(), "", "You are already home")
|
#self.call(general.CmdQuit(), "", "You are already home")
|
||||||
|
|
||||||
from src.commands.default import help
|
from src.commands.default import help
|
||||||
from src.commands.default.cmdset_default import DefaultCmdSet
|
from src.commands.default.cmdset_character import CharacterCmdSet
|
||||||
class TestHelp(CommandTest):
|
class TestHelp(CommandTest):
|
||||||
CID = 2
|
CID = 2
|
||||||
def test_cmds(self):
|
def test_cmds(self):
|
||||||
sep = "-"*78 + "\n"
|
sep = "-"*78 + "\n"
|
||||||
self.call(help.CmdHelp(), "", sep + " Command help entries", cmdset=DefaultCmdSet())
|
self.call(help.CmdHelp(), "", sep + " Command help entries", cmdset=CharacterCmdSet())
|
||||||
self.call(help.CmdSetHelp(), "testhelp, General = This is a test", "Topic 'testhelp' was successfully created.")
|
self.call(help.CmdSetHelp(), "testhelp, General = This is a test", "Topic 'testhelp' was successfully created.")
|
||||||
self.call(help.CmdHelp(), "testhelp", sep + "Help topic for testhelp", cmdset=DefaultCmdSet())
|
self.call(help.CmdHelp(), "testhelp", sep + "Help topic for testhelp", cmdset=CharacterCmdSet())
|
||||||
|
|
||||||
|
|
||||||
from src.commands.default import system
|
from src.commands.default import system
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ class ObjectCreateForm(forms.ModelForm):
|
||||||
widget=forms.TextInput(attrs={'size':'78'}),
|
widget=forms.TextInput(attrs={'size':'78'}),
|
||||||
help_text="a comma-separated list of text strings checked by certain locks. They are mainly of use for Character objects. Character permissions overload permissions defined on a controlling Player. Most objects normally don't have any permissions defined.")
|
help_text="a comma-separated list of text strings checked by certain locks. They are mainly of use for Character objects. Character permissions overload permissions defined on a controlling Player. Most objects normally don't have any permissions defined.")
|
||||||
db_cmdset_storage = forms.CharField(label="CmdSet",
|
db_cmdset_storage = forms.CharField(label="CmdSet",
|
||||||
initial=settings.CMDSET_DEFAULT,
|
initial=settings.CMDSET_CHARACTER,
|
||||||
required=False,
|
required=False,
|
||||||
widget=forms.TextInput(attrs={'size':'78'}),
|
widget=forms.TextInput(attrs={'size':'78'}),
|
||||||
help_text="Most non-character objects don't need a cmdset and can leave this field blank.")
|
help_text="Most non-character objects don't need a cmdset and can leave this field blank.")
|
||||||
|
|
|
||||||
111
src/objects/migrations/0017_rename_default_cmdsets.py
Normal file
111
src/objects/migrations/0017_rename_default_cmdsets.py
Normal file
|
|
@ -0,0 +1,111 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import datetime
|
||||||
|
from south.db import db
|
||||||
|
from south.v2 import DataMigration
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
class Migration(DataMigration):
|
||||||
|
|
||||||
|
def forwards(self, orm):
|
||||||
|
"Write your forwards methods here."
|
||||||
|
# Note: Remember to use orm['appname.ModelName'] rather than "from appname.models..."
|
||||||
|
if not db.dry_run:
|
||||||
|
for obj in orm['objects.ObjectDB'].objects.filter(db_cmdset_storage=u'src.commands.default.cmdset_default.DefaultCmdSet'):
|
||||||
|
obj.db_cmdset_storage=u'src.commands.default.cmdset_character.CharacterCmdSet'
|
||||||
|
obj.save()
|
||||||
|
|
||||||
|
def backwards(self, orm):
|
||||||
|
"Write your backwards methods here."
|
||||||
|
raise RuntimeError("You cannot revert this migration.")
|
||||||
|
|
||||||
|
models = {
|
||||||
|
'auth.group': {
|
||||||
|
'Meta': {'object_name': 'Group'},
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
|
||||||
|
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
|
||||||
|
},
|
||||||
|
'auth.permission': {
|
||||||
|
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
|
||||||
|
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||||
|
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
|
||||||
|
},
|
||||||
|
'auth.user': {
|
||||||
|
'Meta': {'object_name': 'User'},
|
||||||
|
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||||
|
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
|
||||||
|
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
|
||||||
|
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
|
||||||
|
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||||
|
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||||
|
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||||
|
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
|
||||||
|
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||||
|
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
|
||||||
|
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
|
||||||
|
},
|
||||||
|
'contenttypes.contenttype': {
|
||||||
|
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
|
||||||
|
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
|
||||||
|
},
|
||||||
|
'objects.alias': {
|
||||||
|
'Meta': {'object_name': 'Alias'},
|
||||||
|
'db_key': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}),
|
||||||
|
'db_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['objects.ObjectDB']"}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
|
||||||
|
},
|
||||||
|
'objects.objattribute': {
|
||||||
|
'Meta': {'object_name': 'ObjAttribute'},
|
||||||
|
'db_date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'db_key': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}),
|
||||||
|
'db_lock_storage': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
|
||||||
|
'db_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['objects.ObjectDB']"}),
|
||||||
|
'db_value': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
|
||||||
|
},
|
||||||
|
'objects.objectdb': {
|
||||||
|
'Meta': {'object_name': 'ObjectDB'},
|
||||||
|
'db_cmdset_storage': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
|
||||||
|
'db_date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'db_destination': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'destinations_set'", 'null': 'True', 'to': "orm['objects.ObjectDB']"}),
|
||||||
|
'db_home': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'homes_set'", 'null': 'True', 'to': "orm['objects.ObjectDB']"}),
|
||||||
|
'db_key': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}),
|
||||||
|
'db_location': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'locations_set'", 'null': 'True', 'to': "orm['objects.ObjectDB']"}),
|
||||||
|
'db_lock_storage': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
|
||||||
|
'db_permissions': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
|
||||||
|
'db_player': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['players.PlayerDB']", 'null': 'True', 'blank': 'True'}),
|
||||||
|
'db_sessid': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
|
||||||
|
'db_typeclass_path': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
|
||||||
|
},
|
||||||
|
'objects.objectnick': {
|
||||||
|
'Meta': {'unique_together': "(('db_nick', 'db_type', 'db_obj'),)", 'object_name': 'ObjectNick'},
|
||||||
|
'db_nick': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}),
|
||||||
|
'db_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['objects.ObjectDB']"}),
|
||||||
|
'db_real': ('django.db.models.fields.TextField', [], {}),
|
||||||
|
'db_type': ('django.db.models.fields.CharField', [], {'default': "'inputline'", 'max_length': '16', 'null': 'True', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
|
||||||
|
},
|
||||||
|
'players.playerdb': {
|
||||||
|
'Meta': {'object_name': 'PlayerDB'},
|
||||||
|
'db_cmdset_storage': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}),
|
||||||
|
'db_date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'db_is_connected': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||||
|
'db_key': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}),
|
||||||
|
'db_lock_storage': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
|
||||||
|
'db_permissions': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
|
||||||
|
'db_typeclass_path': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'unique': 'True'})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
complete_apps = ['objects']
|
||||||
|
symmetrical = True
|
||||||
|
|
@ -772,7 +772,7 @@ class Character(Object):
|
||||||
self.locks.add(";".join(["get:false()", # noone can pick up the character
|
self.locks.add(";".join(["get:false()", # noone can pick up the character
|
||||||
"call:false()"])) # no commands can be called on character from outside
|
"call:false()"])) # no commands can be called on character from outside
|
||||||
# add the default cmdset
|
# add the default cmdset
|
||||||
self.cmdset.add_default(settings.CMDSET_DEFAULT, permanent=True)
|
self.cmdset.add_default(settings.CMDSET_CHARACTER, permanent=True)
|
||||||
|
|
||||||
def at_object_creation(self):
|
def at_object_creation(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ class PlayerDB(TypedObject):
|
||||||
db_is_connected = models.BooleanField(default=False, verbose_name="is_connected", help_text="If player is connected to game or not")
|
db_is_connected = models.BooleanField(default=False, verbose_name="is_connected", help_text="If player is connected to game or not")
|
||||||
# database storage of persistant cmdsets.
|
# database storage of persistant cmdsets.
|
||||||
db_cmdset_storage = models.CharField('cmdset', max_length=255, null=True,
|
db_cmdset_storage = models.CharField('cmdset', max_length=255, null=True,
|
||||||
help_text="optional python path to a cmdset class. If creating a Character, this will default to settings.CMDSET_DEFAULT.")
|
help_text="optional python path to a cmdset class. If creating a Character, this will default to settings.CMDSET_CHARACTER.")
|
||||||
|
|
||||||
# Database manager
|
# Database manager
|
||||||
objects = manager.PlayerManager()
|
objects = manager.PlayerManager()
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ class Evennia(object):
|
||||||
objects.
|
objects.
|
||||||
"""
|
"""
|
||||||
# setting names
|
# setting names
|
||||||
settings_names = ("CMDSET_DEFAULT", "CMDSET_PLAYER", "BASE_PLAYER_TYPECLASS", "BASE_OBJECT_TYPECLASS",
|
settings_names = ("CMDSET_CHARACTER", "CMDSET_PLAYER", "BASE_PLAYER_TYPECLASS", "BASE_OBJECT_TYPECLASS",
|
||||||
"BASE_CHARACTER_TYPECLASS", "BASE_ROOM_TYPECLASS", "BASE_EXIT_TYPECLASS", "BASE_SCRIPT_TYPECLASS")
|
"BASE_CHARACTER_TYPECLASS", "BASE_ROOM_TYPECLASS", "BASE_EXIT_TYPECLASS", "BASE_SCRIPT_TYPECLASS")
|
||||||
# get previous and current settings so they can be compared
|
# get previous and current settings so they can be compared
|
||||||
settings_compare = zip([ServerConfig.objects.conf(name) for name in settings_names],
|
settings_compare = zip([ServerConfig.objects.conf(name) for name in settings_names],
|
||||||
|
|
|
||||||
|
|
@ -217,7 +217,7 @@ LOCK_FUNC_MODULES = ("src.locks.lockfuncs",)
|
||||||
# Command set used before player has logged in
|
# Command set used before player has logged in
|
||||||
CMDSET_UNLOGGEDIN = "src.commands.default.cmdset_unloggedin.UnloggedinCmdSet"
|
CMDSET_UNLOGGEDIN = "src.commands.default.cmdset_unloggedin.UnloggedinCmdSet"
|
||||||
# Default set for logged in player with characters (fallback)
|
# Default set for logged in player with characters (fallback)
|
||||||
CMDSET_DEFAULT = "src.commands.default.cmdset_default.DefaultCmdSet"
|
CMDSET_CHARACTER = "src.commands.default.cmdset_character.CharacterCmdSet"
|
||||||
# Command set for players without a character (ooc)
|
# Command set for players without a character (ooc)
|
||||||
CMDSET_PLAYER = "src.commands.default.cmdset_player.PlayerCmdSet"
|
CMDSET_PLAYER = "src.commands.default.cmdset_player.PlayerCmdSet"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue