onSuicide & onLastMin native aliases

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6307 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Bukz
2011-04-23 10:44:16 +00:00
parent 4cf0f94191
commit d3e7c6268c
3 changed files with 15 additions and 0 deletions
+2
View File
@@ -178,6 +178,8 @@ docargument [L] [the list of CVARs] [] [0];
docargument [A] [the alias to store them in] [] [0];
docexample [storesets "sensitivity hudgun fov" tmp] [Example result: stores "3.000 1 120" into alias "tmp".];
docremark [Some idents cannot be stored via this command "(e.g. curname)", if an argument is given that cannot be used, the command will throw an error to notify you.];
docident [onSuicide] [If this alias exists, it will be automatically executed whenever you suicide.];
docident [onLastMin] [If this alias exists, it will be automatically executed on the last minute remaining mark.];
docsection [General]
docident [addserver] [Adds a server to the list of server to query in the server list menu.];
docargument [S] [the address of the server (hostname or IP)] [] [0];
+8
View File
@@ -2584,6 +2584,14 @@ Output:
<argument description="the map to use"/>
</arguments>
</command>
<scriptalias name="onSuicide">
<description>If this alias exists, it will be automatically executed whenever you suicide.</description>
</scriptalias>
<scriptalias name="onLastMin">
<description>If this alias exists, it will be automatically executed on the last minute remaining mark.</description>
</scriptalias>
</identifiers>
</section>
+5
View File
@@ -766,7 +766,11 @@ void dokill(playerent *pl, playerent *act, bool gib, int gun)
void (*outf)(const char *s, ...) = (pl == player1 || act == player1) ? hudoutf : conoutf;
if(pl==act)
{
outf("\f2%s suicided%s", pname, pl==player1 ? "!" : "");
if(pl==player1)
if(identexists("onSuicide")) execute("onSuicide");
}
else if(isteam(pl->team, act->team))
{
if(pl==player1) outf("\f2you were %s by teammate %s", death, aname);
@@ -882,6 +886,7 @@ void timeupdate(int milliscur, int millismax)
{
audiomgr.musicsuggest(M_LASTMINUTE1 + rnd(2), 70*1000, true);
hudoutf("1 minute left!");
if(identexists("onLastMin")) execute("onLastMin");
}
else if(clockdisplay==0) conoutf(_("time remaining: %d minutes"), minutesremaining);
}