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
# Do not mess with the default types (0-5). This is passed to the Object
# 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.
# Object type keys, DO NOT CHANGE!
OTYPE_NOTHING = 0
OTYPE_PLAYER = 1
OTYPE_ROOM = 2
@ -21,15 +9,17 @@ OTYPE_EXIT = 4
OTYPE_GOING = 5
OTYPE_GARBAGE = 6
# 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"]
# Do not mess with the default types (0-5). This is passed to the Object
# model's 'choices' argument.
OBJECT_TYPES = (
(OTYPE_NOTHING, 'NOTHING'),
(OTYPE_PLAYER, 'PLAYER'),
(OTYPE_ROOM, 'ROOM'),
(OTYPE_THING, 'THING'),
(OTYPE_EXIT, 'EXIT'),
(OTYPE_GOING, 'GOING'),
(OTYPE_GARBAGE, 'GARBAGE'),
)
# These attribute names can't be modified by players.
NOSET_ATTRIBS = ["MONEY", "ALIAS", "LASTPAGED", "__CHANLIST", "LAST",
@ -41,7 +31,7 @@ HIDDEN_ATTRIBS = ["__CHANLIST", "__PARENT"]
# Server version number.
REVISION = os.popen('svnversion .', 'r').readline().strip()
if not REVISION:
REVISION = "UNKNOWN"
REVISION = "Unknown"
# Clip out the SVN keyword information
EVENNIA_VERSION = 'Alpha ' + REVISION

View file

@ -3,17 +3,27 @@ Everything related to flags and flag management.
"""
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):
"""
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):
"""
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
else:
return False