Partial Reload

Zaddo

Active member
The GenericReloader does not allow a partial reload. This is a rare edge case.

I think this is due to a bug and not by design. The condition for repeating the reload in the ReloadItem method, should have an additional condition. This is the highlighted condition in the screen capture.

1681768747175.png
 
Could you give a bit more context on your setup?
What are you trying to do and why does it not work the way you expect.

The ReloadClipType Single is used by the Shotgun for example, where we reload the weapon one ammo at a time in repeat until full.
 
I only pointed this out, because I thought the intent of the code was to only keep reloading for reload type "Single". If I got this wrong, please ignore this post.

I have implemented my own netcode solution with an authoritive server. I was testing the reload, which sends a request from the client to the server to reload with a reload amount. I had the server respond with an artificial low value to simulate a player attempting to cheat and the server attempting to correct the reload amount. I was surprised that the weapon still did a full reload.

I found that the full reload was occurring because ReloadItem keeps calling StartItemReload whenever there is Ammo in the inventory and the weapon is not fully loaded.

The comment on this condition is "The item may need to be reloaded again if the reload type is single and the inventory still has ammo". I read this to mean that the StartItemReload should only be called if the reload type is Single.

However, the original logic was: If (CanReloadItem(True)) { ... }, Which would call the StartItemReload if the reload type was "Full" or "Single", which is not what the comment indicates the behavior should be.

There are only a few scenarios where you might want a weapon to partially reload. For example, the game design might give the player an option to do a partial reload which is faster than a full reload. Or you might want to make the player press reload for each bullet they load. Or my situation, testing.
 
Last edited:
I'll have to look into this in more detail, because I don't think that's what we were going for.
I'll add this to the list of things to investigate further
 
Top