]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
add a second use key system that responds to presses, not to holding it down
authorRudolf Polzer <divVerent@xonotic.org>
Sun, 12 Jun 2011 12:58:53 +0000 (14:58 +0200)
committerRudolf Polzer <divVerent@xonotic.org>
Sun, 12 Jun 2011 12:58:53 +0000 (14:58 +0200)
defaultXonotic.cfg
qcsrc/server/cl_client.qc
qcsrc/server/cl_impulse.qc
qcsrc/server/ctf.qc
qcsrc/server/defs.qh

index a0e4a44b084a52f12552132e717a9bf5e86e722b..2eb18eca235108d609171032b166cc5066b6565b 100644 (file)
@@ -52,6 +52,7 @@ alias asay_drop "say_team (%l) dropped %w ; impulse 17"
 // other aliases
 alias +hook +button6
 alias -hook -button6
+alias use "impulse 21"
 alias ready "cmd ready"
 alias lockteams "sv_cmd lockteams"
 alias unlockteams "sv_cmd unlockteams"
@@ -1025,7 +1026,7 @@ bind MWHEELDOWN weapprev
 bind r reload
 bind BACKSPACE dropweapon
 bind g dropweapon
-bind f +use
+bind f use
 
 // misc
 bind e +hook
@@ -1362,7 +1363,7 @@ seta "userbind11_press" "say_team attacking (l:%l^7) (h:%h^7 a:%a^7 w:%w^7); g_w
 seta "userbind12_press" "say_team killed flagcarrier (l:%y^7); g_waypointsprite_team_p"; seta "userbind12_release" ""; seta "userbind12_description" "team: killed flag, icon"
 seta "userbind13_press" "say_team dropped flag (l:%d^7); g_waypointsprite_team_here_d"; seta "userbind13_release" ""; seta "userbind13_description" "team: dropped flag, icon"
 seta "userbind14_press" "say_team dropped gun %w^7 (l:%l^7); g_waypointsprite_team_here; wait; dropweapon"; seta "userbind14_release" ""; seta "userbind14_description" "team: drop gun, icon"
-seta "userbind15_press" "say_team dropped flag/key %w^7 (l:%l^7); g_waypointsprite_team_here; wait; +use"; seta "userbind15_release" "-use"; seta "userbind15_description" "team: drop flag/key, icon"
+seta "userbind15_press" "say_team dropped flag/key %w^7 (l:%l^7); g_waypointsprite_team_here; wait; use"; seta "userbind15_release" ""; seta "userbind15_description" "team: drop flag/key, icon"
 seta "userbind16_press" "say :-) / nice one"; seta "userbind16_release" ""; seta "userbind16_description" "chat: nice one"
 seta "userbind17_press" "say good game"; seta "userbind17_release" ""; seta "userbind17_description" "chat: good game"
 seta "userbind18_press" "say hi / good luck and have fun"; seta "userbind18_release" ""; seta "userbind18_description" "chat: hi / good luck"
index 5f265468c90ff1a6facc5d1b2050cee3ad4f4892..058e402503b245c278df750398bf3e4c03250c74 100644 (file)
@@ -2576,6 +2576,17 @@ void SpectatorThink()
        self.flags |= FL_CLIENT | FL_NOTARGET;
 }
 
+float ctf_usekey();
+void PlayerUseKey()
+{
+       if(self.classname != "player")
+               return;
+
+       // a use key was pressed; call handlers
+       if(ctf_usekey())
+               return;
+}
+
 .float touchexplode_time;
 
 /*
@@ -2585,6 +2596,7 @@ PlayerPreThink
 Called every frame for each client before the physics are run
 =============
 */
+.float usekeypressed;
 void() ctf_setstatus;
 void() nexball_setstatus;
 .float items_added;
@@ -2662,6 +2674,10 @@ void PlayerPreThink (void)
 
        MUTATOR_CALLHOOK(PlayerPreThink);
 
+       if(self.BUTTON_USE && !self.usekeypressed)
+               PlayerUseKey();
+       self.usekeypressed = self.BUTTON_USE;
+
        if(self.classname == "player") {
 //             if(self.netname == "Wazat")
 //                     bprint(self.classname, "\n");
index 7bde8b32f7e8633acad1f53b1befd14e9ba20e30..39eab3c61dc3eed38a32015505440c6994bafceb 100644 (file)
@@ -105,6 +105,10 @@ void ImpulseCommands (void)
                else
                        self.impulse = imp; // retry in next frame
        }
+       else if(imp == 21)
+       {
+               PlayerUseKey ();
+       }
        else if(imp >= 200 && imp <= 229)
        {
                if(self.deadflag == DEAD_NO)
index cf16cecff77aedae5f569a8aff92b3f0901f8e51..f5cbae51b505e157ba501b5cd1820d667454bd12 100644 (file)
@@ -405,12 +405,18 @@ void FlagThink()
                DropFlag(self, world, world);
                return;
        }
-
-       if(autocvar_g_ctf_allow_drop)
-       if(e.BUTTON_USE)
-               DropFlag(self, e, world);
 };
 
+float ctf_usekey()
+{
+       if(self.flagcarried)
+       {
+               DropFlag(self.flagcarried, self, world);
+               return TRUE;
+       }
+       return FALSE;
+}
+
 void flag_cap_ring_spawn(vector org)
 {
        shockwave_spawn("models/ctf/shockwavetransring.md3", org - '0 0 15', -0.8, 0, 1);
index e0a362ebe8dfbc8c5bb2d1ebf1c2f2a6a52e7209..3827fb4331ff225f2ae09e7d915bc1eeca77b6ca 100644 (file)
@@ -665,3 +665,5 @@ float serverflags;
 
 .entity muzzle_flash;
 .float misc_bulletcounter;     // replaces uzi & hlac bullet counter.
+
+void PlayerUseKey();