]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'terencehill/keyhunt' into 'master'
authorMario <zacjardine@y7mail.com>
Tue, 3 Jan 2017 01:34:31 +0000 (01:34 +0000)
committerMario <zacjardine@y7mail.com>
Tue, 3 Jan 2017 01:34:31 +0000 (01:34 +0000)
Keyhunt improvements

Closes #1843 and #1837

See merge request !402

.gitlab-ci.yml
qcsrc/common/mutators/mutator/overkill/sv_overkill.qc
qcsrc/common/playerstats.qc
qcsrc/common/t_items.qc
qcsrc/common/triggers/trigger/jumppads.qc
qcsrc/common/weapons/weapon/crylink.qc
qcsrc/lib/warpzone/common.qc
qcsrc/server/client.qc
qcsrc/server/mutators/events.qh
qcsrc/server/player.qc
qcsrc/server/teamplay.qc

index e3f2ccb7ab6fc22429359c6e7d65b7f1ba782f9b..04699d74c70f31bb339e992b5a8b20dc2d4cb355 100644 (file)
@@ -30,7 +30,7 @@ test_sv_game:
     - wget -O data/maps/g-23.waypoints.cache https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/g-23.waypoints.cache
     - wget -O data/maps/g-23.waypoints.hardwired https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/g-23.waypoints.hardwired
     - make
-    - EXPECT=81f90da8c88646dcce300fdcc31113d1
+    - EXPECT=c35a668d31d76df2bcbc503c3ac7b0aa
     - HASH=$(${ENGINE} -noconfig -nohome +exec serverbench.cfg
       | tee /dev/stderr
       | grep '^:'
index 501b3afd82e615b124effc3ddfc9a371a259aab7..589765337e1f298e3d87371d43c008baefae0400 100644 (file)
@@ -171,17 +171,6 @@ MUTATOR_HOOKFUNCTION(ok, PlayerPreThink)
        if(IS_DEAD(player) || !IS_PLAYER(player) || STAT(FROZEN, player))
                return;
 
-       if(player.ok_lastwep)
-       {
-               Weapon newwep = Weapons_from(player.ok_lastwep);
-               if(player.ok_lastwep == WEP_HMG.m_id)
-                       newwep = WEP_MACHINEGUN;
-               if(player.ok_lastwep == WEP_RPC.m_id)
-                       newwep = WEP_VORTEX;
-               PS(player).m_switchweapon = newwep;
-               player.ok_lastwep = 0;
-       }
-
        ok_IncreaseCharge(player, PS(player).m_weapon.m_id);
 
        if(PHYS_INPUT_BUTTON_ATCK2(player))
@@ -248,10 +237,22 @@ MUTATOR_HOOKFUNCTION(ok, PlayerSpawn)
        }
        else
                player.ok_use_ammocharge = 0;
+}
 
-       // if player changed their weapon while dead, don't switch to their death weapon
-       if(player.impulse)
+MUTATOR_HOOKFUNCTION(ok, PlayerWeaponSelect)
+{
+       entity player = M_ARGV(0, entity);
+
+       if(player.ok_lastwep)
+       {
+               Weapon newwep = Weapons_from(player.ok_lastwep);
+               if(player.ok_lastwep == WEP_HMG.m_id)
+                       newwep = WEP_MACHINEGUN;
+               if(player.ok_lastwep == WEP_RPC.m_id)
+                       newwep = WEP_VORTEX;
+               PS(player).m_switchweapon = newwep;
                player.ok_lastwep = 0;
+       }
 }
 
 void self_spawnfunc_weapon_hmg(entity this) { spawnfunc_weapon_hmg(this); }
index b879b63b09587a8846ec9bf910154b796c4cfab3..74585a300375096e088263069ba449649ac649e1 100644 (file)
@@ -257,6 +257,12 @@ void PlayerStats_GameReport_Init() // initiated before InitGameplayMode so that
        else { PlayerStats_GameReport_DelayMapVote = false; }
 }
 
+// this... is a hack, a temporary one until we get a proper duel gametype
+string PlayerStats_GetGametype()
+{
+       return ((IS_GAMETYPE(DEATHMATCH) && autocvar_g_maxplayers == 2) ? "duel" : GetGametype());
+}
+
 void PlayerStats_GameReport_Handler(entity fh, entity pass, float status)
 {
        string t, tn;
@@ -313,7 +319,7 @@ void PlayerStats_GameReport_Handler(entity fh, entity pass, float status)
                        #ifdef WATERMARK
                        url_fputs(fh, sprintf("R %s\n", WATERMARK));
                        #endif
-                       url_fputs(fh, sprintf("G %s\n", GetGametype()));
+                       url_fputs(fh, sprintf("G %s\n", PlayerStats_GetGametype()));
                        url_fputs(fh, sprintf("O %s\n", modname));
                        url_fputs(fh, sprintf("M %s\n", GetMapname()));
                        url_fputs(fh, sprintf("I %s\n", matchid));
@@ -556,7 +562,7 @@ void PlayerStats_PlayerBasic_Handler(entity fh, entity p, float status)
                     case "e":
                         LOG_TRACE("G: ", gt);
                         LOG_TRACE("e: ", data);
-                        if (gt == GetGametype()) {
+                        if (gt == PlayerStats_GetGametype()) {
                             handled = true;
                             float e = stof(data);
                             PlayerScore_Add(p, SP_ELO, +1 + e);
index 9d89679e3be9f88817ea8abd9883774c36eca22a..cacc1e4f511e87ba71f3e91dd83889c0194866af 100644 (file)
@@ -1058,6 +1058,12 @@ void Item_Damage(entity this, entity inflictor, entity attacker, float damage, i
                RemoveItem(this);
 }
 
+void item_use(entity this, entity actor, entity trigger)
+{
+       // use the touch function to handle collection
+       gettouch(this)(this, actor);
+}
+
 void _StartItem(entity this, entity def, float defaultrespawntime, float defaultrespawntimejitter)
 {
        string itemname = def.m_name;
@@ -1179,6 +1185,9 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
                }
                */
 
+               if(this.targetname != "" && (this.spawnflags & 16))
+                       this.use = item_use;
+
                if(autocvar_spawn_debug >= 2)
                {
             // why not flags & fl_item?
index 5a279561d374c5c6b0d975e3a4105b5e2f322787..746270877b5018930d3f6e1d5c32abe05553f62c 100644 (file)
@@ -222,7 +222,7 @@ bool jumppad_push(entity this, entity targ)
        }
 
        if(this.enemy.target)
-               SUB_UseTargets(this.enemy, targ, targ); // TODO: do we need targ as trigger too?
+               SUB_UseTargets(this.enemy, targ, this);
 
        if (targ.flags & FL_PROJECTILE)
        {
@@ -418,6 +418,9 @@ bool target_push_send(entity this, entity to, float sf)
 
 void target_push_use(entity this, entity actor, entity trigger)
 {
+       if(trigger.classname == "trigger_push" || trigger == this)
+               return; // WTF, why is this a thing
+
        jumppad_push(this, actor);
 }
 
index 58214bf390feed3d2f41e1ec5ec24c847b02c10f..1af08bc12c7ded2e48b5111d19b7b66291bd7f15 100644 (file)
@@ -3,7 +3,7 @@
 CLASS(Crylink, Weapon)
 /* ammotype  */ ATTRIB(Crylink, ammo_field, .int, ammo_cells);
 /* impulse   */ ATTRIB(Crylink, impulse, int, 6);
-/* flags     */ ATTRIB(Crylink, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH);
+/* flags     */ ATTRIB(Crylink, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH | WEP_FLAG_CANCLIMB);
 /* rating    */ ATTRIB(Crylink, bot_pickupbasevalue, float, BOT_PICKUP_RATING_MID);
 /* color     */ ATTRIB(Crylink, wpcolor, vector, '1 0.5 1');
 /* modelname */ ATTRIB(Crylink, mdl, string, "crylink");
index 5a3929e1e92d58ecd6520f0bbb05d68499e61f73..78d51cf0bc4fa4c6f050b6c137978eb130695d16 100644 (file)
@@ -298,13 +298,13 @@ void WarpZone_TraceBox_ThroughZone(vector org, vector mi, vector ma, vector end,
                        }
                        break;
                }
-               if(trace_ent == wz)
+               /*if(trace_ent == wz)
                {
                        // FIXME can this check be removed? Do we really need it?
                        LOG_TRACE("I transformed into the same zone again, wtf, aborting the trace");
                        trace_ent = NULL;
                        break;
-               }
+               }*/
                wz = trace_ent;
                if(!WarpZone_trace_firstzone)
                        WarpZone_trace_firstzone = wz;
index d4a3e9febfa359aef00e37995c6b56961d0a8a25..c1cce0c0a6b310f5fe77a14e0d152fa9a5c3b7c0 100644 (file)
@@ -706,6 +706,8 @@ void PutClientInServer(entity this)
                this.weaponname = "";
                PS(this).m_switchingweapon = WEP_Null;
 
+               MUTATOR_CALLHOOK(PlayerWeaponSelect, this);
+
                if (!warmup_stage && !this.alivetime)
                        this.alivetime = time;
 
index 499110efa3f3641bf28c5589b1525fc59b15a0fd..2bea200d55348205aebef1512781eb100410929f 100644 (file)
@@ -31,6 +31,12 @@ MUTATOR_HOOKABLE(ForbidSpawn, EV_ForbidSpawn);
     /**/
 MUTATOR_HOOKABLE(PlayerSpawn, EV_PlayerSpawn);
 
+/** called after a player's weapon is chosen so it can be overriden here */
+#define EV_PlayerWeaponSelect(i, o) \
+       /** player spawning */ i(entity, MUTATOR_ARGV_0_entity) \
+    /**/
+MUTATOR_HOOKABLE(PlayerWeaponSelect, EV_PlayerWeaponSelect);
+
 /** called in reset_map */
 #define EV_reset_map_global(i, o) \
     /**/
index 59f0c8029b7ab89f9a01458687631a5951e07c64..f23e6021dda913622990607875680f802152d608 100644 (file)
@@ -435,7 +435,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
                                        }
 
                                        if(sound_allowed(MSG_BROADCAST, attacker))
-                                       if((this.health < 2 * WEP_CVAR_PRI(blaster, damage) * autocvar_g_balance_selfdamagepercent + 1) || !(DEATH_WEAPONOF(deathtype).spawnflags & WEP_FLAG_CANCLIMB) || attacker != this) // WEAPONTODO: create separate limit for pain notification with laser
+                                       if(this.health < 25 || !(DEATH_WEAPONOF(deathtype).spawnflags & WEP_FLAG_CANCLIMB) || take > 20 || attacker != this)
                                        if(this.health > 1)
                                        // exclude pain sounds for laserjumps as long as you aren't REALLY low on health and would die of the next two
                                        {
index fd9f340f5f1965bdbdd370cde24121517abcdfb1..d16bb781b821998383b8be8460745309cb7b4783 100644 (file)
@@ -87,25 +87,23 @@ void InitGameplayMode()
 
 string GetClientVersionMessage(entity this)
 {
-       string versionmsg;
        if (this.version_mismatch) {
                if(this.version < autocvar_gameversion) {
-                       versionmsg = "^3Your client version is outdated.\n\n\n### YOU WON'T BE ABLE TO PLAY ON THIS SERVER ###\n\n\nPlease update!!!^8";
+                       return strcat("This is Xonotic ", autocvar_g_xonoticversion,
+                               "\n^3Your client version is outdated.\n\n\n### YOU WON'T BE ABLE TO PLAY ON THIS SERVER ###\n\n\nPlease update!!!^8");
                } else {
-                       versionmsg = "^3This server is using an outdated Xonotic version.\n\n\n ### THIS SERVER IS INCOMPATIBLE AND THUS YOU CANNOT JOIN ###.^8";
+                       return strcat("This is Xonotic ", autocvar_g_xonoticversion,
+                               "\n^3This server is using an outdated Xonotic version.\n\n\n ### THIS SERVER IS INCOMPATIBLE AND THUS YOU CANNOT JOIN ###.^8");
                }
        } else {
-               versionmsg = "^2client version and server version are compatible.^8";
+               return strcat("Welcome to Xonotic ", autocvar_g_xonoticversion);
        }
-       return versionmsg;
 }
 
 string getwelcomemessage(entity this)
 {
-       string s, modifications, motd;
-
        MUTATOR_CALLHOOK(BuildMutatorsPrettyString, "");
-       modifications = M_ARGV(0, string);
+       string modifications = M_ARGV(0, string);
 
        if(g_weaponarena)
        {
@@ -129,9 +127,7 @@ string getwelcomemessage(entity this)
        modifications = substring(modifications, 2, strlen(modifications) - 2);
 
        string versionmessage = GetClientVersionMessage(this);
-
-       s = strcat("This is Xonotic ", autocvar_g_xonoticversion, "\n", versionmessage);
-       s = strcat(s, "^8\n\nmatch type is ^1", gamemode_name, "^8\n");
+       string s = strcat(versionmessage, "^8\n^8\nmatch type is ^1", gamemode_name, "^8\n");
 
        if(modifications != "")
                s = strcat(s, "^8\nactive modifications: ^3", modifications, "^8\n");
@@ -156,7 +152,7 @@ string getwelcomemessage(entity this)
 
        s = strcat(s, mutator_msg); // trust that the mutator will do proper formatting
 
-       motd = autocvar_sv_motd;
+       string motd = autocvar_sv_motd;
        if (motd != "") {
                s = strcat(s, "\n\n^8MOTD: ^7", strreplace("\\n", "\n", motd));
        }