def q_touch(*qwp_extra): stemp = engine.world best = 0 s = None if qc.other.classname != 'player': return if qc.other.health <= 0: return qc.self.mdl = qc.self.model qc.other.sound(defs.CHAN_VOICE, qc.self.noise, 1, defs.ATTN_NORM) qc.other.stuffcmd('bf\012') qc.self.solid = defs.SOLID_NOT qc.other.items |= defs.IT_QUAD qc.self.model = defs.string_null if defs.deathmatch == 4: qc.other.armortype = 0 qc.other.armorvalue = 0 * 0.01 qc.other.ammo_cells = 0 # do the apropriate action qc.other.super_time = 1 qc.other.super_damage_finished = qc.self.cnt s = str(round(qc.other.super_damage_finished - qc.time)) engine.bprint(defs.PRINT_LOW, qc.other.netname) if defs.deathmatch == 4: engine.bprint(defs.PRINT_LOW, ' recovered an OctaPower with ') else: engine.bprint(defs.PRINT_LOW, ' recovered a Quad with ') engine.bprint(defs.PRINT_LOW, s) engine.bprint(defs.PRINT_LOW, ' seconds remaining!\012') defs.activator = qc.other subs.SUB_UseTargets() # fire all targets / killtargets
def ClientKill(*qwp_extra): engine.bprint(defs.PRINT_MEDIUM, qc.self.netname) engine.bprint(defs.PRINT_MEDIUM, ' suicides\012') player.set_suicide_frame() qc.self.modelindex = modelindex_player qc.self.logfrag(qc.self) qc.self.frags -= 2 # extra penalty respawn()
def ClientDisconnect(*qwp_extra): # let everyone else know engine.bprint(defs.PRINT_HIGH, qc.self.netname) engine.bprint(defs.PRINT_HIGH, ' left the game with ') engine.bprint(defs.PRINT_HIGH, str(qc.self.frags)) engine.bprint(defs.PRINT_HIGH, ' frags\012') qc.self.sound(defs.CHAN_BODY, 'player/tornoff2.wav', 1, defs.ATTN_NONE) player.set_suicide_frame()
def LoopThroughPlayersAfterCapture(*qwp_extra): global lastteamscrtime global teamscr1 global teamscr2 # count up teamscr lastteamscrtime = qc.time + TEAMSCRTIME teamscr1 = teamscr2 = 0 # Ok, let's do the player loop, hand out the bonuses, add up # the scores, and inform the players about the capture p = qc.find(qc.world, 'classname', 'player') while p != qc.world: # Ok, let's do the player loop, hand out the bonuses qc.self = p qc.self.killed = 0 if qc.self.steam == qc.other.steam and qc.self != qc.other: qc.self.frags += TEAM_CAPTURE_TEAM_BONUS if qc.self.steam != qc.other.steam: # *XXX* EXPERT CTF # reset the last_hurt_carrier variable in all enemy # players, so that you don't get bonuses for defending # the flag carrier if the flag carrier has already # completed a capture qc.self.last_hurt_carrier = -5 elif qc.self.steam == qc.other.steam: # done to all players on the capturing team # *XXX* EXPERT CTF # award extra points for capture assists if qc.self.last_returned_flag + TEAM_CAPTURE_RETURN_FLAG_ASSIST_TIMEOUT > qc.time: engine.bprint(defs.PRINT_HIGH, qc.self.netname) engine.bprint(defs.PRINT_HIGH, ' gets an assist for returning his flag!\012') qc.self.frags += TEAM_CAPTURE_RETURN_FLAG_ASSIST_BONUS if qc.self.last_fragged_carrier + TEAM_CAPTURE_FRAG_CARRIER_ASSIST_TIMEOUT > qc.time: engine.bprint(defs.PRINT_HIGH, qc.self.netname) engine.bprint( defs.PRINT_HIGH, ' gets an assist for fragging the flag carrier!\012') qc.self.frags += TEAM_CAPTURE_FRAG_CARRIER_ASSIST_BONUS qc.self.player_flag -= qc.self.player_flag & defs.ITEM_ENEMY_FLAG # count up teamscr if p.steam == TEAM_COLOR1: teamscr1 += p.frags elif p.steam == TEAM_COLOR2: teamscr2 += p.frags # inform players about capture if (p.steam == TEAM_COLOR1 and qc.other.steam == TEAM_COLOR2) or ( p.steam == TEAM_COLOR2 and qc.other.steam == TEAM_COLOR1): status.TeamPlayerUpdate(p, 'Your flag was captured!') elif p.steam == qc.other.steam: status.TeamPlayerUpdate(p, 'Your team captured the flag!') # remove any flags p.effects -= p.effects & (defs.EF_FLAG1 | defs.EF_FLAG2) p = qc.find(p, 'classname', 'player')
def LoopThroughPlayersAfterCapture(*qwp_extra): global lastteamscrtime global teamscr1 global teamscr2 # count up teamscr lastteamscrtime = qc.time + TEAMSCRTIME teamscr1 = teamscr2 = 0 # Ok, let's do the player loop, hand out the bonuses, add up # the scores, and inform the players about the capture p = qc.find(qc.world, "classname", "player") while p != qc.world: # Ok, let's do the player loop, hand out the bonuses qc.self = p qc.self.killed = 0 if qc.self.steam == qc.other.steam and qc.self != qc.other: qc.self.frags += TEAM_CAPTURE_TEAM_BONUS if qc.self.steam != qc.other.steam: # *XXX* EXPERT CTF # reset the last_hurt_carrier variable in all enemy # players, so that you don't get bonuses for defending # the flag carrier if the flag carrier has already # completed a capture qc.self.last_hurt_carrier = -5 elif qc.self.steam == qc.other.steam: # done to all players on the capturing team # *XXX* EXPERT CTF # award extra points for capture assists if qc.self.last_returned_flag + TEAM_CAPTURE_RETURN_FLAG_ASSIST_TIMEOUT > qc.time: engine.bprint(defs.PRINT_HIGH, qc.self.netname) engine.bprint(defs.PRINT_HIGH, " gets an assist for returning his flag!\012") qc.self.frags += TEAM_CAPTURE_RETURN_FLAG_ASSIST_BONUS if qc.self.last_fragged_carrier + TEAM_CAPTURE_FRAG_CARRIER_ASSIST_TIMEOUT > qc.time: engine.bprint(defs.PRINT_HIGH, qc.self.netname) engine.bprint(defs.PRINT_HIGH, " gets an assist for fragging the flag carrier!\012") qc.self.frags += TEAM_CAPTURE_FRAG_CARRIER_ASSIST_BONUS qc.self.player_flag -= qc.self.player_flag & defs.ITEM_ENEMY_FLAG # count up teamscr if p.steam == TEAM_COLOR1: teamscr1 += p.frags elif p.steam == TEAM_COLOR2: teamscr2 += p.frags # inform players about capture if (p.steam == TEAM_COLOR1 and qc.other.steam == TEAM_COLOR2) or ( p.steam == TEAM_COLOR2 and qc.other.steam == TEAM_COLOR1 ): status.TeamPlayerUpdate(p, "Your flag was captured!") elif p.steam == qc.other.steam: status.TeamPlayerUpdate(p, "Your team captured the flag!") # remove any flags p.effects -= p.effects & (defs.EF_FLAG1 | defs.EF_FLAG2) p = qc.find(p, "classname", "player")
def changelevel_touch(*qwp_extra): global nextmap pos = engine.world if qc.other.classname != 'player': return # if "noexit" is set, blow up the player trying to leave # ZOID, 12-13-96, noexit isn't supported in QW. Overload samelevel # if ((cvar("noexit") == 1) || ((cvar("noexit") == 2) && (mapname != "start"))) if (engine.cvar('samelevel') == 2) or ((engine.cvar('samelevel') == 3) and (qc.mapname != 'start')): combat.T_Damage(qc.other, qc.self, qc.self, 50000) return engine.bprint(defs.PRINT_HIGH, qc.other.netname) engine.bprint(defs.PRINT_HIGH, ' exited the level\012') nextmap = qc.self.map subs.SUB_UseTargets() qc.self.touch = subs.SUB_Null # we can't move people right now, because touch functions are called # in the middle of C movement code, so set a think time to do it qc.self.think = execute_changelevel qc.self.nextthink = qc.time + 0.1
def SpectatorConnect(*qwp_extra): engine.bprint(defs.PRINT_MEDIUM, 'Spectator ') engine.bprint(defs.PRINT_MEDIUM, qc.self.netname) engine.bprint(defs.PRINT_MEDIUM, ' entered the game\012') qc.self.goalentity = qc.world # used for impulse 1 below qc.self.motd_count = 1 qc.self.classname = 'spectator'
def SpectatorConnect(*qwp_extra): engine.bprint(defs.PRINT_MEDIUM, "Spectator ") engine.bprint(defs.PRINT_MEDIUM, qc.self.netname) engine.bprint(defs.PRINT_MEDIUM, " entered the game\012") qc.self.goalentity = qc.world # used for impulse 1 below qc.self.motd_count = 1 qc.self.classname = "spectator"
def voteexit_touch(*qwp_extra): global vote_leader global voteexit_time if qc.other.classname != 'player': return # only teleport living creatures if qc.other.health <= 0 or qc.other.solid != defs.SOLID_SLIDEBOX: return if qc.other.voted: if qc.other.voted < qc.time: status.TeamPlayerUpdate(qc.other, 'You have already voted.') qc.other.voted = qc.time + 1 voteexit_teleport() return # non-zero for vote, time is when to display a 'you voted' msg qc.other.voted = qc.time + 1 subs.SUB_UseTargets() engine.bprint(defs.PRINT_HIGH, qc.other.netname) engine.bprint(defs.PRINT_HIGH, ' has voted for ') engine.bprint(defs.PRINT_HIGH, qc.self.message) engine.bprint(defs.PRINT_HIGH, '\012') # ok, the player has voted for this exit qc.self.cnt += 1 # find new leader # we're on the start map, something special is happening vote_leader = qc.world t = qc.find(qc.world, 'classname', 'trigger_voteexit') while t != qc.world: if (t.cnt > vote_leader.cnt) and (t != qc.self): vote_leader = t t = qc.find(t, 'classname', 'trigger_voteexit') # if we are higher than the current leader, then we are the new # leader, if we are same, half chance if qc.self.cnt > vote_leader.cnt: vote_leader = qc.self elif (qc.self.cnt == vote_leader.cnt) and (random.random() > 0.5): vote_leader = qc.self # we check here about exit time if vote_leader != qc.world and voteexit_time == 0: voteexit_time = qc.time + VOTEEXIT_TIME_LIMIT # notify everyone about the change status.TeamCaptureResetUpdate() voteexit_teleport()
def r_touch(*qwp_extra): stemp = engine.world best = 0 s = None if qc.other.classname != 'player': return if qc.other.health <= 0: return qc.self.mdl = qc.self.model qc.other.sound(defs.CHAN_VOICE, qc.self.noise, 1, defs.ATTN_NORM) qc.other.stuffcmd('bf\012') qc.self.solid = defs.SOLID_NOT qc.other.items |= defs.IT_INVISIBILITY qc.self.model = defs.string_null # do the apropriate action qc.other.invisible_time = 1 qc.other.invisible_finished = qc.self.cnt s = str(round(qc.other.invisible_finished - qc.time)) engine.bprint(defs.PRINT_LOW, qc.other.netname) engine.bprint(defs.PRINT_LOW, ' recovered a Ring with ') engine.bprint(defs.PRINT_LOW, s) engine.bprint(defs.PRINT_LOW, ' seconds remaining!\012') defs.activator = qc.other subs.SUB_UseTargets() # fire all targets / killtargets
def TeamDropFlag(flg, *qwp_extra): p = flg.owner engine.bprint(defs.PRINT_HIGH, p.netname) if p.steam == TEAM_COLOR1: engine.bprint(defs.PRINT_HIGH, " \354\357\363\364 the \302\314\325\305 flag!\012") # blue else: engine.bprint(defs.PRINT_HIGH, " \354\357\363\364 the \322\305\304 flag!\012") # red p.effects -= p.effects & (defs.EF_FLAG1 | defs.EF_FLAG2) flg.origin = p.origin - Vector(0, 0, 24) flg.cnt = FLAG_DROPPED flg.velocity %= Vector(None, None, 300) flg.velocity %= Vector(0, None, None) flg.velocity %= Vector(None, 0, None) flg.flags = defs.FL_ITEM flg.solid = defs.SOLID_TRIGGER flg.movetype = defs.MOVETYPE_TOSS flg.setmodel(flg.mdl) qc.setsize(qc.self, Vector(-16, -16, 0), Vector(16, 16, 74)) # return it after so long flg.super_time = qc.time + TEAM_CAPTURE_FLAG_RETURN_TIME
def TeamDropFlag(flg, *qwp_extra): p = flg.owner engine.bprint(defs.PRINT_HIGH, p.netname) if p.steam == TEAM_COLOR1: engine.bprint( defs.PRINT_HIGH, ' \354\357\363\364 the \302\314\325\305 flag!\012') # blue else: engine.bprint(defs.PRINT_HIGH, ' \354\357\363\364 the \322\305\304 flag!\012') # red p.effects -= p.effects & (defs.EF_FLAG1 | defs.EF_FLAG2) flg.origin = p.origin - Vector(0, 0, 24) flg.cnt = FLAG_DROPPED flg.velocity %= Vector(None, None, 300) flg.velocity %= Vector(0, None, None) flg.velocity %= Vector(None, 0, None) flg.flags = defs.FL_ITEM flg.solid = defs.SOLID_TRIGGER flg.movetype = defs.MOVETYPE_TOSS flg.setmodel(flg.mdl) qc.setsize(qc.self, Vector(-16, -16, 0), Vector(16, 16, 74)) # return it after so long flg.super_time = qc.time + TEAM_CAPTURE_FLAG_RETURN_TIME
def TeamCaptureFlagTouch(*qwp_extra): global last_flag_capture global last_capture_team if qc.other.classname != 'player': return if qc.other.health <= 0: return if qc.self.steam == qc.other.steam: # same team, if the flag is *not* at the base, return # it to base. we overload the 'cnt' field for this if qc.self.cnt == FLAG_AT_BASE: # the flag is at home base. if the player has the enemy # flag, he's just won! if qc.other.player_flag & defs.ITEM_ENEMY_FLAG: engine.bprint(defs.PRINT_HIGH, qc.other.netname) if qc.other.steam == TEAM_COLOR1: engine.bprint( defs.PRINT_HIGH, ' \343\341\360\364\365\362\345\344 the \302\314\325\305 flag!\012' ) # blue else: engine.bprint( defs.PRINT_HIGH, ' \343\341\360\364\365\362\345\344 the \322\305\304 flag!\012' ) # red qc.other.items -= qc.other.items & (defs.IT_KEY1 | defs.IT_KEY2) last_flag_capture = qc.time last_capture_team = qc.other.steam qc.other.sound(defs.CHAN_VOICE, 'misc/flagcap.wav', 1, defs.ATTN_NONE) # other gets another 10 frag bonus qc.other.frags += TEAM_CAPTURE_CAPTURE_BONUS # possum: 3 loops in one LoopThroughPlayersAfterCapture() # respawn flags TeamCaptureRegenFlags() return return # its at home base already # hey, its not home. return it by teleporting it back engine.bprint(defs.PRINT_HIGH, qc.other.netname) if qc.other.steam == TEAM_COLOR1: engine.bprint( defs.PRINT_HIGH, ' \362\345\364\365\362\356\345\344 the \322\305\304 flag!\012' ) # red else: engine.bprint( defs.PRINT_HIGH, ' \362\345\364\365\362\356\345\344 the \302\314\325\305 flag!\012' ) # blue qc.other.frags += TEAM_CAPTURE_RECOVERY_BONUS # *XXX* EXPERT CTF set time when player last returned his flag qc.other.last_returned_flag = qc.time qc.other.sound(defs.CHAN_ITEM, qc.self.noise1, 1, defs.ATTN_NORM) TeamCaptureReturnFlag(qc.self) return # hey, its not our flag, pick it up engine.bprint(defs.PRINT_HIGH, qc.other.netname) if qc.other.steam == TEAM_COLOR1: engine.bprint(defs.PRINT_HIGH, ' \347\357\364 the \302\314\325\305 flag!\012') # blue else: engine.bprint(defs.PRINT_HIGH, ' \347\357\364 the \322\305\304 flag!\012') # red if TEAM_CAPTURE_FLAG_BONUS: qc.other.frags += TEAM_CAPTURE_FLAG_BONUS # TeamPlayerUpdate(other, "YOU GOT THE ENEMY FLAG!\n\nRETURN TO BASE!"); status.TeamPlayerUpdate( qc.other, '\331\317\325 \307\317\324 \324\310\305 \305\316\305\315\331 \306\314\301\307\012\012\322\305\324\325\322\316 \324\317 \302\301\323\305' ) qc.other.sound(defs.CHAN_ITEM, qc.self.noise, 1, defs.ATTN_NORM) qc.other.player_flag += defs.ITEM_ENEMY_FLAG qc.other.items |= qc.self.items # *XXX* EXPERT CTF set the time at which the carrier picked up the flag qc.other.flag_since = qc.time # pick up the flag qc.self.cnt = FLAG_CARRIED qc.self.solid = defs.SOLID_NOT qc.self.owner = qc.other if qc.self.steam == TEAM_COLOR1: qc.self.owner.effects |= defs.EF_FLAG1 else: # must be other team qc.self.owner.effects |= defs.EF_FLAG2 qc.self.setmodel(None) p = qc.find(qc.world, 'classname', 'player') while p != qc.world: if p != qc.other: if p.steam != qc.other.steam: status.TeamPlayerUpdate(p, 'Your flag has been taken!') elif p.steam == qc.other.steam: status.TeamPlayerUpdate(p, 'Your team has the enemy flag!') p = qc.find(p, 'classname', 'player')
def TeamEndScore(*qwp_extra): if defs.gamestart: return teamplay.lastteamscrtime = 0 TeamCaptureCheckUpdate() if teamplay.teamscr1 > teamplay.teamscr2: engine.bprint(defs.PRINT_HIGH, '\322\305\304 team won the level with ') s = str(teamplay.teamscr1) engine.bprint(defs.PRINT_HIGH, s) engine.bprint(defs.PRINT_HIGH, ' points!\012') engine.bprint(defs.PRINT_HIGH, '\302\314\325\305 team lost with ') s = str(teamplay.teamscr2) engine.bprint(defs.PRINT_HIGH, s) engine.bprint(defs.PRINT_HIGH, ' points.\012') elif teamplay.teamscr1 < teamplay.teamscr2: engine.bprint(defs.PRINT_HIGH, '\302\314\325\305 team won the level with ') s = str(teamplay.teamscr2) engine.bprint(defs.PRINT_HIGH, s) engine.bprint(defs.PRINT_HIGH, ' points!\012') engine.bprint(defs.PRINT_HIGH, '\322\305\304 team lost with ') s = str(teamplay.teamscr1) engine.bprint(defs.PRINT_HIGH, s) engine.bprint(defs.PRINT_HIGH, ' points.\012') else: engine.bprint(defs.PRINT_HIGH, '\302\314\325\305 and \322\305\304 team tied level with ') s = str(teamplay.teamscr1) engine.bprint(defs.PRINT_HIGH, s) engine.bprint(defs.PRINT_HIGH, ' points!\012')
def SpectatorDisconnect(*qwp_extra): engine.bprint(defs.PRINT_MEDIUM, "Spectator ") engine.bprint(defs.PRINT_MEDIUM, qc.self.netname) engine.bprint(defs.PRINT_MEDIUM, " left the game\012") qc.self.statstate = 0
def BackpackTouch(*qwp_extra): s = None best = 0 old = 0 new = 0 stemp = engine.world acount = 0 b_switch = 0 if defs.deathmatch == 4: if qc.other.invincible_time > 0: return if (qc.stof(qc.other.infokey('b_switch'))) == 0: b_switch = 8 else: b_switch = qc.stof(qc.other.infokey('b_switch')) if qc.other.classname != 'player': return if qc.other.health <= 0: return acount = 0 qc.other.sprint(defs.PRINT_LOW, 'You get ') if defs.deathmatch == 4: qc.other.health += 10 qc.other.sprint(defs.PRINT_LOW, '10 additional health\012') if (qc.other.health > 250) and (qc.other.health < 300): qc.other.sound(defs.CHAN_ITEM, 'items/protect3.wav', 1, defs.ATTN_NORM) else: qc.other.sound(defs.CHAN_ITEM, 'weapons/lock4.wav', 1, defs.ATTN_NORM) qc.other.stuffcmd('bf\012') qc.self.remove() if qc.other.health > 299: if qc.other.invincible_time != 1: qc.other.invincible_time = 1 qc.other.invincible_finished = qc.time + 30 qc.other.items |= defs.IT_INVULNERABILITY qc.other.super_time = 1 qc.other.super_damage_finished = qc.time + 30 qc.other.items |= defs.IT_QUAD qc.other.ammo_cells = 0 qc.other.sound(defs.CHAN_VOICE, 'boss1/sight1.wav', 1, defs.ATTN_NORM) qc.other.stuffcmd('bf\012') engine.bprint(defs.PRINT_HIGH, qc.other.netname) engine.bprint(defs.PRINT_HIGH, ' attains bonus powers!!!\012') qc.self = qc.other return if qc.self.items: if (qc.other.items & qc.self.items) == 0: acount = 1 qc.other.sprint(defs.PRINT_LOW, 'the ') qc.other.sprint(defs.PRINT_LOW, qc.self.netname) # if the player was using his best weapon, change up to the new one if better stemp = qc.self qc.self = qc.other best = weapons.W_BestWeapon() qc.self = stemp # change weapons qc.other.ammo_shells += qc.self.ammo_shells qc.other.ammo_nails += qc.self.ammo_nails qc.other.ammo_rockets += qc.self.ammo_rockets qc.other.ammo_cells += qc.self.ammo_cells new = qc.self.items if not new: new = qc.other.weapon old = qc.other.items qc.other.items |= qc.self.items bound_other_ammo() if qc.self.ammo_shells: if acount: qc.other.sprint(defs.PRINT_LOW, ', ') acount = 1 s = str(qc.self.ammo_shells) qc.other.sprint(defs.PRINT_LOW, s) qc.other.sprint(defs.PRINT_LOW, ' shells') if qc.self.ammo_nails: if acount: qc.other.sprint(defs.PRINT_LOW, ', ') acount = 1 s = str(qc.self.ammo_nails) qc.other.sprint(defs.PRINT_LOW, s) qc.other.sprint(defs.PRINT_LOW, ' nails') if qc.self.ammo_rockets: if acount: qc.other.sprint(defs.PRINT_LOW, ', ') acount = 1 s = str(qc.self.ammo_rockets) qc.other.sprint(defs.PRINT_LOW, s) qc.other.sprint(defs.PRINT_LOW, ' rockets') if qc.self.ammo_cells: if acount: qc.other.sprint(defs.PRINT_LOW, ', ') acount = 1 s = str(qc.self.ammo_cells) qc.other.sprint(defs.PRINT_LOW, s) qc.other.sprint(defs.PRINT_LOW, ' cells') if (defs.deathmatch == 3 or defs.deathmatch == 5) & ( (WeaponCode(new) == 6) or (WeaponCode(new) == 7)) & (qc.other.ammo_rockets < 5): qc.other.ammo_rockets = 5 qc.other.sprint(defs.PRINT_LOW, '\012') # backpack touch sound qc.other.sound(defs.CHAN_ITEM, 'weapons/lock4.wav', 1, defs.ATTN_NORM) qc.other.stuffcmd('bf\012') qc.self.remove() qc.self = qc.other # change to the weapon if WeaponCode(new) <= b_switch: if qc.self.flags & defs.FL_INWATER: if new != defs.IT_LIGHTNING: Deathmatch_Weapon(old, new) else: Deathmatch_Weapon(old, new) weapons.W_SetCurrentAmmo()
def RuneTouch(*qwp_extra): if qc.other.classname != 'player': return if qc.other.health <= 0: return if qc.other.player_flag & defs.ITEM_RUNE_MASK: if qc.other.rune_notice_time < qc.time: status.TeamPlayerUpdate(qc.other, 'You already have a rune.') qc.other.rune_notice_time = qc.time + 5 return # one per customer qc.other.player_flag |= qc.self.player_flag # notification of rune, no nofity in team mode if qc.self.player_flag & defs.ITEM_RUNE1_FLAG: qc.self.items |= defs.IT_SIGIL1 if defs.teamplay == 0: engine.bprint(defs.PRINT_LOW, qc.other.netname) engine.bprint(defs.PRINT_LOW, ' got the rune of \305\341\362\364\350 \315\341\347\351\343!\012') status.TeamPlayerUpdate(qc.other, '\305\341\362\364\350 \315\341\347\351\343! \322\345\363\351\363\364\341\356\343\345') if qc.self.player_flag & defs.ITEM_RUNE2_FLAG: qc.self.items |= defs.IT_SIGIL2 if defs.teamplay == 0: engine.bprint(defs.PRINT_LOW, qc.other.netname) engine.bprint(defs.PRINT_LOW, ' got the rune of \302\354\341\343\353 \315\341\347\351\343!\012') status.TeamPlayerUpdate(qc.other, '\302\354\341\343\353 \315\341\347\351\343! \323\364\362\345\356\347\364\350') if qc.self.player_flag & defs.ITEM_RUNE3_FLAG: qc.self.items |= defs.IT_SIGIL3 if defs.teamplay == 0: engine.bprint(defs.PRINT_LOW, qc.other.netname) engine.bprint(defs.PRINT_LOW, ' got the rune of \310\345\354\354 \315\341\347\351\343!\012') status.TeamPlayerUpdate(qc.other, '\310\345\354\354 \315\341\347\351\343! \310\341\363\364\345') qc.other.maxspeed *= 1.25 if qc.self.player_flag & defs.ITEM_RUNE4_FLAG: qc.self.items |= defs.IT_SIGIL4 if defs.teamplay == 0: engine.bprint(defs.PRINT_LOW, qc.other.netname) engine.bprint(defs.PRINT_LOW, ' got the rune of \305\354\344\345\362 \315\341\347\351\343!\012') status.TeamPlayerUpdate(qc.other, '\305\354\344\345\362 \315\341\347\351\343! \322\345\347\345\356\345\362\341\364\351\357\356') # backpack touch sound qc.other.sound(defs.CHAN_ITEM, 'weapons/lock4.wav', 1, defs.ATTN_NORM) qc.other.stuffcmd('bf\012') qc.self.remove()
def ClientObituary(targ, attacker, *qwp_extra): rnum = 0 deathstring = None deathstring2 = None s = None attackerteam = None targteam = None rnum = random.random() # ZOID 12-13-96: self.team doesn't work in QW. Use keys attackerteam = attacker.infokey('team') targteam = targ.infokey('team') if targ.classname == 'player': if defs.deathmatch > 3: if targ.deathtype == 'selfwater': engine.bprint(defs.PRINT_MEDIUM, targ.netname) engine.bprint(defs.PRINT_MEDIUM, ' electrocutes himself.\012 ') targ.frags -= 1 return if attacker.classname == 'teledeath': engine.bprint(defs.PRINT_MEDIUM, targ.netname) engine.bprint(defs.PRINT_MEDIUM, ' was telefragged by ') engine.bprint(defs.PRINT_MEDIUM, attacker.owner.netname) engine.bprint(defs.PRINT_MEDIUM, '\012') attacker.owner.logfrag(targ) attacker.owner.frags += 1 return if attacker.classname == 'teledeath2': engine.bprint(defs.PRINT_MEDIUM, "Satan's power deflects ") engine.bprint(defs.PRINT_MEDIUM, targ.netname) engine.bprint(defs.PRINT_MEDIUM, "'s telefrag\012") targ.frags -= 1 targ.logfrag(targ) return # double 666 telefrag (can happen often in deathmatch 4) if attacker.classname == 'teledeath3': engine.bprint(defs.PRINT_MEDIUM, targ.netname) engine.bprint(defs.PRINT_MEDIUM, ' was telefragged by ') engine.bprint(defs.PRINT_MEDIUM, attacker.owner.netname) engine.bprint(defs.PRINT_MEDIUM, "'s Satan's power\012") targ.frags -= 1 targ.logfrag(targ) return if targ.deathtype == 'squish': if defs.teamplay and targteam == attackerteam and attackerteam != None and targ != attacker: attacker.logfrag(attacker) attacker.frags -= 1 engine.bprint(defs.PRINT_MEDIUM, attacker.netname) engine.bprint(defs.PRINT_MEDIUM, ' squished a teammate\012') return elif attacker.classname == 'player' and attacker != targ: engine.bprint(defs.PRINT_MEDIUM, attacker.netname) engine.bprint(defs.PRINT_MEDIUM, ' squishes ') engine.bprint(defs.PRINT_MEDIUM, targ.netname) engine.bprint(defs.PRINT_MEDIUM, '\012') attacker.logfrag(targ) attacker.frags += 1 return else: targ.logfrag(targ) targ.frags -= 1 # killed self engine.bprint(defs.PRINT_MEDIUM, targ.netname) engine.bprint(defs.PRINT_MEDIUM, ' was squished\012') return if attacker.classname == 'player': if targ == attacker: # killed self attacker.logfrag(attacker) attacker.frags -= 1 engine.bprint(defs.PRINT_MEDIUM, targ.netname) if targ.deathtype == 'grenade': engine.bprint(defs.PRINT_MEDIUM, ' tries to put the pin back in\012') elif targ.deathtype == 'rocket': engine.bprint(defs.PRINT_MEDIUM, ' becomes bored with life\012') elif targ.weapon == 64 and targ.waterlevel > 1: if targ.watertype == defs.CONTENT_SLIME: engine.bprint(defs.PRINT_MEDIUM, ' discharges into the slime\012') elif targ.watertype == defs.CONTENT_LAVA: engine.bprint(defs.PRINT_MEDIUM, ' discharges into the lava\012') else: engine.bprint(defs.PRINT_MEDIUM, ' discharges into the water.\012') else: engine.bprint(defs.PRINT_MEDIUM, ' becomes bored with life\012') return elif (defs.teamplay == 2) and (targteam == attackerteam) and (attackerteam != None): if rnum < 0.25: deathstring = ' mows down a teammate\012' elif rnum < 0.50: deathstring = ' checks his glasses\012' elif rnum < 0.75: deathstring = ' gets a frag for the other team\012' else: deathstring = ' loses another friend\012' engine.bprint(defs.PRINT_MEDIUM, attacker.netname) engine.bprint(defs.PRINT_MEDIUM, deathstring) attacker.frags -= 1 # ZOID 12-13-96: killing a teammate logs as suicide attacker.logfrag(attacker) return else: attacker.logfrag(targ) attacker.frags += 1 rnum = attacker.weapon if targ.deathtype == 'nail': deathstring = ' was nailed by ' deathstring2 = '\012' elif targ.deathtype == 'supernail': deathstring = ' was punctured by ' deathstring2 = '\012' elif targ.deathtype == 'grenade': deathstring = ' eats ' deathstring2 = "'s pineapple\012" if targ.health < -40: deathstring = ' was gibbed by ' deathstring2 = "'s grenade\012" elif targ.deathtype == 'rocket': if attacker.super_damage_finished > 0 and targ.health < -40: rnum = random.random() if rnum < 0.3: deathstring = ' was brutalized by ' elif rnum < 0.6: deathstring = ' was smeared by ' else: engine.bprint(defs.PRINT_MEDIUM, attacker.netname) engine.bprint(defs.PRINT_MEDIUM, ' rips ') engine.bprint(defs.PRINT_MEDIUM, targ.netname) engine.bprint(defs.PRINT_MEDIUM, ' a new one\012') return deathstring2 = "'s quad rocket\012" else: deathstring = ' rides ' deathstring2 = "'s rocket\012" if targ.health < -40: deathstring = ' was gibbed by ' deathstring2 = "'s rocket\012" elif rnum == defs.IT_AXE: deathstring = ' was ax-murdered by ' deathstring2 = '\012' elif rnum == defs.IT_SHOTGUN: deathstring = ' chewed on ' deathstring2 = "'s boomstick\012" elif rnum == defs.IT_SUPER_SHOTGUN: deathstring = ' ate 2 loads of ' deathstring2 = "'s buckshot\012" elif rnum == defs.IT_LIGHTNING: deathstring = ' accepts ' if attacker.waterlevel > 1: deathstring2 = "'s discharge\012" else: deathstring2 = "'s shaft\012" engine.bprint(defs.PRINT_MEDIUM, targ.netname) engine.bprint(defs.PRINT_MEDIUM, deathstring) engine.bprint(defs.PRINT_MEDIUM, attacker.netname) engine.bprint(defs.PRINT_MEDIUM, deathstring2) return else: targ.logfrag(targ) targ.frags -= 1 # killed self rnum = targ.watertype engine.bprint(defs.PRINT_MEDIUM, targ.netname) if rnum == -3: if random.random() < 0.5: engine.bprint(defs.PRINT_MEDIUM, ' sleeps with the fishes\012') else: engine.bprint(defs.PRINT_MEDIUM, ' sucks it down\012') return elif rnum == -4: if random.random() < 0.5: engine.bprint(defs.PRINT_MEDIUM, ' gulped a load of slime\012') else: engine.bprint(defs.PRINT_MEDIUM, " can't exist on slime alone\012") return elif rnum == -5: if targ.health < -15: engine.bprint(defs.PRINT_MEDIUM, ' burst into flames\012') return if random.random() < 0.5: engine.bprint(defs.PRINT_MEDIUM, ' turned into hot slag\012') else: engine.bprint(defs.PRINT_MEDIUM, ' visits the Volcano God\012') return if attacker.classname == 'explo_box': engine.bprint(defs.PRINT_MEDIUM, ' blew up\012') return if targ.deathtype == 'falling': engine.bprint(defs.PRINT_MEDIUM, ' fell to his death\012') return if targ.deathtype == 'nail' or targ.deathtype == 'supernail': engine.bprint(defs.PRINT_MEDIUM, ' was spiked\012') return if targ.deathtype == 'laser': engine.bprint(defs.PRINT_MEDIUM, ' was zapped\012') return if attacker.classname == 'fireball': engine.bprint(defs.PRINT_MEDIUM, ' ate a lavaball\012') return if attacker.classname == 'trigger_changelevel': engine.bprint(defs.PRINT_MEDIUM, ' tried to leave\012') return engine.bprint(defs.PRINT_MEDIUM, ' died\012')
def SpectatorConnect(*qwp_extra): engine.bprint(defs.PRINT_MEDIUM, 'Spectator ') engine.bprint(defs.PRINT_MEDIUM, qc.self.netname) engine.bprint(defs.PRINT_MEDIUM, ' entered the game\012') qc.self.goalentity = qc.world # used for impulse 1 below
def SpectatorDisconnect(*qwp_extra): engine.bprint(defs.PRINT_MEDIUM, 'Spectator ') engine.bprint(defs.PRINT_MEDIUM, qc.self.netname) engine.bprint(defs.PRINT_MEDIUM, ' left the game\012')
def TeamEndScore(*qwp_extra): if defs.gamestart: return teamplay.lastteamscrtime = 0 TeamCaptureCheckUpdate() if teamplay.teamscr1 > teamplay.teamscr2: engine.bprint(defs.PRINT_HIGH, '\322\305\304 team won the level with ') s = str(teamplay.teamscr1) engine.bprint(defs.PRINT_HIGH, s) engine.bprint(defs.PRINT_HIGH, ' points!\012') engine.bprint(defs.PRINT_HIGH, '\302\314\325\305 team lost with ') s = str(teamplay.teamscr2) engine.bprint(defs.PRINT_HIGH, s) engine.bprint(defs.PRINT_HIGH, ' points.\012') elif teamplay.teamscr1 < teamplay.teamscr2: engine.bprint(defs.PRINT_HIGH, '\302\314\325\305 team won the level with ') s = str(teamplay.teamscr2) engine.bprint(defs.PRINT_HIGH, s) engine.bprint(defs.PRINT_HIGH, ' points!\012') engine.bprint(defs.PRINT_HIGH, '\322\305\304 team lost with ') s = str(teamplay.teamscr1) engine.bprint(defs.PRINT_HIGH, s) engine.bprint(defs.PRINT_HIGH, ' points.\012') else: engine.bprint( defs.PRINT_HIGH, '\302\314\325\305 and \322\305\304 team tied level with ') s = str(teamplay.teamscr1) engine.bprint(defs.PRINT_HIGH, s) engine.bprint(defs.PRINT_HIGH, ' points!\012')
def TeamCheckLock(*qwp_extra): n = 0 s = None t = None pteam = 0 # Don't do anything if teamplay is negative if defs.teamplay < 0: return if defs.gamestart: s = qc.self.infokey('bottomcolor') pteam = qc.stof(s) if pteam != 0: qc.self.stuffcmd('setinfo bottomcolor 0\012') qc.self.steam = -1 return if qc.self.player_flag & defs.TEAM_STUFF_COLOR: qc.self.player_flag -= defs.TEAM_STUFF_COLOR s = str(qc.self.steam) qc.self.stuffcmd('setinfo bottomcolor ') qc.self.stuffcmd(s) qc.self.stuffcmd('\012') s = qc.self.infokey('topcolor') n = qc.stof(s) if CrossDressCheck(n, qc.self.steam): s = str(qc.self.steam) qc.self.stuffcmd('setinfo topcolor ') qc.self.stuffcmd(s) qc.self.stuffcmd('\012') s = GetShortTeamColor(qc.self.steam) qc.self.stuffcmd('setinfo team ') qc.self.stuffcmd(s) qc.self.stuffcmd('\012') if defs.teamplay & TEAM_CAPTURE_FLAG: qc.self.stuffcmd('setinfo skin ') qc.self.stuffcmd(qc.self.ctfskin) qc.self.stuffcmd('\012') qc.self.lastteamset = qc.time return s = qc.self.infokey('bottomcolor') pteam = qc.stof(s) # Check to see if the player has changed skins if qc.self.steam > 0 and qc.time - qc.self.lastteamset > 2: if defs.teamplay & TEAM_CAPTURE_FLAG: if qc.self.infokey('skin') != qc.self.ctfskin: qc.self.stuffcmd('setinfo skin ') qc.self.stuffcmd(qc.self.ctfskin) qc.self.stuffcmd('\012') qc.self.lastteamset = qc.time s = GetShortTeamColor(qc.self.steam) if qc.self.infokey('team') != s: qc.self.stuffcmd('setinfo team ') qc.self.stuffcmd(s) qc.self.stuffcmd('\012') qc.self.lastteamset = qc.time # check for crossdressing s = qc.self.infokey('topcolor') n = qc.stof(s) if CrossDressCheck(n, qc.self.steam): s = str(qc.self.steam) qc.self.stuffcmd('setinfo topcolor ') qc.self.stuffcmd(s) qc.self.stuffcmd('\012') return # Check to see if the player has changed colors if qc.time - qc.self.lastteamset > 2 and pteam != qc.self.steam: # Player has changed colors # If teams are static and we've been on some team already, # put us back on the team we were on. if (defs.teamplay & TEAM_STATIC_TEAMS) and (qc.self.steam >= 0): if TeamColorIsLegal(qc.self.steam): # changing teams sucks, kill him # if he has tried to change teams several # times, kick him off the server. if qc.self.suicide_count > 3: qc.self.sprint( defs.PRINT_HIGH, "You were told you can't change teams.\012Go play color games somewhere else.\012" ) qc.self.stuffcmd('disconnect\012') engine.bprint(defs.PRINT_MEDIUM, qc.self.netname) engine.bprint(defs.PRINT_MEDIUM, ' has bad color sense\012') # case base respawn qc.self.killed = 99 combat.T_Damage(qc.self, qc.self, qc.self, 1000) # Kill the player qc.self.killed = 2 # trying to change teams counts as a suicide qc.self.suicide_count += 1 qc.self.logfrag(qc.self) # he pays for it qc.self.sprint(defs.PRINT_HIGH, 'You cannot change teams.\012') qc.self.stuffcmd('setinfo bottomcolor ') s = str(qc.self.steam) qc.self.stuffcmd(s) qc.self.stuffcmd('\012') qc.self.lastteamset = qc.time return else: # If we're on an illegal team, force a change. qc.self.steam = -1 elif not (defs.teamplay & TEAM_LOCK_COLORS): return if qc.self.steam >= 0: # case base respawn qc.self.killed = 99 combat.T_Damage(qc.self, qc.self, qc.self, 1000) # Kill the player qc.self.killed = 0 qc.self.steam = pteam qc.self.frags = 0 # Zero out frags TeamAssign()
def SpectatorDisconnect(*qwp_extra): engine.bprint(defs.PRINT_MEDIUM, 'Spectator ') engine.bprint(defs.PRINT_MEDIUM, qc.self.netname) engine.bprint(defs.PRINT_MEDIUM, ' left the game\012') qc.self.statstate = 0
def ClientConnect(*qwp_extra): engine.bprint(defs.PRINT_HIGH, qc.self.netname) engine.bprint(defs.PRINT_HIGH, ' entered the game\012') # a client connecting during an intermission can cause problems if intermission_running: GotoNextMap()
def PlayerDie(*qwp_extra): i = 0 s = None qc.self.items -= qc.self.items & defs.IT_INVISIBILITY if (qc.stof(qc.world.infokey("dq"))) != 0: if qc.self.super_damage_finished > 0: items.DropQuad(qc.self.super_damage_finished - qc.time) engine.bprint(defs.PRINT_LOW, qc.self.netname) if defs.deathmatch == 4: engine.bprint(defs.PRINT_LOW, " lost an OctaPower with ") else: engine.bprint(defs.PRINT_LOW, " lost a quad with ") s = str(round(qc.self.super_damage_finished - qc.time)) engine.bprint(defs.PRINT_LOW, s) engine.bprint(defs.PRINT_LOW, " seconds remaining\012") if (qc.stof(qc.world.infokey("dr"))) != 0: if qc.self.invisible_finished > 0: engine.bprint(defs.PRINT_LOW, qc.self.netname) engine.bprint(defs.PRINT_LOW, " lost a ring with ") s = str(round(qc.self.invisible_finished - qc.time)) engine.bprint(defs.PRINT_LOW, s) engine.bprint(defs.PRINT_LOW, " seconds remaining\012") items.DropRing(qc.self.invisible_finished - qc.time) qc.self.invisible_finished = 0 # don't die as eyes qc.self.invincible_finished = 0 qc.self.super_damage_finished = 0 qc.self.radsuit_finished = 0 qc.self.modelindex = client.modelindex_player # don't use eyes items.DropBackpack() qc.self.weaponmodel = None qc.self.view_ofs = Vector(0, 0, -8) qc.self.deadflag = defs.DEAD_DYING qc.self.solid = defs.SOLID_NOT qc.self.flags -= qc.self.flags & defs.FL_ONGROUND qc.self.movetype = defs.MOVETYPE_TOSS if qc.self.velocity.z < 10: qc.self.velocity %= Vector(None, None, qc.self.velocity.z + random.random() * 300) if qc.self.health < -40: GibPlayer() return DeathSound() qc.self.angles %= Vector(0, None, None) qc.self.angles %= Vector(None, None, 0) if qc.self.weapon == defs.IT_AXE: player_die_ax1() return i = engine.cvar("temp1") if not i: i = 1 + math.floor(random.random() * 6) if i == 1: player_diea1() elif i == 2: player_dieb1() elif i == 3: player_diec1() elif i == 4: player_died1() else: player_diee1()
def BackpackTouch(*qwp_extra): s = None best = 0 old = 0 new = 0 stemp = engine.world acount = 0 b_switch = 0 if defs.deathmatch == 4: if qc.other.invincible_time > 0: return if (qc.stof(qc.other.infokey('b_switch'))) == 0: b_switch = 8 else: b_switch = qc.stof(qc.other.infokey('b_switch')) if qc.other.classname != 'player': return if qc.other.health <= 0: return acount = 0 qc.other.sprint(defs.PRINT_LOW, 'You get ') if defs.deathmatch == 4: qc.other.health += 10 qc.other.sprint(defs.PRINT_LOW, '10 additional health\012') if (qc.other.health > 250) and (qc.other.health < 300): qc.other.sound(defs.CHAN_ITEM, 'items/protect3.wav', 1, defs.ATTN_NORM) else: qc.other.sound(defs.CHAN_ITEM, 'weapons/lock4.wav', 1, defs.ATTN_NORM) qc.other.stuffcmd('bf\012') qc.self.remove() if qc.other.health > 299: if qc.other.invincible_time != 1: qc.other.invincible_time = 1 qc.other.invincible_finished = qc.time + 30 qc.other.items |= defs.IT_INVULNERABILITY qc.other.super_time = 1 qc.other.super_damage_finished = qc.time + 30 qc.other.items |= defs.IT_QUAD qc.other.ammo_cells = 0 qc.other.sound(defs.CHAN_VOICE, 'boss1/sight1.wav', 1, defs.ATTN_NORM) qc.other.stuffcmd('bf\012') engine.bprint(defs.PRINT_HIGH, qc.other.netname) engine.bprint(defs.PRINT_HIGH, ' attains bonus powers!!!\012') qc.self = qc.other return if qc.self.items: if (qc.other.items & qc.self.items) == 0: acount = 1 qc.other.sprint(defs.PRINT_LOW, 'the ') qc.other.sprint(defs.PRINT_LOW, qc.self.netname) # if the player was using his best weapon, change up to the new one if better stemp = qc.self qc.self = qc.other best = weapons.W_BestWeapon() qc.self = stemp # change weapons qc.other.ammo_shells += qc.self.ammo_shells qc.other.ammo_nails += qc.self.ammo_nails qc.other.ammo_rockets += qc.self.ammo_rockets qc.other.ammo_cells += qc.self.ammo_cells new = qc.self.items if not new: new = qc.other.weapon old = qc.other.items qc.other.items |= qc.self.items bound_other_ammo() if qc.self.ammo_shells: if acount: qc.other.sprint(defs.PRINT_LOW, ', ') acount = 1 s = str(qc.self.ammo_shells) qc.other.sprint(defs.PRINT_LOW, s) qc.other.sprint(defs.PRINT_LOW, ' shells') if qc.self.ammo_nails: if acount: qc.other.sprint(defs.PRINT_LOW, ', ') acount = 1 s = str(qc.self.ammo_nails) qc.other.sprint(defs.PRINT_LOW, s) qc.other.sprint(defs.PRINT_LOW, ' nails') if qc.self.ammo_rockets: if acount: qc.other.sprint(defs.PRINT_LOW, ', ') acount = 1 s = str(qc.self.ammo_rockets) qc.other.sprint(defs.PRINT_LOW, s) qc.other.sprint(defs.PRINT_LOW, ' rockets') if qc.self.ammo_cells: if acount: qc.other.sprint(defs.PRINT_LOW, ', ') acount = 1 s = str(qc.self.ammo_cells) qc.other.sprint(defs.PRINT_LOW, s) qc.other.sprint(defs.PRINT_LOW, ' cells') if (defs.deathmatch == 3 or defs.deathmatch == 5) & ((WeaponCode(new) == 6) or (WeaponCode(new) == 7)) & (qc.other.ammo_rockets < 5): qc.other.ammo_rockets = 5 qc.other.sprint(defs.PRINT_LOW, '\012') # backpack touch sound qc.other.sound(defs.CHAN_ITEM, 'weapons/lock4.wav', 1, defs.ATTN_NORM) qc.other.stuffcmd('bf\012') qc.self.remove() qc.self = qc.other # change to the weapon if WeaponCode(new) <= b_switch: if qc.self.flags & defs.FL_INWATER: if new != defs.IT_LIGHTNING: Deathmatch_Weapon(old, new) else: Deathmatch_Weapon(old, new) weapons.W_SetCurrentAmmo()
def TeamCheckLock(*qwp_extra): n = 0 s = None t = None pteam = 0 # Don't do anything if teamplay is negative if defs.teamplay < 0: return if defs.gamestart: s = qc.self.infokey("bottomcolor") pteam = qc.stof(s) if pteam != 0: qc.self.stuffcmd("setinfo bottomcolor 0\012") qc.self.steam = -1 return if qc.self.player_flag & defs.TEAM_STUFF_COLOR: qc.self.player_flag -= defs.TEAM_STUFF_COLOR s = str(qc.self.steam) qc.self.stuffcmd("setinfo bottomcolor ") qc.self.stuffcmd(s) qc.self.stuffcmd("\012") s = qc.self.infokey("topcolor") n = qc.stof(s) if CrossDressCheck(n, qc.self.steam): s = str(qc.self.steam) qc.self.stuffcmd("setinfo topcolor ") qc.self.stuffcmd(s) qc.self.stuffcmd("\012") s = GetShortTeamColor(qc.self.steam) qc.self.stuffcmd("setinfo team ") qc.self.stuffcmd(s) qc.self.stuffcmd("\012") if defs.teamplay & TEAM_CAPTURE_FLAG: qc.self.stuffcmd("setinfo skin ") qc.self.stuffcmd(qc.self.ctfskin) qc.self.stuffcmd("\012") qc.self.lastteamset = qc.time return s = qc.self.infokey("bottomcolor") pteam = qc.stof(s) # Check to see if the player has changed skins if qc.self.steam > 0 and qc.time - qc.self.lastteamset > 2: if defs.teamplay & TEAM_CAPTURE_FLAG: if qc.self.infokey("skin") != qc.self.ctfskin: qc.self.stuffcmd("setinfo skin ") qc.self.stuffcmd(qc.self.ctfskin) qc.self.stuffcmd("\012") qc.self.lastteamset = qc.time s = GetShortTeamColor(qc.self.steam) if qc.self.infokey("team") != s: qc.self.stuffcmd("setinfo team ") qc.self.stuffcmd(s) qc.self.stuffcmd("\012") qc.self.lastteamset = qc.time # check for crossdressing s = qc.self.infokey("topcolor") n = qc.stof(s) if CrossDressCheck(n, qc.self.steam): s = str(qc.self.steam) qc.self.stuffcmd("setinfo topcolor ") qc.self.stuffcmd(s) qc.self.stuffcmd("\012") return # Check to see if the player has changed colors if qc.time - qc.self.lastteamset > 2 and pteam != qc.self.steam: # Player has changed colors # If teams are static and we've been on some team already, # put us back on the team we were on. if (defs.teamplay & TEAM_STATIC_TEAMS) and (qc.self.steam >= 0): if TeamColorIsLegal(qc.self.steam): # changing teams sucks, kill him # if he has tried to change teams several # times, kick him off the server. if qc.self.suicide_count > 3: qc.self.sprint( defs.PRINT_HIGH, "You were told you can't change teams.\012Go play color games somewhere else.\012", ) qc.self.stuffcmd("disconnect\012") engine.bprint(defs.PRINT_MEDIUM, qc.self.netname) engine.bprint(defs.PRINT_MEDIUM, " has bad color sense\012") # case base respawn qc.self.killed = 99 combat.T_Damage(qc.self, qc.self, qc.self, 1000) # Kill the player qc.self.killed = 2 # trying to change teams counts as a suicide qc.self.suicide_count += 1 qc.self.logfrag(qc.self) # he pays for it qc.self.sprint(defs.PRINT_HIGH, "You cannot change teams.\012") qc.self.stuffcmd("setinfo bottomcolor ") s = str(qc.self.steam) qc.self.stuffcmd(s) qc.self.stuffcmd("\012") qc.self.lastteamset = qc.time return else: # If we're on an illegal team, force a change. qc.self.steam = -1 elif not (defs.teamplay & TEAM_LOCK_COLORS): return if qc.self.steam >= 0: # case base respawn qc.self.killed = 99 combat.T_Damage(qc.self, qc.self, qc.self, 1000) # Kill the player qc.self.killed = 0 qc.self.steam = pteam qc.self.frags = 0 # Zero out frags TeamAssign()
def TeamCaptureFlagTouch(*qwp_extra): global last_flag_capture global last_capture_team if qc.other.classname != "player": return if qc.other.health <= 0: return if qc.self.steam == qc.other.steam: # same team, if the flag is *not* at the base, return # it to base. we overload the 'cnt' field for this if qc.self.cnt == FLAG_AT_BASE: # the flag is at home base. if the player has the enemy # flag, he's just won! if qc.other.player_flag & defs.ITEM_ENEMY_FLAG: engine.bprint(defs.PRINT_HIGH, qc.other.netname) if qc.other.steam == TEAM_COLOR1: engine.bprint( defs.PRINT_HIGH, " \343\341\360\364\365\362\345\344 the \302\314\325\305 flag!\012" ) # blue else: engine.bprint( defs.PRINT_HIGH, " \343\341\360\364\365\362\345\344 the \322\305\304 flag!\012" ) # red qc.other.items -= qc.other.items & (defs.IT_KEY1 | defs.IT_KEY2) last_flag_capture = qc.time last_capture_team = qc.other.steam qc.other.sound(defs.CHAN_VOICE, "misc/flagcap.wav", 1, defs.ATTN_NONE) # other gets another 10 frag bonus qc.other.frags += TEAM_CAPTURE_CAPTURE_BONUS # possum: 3 loops in one LoopThroughPlayersAfterCapture() # respawn flags TeamCaptureRegenFlags() return return # its at home base already # hey, its not home. return it by teleporting it back engine.bprint(defs.PRINT_HIGH, qc.other.netname) if qc.other.steam == TEAM_COLOR1: engine.bprint(defs.PRINT_HIGH, " \362\345\364\365\362\356\345\344 the \322\305\304 flag!\012") # red else: engine.bprint(defs.PRINT_HIGH, " \362\345\364\365\362\356\345\344 the \302\314\325\305 flag!\012") # blue qc.other.frags += TEAM_CAPTURE_RECOVERY_BONUS # *XXX* EXPERT CTF set time when player last returned his flag qc.other.last_returned_flag = qc.time qc.other.sound(defs.CHAN_ITEM, qc.self.noise1, 1, defs.ATTN_NORM) TeamCaptureReturnFlag(qc.self) return # hey, its not our flag, pick it up engine.bprint(defs.PRINT_HIGH, qc.other.netname) if qc.other.steam == TEAM_COLOR1: engine.bprint(defs.PRINT_HIGH, " \347\357\364 the \302\314\325\305 flag!\012") # blue else: engine.bprint(defs.PRINT_HIGH, " \347\357\364 the \322\305\304 flag!\012") # red if TEAM_CAPTURE_FLAG_BONUS: qc.other.frags += TEAM_CAPTURE_FLAG_BONUS # TeamPlayerUpdate(other, "YOU GOT THE ENEMY FLAG!\n\nRETURN TO BASE!"); status.TeamPlayerUpdate( qc.other, "\331\317\325 \307\317\324 \324\310\305 \305\316\305\315\331 \306\314\301\307\012\012\322\305\324\325\322\316 \324\317 \302\301\323\305", ) qc.other.sound(defs.CHAN_ITEM, qc.self.noise, 1, defs.ATTN_NORM) qc.other.player_flag += defs.ITEM_ENEMY_FLAG qc.other.items |= qc.self.items # *XXX* EXPERT CTF set the time at which the carrier picked up the flag qc.other.flag_since = qc.time # pick up the flag qc.self.cnt = FLAG_CARRIED qc.self.solid = defs.SOLID_NOT qc.self.owner = qc.other if qc.self.steam == TEAM_COLOR1: qc.self.owner.effects |= defs.EF_FLAG1 else: # must be other team qc.self.owner.effects |= defs.EF_FLAG2 qc.self.setmodel(None) p = qc.find(qc.world, "classname", "player") while p != qc.world: if p != qc.other: if p.steam != qc.other.steam: status.TeamPlayerUpdate(p, "Your flag has been taken!") elif p.steam == qc.other.steam: status.TeamPlayerUpdate(p, "Your team has the enemy flag!") p = qc.find(p, "classname", "player")
def PlayerDie(*qwp_extra): i = 0 s = None qc.self.items -= qc.self.items & defs.IT_INVISIBILITY if (qc.stof(qc.world.infokey('dq'))) != 0: if qc.self.super_damage_finished > 0: items.DropQuad(qc.self.super_damage_finished - qc.time) engine.bprint(defs.PRINT_LOW, qc.self.netname) if defs.deathmatch == 4: engine.bprint(defs.PRINT_LOW, ' lost an OctaPower with ') else: engine.bprint(defs.PRINT_LOW, ' lost a quad with ') s = str(round(qc.self.super_damage_finished - qc.time)) engine.bprint(defs.PRINT_LOW, s) engine.bprint(defs.PRINT_LOW, ' seconds remaining\012') if (qc.stof(qc.world.infokey('dr'))) != 0: if qc.self.invisible_finished > 0: engine.bprint(defs.PRINT_LOW, qc.self.netname) engine.bprint(defs.PRINT_LOW, ' lost a ring with ') s = str(round(qc.self.invisible_finished - qc.time)) engine.bprint(defs.PRINT_LOW, s) engine.bprint(defs.PRINT_LOW, ' seconds remaining\012') items.DropRing(qc.self.invisible_finished - qc.time) qc.self.invisible_finished = 0 # don't die as eyes qc.self.invincible_finished = 0 qc.self.super_damage_finished = 0 qc.self.radsuit_finished = 0 qc.self.modelindex = client.modelindex_player # don't use eyes items.DropBackpack() qc.self.weaponmodel = None qc.self.view_ofs = Vector(0, 0, -8) qc.self.deadflag = defs.DEAD_DYING qc.self.solid = defs.SOLID_NOT qc.self.flags -= qc.self.flags & defs.FL_ONGROUND qc.self.movetype = defs.MOVETYPE_TOSS if qc.self.velocity.z < 10: qc.self.velocity %= Vector(None, None, qc.self.velocity.z + random.random() * 300) if qc.self.health < -40: GibPlayer() return DeathSound() qc.self.angles %= Vector(0, None, None) qc.self.angles %= Vector(None, None, 0) if qc.self.weapon == defs.IT_AXE: player_die_ax1() return i = engine.cvar('temp1') if not i: i = 1 + math.floor(random.random() * 6) if i == 1: player_diea1() elif i == 2: player_dieb1() elif i == 3: player_diec1() elif i == 4: player_died1() else: player_diee1()