diff --git a/source/client.qc b/source/client.qc index 86a9686..bb469dc 100644 --- a/source/client.qc +++ b/source/client.qc @@ -6,6 +6,7 @@ void() player_pain; void() player_stand1; void(vector org) spawn_tfog; void(vector org, entity death_owner) spawn_tdeath; +float(entity targ, entity attacker) SameTeam; float modelindex_eyes, modelindex_player; @@ -1132,7 +1133,7 @@ void(entity targ, entity attacker) ClientObituary = { bprint(" becomes bored with life\n"); } return; - } else if((teamplay == 2) && (targ.team > 0) && (targ.team == attacker.team)) { + } else if(teamplay == 2 && SameTeam(targ, attacker)) { if(rnum < 0.25) { deathstring = " mows down a teammate\n"; } else if(rnum < 0.50) { diff --git a/source/combat.qc b/source/combat.qc index f7fb31e..13c4666 100644 --- a/source/combat.qc +++ b/source/combat.qc @@ -7,6 +7,14 @@ void() monster_death_use; //============================================================================ +float(entity targ, entity attacker) SameTeam = { + return targ.team > 0 && targ.team == attacker.team; +}; + +float(entity targ, entity attacker) BothPlayers = { + return targ.classname == "player" && attacker.classname == "player"; +}; + /* ============ CanDamage @@ -109,6 +117,15 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage = { local float save; local float take; + // team play damage avoidance + if(teamplay == 1 && SameTeam(targ, attacker)) { + return; + } + + if(teamplay == 3 && BothPlayers(targ, attacker)) { + return; + } + if(!targ.takedamage) { return; } @@ -161,11 +178,6 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage = { return; } - // team play damage avoidance - if((teamplay == 1) && (targ.team > 0) && (targ.team == attacker.team)) { - return; - } - // do the damage targ.health = targ.health - take; diff --git a/todo b/todo index 8e5ccc7..1801924 100644 --- a/todo +++ b/todo @@ -1,10 +1,8 @@ core features: -corpse pickups have keys custom pronouns distributed ammo lives counting -no friendly fire by default useful features: @@ -16,6 +14,12 @@ extraneous features: emotes player sound effect option +players shoot through eachother selectable player models and skins sound clips third person player weapon models + +done: + +corpse pickups have keys +no friendly fire