Moving constants over to the new flags module.

This commit is contained in:
Greg Taylor 2008-06-15 20:41:58 +00:00
parent e89a30f511
commit b12ba45cc7
2 changed files with 25 additions and 25 deletions

View file

@ -1,18 +1,6 @@
import os import os
# Do not mess with the default types (0-5). This is passed to the Object # Object type keys, DO NOT CHANGE!
# model's 'choices' argument.
OBJECT_TYPES = (
(0, 'NOTHING'),
(1, 'PLAYER'),
(2, 'ROOM'),
(3, 'THING'),
(4, 'EXIT'),
(5, 'GOING'),
(6, 'GARBAGE'),
)
# Hate to duplicate the above, but it's the easiest way.
OTYPE_NOTHING = 0 OTYPE_NOTHING = 0
OTYPE_PLAYER = 1 OTYPE_PLAYER = 1
OTYPE_ROOM = 2 OTYPE_ROOM = 2
@ -21,15 +9,17 @@ OTYPE_EXIT = 4
OTYPE_GOING = 5 OTYPE_GOING = 5
OTYPE_GARBAGE = 6 OTYPE_GARBAGE = 6
# This is a list of flags that the server actually uses. Anything not in this # Do not mess with the default types (0-5). This is passed to the Object
# list is a custom flag. # model's 'choices' argument.
SERVER_FLAGS = ["CONNECTED", "DARK", "FLOATING", "GAGGED", "HAVEN", "OPAQUE", "SAFE", "SLAVE", "SUSPECT", "TRANSPARENT"] OBJECT_TYPES = (
(OTYPE_NOTHING, 'NOTHING'),
# These flags are not saved. (OTYPE_PLAYER, 'PLAYER'),
NOSAVE_FLAGS = ["CONNECTED"] (OTYPE_ROOM, 'ROOM'),
(OTYPE_THING, 'THING'),
# These flags can't be modified by players. (OTYPE_EXIT, 'EXIT'),
NOSET_FLAGS = ["CONNECTED"] (OTYPE_GOING, 'GOING'),
(OTYPE_GARBAGE, 'GARBAGE'),
)
# These attribute names can't be modified by players. # These attribute names can't be modified by players.
NOSET_ATTRIBS = ["MONEY", "ALIAS", "LASTPAGED", "__CHANLIST", "LAST", NOSET_ATTRIBS = ["MONEY", "ALIAS", "LASTPAGED", "__CHANLIST", "LAST",
@ -41,7 +31,7 @@ HIDDEN_ATTRIBS = ["__CHANLIST", "__PARENT"]
# Server version number. # Server version number.
REVISION = os.popen('svnversion .', 'r').readline().strip() REVISION = os.popen('svnversion .', 'r').readline().strip()
if not REVISION: if not REVISION:
REVISION = "UNKNOWN" REVISION = "Unknown"
# Clip out the SVN keyword information # Clip out the SVN keyword information
EVENNIA_VERSION = 'Alpha ' + REVISION EVENNIA_VERSION = 'Alpha ' + REVISION

View file

@ -3,17 +3,27 @@ Everything related to flags and flag management.
""" """
import defines_global import defines_global
# This is a list of flags that the server actually uses. Anything not in this
# list is a custom flag.
SERVER_FLAGS = ["CONNECTED", "DARK", "FLOATING", "GAGGED", "HAVEN", "OPAQUE", "SAFE", "SLAVE", "SUSPECT", "TRANSPARENT"]
# These flags are not saved.
NOSAVE_FLAGS = ["CONNECTED"]
# These flags can't be modified by players.
NOSET_FLAGS = ["CONNECTED"]
def is_unsavable_flag(flagname): def is_unsavable_flag(flagname):
""" """
Returns TRUE if the flag is an unsavable flag. Returns TRUE if the flag is an unsavable flag.
""" """
return flagname.upper() in defines_global.NOSAVE_FLAGS return flagname.upper() in NOSAVE_FLAGS
def is_modifiable_flag(flagname): def is_modifiable_flag(flagname):
""" """
Check to see if a particular flag is modifiable. Check to see if a particular flag is modifiable.
""" """
if flagname.upper() not in defines_global.NOSET_FLAGS: if flagname.upper() not in NOSET_FLAGS:
return True return True
else: else:
return False return False