assault weapon now reloading correctly
This commit is contained in:
@@ -36,8 +36,11 @@ void AssaultWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo&
|
|||||||
int& magSize = cWeapon["MagazineSize"];
|
int& magSize = cWeapon["MagazineSize"];
|
||||||
int& ammo = cWeapon["Ammo"];
|
int& ammo = cWeapon["Ammo"];
|
||||||
|
|
||||||
ammo = glm::max(0, ammo - (magSize - magAmmo));
|
int usedAmmo = glm::max(0, magSize - magAmmo);
|
||||||
magAmmo = glm::min(magSize, ammo);
|
magAmmo = glm::clamp(ammo + magAmmo, 0, magSize);
|
||||||
|
ammo = glm::max(0, ammo - usedAmmo);
|
||||||
|
|
||||||
|
|
||||||
isReloading = false;
|
isReloading = false;
|
||||||
if (wi.FirstPersonEntity.Valid()) {
|
if (wi.FirstPersonEntity.Valid()) {
|
||||||
wi.FirstPersonEntity.FirstChildByName("ViewModel")["Model"]["Visible"] = true;
|
wi.FirstPersonEntity.FirstChildByName("ViewModel")["Model"]["Visible"] = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user