]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'terencehill/vote_commands' into 'master'
authorz411 <z411@omaera.org>
Sat, 10 Jun 2023 02:17:26 +0000 (02:17 +0000)
committerz411 <z411@omaera.org>
Sat, 10 Jun 2023 02:17:26 +0000 (02:17 +0000)
Made moveto* votes always show player ID and name, 2 other minor voting related fixes

See merge request xonotic/xonotic-data.pk3dir!1198

1  2 
qcsrc/server/command/vote.qc

index 118b852a632c0476b14a9efd2974b9e21eeffcc3,e8a3f6c8dd76bd0ad17f2ed69291daa4ff8c3cb6..a3d146c75f7529cbe8a9e9689e717a983ceefe43
@@@ -25,7 -25,6 +25,7 @@@
  #include <server/scores.qh>
  #include <server/teamplay.qh>
  #include <server/weapons/accuracy.qh>
 +#include <server/weapons/selection.qh>
  #include <server/world.qh>
  
  // =============================================
@@@ -417,13 -416,6 +417,13 @@@ void reset_map(bool is_fake_round_start
                        it.avelocity = '0 0 0';
                        CS(it).movement = '0 0 0';
                        PutClientInServer(it);
 +
 +                      if(IS_BOT_CLIENT(it))
 +                      {
 +                              .entity weaponentity = weaponentities[0];
 +                              if(it.(weaponentity).m_weapon == WEP_Null)
 +                                      W_NextWeapon(it, 0, weaponentity);
 +                      }
                });
        }
  }
@@@ -754,6 -746,29 +754,29 @@@ int VoteCommand_parse(entity caller, st
  
        switch (first_command) // now go through and parse the proper commands to adjust as needed.
        {
+               case "movetoauto":
+               case "movetored":
+               case "movetoblue":
+               case "movetoyellow":
+               case "movetopink":
+               case "movetospec":
+               {
+                       entity victim = GetIndexedEntity(argc, (startpos + 1));
+                       float accepted = VerifyClientEntity(victim, true, false);
+                       if (accepted > 0)
+                       {
+                               vote_parsed_command = vote_command;
+                               vote_parsed_display = sprintf("^1%s #%d ^7%s", first_command, etof(victim), victim.netname);
+                       }
+                       else
+                       {
+                               print_to(caller, strcat("vcall: ", GetClientErrorString(accepted, argv(startpos + 1)), ".\n"));
+                               return 0;
+                       }
+                       break;
+               }
                case "kick":
                case "kickban":    // catch all kick/kickban commands
                {
                        break;
                }
  
+               case "fraglimit": // include restrictions on the maximum votable frag limit
+               {
+                       float fraglimit_vote = stof(argv(startpos + 1));
+                       float fraglimit_min = 0;
+                       float fraglimit_max = 999999;
+                       if(fraglimit_vote > fraglimit_max || fraglimit_vote < fraglimit_min)
+                       {
+                               print_to(caller, strcat("Invalid fraglimit vote, accepted values are between ", ftos(fraglimit_min), " and ", ftos(fraglimit_max), "."));
+                               return -1;
+                       }
+                       vote_parsed_command = strcat("fraglimit ", ftos(fraglimit_vote));
+                       vote_parsed_display = strzone(strcat("^1", vote_parsed_command));
+                       break;
+               }
                case "timelimit": // include restrictions on the maximum votable time limit
                {
                        float timelimit_vote = stof(argv(startpos + 1));
                                print_to(caller, strcat("Invalid timelimit vote, accepted values are between ", ftos(autocvar_timelimit_min), " and ", ftos(autocvar_timelimit_max), "."));
                                return -1;
                        }
-                       timelimit_vote = bound(autocvar_timelimit_min, timelimit_vote, autocvar_timelimit_max);
                        vote_parsed_command = strcat("timelimit ", ftos(timelimit_vote));
                        vote_parsed_display = strzone(strcat("^1", vote_parsed_command));