-
Notifications
You must be signed in to change notification settings - Fork 738
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
Linking belt refactoring #5206
Linking belt refactoring #5206
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,15 +16,10 @@ params ["_player", "_target"]; | |
if (vehicle _target != _target) exitWith {false}; | ||
|
||
private _magazineType = currentMagazine _target; | ||
private _magazineCfg = configFile >> "CfgMagazines" >> _magazineType; | ||
|
||
if (getNumber (_magazineCfg >> "ACE_isBelt") == 0) exitWith {false}; | ||
private _canLink = [_player, _target] call FUNC(canLinkBelt); | ||
|
||
// Check if the ammo is not empty or full | ||
private _ammoCount = _target ammo currentWeapon _target; | ||
|
||
// Exit if the belt is full or empty | ||
if ((_ammoCount == 0) || (getNumber (_magazineCfg >> "count") - _ammoCount) == 0) exitWith {false}; | ||
if ( !_canLink ) exitWith {} ; | ||
|
||
// Check if the player has any of the same same magazines | ||
// Calculate max ammo it can link | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This section below is already included in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okey but I wanted to keep that FUNC(canLinkBelt) returned a bool and not a number. So thats why i kept the lower part in both cases. But I could redo both of the files to keep them 100% unique? Just say the word nad ill do it :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be a good idea to cut down on duplicate code if nothing else. As long as it doesn't make it more complicated. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
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.
if (!_canLink) exitWith {};
would be per our coding guidelines.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.
Okey!