]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Don't remove nades that pass through weapon clips (has some side effects, but also...
authorMario <zacjardine@y7mail.com>
Thu, 5 Feb 2015 12:36:48 +0000 (23:36 +1100)
committerMario <zacjardine@y7mail.com>
Thu, 5 Feb 2015 12:36:48 +0000 (23:36 +1100)
qcsrc/server/mutators/gamemode_tdm.qc
qcsrc/server/mutators/mutator_nades.qc

index 95e6cfa2bcb48939c06557832a8d470c3bad3f60..a2caf8b67f05842091f4d8a46a686a6994641976 100644 (file)
@@ -1,3 +1,13 @@
+int tdm_teams;
+
+// scoreboard setup
+void tdm_ScoreRules(float teams)
+{
+       //CheckAllowedTeams(world);
+       ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, true);
+       ScoreRules_basics_end();
+}
+
 /*QUAKED spawnfunc_tdm_team (0 .5 .8) (-16 -16 -24) (16 16 32)
 Team declaration for TDM gameplay, this allows you to decide what team names and control point models are used in your map.
 Note: If you use spawnfunc_tdm_team entities you must define at least 2!  However, unlike domination, you don't need to make a blank one too.
@@ -29,36 +39,30 @@ void tdm_SpawnTeam (string teamname, float teamcolor)
 
 void tdm_DelayedInit()
 {
+       tdm_teams = 2;
+
+       if(autocvar_g_tdm_teams_override < 2 || autocvar_g_tdm_teams_override > 4)
+               tdm_teams = autocvar_g_tdm_teams;
+       else
+               tdm_teams = autocvar_g_tdm_teams_override;
+
+       tdm_teams = bound(2, tdm_teams, 4);
+
        // if no teams are found, spawn defaults
        if(find(world, classname, "tdm_team") == world)
        {
                print("No ""tdm_team"" entities found on this map, creating them anyway.\n");
-
-               float numteams = autocvar_g_tdm_teams_override;
-               if(numteams < 2 || numteams > 4)
-                       numteams = autocvar_g_tdm_teams;
-               numteams = bound(2, numteams, 4);
-
-               tdm_SpawnTeam(NAME_TEAM_1, NUM_TEAM_1 - 1);
-               tdm_SpawnTeam(NAME_TEAM_2, NUM_TEAM_2 - 1);
-               if(numteams >= 3)
-                       tdm_SpawnTeam(NAME_TEAM_3, NUM_TEAM_3 - 1);
-               if(numteams >= 4)
-                       tdm_SpawnTeam(NAME_TEAM_4, NUM_TEAM_4 - 1);
+               float i;
+               for(i = 1; i <= tdm_teams; ++i)
+                       tdm_SpawnTeam(Team_ColorName(Team_NumberToTeam(i)), Team_NumberToTeam(i) - 1);
        }
+
+       tdm_ScoreRules(tdm_teams);
 }
 
 MUTATOR_HOOKFUNCTION(tdm_GetTeamCount)
 {
        ret_string = "tdm_team";
-       if(find(world, classname, "tdm_team") == world)
-       {
-               // make it at least half accurate
-               ret_float = bound(2, ((autocvar_g_tdm_teams_override < 2) ? autocvar_g_tdm_teams : autocvar_g_tdm_teams_override), 4);
-               ret_string = string_null;
-               return false;
-       }
-
        return true;
 }
 
index 3de5608a680d7e6664f9966bac68583df5b70854..388c5480e251a1e1762386e2c3f7ca37ac4973f3 100644 (file)
@@ -552,12 +552,12 @@ void nade_boom()
 
 void nade_touch()
 {
-       float is_weapclip = 0;
+       /*float is_weapclip = 0;
        if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NODRAW)
        if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NONSOLID))
        if (!(trace_dphitcontents & DPCONTENTS_OPAQUE))
-               is_weapclip = 1;
-       if(ITEM_TOUCH_NEEDKILL() || is_weapclip)
+               is_weapclip = 1;*/
+       if(ITEM_TOUCH_NEEDKILL()) // || is_weapclip)
        {
                remove(self);
                return;