diff --git a/game/gamesrc/commands/default/objmanip.py b/game/gamesrc/commands/default/objmanip.py index 43e533c665..303b76eeae 100644 --- a/game/gamesrc/commands/default/objmanip.py +++ b/game/gamesrc/commands/default/objmanip.py @@ -184,7 +184,7 @@ class CmdSetObjAlias(MuxCommand): objname, aliases = self.lhs, self.rhslist if not aliases: - caller.msg("Usage: @alias = ") + caller.msg("Usage: @alias = ,,...") return # Find the object to receive aliases obj = caller.search(objname, global_search=True) @@ -195,17 +195,15 @@ class CmdSetObjAlias(MuxCommand): caller.msg("You don't have permission to do that.") return # merge the old and new aliases (if any) - old_aliases = obj.aliases.split(',') + old_aliases = obj.aliases new_aliases = [str(alias).strip().lower() for alias in aliases if alias.strip()] # make the aliases only appear once old_aliases.extend(new_aliases) - aliases = list(set(old_aliases)) - aliases = ",".join(str(alias).lower().strip() for alias in aliases if alias) + aliases = list(set(old_aliases)) # save back to object. obj.aliases = aliases - obj.save() - caller.msg("Aliases for '%s' are now set to [%s]." % (obj.name, aliases)) + caller.msg("Aliases for '%s' are now set to %s." % (obj.name, aliases)) class CmdName(ObjManipCommand): @@ -1465,19 +1463,21 @@ class CmdExamine(ObjManipCommand): returns a string. """ - dbref = "" - if has_perm_string(self.caller, 'see_dbref'): - dbref = "(#%i)" % obj.id - string = "\n{wName{n: %s%s" % (obj.name, dbref) + + string = "\n{wName/key{n: %s (#%i)" % (obj.name, obj.id) + if obj.aliases: + string += "\n{wAliases{n: %s" % (", ".join(obj.aliases)) if obj.has_player: string += "\n{wPlayer{n: %s" % obj.player.name - string += "\n{wTypeclass{n: %s" % utils.fill(obj.typeclass) + string += "\n{wTypeclass{n: %s (%s)" % (obj.typeclass, obj.typeclass_path) string += "\n{wLocation{n: %s" % obj.location perms = obj.permissions if obj.player and obj.player.is_superuser: - perms = "" - string += "\n{wPerms/Locks{n: %s" % utils.fill(perms) - if obj.cmdset.all(): + perms = [""] + elif not perms: + perms = [""] + string += "\n{wPerms/Locks{n: %s" % (", ".join(perms)) + if not (len(obj.cmdset.all()) == 1 and obj.cmdset.current.key == "Empty"): string += "\n{wCurrent Cmdset{n:\n\r %s" % obj.cmdset if obj.scripts.all(): string += "\n{wScripts{n:\n\r %s" % obj.scripts diff --git a/game/gamesrc/commands/default/privileged.py b/game/gamesrc/commands/default/privileged.py index 391ab62551..a7694fcc12 100644 --- a/game/gamesrc/commands/default/privileged.py +++ b/game/gamesrc/commands/default/privileged.py @@ -33,12 +33,33 @@ class CmdReload(MuxCommand): def func(self): """ - reload the system. + Reload the system. """ caller = self.caller - reloads.reload_modules() - reloads.reload_scripts() - reloads.reload_commands() + reloads.reload_modules() + + max_attempts = 4 + for attempt in range(max_attempts): + # if reload modules take a long time, + # we might end up in a situation where + # the subsequent commands fail since they + # can't find the reloads module (due to it + # not yet fully loaded). So we retry a few + # times before giving up. + try: + reloads.reload_scripts() + reloads.reload_commands() + break + except AttributeError: + if attempt < max_attempts-1: + caller.msg(" Waiting for modules(s) to finish (%s) ..." % attempt) + pass + else: + string = " ... The module(s) took too long to reload, " + string += "\n so the remainding reloads where skipped." + string += "\n Re-run @reload again when modules have fully " + string += "\n re-initialized." + caller.msg(string) class CmdPy(MuxCommand): """ @@ -607,12 +628,14 @@ class CmdPerm(MuxCommand): return else: #just print all available permissions - string = "\nAll currently available permissions (i.e. not locks):" - pgroups = PermissionGroup.objects.all() + string = "\nAll defined permission groups and keys (i.e. not locks):" + pgroups = list(PermissionGroup.objects.all()) + pgroups.sort(lambda x,y: cmp(x.key, y.key)) # sort by group key + for pgroup in pgroups: - string += "\n\n - %s (%s):" % (pgroup.key, pgroup.desc) + string += "\n\n - {w%s{n (%s):" % (pgroup.key, pgroup.desc) string += "\n%s" % \ - utils.fill(", ".join(pgroup.group_permissions)) + utils.fill(", ".join(sorted(pgroup.group_permissions))) caller.msg(string) return @@ -622,13 +645,16 @@ class CmdPerm(MuxCommand): return if not rhs: - #if we didn't have any =, we list the permissions set on . - if hasattr(obj, 'is_superuser') and obj.is_superuser: - string = "\n This is a SUPERUSER account! " - string += "All permissions are automatically set." + string = "Permission string on {w%s{n: " % obj.key + if not obj.permissions: + string += "" else: - string = "Permissions set on this object:\n" string += ", ".join(obj.permissions) + if obj.player and obj.player.is_superuser: + string += "\n(... But this object's player is a SUPERUSER! " + string += "All access checked are passed automatically.)" + + caller.msg(string) return diff --git a/src/objects/objects.py b/src/objects/objects.py index 2170de9fe0..5d14135528 100644 --- a/src/objects/objects.py +++ b/src/objects/objects.py @@ -327,9 +327,7 @@ class Character(Object): def at_after_move(self, source_location): "Default is to look around after a move." self.execute_cmd('look') - - - + # # Base Room object # diff --git a/src/players/manager.py b/src/players/manager.py index ad6a987109..14f1465b93 100644 --- a/src/players/manager.py +++ b/src/players/manager.py @@ -6,6 +6,7 @@ import datetime from django.db import models from django.contrib.auth.models import User from src.typeclasses.managers import returns_typeclass_list, returns_typeclass +from src.utils import logger # # Player Manager @@ -32,7 +33,7 @@ def returns_player_list(method): try: players.append(user.get_profile()) except Exception: - players.append(user) + logger.log_trace("User has no profile(), maybe database was partially reset?") return players return func diff --git a/src/server/initial_setup.py b/src/server/initial_setup.py index 54bb604b25..064aaaa067 100644 --- a/src/server/initial_setup.py +++ b/src/server/initial_setup.py @@ -86,8 +86,8 @@ def create_objects(): # Limbo is the initial starting room. - object_typeclass = settings.BASE_OBJECT_TYPECLASS - limbo_obj = create.create_object(object_typeclass, 'Limbo') + room_typeclass = settings.BASE_ROOM_TYPECLASS + limbo_obj = create.create_object(room_typeclass, 'Limbo') limbo_obj.id = 2 string = "Welcome to your new %chEvennia%cn-based game." string += " From here you are ready to begin development."