From e55a3ea5c671daa39b60d671db212e8ab83b9419 Mon Sep 17 00:00:00 2001 From: Martin Taibr Date: Thu, 12 Sep 2019 23:19:55 +0200 Subject: [PATCH] fix burst when no ammo for reload, update hash --- .gitlab-ci.yml | 2 +- qcsrc/common/weapons/weapon/machinegun.qc | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0b75042c1f..2a26756c55 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,7 +29,7 @@ test_sv_game: - wget -O data/maps/stormkeep.waypoints https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.waypoints - wget -O data/maps/stormkeep.waypoints.cache https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.waypoints.cache - make - - EXPECT=87520b179179232b2bce66d249d4686b + - EXPECT=892e447048e051e51f30cff2affc729a - HASH=$(${ENGINE} -noconfig -nohome +exec serverbench.cfg | tee /dev/stderr | grep '^:' diff --git a/qcsrc/common/weapons/weapon/machinegun.qc b/qcsrc/common/weapons/weapon/machinegun.qc index 7b97526863..5a55b7e8b5 100644 --- a/qcsrc/common/weapons/weapon/machinegun.qc +++ b/qcsrc/common/weapons/weapon/machinegun.qc @@ -272,15 +272,16 @@ METHOD(MachineGun, wr_checkammo1, bool(entity thiswep, entity actor, .entity wea METHOD(MachineGun, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity)) { float ammo_amount; + float burst_ammo_per_shot = WEP_CVAR(machinegun, burst_ammo) / WEP_CVAR(machinegun, burst); if(WEP_CVAR(machinegun, mode) == 1) - ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(machinegun, burst_ammo); + ammo_amount = GetResource(actor, thiswep.ammo_type) >= burst_ammo_per_shot; else ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(machinegun, first_ammo); if(WEP_CVAR(machinegun, reload_ammo)) { if(WEP_CVAR(machinegun, mode) == 1) - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(machinegun, burst_ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= burst_ammo_per_shot; else ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(machinegun, first_ammo); } -- 2.39.2