onNewMap native alias

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6306 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Bukz
2011-04-23 10:11:35 +00:00
parent a4ac3542e5
commit 4cf0f94191
3 changed files with 12 additions and 1 deletions
+1
View File
@@ -339,6 +339,7 @@ docremark [The servers are written to the config/servers.cfg file. This menu can
docident [version] [Gets an integer representing the game version. READ ONLY];
docremark [As example, version 1.0 is represented as value 1000.];
docident [writecfg] [writes current configuration to config/saved.cfg - automatic on quit];
docident [onNewMap] [If this alias exists, it will be automatically executed when you start a new map.];
docsection [Gameplay]
docident [add2alias] [This will append the passed 2nd argument to any existing content of the alias named in the 1st argument. Several popular aliases have predefined shortcuts using this scriptalias: addOnQuit, addOnLoadOnce, addOnLoadAlways. Check config/scripts.cfg for possible omissions in that list.];
docexample [foo = "one" add2alias foo two echo foo] [Output: one two];
+4
View File
@@ -3526,6 +3526,10 @@ Output:
<remark>If disabled, an updated editing binds system is used, see the comments in "/config/resetbinds.cfg" for more info.</remark>
</remarks>
</variable>
<scriptalias name="onNewMap">
<description>If this alias exists, it will be automatically executed when you start a new map.</description>
</scriptalias>
</identifiers>
</section>
+7 -1
View File
@@ -496,7 +496,13 @@ bool empty_world(int factor, bool force) // main empty world creation routine
void mapenlarge() { if(empty_world(-1, false)) addmsg(SV_NEWMAP, "ri", -1); }
void mapshrink() { if(empty_world(-2, false)) addmsg(SV_NEWMAP, "ri", -2); }
void newmap(int i) { if(empty_world(i, false)) addmsg(SV_NEWMAP, "ri", max(i, 0)); }
void newmap(int i) {
if(empty_world(i, false))
{
addmsg(SV_NEWMAP, "ri", max(i, 0));
if(identexists("onNewMap")) execute("onNewMap");
}
}
COMMAND(mapenlarge, ARG_NONE);
COMMAND(mapshrink, ARG_NONE);