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
For bigger lastmillis and zero basetime in combination with odd values for
as.speed, t can become negative due to rounding errors.
(time: 3404565, as.speed: 43,47826 -> t: -0,00575)
After dropping the flag player1 will see for a very short moment,
before flag position will be updated by server, flag dropped at player1
position. Earlier he could see for this moment flag dropped in a place,
when it was picked up.
The bug caused SIGTRAP during fastforwading demo in debug mode, when other
players disconnected.
These asserts were removed, because they can be triggered because of a bug.
1. In multiplayer this switching isn't allowed, because it was broken
and messed up, for example other players didn't see concurrently
spectating and editing player.
2. In demo mode switching from spectate to edit mode is improved.
3. Several years broken code for edit mode is reverted.
No more sounds audible on the whole map in bot modes, when bots change
weapon or have no ammo.
Gun change sound in bot code was a duplicate, so removed.
auto-generate mapmodel menus depending on the actually available models
in the current map config.
Also fixes memory leak in "newmenu".
DOCREF mapmodelname mapmodelbyname mapmodelchanged
Fixed nested list in Cubescript, fixed conopen (now read-only), removed changeteam(),
fixed name of shortcuts for team survivor modes (so it fixes
https://github.com/assaultcube/AC/issues/73 ).
DOCREF ts tsurv btsurv
curmenu gives back the name of the currently open menu, which can be used
to close just that.
The new script "closecurmenu" uses curmenu to close the current menu.
DOCREF curmenu closecurmenu
Moved the comment on the CXX flag to a seperate line, so that compiling logs don't show extra whitespace. Additionally, I've added a comment about why we use clang++ (instead of g++) to help future 3rd parties.
All cfg-files in config/autostart get executed during startup.
- more appropriate directory name and place
- files are now sorted alphabetically, as promised
- doubles are removed (resulting from identical file names in home and
install tree) since they would only result in files run twice
- scripts with file names prefixed with "_veryfirst_", "_beforesaved_"
or "_aftersaved_" will be run as very first config file, right before
saved.cfg or right after saved.cfg
- all remaining files will be run right before autoexec.cfg
- the directory "config/autostart" will be created, if it doesn't already
exist in the home tree
like this:
alias listwiththreeelements [
first // first element
second // second element
third // third element
]
"echo $listwiththreeelements" will print everything, including comments,
but "echo (listlen $listwiththreeelements)" will print "3", and
"echo (at $listwiththreeelements 1)" will print "second".
Before, if player switched to akimbo just as it expired, he ended up with
akimbo and 0 ammo. Now his weapon will change to default weapon (the most
often primary), as if he would take akimbo in the hands.
instead of "pop var_a ; pop var_b" you can write "pop var_a var_b"
Also, "pop" will now give back the removed value of the first alias from
the argument list. This allows using the pop'd value one last time.
DOCREF pop
Some operations, like pop or looplist, leave empty aliases behind. Mostly,
this is without consequence - but before this commit, they showed up
during command completion.
An alias, that was at least once used with the new "tempalias" will not be
written to saved.cfg.
So, now there are four ways to create aliases:
1) alias (or "=")
General alias, who's value gets saved at game exit in saved.cfg, and
restored at the next restart - unless the alias was created at a time,
where persistidents was zero (usually during execution of the game's own
config files during startup).
2) const
Creates an alias, that can not be changed. Makes it harder for users
to destroy their config.
3) push
Reassigns an alias with a new value. After "pop", the old value is
restored. Allows the use of "local" aliases in scripts. Also avoids
name conflicts.
4) tempalias
Like "alias", but the value will not be written to saved.cfg.
The commit also changes aliases, written by the engine itself, to "temp":
gametimestart, __getmaprevisions
DOCREF tempalias
Defaults to omitting variables from saved.cfg, that are still at default
value. By setting omitunchangeddefaults to zero, those variables get
written, but commented out. The variable "groupvariables" sets the number
of variables with similar names, that can be grouped on one line. Setting
it to zero will additionally write min, max and default values and a
short description of the variable to file.
In general, variables, that are still at default value, will not be
restored from saved.cfg, so when the default in the game is changed, all
clients will use that new default. This way, testers don't have to erase
their saved.cfg as often.
DOCREF omitunchangeddefaults groupvariables
If an alias has a local value assigned (by "push"), this change will write
the original value to saved.cfg instead of the last local value.
This has the additional effect, that aliases, that were created by "push",
will not be written to saved.cfg, since the original value was empty.
* combine all weapon attributes in a table
* sort variables and aliases
* group variables
* implement curname as SVAR
* implement cmdbuf as temporary alias