MCPcopy Create free account
hub / github.com/assaultcube/AC / checkweaponswitch

Function checkweaponswitch

source/src/weapon.cpp:28–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26}
27
28void checkweaponswitch()
29{
30 if(!player1->weaponchanging) return;
31 int timeprogress = lastmillis-player1->weaponchanging;
32 if(timeprogress>weapon::weaponchangetime)
33 {
34 addmsg(SV_WEAPCHANGE, "ri", player1->weaponsel->type);
35 player1->weaponchanging = 0;
36 }
37 else if(timeprogress>(weapon::weaponchangetime>>1) && player1->weaponsel != player1->nextweaponsel)
38 {
39 player1->prevweaponsel = player1->weaponsel;
40 player1->weaponsel = player1->nextweaponsel;
41 if(quicknade){
42 keym *key_LMB = keyms.access(-1);
43 if(key_LMB->pressed)
44 {
45 player1->attacking = true;
46 player1->weaponsel->attack(worldpos);
47 }
48 }
49 }
50}
51
52void selectweapon(weapon *w)
53{

Callers 1

checkweaponstateFunction · 0.85

Calls 3

addmsgFunction · 0.85
accessMethod · 0.80
attackMethod · 0.80

Tested by

no test coverage detected