-
Notifications
You must be signed in to change notification settings - Fork 734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CSW - Fix and Improve reloading #9234
base: master
Are you sure you want to change the base?
Conversation
The public functions were made with ZEN compatibility for CSW Artillery in mind, I intend to make another PR for the remainder of that. Sorry for the scope on this, but it'd have been merge conflict or PR-dependency hell otherwise. |
I went ahead and pushed some fixes and a change. EDIT: |
// Don't remove ammo if it failed to load | ||
_ammoRemaining = _ammoRemaining + _ammoUsed; | ||
|
||
ERROR_1("failed to setAmmo - %1",_this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've adding this change because I feel it's wrong to punish a player if a reload can't happen, but I'm not sure if this can be abused.
Ref review, see https://github.com/LinkIsGrim/ACE3/blob/f5f14b77594d28c938822740602de83b7c30b010/addons/csw/functions/fnc_reload_canLoadMagazine.sqf#L29-L36 Calling For
For
For
Writing this I remembered that I wanted to split that function up for readability while writing this PR but never got around to it. |
|
Need to check if API won't break with that, but should be fine otherwise, yeah. |
When merged this pull request will:
FUNC(reload_canLoadMagazine)
conditions.nearSupplies
check. 10 meters was excessive._unit
param in events and logging.FUNC(getNearbySources)
.FUNC(getSourceCompatibleMags)
: returns a source's compatible carry magazines with ammo count.FUNC(compatibleMagazines)
: returns a CSW's compatible carry magazines.FUNC(reload_getLoadableMagazines)
. Done to optimize the checks for best ammo to send.FUNC(getCarryMagazine)
public.FUNC(reload_getLoadableMagazines)
by making use of new functions.FUNC(ai_reload)
useFUNC(reload_getLoadableMagazines)
directly: parameter was added to use the turret path in the latter._staticWeapon
in parameters to_vehicle
.FUNC(getAvailableAmmo)
: returns nearby compatible magazine types and sum of their ammo. Intended for ZEN compatibility.ace_csw_forcedMag
.FUNC(unloadMagazines)
: unloads magazines in turret path.FUNC(ai_switchMagazine)
: forces AI to reload specified magazine.MP tested and objNull/no container/full inventory-resistant.
I did not intend for this to grow so much, but here we are.
Review after #9238 and #9255.
IMPORTANT
Component - Add|Fix|Improve|Change|Make|Remove {changes}
.