|
|
1.1 ! root 1: // Spectator functions ! 2: // Added Aug11'97 by Zoid <[email protected]> ! 3: // ! 4: // These functions are called from the server if they exist. ! 5: // Note that Spectators only have one think since they movement code doesn't ! 6: // track them much. Impulse commands work as usual, but don't call ! 7: // the regular ImpulseCommand handler in weapons.qc since Spectators don't ! 8: // have any weapons and things can explode. ! 9: // ! 10: // --- Zoid. ! 11: ! 12: /* ! 13: =========== ! 14: SpectatorConnect ! 15: ! 16: called when a spectator connects to a server ! 17: ============ ! 18: */ ! 19: void() SpectatorConnect = ! 20: { ! 21: bprint (PRINT_MEDIUM, "Spectator "); ! 22: bprint (PRINT_MEDIUM, self.netname); ! 23: bprint (PRINT_MEDIUM, " entered the game\n"); ! 24: ! 25: self.goalentity = world; // used for impulse 1 below ! 26: }; ! 27: ! 28: /* ! 29: =========== ! 30: SpectatorDisconnect ! 31: ! 32: called when a spectator disconnects from a server ! 33: ============ ! 34: */ ! 35: void() SpectatorDisconnect = ! 36: { ! 37: bprint (PRINT_MEDIUM, "Spectator "); ! 38: bprint (PRINT_MEDIUM, self.netname); ! 39: bprint (PRINT_MEDIUM, " left the game\n"); ! 40: }; ! 41: ! 42: /* ! 43: ================ ! 44: SpectatorImpulseCommand ! 45: ! 46: Called by SpectatorThink if the spectator entered an impulse ! 47: ================ ! 48: */ ! 49: void() SpectatorImpulseCommand = ! 50: { ! 51: if (self.impulse == 1) { ! 52: // teleport the spectator to the next spawn point ! 53: // note that if the spectator is tracking, this doesn't do ! 54: // much ! 55: self.goalentity = find(self.goalentity, classname, "info_player_deathmatch"); ! 56: if (self.goalentity == world) ! 57: self.goalentity = find(self.goalentity, classname, "info_player_deathmatch"); ! 58: if (self.goalentity != world) { ! 59: setorigin(self, self.goalentity.origin); ! 60: self.angles = self.goalentity.angles; ! 61: self.fixangle = TRUE; // turn this way immediately ! 62: } ! 63: } ! 64: ! 65: self.impulse = 0; ! 66: }; ! 67: ! 68: /* ! 69: ================ ! 70: SpectatorThink ! 71: ! 72: Called every frame after physics are run ! 73: ================ ! 74: */ ! 75: void() SpectatorThink = ! 76: { ! 77: // self.origin, etc contains spectator position, so you could ! 78: // do some neat stuff here ! 79: ! 80: if (self.impulse) ! 81: SpectatorImpulseCommand(); ! 82: }; ! 83: ! 84:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.