MantisBT - Zandronum
View Issue Details
0003863Zandronum[All Projects] Bugpublic2020-09-27 11:492020-10-18 19:28
needs testingopen 
0003863: A_CustomPunch does not consume ammo online
I'm not sure if this was already reported before but A_CustomPunch does not consume ammo in netgames, it looks as if the hits do register and the game recognizes that the ammo was consumed but the ammo counter does not deplete, and the game thinks I still have the weapon but uses a different weapon instead, this becomes a major problem for melee weapons that are dependant on ammo count to perform different actions and jump. If what I'm saying doesn't make sense I provided an example file for you to test, host a lan server with it and you'll start seeing the problems. it works perfectly fine offline but then you go online and things get real weird.
No tags attached.
? BrownBottle.pk3 (98,060) 2020-09-27 11:49
Issue History
2020-09-27 11:49UnknownNew Issue
2020-09-27 11:49UnknownFile Added: BrownBottle.pk3
2020-09-28 08:14GarryMcGoobleNote Added: 0021544
2020-09-28 15:07GarryMcGoobleNote Edited: 0021544bug_revision_view_page.php?bugnote_id=21544#r13260
2020-10-18 19:27Torr SamahoNote Added: 0021550
2020-10-18 19:28Torr SamahoStatusnew => needs testing
2020-10-18 19:28Torr SamahoTarget Version => 3.1

2020-09-28 08:14   
(edited on: 2020-09-28 15:07)
Adding the +INVENTORY.ALWAYSPICKUP flag to your ActionAmmo actor seems to fix the issue

After digging some more it appears that A_CustomPunch issues the GiveInventory server command, expecting it to update the client's ammo count. However, GiveInventory calls CallTryPickup, which eventually results in AAmmo::HandlePickup being called. This function only tries to add ammo, and returns true if the player has max ammo, which they always do on the client's side right now. This can be fixed by replacing the two GiveInventory commands in A_CustomPunch with TakeInventory commands

Torr Samaho   
2020-10-18 19:27   
Thanks a lot! You patch looks fine and I added it.