From 28ffb06db6bf50fd63223c94e91b72e57e110be9 Mon Sep 17 00:00:00 2001 From: flowtron Date: Sun, 17 Apr 2011 14:45:52 +0000 Subject: [PATCH] "setfollowplayer CN" command git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6263 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- docs/reference.xml | 6 ++++++ source/src/clientgame.cpp | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/docs/reference.xml b/docs/reference.xml index de1dba5c..30ae1c89 100644 --- a/docs/reference.xml +++ b/docs/reference.xml @@ -1707,6 +1707,12 @@ echo (pstat_weap 0) + + + + + + Returns 1 if the local player is alive. diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 7bb3839e..5dd5b6bc 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -1460,6 +1460,21 @@ playerent *updatefollowplayer(int shiftdirection) return players[player1->followplayercn]; } +void setfollowplayer(int cn) +{ + // silently ignores invalid player-cn value passed + loopv(players) if(players[i]) + { + if(player1->team != TEAM_SPECT && !watchingdemo && m_teammode && team_base(players[i]->team) != team_base(player1->team)) continue; + if(players[i]->clientnum == cn) + { + if(player1->followplayercn != players[i]->clientnum) addmsg(SV_SPECTCN, "ri", cn); + player1->followplayercn = cn; + } + } + +} + // set new spect mode void spectate(int mode) { @@ -1526,6 +1541,7 @@ void changefollowplayer(int shift) COMMANDN(spectatemode, spectate, ARG_1INT); COMMAND(togglespect, ARG_NONE); COMMAND(changefollowplayer, ARG_1INT); +COMMAND(setfollowplayer, ARG_1INT); int isalive() { return player1->state==CS_ALIVE ? 1 : 0; } COMMANDN(alive, isalive, ARG_IVAL);