From: Jakob MG Date: Thu, 16 Aug 2012 21:20:55 +0000 (+0200) Subject: Make superspec better, support cmd followfc [red|blue], comment out unused funcs X-Git-Tag: xonotic-v0.7.0~277 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=69dfb99d62da1ce62fbe47d7debfec56b1c87b03;p=xonotic%2Fxonotic-data.pk3dir.git Make superspec better, support cmd followfc [red|blue], comment out unused funcs --- diff --git a/qcsrc/server/mutators/mutator_superspec.qc b/qcsrc/server/mutators/mutator_superspec.qc index cb5a9c007..1666ac1da 100644 --- a/qcsrc/server/mutators/mutator_superspec.qc +++ b/qcsrc/server/mutators/mutator_superspec.qc @@ -1,6 +1,11 @@ -MUTATOR_HOOKFUNCTION(superspec_PlayerPreThink) +float _spectate(entity _player) { - return FALSE; + if(SpectateNext(_player) == 1) + { + PutObserverInServer(); + self.classname = "spectator"; + } + return TRUE; } MUTATOR_HOOKFUNCTION(superspec_SV_ParseClientCommand) @@ -9,78 +14,70 @@ MUTATOR_HOOKFUNCTION(superspec_SV_ParseClientCommand) return FALSE; if(self.classname == "player") - { - centerprint(self, "GTFO\n"); return TRUE; - } - + if(cmd_name == "followpowerup") { entity _player; FOR_EACH_PLAYER(_player) { if(_player.strength_finished > time || _player.invincible_finished > time) - { - SpectateNext(_player); - //centerprint(self, "Active powerup found\n"); - return TRUE; - } + return _spectate(_player); } - //centerprint(self, "No active powerups\n"); - return TRUE; + centerprint(self, "No active powerups\n"); + return TRUE; } - + if(cmd_name == "followstrength") { entity _player; FOR_EACH_PLAYER(_player) { if(_player.strength_finished > time) - { - SpectateNext(_player); - //centerprint(self, "Active powerup found\n"); - return TRUE; - } + return _spectate(_player); } - //centerprint(self, "No active powerups\n"); - return TRUE; + centerprint(self, "No active Strength\n"); + return TRUE; } - + if(cmd_name == "followstshield") { entity _player; FOR_EACH_PLAYER(_player) { if(_player.invincible_finished > time) - { - SpectateNext(_player); - //centerprint(self, "Active powerup found\n"); - return TRUE; - } + return _spectate(_player); } - //centerprint(self, "No active powerups\n"); - return TRUE; + centerprint(self, "No active Shield\n"); + return TRUE; } - - /* + + if(cmd_name == "followfc") { + if(!g_ctf) + return TRUE; + + entity _player; + float _team; + if(cmd_argc == 2) - { - if(argv(1) == "bar") - - else if(argv(1) == "baz") - + { + if(argv(1) == "red") + _team = COLOR_TEAM1; else - { - float _idx = stof(argv(1)); - - } + _team = COLOR_TEAM2; } + FOR_EACH_PLAYER(_player) + { + if(_player.flagcarried && (_player.team == _team || _team == 0)) + return _spectate(_player); + } + + centerprint(self, "No active FC\n"); return TRUE; - } - */ - + } + return FALSE; } @@ -96,17 +93,23 @@ MUTATOR_HOOKFUNCTION(superspec_BuildMutatorsPrettyString) return 0; } +/* MUTATOR_HOOKFUNCTION(superspec_PlayerSpawn) -{ - +{ + return FALSE; } MUTATOR_HOOKFUNCTION(superspec_ClientDisconnect) { - + + return FALSE; +} +MUTATOR_HOOKFUNCTION(superspec_PlayerPreThink) +{ return FALSE; } +*/ MUTATOR_DEFINITION(mutator_superspec) {