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

Method reload

source/src/weapon.cpp:968–987  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

966}
967
968bool weapon::reload(bool autoreloaded)
969{
970 if(mag>=info.magsize || ammo<=0) return false;
971 updatelastaction(owner);
972 reloading = lastmillis;
973 gunwait += info.reloadtime;
974
975 int numbullets = min(info.magsize - mag, ammo);
976 mag += numbullets;
977 ammo -= numbullets;
978
979 bool local = (player1 == owner);
980 if(info.reload != S_NULL) audiomgr.playsound(info.reload, owner, local ? SP_HIGH : SP_NORMAL);
981 if(local)
982 {
983 addmsg(SV_RELOAD, "ri2", lastmillis, owner->weaponsel->type);
984 exechook(HOOK_SP, "onReload", "%d", (int)autoreloaded);
985 }
986 return true;
987}
988
989VARP(oldfashionedgunstats, 0, 0, 1);
990

Callers 2

parsemessagesFunction · 0.80
tryreloadFunction · 0.80

Calls 5

updatelastactionFunction · 0.85
minFunction · 0.85
addmsgFunction · 0.85
exechookFunction · 0.85
playsoundMethod · 0.80

Tested by

no test coverage detected