From 2986ce295f552c4704a6a79aafe3f49419e9cffa Mon Sep 17 00:00:00 2001 From: flowtron Date: Tue, 18 Jan 2011 06:03:20 +0000 Subject: [PATCH] onSpawn*/onDeath* (Self/Other) aliases git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6026 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/clientgame.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index ddce4613..496ee145 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -244,15 +244,8 @@ VARP(autoscreenshot, 0, 0, 1); void deathstate(playerent *pl) { - /* - TODO:FIXME: talk to DES|V-Man about passing arguments - if(pl==player1) - { - // execute ondeath event - const char *ondeath = getalias("ondeath"); - if(ondeath && ondeath[0]) { addsleep(0, ondeath); } - } - */ + if(pl==player1) { if(identexists("onDeathSelf")) execute("onDeathSelf"); } + else { if(identexists("onDeathOther")) execute("onDeathOther"); } pl->state = CS_DEAD; pl->spectatemode = SM_DEATHCAM; pl->respawnoffset = pl->lastpain = lastmillis; @@ -295,8 +288,8 @@ playerent *newplayerent() // create a new blank player { playerent *d = new playerent; d->lastupdate = totalmillis; - setskin(d, rnd(6)); - weapon::equipplayer(d); // flowtron : avoid overwriting d->spawnstate(gamemode) stuff from the following line (this used to be called afterwards) + setskin(d, rnd(6)); + weapon::equipplayer(d); // flowtron : avoid overwriting d->spawnstate(gamemode) stuff from the following line (this used to be called afterwards) spawnstate(d); return d; } @@ -306,8 +299,8 @@ botent *newbotent() // create a new blank player botent *d = new botent; d->lastupdate = totalmillis; setskin(d, rnd(6)); - spawnstate(d); weapon::equipplayer(d); + spawnstate(d); // move like above loopv(players) if(i!=getclientnum() && !players[i]) { players[i] = d; @@ -576,6 +569,8 @@ void spawnplayer(playerent *d) d->spawnstate(gamemode); d->state = (d==player1 && editmode) ? CS_EDITING : CS_ALIVE; findplayerstart(d); + if(d==player1) { if(identexists("onSpawnSelf")) execute("onSpawnSelf"); } + else { if(identexists("onSpawnOther")) execute("onSpawnOther"); } } void respawnself()