mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Magazine Repack - Add setting & hint for repacking loaded magazines (#8475)
* add setting to repack equipped magazines * derp * derpderp * always show hint, remove setting
This commit is contained in:
parent
88e774c30d
commit
bbe4b488e0
@ -25,5 +25,5 @@ private _maxAmmoCount = getNumber (configFile >> "CfgMagazines" >> _magazine >>
|
|||||||
|
|
||||||
_magazineType == _magazine // Magazine is of given type
|
_magazineType == _magazine // Magazine is of given type
|
||||||
&& {_ammoCount > 0 && {_ammoCount < _maxAmmoCount}} // Is a partial magazine
|
&& {_ammoCount > 0 && {_ammoCount < _maxAmmoCount}} // Is a partial magazine
|
||||||
&& {!_isLoaded || {[_unit, _magazineType] call CBA_fnc_canAddItem}} // In inventory or can be moved into it
|
&& {!_isLoaded || {GVAR(repackLoadedMagazines) && {[_unit, _magazineType] call CBA_fnc_canAddItem}}} // In inventory or can be moved into it
|
||||||
} count magazinesAmmoFull _unit > 1
|
} count magazinesAmmoFull _unit > 1
|
||||||
|
@ -27,7 +27,7 @@ private _unitMagCounts = [];
|
|||||||
private _xFullMagazineCount = getNumber (configFile >> "CfgMagazines" >> _xClassname >> "count");
|
private _xFullMagazineCount = getNumber (configFile >> "CfgMagazines" >> _xClassname >> "count");
|
||||||
|
|
||||||
//for every partial magazine, that is either in inventory or can be moved there
|
//for every partial magazine, that is either in inventory or can be moved there
|
||||||
if ((_xCount < _xFullMagazineCount) && {_xCount > 0} && {(!_xLoaded) || {[_player, _xClassname] call CBA_fnc_canAddItem}}) then {
|
if ((_xCount < _xFullMagazineCount) && {_xCount > 0} && {(!_xLoaded) || {GVAR(repackLoadedMagazines) && {[_player, _xClassname] call CBA_fnc_canAddItem}}}) then {
|
||||||
private _index = _unitMagazines find _xClassname;
|
private _index = _unitMagazines find _xClassname;
|
||||||
if (_index == -1) then {
|
if (_index == -1) then {
|
||||||
_unitMagazines pushBack _xClassname;
|
_unitMagazines pushBack _xClassname;
|
||||||
|
@ -39,7 +39,7 @@ private _startingAmmoCounts = [];
|
|||||||
if (_xClassname == _magazineClassname && {_xCount != _fullMagazineCount && {_xCount > 0}}) then {
|
if (_xClassname == _magazineClassname && {_xCount != _fullMagazineCount && {_xCount > 0}}) then {
|
||||||
if (_xLoaded) then {
|
if (_xLoaded) then {
|
||||||
//Try to Remove from weapon and add to inventory, otherwise ignore
|
//Try to Remove from weapon and add to inventory, otherwise ignore
|
||||||
if ([_player, _magazineClassname] call CBA_fnc_canAddItem) then {
|
if (GVAR(repackLoadedMagazines) && {[_player, _magazineClassname] call CBA_fnc_canAddItem}) then {
|
||||||
switch (_xType) do {
|
switch (_xType) do {
|
||||||
case (1): {_player removePrimaryWeaponItem _magazineClassname};
|
case (1): {_player removePrimaryWeaponItem _magazineClassname};
|
||||||
case (2): {_player removeHandgunItem _magazineClassname};
|
case (2): {_player removeHandgunItem _magazineClassname};
|
||||||
@ -48,6 +48,7 @@ private _startingAmmoCounts = [];
|
|||||||
};
|
};
|
||||||
_player addMagazine [_magazineClassname, _xCount];
|
_player addMagazine [_magazineClassname, _xCount];
|
||||||
_startingAmmoCounts pushBack _xCount;
|
_startingAmmoCounts pushBack _xCount;
|
||||||
|
[LLSTRING(repackLoadedMagazinesHint)] call EFUNC(common,displayTextStructured);
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
_startingAmmoCounts pushBack _xCount;
|
_startingAmmoCounts pushBack _xCount;
|
||||||
|
@ -23,3 +23,11 @@ private _category = format ["ACE %1", localize LSTRING(DisplayName)];
|
|||||||
[1, 10, 8, 1],
|
[1, 10, 8, 1],
|
||||||
1
|
1
|
||||||
] call CBA_fnc_addSetting;
|
] call CBA_fnc_addSetting;
|
||||||
|
|
||||||
|
[
|
||||||
|
QGVAR(repackLoadedMagazines), "CHECKBOX",
|
||||||
|
LSTRING(repackLoadedMagazines),
|
||||||
|
_category,
|
||||||
|
true,
|
||||||
|
0
|
||||||
|
] call CBA_fnc_addSetting;
|
||||||
|
@ -166,5 +166,11 @@
|
|||||||
<Chinese>%1個滿的與%2個部分的</Chinese>
|
<Chinese>%1個滿的與%2個部分的</Chinese>
|
||||||
<Turkish>%1 Dolu ve %2 Partial</Turkish>
|
<Turkish>%1 Dolu ve %2 Partial</Turkish>
|
||||||
</Key>
|
</Key>
|
||||||
|
<Key ID="STR_ACE_MagazineRepack_repackLoadedMagazines">
|
||||||
|
<English>Repack Loaded Magazines</English>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_MagazineRepack_repackLoadedMagazinesHint">
|
||||||
|
<English>Repacking magazines, weapon unloaded</English>
|
||||||
|
</Key>
|
||||||
</Package>
|
</Package>
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
Reference in New Issue
Block a user