If a key is not listed in keymap.cfg but SDL provides a good enough name
for the corresponding scancode, a keymap entry is generated automatically.
If a key can't be found when adding a bind, it is checked, if SDL can
resolve the key name. The resolved keybind is then used to recreate the
keymap entry - and the bind can succeed.
Some SDL names for scancodes may not be usable as keymap names: if the
name contains (, ), $ or ", it will be rejected. Also, SDL does not
provide names for all scancodes. Scancode names provided by SDL can be
platform-dependant, therefore recreating the bind may fail on a different
platform.
However, the feature should work fine with most nonstandard keys - and the
information written to clientlog can be used to amend keymap.cfg
changed commands:
strstr haystack needle
now returns position of needle in haystack (counting from 1)
or zero, if not found
substr string start len
now counts negative length from total length
"substr text 1 -2" now returns the text without first and last char
strreplace text search replace
no longer restricted to 260 char stringlengths
removed commands:
swapelements, strpos (can be scripted, if required)
DOCREF strstr substr
DOCREF swapelements strpos
The edit protocol now allows the following commands in multiplayer:
arch, slope, edittag, edittagclip, selectionrotate, selectionflip
also:
mapenlarge has been limited to size 10 in multiplayer
entitiy undelete in multiplayer has been fixed
SV_EDITS, SV_EDITD and SV_EDITE are to be cleaned up with a protocol bump
DOCREF arch slope edittag edittagclip selectionrotate selectionflip
Two new string variables, mapinfo_license and mapinfo_comment, are stored
withing the header of a map file.
The variables are automatically read and written during loading and
saving maps. Default values are empty strings. The comment string is
ignored, as long as no license string is set. The license string is meant
to hold an abbreviated name of the license, picked from a list of
known map licenses.
DOCREF mapinfo_license mapinfo_comment
getmod modname
Try to download mods/modname.zip from all configured package servers.
Does not automatically activate the mod. The zip files are limited to
one megabyte total.
DOCREF getmod
addzipmod zipname
Add the zip package file "mods/zipname.zip" to the virtual file system.
Only files below the path "packages/" are added (and also files below
"config/", if zipname starts with "###"). If the size of the zip file
is below zipcachemaxsize, the whole zip file is cached in memory.
(Un-cached zip files are kept open at all time, so caching keeps the
number of simultaneously opened files lower.)
zipmodremove zipname
Removes one zip file from the virtual file system.
zipmodclear
Removes all zip files from the virtual file system.
zipmodlist [what]
Lists zip files in "mods/". By default, or if "what" is "all", all zips
are listed. If "what" is "active", only those zips, that are already in
use, are listed. If "what" is "inactive", only the unused zip files are
listed.
zipmodgetdesc zipfile
Reads and returns the first 11 lines from the file "desc.txt" in the
named zip file. The first line is supposed to contain a descriptive
title for the zip (for use in menus) and the next 10 lines should
contain a more detailed description (also for use in menus).
The command also unpacks "preview.jpg" from the zip and mounts it as a
temporary file under the name "packages/modpreviews/zipname.jpg".
zipmodgetfiles zipfile
Returns the list of files contained in a zip file.
zipmodgetrevision zipfile
Returns the revision number of the zip file. The number is supposed to
be part of a filename: "revision_n". If no such file is found in the zip
file, the return value is zero. The content of the revision file is not
relevant and a file size of zero is recommended.
DOCREF addzipmod zipmodremove zipmodclear zipcachemaxsize
DOCREF zipmodlist zipmodgetdesc zipmodgetfiles zipmodgetrevision
* own source file for autodownload
* use cleaned up zip functions
* use new http get function (no more curl)
* enforce strict file naming rules and file size limits
* ping all package servers on every game start to determine ping times
* support media file update lists (also kept on package servers)
* allow users to manually prioritise package servers
* automatically select server with newest media file revision
new or changed commands:
addpckserver hostname [priority]
Adds a host name to the list of package servers. If a priority is given,
it influences the sorting of servers. Servers with higher priority are
queried first. If servers have the same priority, they are sorted by
ping. Default priority is zero.
getpackageserver
Returns a table with four columns of all configured package servers. The
columns are: host name, priority, ping and resolved.
"resolved" is a flag, indicating, if the server answered the ping during
game start.
removed cubescript idents: sortpckservers gamestarts
DOCREF addpckserver getpckserver
menuselectionpersistent
Enables persistent selections for the currently displayed menu and also
restores a previously saved selection. Probably most efficient inside
"menuinit". The position is restored during execution of this command,
so the menu entry has to already exist and the alias with the last
position has to be read from saved.cfg. In autmatically created menus
it may be necessary to execute the command with a short delay (see
examples in this commit).
DOCREF menuselectionpersistent
No more spaces in filenames. The only allowed chars are a-z, A-Z, 0-9 and
"-_.()".
An exception are texture filenames, which may also have a prefix command
like "<decal>" included.
Also fixed some memory leaks in media download.
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
* replaces filtertext() with a version with a dozen of single filters
that can be used in any combination
* defines classes of allowed characters for strings for various uses
(see protocol.h line 153ff)
* now the allowed charset of, for example, player names is defined
in one location only
* fixes issue #58