def weapon_touch(*qwp_extra): hadammo = 0 best = 0 new = 0 old = 0 stemp = engine.world leave = 0 # For client weapon_switch w_switch = 0 if not (qc.other.flags & defs.FL_CLIENT): return if (qc.stof(qc.other.infokey('w_switch'))) == 0: w_switch = 8 else: w_switch = qc.stof(qc.other.infokey('w_switch')) # 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 if defs.deathmatch == 2 or defs.deathmatch == 3 or defs.deathmatch == 5: leave = 1 else: leave = 0 if qc.self.classname == 'weapon_nailgun': if leave and (qc.other.items & defs.IT_NAILGUN): return hadammo = qc.other.ammo_nails new = defs.IT_NAILGUN qc.other.ammo_nails += 30 elif qc.self.classname == 'weapon_supernailgun': if leave and (qc.other.items & defs.IT_SUPER_NAILGUN): return hadammo = qc.other.ammo_rockets new = defs.IT_SUPER_NAILGUN qc.other.ammo_nails += 30 elif qc.self.classname == 'weapon_supershotgun': if leave and (qc.other.items & defs.IT_SUPER_SHOTGUN): return hadammo = qc.other.ammo_rockets new = defs.IT_SUPER_SHOTGUN qc.other.ammo_shells += 5 elif qc.self.classname == 'weapon_rocketlauncher': if leave and (qc.other.items & defs.IT_ROCKET_LAUNCHER): return hadammo = qc.other.ammo_rockets new = defs.IT_ROCKET_LAUNCHER qc.other.ammo_rockets += 5 elif qc.self.classname == 'weapon_grenadelauncher': if leave and (qc.other.items & defs.IT_GRENADE_LAUNCHER): return hadammo = qc.other.ammo_rockets new = defs.IT_GRENADE_LAUNCHER qc.other.ammo_rockets += 5 elif qc.self.classname == 'weapon_lightning': if leave and (qc.other.items & defs.IT_LIGHTNING): return hadammo = qc.other.ammo_rockets new = defs.IT_LIGHTNING qc.other.ammo_cells += 15 else: qc.objerror('weapon_touch: unknown classname') qc.other.sprint(defs.PRINT_LOW, 'You got the ') qc.other.sprint(defs.PRINT_LOW, qc.self.netname) qc.other.sprint(defs.PRINT_LOW, '\012') # weapon touch sound qc.other.sound(defs.CHAN_ITEM, 'weapons/pkup.wav', 1, defs.ATTN_NORM) qc.other.stuffcmd('bf\012') bound_other_ammo() # change to the weapon old = qc.other.items qc.other.items |= new stemp = qc.self qc.self = qc.other if WeaponCode(new) <= w_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() qc.self = stemp if leave: return if defs.deathmatch != 3 or defs.deathmatch != 5: # remove it in single player, or setup for respawning in deathmatch qc.self.model = defs.string_null qc.self.solid = defs.SOLID_NOT if defs.deathmatch != 2: qc.self.nextthink = qc.time + 30 qc.self.think = SUB_regen defs.activator = qc.other subs.SUB_UseTargets() # fire all targets / killtargets
def PutClientInServer(*qwp_extra): global modelindex_eyes global modelindex_player spot = engine.world s = None qc.self.classname = 'player' qc.self.health = 100 qc.self.takedamage = defs.DAMAGE_AIM qc.self.solid = defs.SOLID_SLIDEBOX qc.self.movetype = defs.MOVETYPE_WALK qc.self.show_hostile = 0 qc.self.max_health = 100 qc.self.flags = defs.FL_CLIENT qc.self.air_finished = qc.time + 12 qc.self.dmg = 2 # initial water damage qc.self.super_damage_finished = 0 qc.self.radsuit_finished = 0 qc.self.invisible_finished = 0 qc.self.invincible_finished = 0 qc.self.effects = 0 qc.self.invincible_time = 0 DecodeLevelParms() weapons.W_SetCurrentAmmo() qc.self.attack_finished = qc.time qc.self.th_pain = player.player_pain qc.self.th_die = player.PlayerDie qc.self.deadflag = defs.DEAD_NO # paustime is set by teleporters to keep the player from moving a while qc.self.pausetime = 0 spot = SelectSpawnPoint() qc.self.origin = spot.origin + Vector(0, 0, 1) qc.self.angles = spot.angles qc.self.fixangle = defs.TRUE # turn this way immediately # oh, this is a hack! qc.self.setmodel('progs/eyes.mdl') modelindex_eyes = qc.self.modelindex qc.self.setmodel('progs/player.mdl') modelindex_player = qc.self.modelindex qc.setsize(qc.self, defs.VEC_HULL_MIN, defs.VEC_HULL_MAX) qc.self.view_ofs = Vector(0, 0, 22) # Mod - Xian (May.20.97) # Bug where player would have velocity from their last kill qc.self.velocity = Vector(0, 0, 0) player.player_stand1() qc.makevectors(qc.self.angles) triggers.spawn_tfog(qc.self.origin + qc.v_forward * 20) triggers.spawn_tdeath(qc.self.origin, qc.self) # Set Rocket Jump Modifiers if qc.stof(qc.world.infokey('rj')) != 0: defs.rj = qc.stof(qc.world.infokey('rj')) if defs.deathmatch == 4: qc.self.ammo_shells = 0 if qc.stof(qc.world.infokey('axe')) == 0: qc.self.ammo_nails = 255 qc.self.ammo_shells = 255 qc.self.ammo_rockets = 255 qc.self.ammo_cells = 255 qc.self.items |= defs.IT_NAILGUN qc.self.items |= defs.IT_SUPER_NAILGUN qc.self.items |= defs.IT_SUPER_SHOTGUN qc.self.items |= defs.IT_ROCKET_LAUNCHER # self.items = self.items | IT_GRENADE_LAUNCHER; qc.self.items |= defs.IT_LIGHTNING qc.self.items = qc.self.items - (qc.self.items & (defs.IT_ARMOR1 | defs.IT_ARMOR2 | defs.IT_ARMOR3)) + defs.IT_ARMOR3 qc.self.armorvalue = 200 qc.self.armortype = 0.8 qc.self.health = 250 qc.self.items |= defs.IT_INVULNERABILITY qc.self.invincible_time = 1 qc.self.invincible_finished = qc.time + 3 if defs.deathmatch == 5: qc.self.ammo_nails = 80 qc.self.ammo_shells = 30 qc.self.ammo_rockets = 10 qc.self.ammo_cells = 30 qc.self.items |= defs.IT_NAILGUN qc.self.items |= defs.IT_SUPER_NAILGUN qc.self.items |= defs.IT_SUPER_SHOTGUN qc.self.items |= defs.IT_ROCKET_LAUNCHER qc.self.items |= defs.IT_GRENADE_LAUNCHER qc.self.items |= defs.IT_LIGHTNING qc.self.items = qc.self.items - (qc.self.items & (defs.IT_ARMOR1 | defs.IT_ARMOR2 | defs.IT_ARMOR3)) + defs.IT_ARMOR3 qc.self.armorvalue = 200 qc.self.armortype = 0.8 qc.self.health = 200 qc.self.items |= defs.IT_INVULNERABILITY qc.self.invincible_time = 1 qc.self.invincible_finished = qc.time + 3
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 weapon_touch(*qwp_extra): # For client weapon_switch w_switch = 0 if not (qc.other.flags & defs.FL_CLIENT): return if (qc.stof(qc.other.infokey('w_switch'))) == 0: w_switch = 8 else: w_switch = qc.stof(qc.other.infokey('w_switch')) # 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 if defs.deathmatch == 2 or defs.deathmatch == 3: leave = 1 else: leave = 0 if qc.self.classname == 'weapon_nailgun': if leave and (qc.other.items & defs.IT_NAILGUN): return hadammo = qc.other.ammo_nails new = defs.IT_NAILGUN # *TEAMPLAY* qc.other.ammo_nails += 30 elif qc.self.classname == 'weapon_supernailgun': if leave and (qc.other.items & defs.IT_SUPER_NAILGUN): return hadammo = qc.other.ammo_rockets new = defs.IT_SUPER_NAILGUN # *TEAMPLAY* qc.other.ammo_nails += 30 elif qc.self.classname == 'weapon_supershotgun': if leave and (qc.other.items & defs.IT_SUPER_SHOTGUN): return hadammo = qc.other.ammo_rockets new = defs.IT_SUPER_SHOTGUN # *TEAMPLAY* qc.other.ammo_shells += 5 elif qc.self.classname == 'weapon_rocketlauncher': if leave and (qc.other.items & defs.IT_ROCKET_LAUNCHER): return hadammo = qc.other.ammo_rockets new = defs.IT_ROCKET_LAUNCHER # *TEAMPLAY* qc.other.ammo_rockets += 5 elif qc.self.classname == 'weapon_grenadelauncher': if leave and (qc.other.items & defs.IT_GRENADE_LAUNCHER): return hadammo = qc.other.ammo_rockets new = defs.IT_GRENADE_LAUNCHER # *TEAMPLAY* qc.other.ammo_rockets += 5 elif qc.self.classname == 'weapon_lightning': if leave and (qc.other.items & defs.IT_LIGHTNING): return hadammo = qc.other.ammo_rockets new = defs.IT_LIGHTNING qc.other.ammo_cells += 15 else: qc.objerror('weapon_touch: unknown classname') qc.other.sprint(defs.PRINT_LOW, 'You got the ') qc.other.sprint(defs.PRINT_LOW, qc.self.netname) qc.other.sprint(defs.PRINT_LOW, '\012') # weapon touch sound qc.other.sound(defs.CHAN_ITEM, 'weapons/pkup.wav', 1, defs.ATTN_NORM) qc.other.stuffcmd('bf\012') bound_other_ammo() # change to the weapon old = qc.other.items qc.other.items |= new stemp = qc.self qc.self = qc.other prevweapon = qc.self.weapon if WeaponCode(new) <= w_switch: if qc.self.flags & defs.FL_INWATER: if new != defs.IT_LIGHTNING: Deathmatch_Weapon(old, new) else: Deathmatch_Weapon(old, new) if qc.self.weapon != prevweapon: qc.self.previous_weapon = prevweapon weapons.W_SetCurrentAmmo() qc.self = stemp if leave: return # remove it in single player, or setup for respawning in deathmatch qc.self.model = defs.string_null qc.self.solid = defs.SOLID_NOT if defs.deathmatch == 1 or defs.deathmatch == 3: qc.self.nextthink = qc.time + 30 qc.self.think = SUB_regen defs.activator = qc.other subs.SUB_UseTargets() # fire all targets / killtargets
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 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 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()