diff --git a/config/scripts.cfg b/config/scripts.cfg index 78970c98..f1a24b46 100644 --- a/config/scripts.cfg +++ b/config/scripts.cfg @@ -86,12 +86,20 @@ alias ktf [ votemap 15 $arg1 ] alias primary [ weapon (currentprimary) ] alias secondary [ weapon 1 ] alias melee [ weapon 0 ] -alias grenades [ weapon 6 ] +alias grenades [ weapon 7 ] alias altaction [ (concatword altaction_ (curweapon)) ] +alias quicknadethrow_old [ + if (> (magcontent 7) 0) [ + if (!= (curweapon) 7) [grenades] + attack + ] + onrelease [ sleep 1 [ if (= (curweapon) 7) [weapon (prevweapon)] ] ] +] + loop i 9 [ alias (concatword altaction_ $i) quicknadethrow ] // Quick nade throw is default alias altaction_5 [ zoom 1; onrelease [ zoom 0 ] ] // Sniper //alias altaction_7 [ attack ] // Grenade // with this comment, you throw the nade and the nade is unselected : Brahma diff --git a/source/src/entity.h b/source/src/entity.h index e5fed23f..e15ab3ca 100644 --- a/source/src/entity.h +++ b/source/src/entity.h @@ -349,7 +349,7 @@ public: int frags, flagscore, deaths; int lastaction, lastmove, lastpain, lastvoicecom; int clientrole; - bool attacking; + bool attacking, quicknade; string name; int team; int weaponchanging; @@ -379,6 +379,7 @@ public: smoothmillis(-1), head(-1, -1, -1), ignored(false), muted(false) { + quicknade = false; type = ENT_PLAYER; name[0] = 0; maxeyeheight = 4.5f; diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index 334cc9b3..da45bef6 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -110,7 +110,8 @@ void quicknadethrow(bool on) else { attack(false); - if(player1->weaponsel->type == GUN_GRENADE) selectweapon(player1->prevweaponsel); + player1->quicknade = true; +// if(player1->weaponsel->type == GUN_GRENADE) selectweapon(player1->prevweaponsel); } } @@ -832,7 +833,8 @@ bool grenades::attack(vec &targ) int attackmillis = lastmillis-owner->lastaction; vec &to = targ; - bool waitdone = attackmillis>=gunwait && !(m_arena && m_teammode && arenaintermission); + bool quickwait = attackmillis*3>=gunwait && !(m_arena && m_teammode && arenaintermission); + bool waitdone = attackmillis>=gunwait && quickwait; if(waitdone) gunwait = reloading = 0; switch(state) @@ -842,7 +844,7 @@ bool grenades::attack(vec &targ) break; case GST_INHAND: - if(waitdone) + if(waitdone || ( owner->quicknade && quickwait ) ) { if(!owner->attacking || this!=owner->weaponsel) thrownade(); // throw else if(!inhandnade->isalive(lastmillis)) dropnade(); // drop & have fun @@ -906,6 +908,8 @@ void grenades::activatenade(const vec &to) void grenades::thrownade() { + if (owner->quicknade && owner->weaponsel->type == GUN_GRENADE) selectweapon(owner->prevweaponsel); + owner->quicknade = false; if(!inhandnade) return; const float speed = cosf(RAD*owner->pitch); vec vel(sinf(RAD*owner->yaw)*speed, -cosf(RAD*owner->yaw)*speed, sinf(RAD*owner->pitch));