This adds a means to store additional attributes for mapmodels, including
a caching mechanism, so the mapmodels don't have to be loaded to access
the information. The goal is, to provide fully automatic mapmodel menus
for map editing who also add information about downloaded mapmodels.
Model attributes are extracted everytime, when a model is loaded. At game
end, all available data is written to config/mapmodelattributes.cfg and
restored at next startup. On release, a file with all (but only) official
models should be included. Since autodownloaded models are usually "loaded"
after download, those are automatically added to the database. If someone
adds models manually to the directories (media pack, w/e), the command
"loadallmapmodels" can be used to try to find all available models. The
only way to delete something from the database, is to delete the file
config/mapmodelattributes.cfg when the game is closed.
The current list of attributes is:
keywords
List of one or more menu topics to list the model under. Check
config/menus_edit.cfg for available keywords. Unknown keywords will
be listed separately.
desc
Short name or description of the model. Will be used as menu entry.
usage
Important information for how to use that specific model.
author
Who created the mapmodel. If it's a derivative of another model, state
the author of the mod (refer to the original author under "license", if
you like). Always use the exact same spelling for the same author, to
allow menus to automatically group models by author.
license
Free-text attribute for license info or info about additional
contributors (or original authors for derivated works).
distribution
One of "official", "autodownload" or "manual". Other values default to
"manual". This is used to determine, if a map contains only original
media or media that can be download automatically.
version
Single numerical value to separate older from newer versions. Defaults
to zero. Higher numbers mean "newer". Maybe someone manages to implement
a versioning system for custom media in the future...
New commands:
mdlattribute <attr> <value>
To be used in model config files. Adds a value for a specified
attribute to the model.
mapmodelregister <modelpath> <attr1> <attr2> ...
Adds values for all attributes to a specific mapmodel. This is used to
restore the cached values from config/mapmodelattributes.cfg during
game start. Does not actually verify of load the model.
mapmodelattributes <modelpath> <attr>
Returns the value of a specific attribute of a mapmodel. If modelpath
is a number, it is interpreted as index for the list of models in the
current map config. If no attribute name is specified, all attributes
are printed to the console instead.
getmapmodelattributes <list of attribute names>
Returns a table of all known mapmodels. Each model is listed with the
modelpath and the values for the requested attributes. To be used
instead of a fixed table in menu_edit.cfg. In addition to attribute
names, the function also allows the keywords "explodekeywords" and
"sortby:" as arguments. If "explodekeywords" is given, all mapmodels
with more than one keyword are listed multiple times, once for each
keyword. If an attribute name is preceeded by "sortby:" the list will
be sorted by this table column. If "sortby:" is used several times,
this first sort will have highest priority. The list is always sorted
by path by default.
example:
getmapmodelattributes sortby: author sortby: desc explodekeywords
loadallmapmodels
Tries to load mapmodels from /all/ paths below packages/models/mapmodels.
Will throw a lot of error messages, because not all directories contain
models to load. This command can be used to build or rebuild the
complete list of all available mapmodels. It is only necessary, if models
are added manually to the directories, since every mapmodel gets added
to the list when it is loaded - which takes care of all automatically
downloaded models.
DOCREF mdlattribute mapmodelregister mapmodelattributes
DOCREF getmapmodelattributes loadallmapmodels
License ======= The AssaultCube source code is mainly based on the cube game/engine and uses the same license (z-lib like). See README_CUBEENGINE.txt In addition AssaultCube contains code from pCube (Cube pro mod) and Sauerbraten (Cube successor) and other sources. AssaultCube Authors ================== Adrian 'driAn' Henke drian at sprintf.org Andrew 'Arghvark' Davis arghvark at gmail.com Lee 'Eihrul' Salzman stef Cube Engine Authors =================== Wouter 'Aardappel' van Oortmerssen, Lee 'Eihrul' Salzman and others. See README_CUBEENGINE.txt and http://www.cubeengine.com pCube Authors ============= Adrian 'driAn' Henke and others. http://p.cubers.net Sauerbraten Authors =================== Wouter 'Aardappel' van Oortmerssen, Lee 'Eihrul' Salzman, Mike 'Gilt' Dysart and others. http://www.sauerbraten.org Cheat Protection ================ The cheat protection described in README_CUBEENGINE.txt is not used in AssaultCube. Binaries compiled from source are compatible with the official binaries. This means, the client can easily be hacked, on the other hand, you can compile AssaultCube for different platforms and fix bugs yourself. You MUST NOT connect to servers that are not yours with a modified client that contains changes that were not made for platform-compatibility or to fix bugs. This would be cheating. Thank you for supporting fair play gaming.