trigger weaponswitch for others (issue #257)

This commit is contained in:
flowtron
2021-06-19 11:44:31 +02:00
parent ed75cdee8a
commit d37e73a61d
3 changed files with 12 additions and 5 deletions
+1 -1
View File
@@ -944,7 +944,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p, bool demo = false)
case SV_WEAPCHANGE:
{
int gun = getint(p);
if(d) d->selectweapon(gun);
if(d) d->selectweapon(gun,d!=player1);
break;
}
+8 -1
View File
@@ -534,7 +534,14 @@ public:
curskin = nextskin[team_base(team)];
}
void selectweapon(int w) { if (weaponsel) prevweaponsel = weaponsel; weaponsel = weapons[(gunselect = w)]; if (!prevweaponsel) prevweaponsel = weaponsel; }
void selectweapon(int w, bool other = false)
{
if(weaponsel) prevweaponsel = weaponsel;
weaponsel = weapons[(gunselect = w)];
if(!prevweaponsel) prevweaponsel = weaponsel;
if(other && (prevweaponsel != weaponsel)) weaponswitch(weaponsel, true);
}
void setprimary(int w) { primweap = weapons[(primary = w)]; }
void setnextprimary(int w) { nextprimweap = weapons[(nextprimary = w)]; }
bool isspectating() { return state==CS_SPECTATE || (state==CS_DEAD && spectatemode > SM_NONE); }
+3 -3
View File
@@ -1510,8 +1510,8 @@ int sniperrifle::dynspread()
float sniperrifle::dynrecoil() { return scoped && lastmillis - scoped_since > SCOPESETTLETIME ? info.recoil / 3 : info.recoil; }
bool sniperrifle::selectable() { return weapon::selectable() && !m_noprimary && this == owner->primweap; }
void sniperrifle::onselecting(bool sound) { weapon::onselecting(sound); scoped = false; player1->scoping = false; }
void sniperrifle::ondeselecting() { scoped = false; player1->scoping = false; }
void sniperrifle::onownerdies() { scoped = false; player1->scoping = false; shots = 0; }
void sniperrifle::ondeselecting() { scoped = false; owner->scoping = false; }
void sniperrifle::onownerdies() { shots = 0; scoped = false; owner->scoping = false; }
void sniperrifle::renderhudmodel() { if(!scoped) weapon::renderhudmodel(); }
void sniperrifle::renderaimhelp(bool teamwarning)
@@ -1577,7 +1577,7 @@ void akimbo::onammopicked()
if(akimboautoswitch || owner->weaponsel->type==GUN_PISTOL)
{
if(player1->weapons[GUN_GRENADE]->busy()) player1->attacking = false;
owner->weaponswitch(this);
player1->weaponswitch(this);
}
addmsg(SV_AKIMBO, "ri", lastmillis);
}