]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into Lyberta/TeamplayFixes_
authorLyberta <lyberta@lyberta.net>
Wed, 5 Jul 2017 23:13:00 +0000 (02:13 +0300)
committerLyberta <lyberta@lyberta.net>
Wed, 5 Jul 2017 23:13:00 +0000 (02:13 +0300)
1  2 
qcsrc/server/autocvars.qh
qcsrc/server/client.qc
qcsrc/server/player.qc

index 8dd913e29dcd1237f8fc4a9cb8b9d38650bbfe36,0c2c1ed4feb90f96b025792af4737a1b715f967e..66cb5172a187e2b865c53e3e16bd98237973a785
@@@ -88,7 -88,7 +88,7 @@@ float autocvar_g_balance_superweapons_t
  float autocvar_g_balance_selfdamagepercent;
  bool autocvar_g_balance_teams;
  bool autocvar_g_balance_teams_prevent_imbalance;
 -float autocvar_g_balance_teams_scorefactor;
 +//float autocvar_g_balance_teams_scorefactor;
  float autocvar_g_ballistics_density_corpse;
  float autocvar_g_ballistics_density_player;
  float autocvar_g_ballistics_mindistance;
@@@ -518,6 -518,7 +518,7 @@@ float autocvar_sv_airaccel_sideways_fri
  float autocvar_sv_aircontrol;
  float autocvar_sv_aircontrol_power;
  float autocvar_sv_aircontrol_backwards;
+ float autocvar_sv_aircontrol_sidewards;
  float autocvar_sv_aircontrol_penalty;
  float autocvar_sv_warsowbunny_airforwardaccel;
  float autocvar_sv_warsowbunny_topspeed;
diff --combined qcsrc/server/client.qc
index 297f5651a4da804d6e2654f90a31fa1d94f3e5de,381373ad2bcb713d93ccc4046efa6ac2341c14ed..c762ab4ee6c7706fa39de42a9fb16f3993841931
@@@ -271,9 -271,7 +271,9 @@@ void PutObserverInServer(entity this
        if (mutator_returnvalue) {
            // mutator prevents resetting teams+score
        } else {
 +              int oldteam = this.team;
                this.team = -1;  // move this as it is needed to log the player spectating in eventlog
 +              MUTATOR_CALLHOOK(Player_ChangedTeam, this, oldteam, this.team); // Lyberta: added hook
          this.frags = FRAGS_SPECTATOR;
          PlayerScore_Clear(this);  // clear scores when needed
      }
@@@ -660,6 -658,8 +660,8 @@@ void PutClientInServer(entity this
                if(!this.bot_attack)
                        IL_PUSH(g_bot_targets, this);
                this.bot_attack = true;
+               if(!this.monster_attack)
+                       IL_PUSH(g_monster_targets, this);
                this.monster_attack = true;
                navigation_dynamicgoal_init(this, false);
  
@@@ -886,10 -886,8 +888,10 @@@ void ClientKill_Now(entity this
        if(this.killindicator_teamchange)
                ClientKill_Now_TeamChange(this);
  
 -      if(!IS_SPEC(this) && !IS_OBSERVER(this))
 +      if (!IS_SPEC(this) && !IS_OBSERVER(this) && MUTATOR_CALLHOOK(ClientKill_Now, this) == false)
 +      {
                Damage(this, this, this, 100000, DEATH_KILL.m_id, this.origin, '0 0 0');
 +      }
  
        // now I am sure the player IS dead
  }
diff --combined qcsrc/server/player.qc
index 72802ddd6469a003cdca7f37439ab6474c7ff8f5,faba40f3fc92de55833f334e72590c47ac2d2bac..7bd683c3065954f8a0260ae4bf5a368a97e1c8b5
@@@ -311,7 -311,6 +311,6 @@@ void PlayerDamage(entity this, entity i
  {
        float take, save, dh, da;
        vector v;
-       float valid_damage_for_weaponstats;
        float excess;
  
        dh = max(this.health, 0);
        bool abot = (IS_BOT_CLIENT(attacker));
        bool vbot = (IS_BOT_CLIENT(this));
  
-       valid_damage_for_weaponstats = 0;
+       bool valid_damage_for_weaponstats = false;
        Weapon awep = WEP_Null;
        .entity weaponentity = weaponentities[0]; // TODO: unhardcode
  
                        awep = attacker.(weaponentity).m_weapon;
                else
                        awep = DEATH_WEAPONOF(deathtype);
-               valid_damage_for_weaponstats = 1;
+               valid_damage_for_weaponstats = true;
        }
  
        dh = dh - max(this.health, 0);
                MUTATOR_CALLHOOK(PlayerDies, inflictor, attacker, this, deathtype, damage);
                excess = M_ARGV(4, float);
  
-               Weapon wep = this.(weaponentity).m_weapon;
+               //Weapon wep = this.(weaponentity).m_weapon;
                for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
                {
                        .entity went = weaponentities[slot];
+                       if(!this.(weaponentity))
+                               continue; // TODO: clones have no weapon, but we don't want to have to check this all the time
+                       Weapon wep = this.(weaponentity).m_weapon;
                        wep.wr_playerdeath(wep, this, went);
                }
  
                }
  
                // reset fields the weapons may use just in case
-               FOREACH(Weapons, it != WEP_Null, LAMBDA(
-                       it.wr_resetplayer(it, this);
-                       for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+               if(this.classname != "body")
+               {
+                       FOREACH(Weapons, it != WEP_Null,
                        {
-                               ATTACK_FINISHED_FOR(this, it.m_id, slot) = 0;
-                       }
-               ));
+                               it.wr_resetplayer(it, this);
+                               for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+                               {
+                                       ATTACK_FINISHED_FOR(this, it.m_id, slot) = 0;
+                               }
+                       });
+               }
                MUTATOR_CALLHOOK(PlayerDied, this);
        }
  }
  
 -void MoveToTeam(entity client, int team_colour, int type)
 +bool MoveToTeam(entity client, int team_colour, int type)
  {
        int lockteams_backup = lockteams;  // backup any team lock
        lockteams = 0;  // disable locked teams
        TeamchangeFrags(client);  // move the players frags
 -      SetPlayerColors(client, team_colour - 1);  // set the players colour
 +      if (!SetPlayerTeamSimple(client, team_colour))
 +      {
 +              return false;
 +      }
        Damage(client, client, client, 100000, DEATH_AUTOTEAMCHANGE.m_id, client.origin, '0 0 0');  // kill the player
        lockteams = lockteams_backup;  // restore the team lock
        LogTeamchange(client.playerid, client.team, type);
 +      return true;
  }
  
  /** print(), but only print if the server is not local */