From 35c9902232931a91cbb3c2317299321b16dfc8af Mon Sep 17 00:00:00 2001 From: He-Man Date: Sun, 15 Oct 2017 18:19:41 +0200 Subject: [PATCH] Remove Ammo Tweaks --- .../EPOCH_fnc_addMagazineOverflow.sqf | 32 +++++++++++-------- .../EPOCH_vehicle_checkTurretAmmo.sqf | 2 +- .../EPOCH_vehicle_removeTurretAmmo.sqf | 1 + 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/Sources/epoch_code/compile/functions/EPOCH_fnc_addMagazineOverflow.sqf b/Sources/epoch_code/compile/functions/EPOCH_fnc_addMagazineOverflow.sqf index 524355f2..09bbd273 100644 --- a/Sources/epoch_code/compile/functions/EPOCH_fnc_addMagazineOverflow.sqf +++ b/Sources/epoch_code/compile/functions/EPOCH_fnc_addMagazineOverflow.sqf @@ -38,23 +38,29 @@ if (player canAdd _item) then { _return = 3; if(_canDrop)then{ _wH = objNull; - if (isNil "_nearByHolder") then { - _nearByHolder = nearestObjects [player,["groundWeaponHolder"],3]; - }; - if (_nearByHolder isEqualTo []) then { - _wHPos = player modelToWorld [0,1,0]; - if (surfaceIsWater _wHPos) then { - _wHPos = ASLToATL _wHPos; - }; - _wH = createVehicle ["groundWeaponHolder",_wHPos, [], 0, "CAN_COLLIDE"]; - } else { - _wH = _nearByHolder select 0; - }; + if (player != vehicle player && vehicle player canAdd _item) then { + _return = 4; + _wh = vehicle player; + } + else { + _return = 2; + if (isNil "_nearByHolder") then { + _nearByHolder = nearestObjects [player,["groundWeaponHolder"],3]; + }; + if (_nearByHolder isEqualTo []) then { + _wHPos = player modelToWorld [0,1,0]; + if (surfaceIsWater _wHPos) then { + _wHPos = ASLToATL _wHPos; + }; + _wH = createVehicle ["groundWeaponHolder",_wHPos, [], 0, "CAN_COLLIDE"]; + } else { + _wH = _nearByHolder select 0; + }; + }; if !(isNull _wh) then { //_wh addItemCargoGlobal [_item,1]; _wh addMagazineAmmoCargo [_item, 1, _count]; }; - _return = 2; }; }; _return diff --git a/Sources/epoch_code/compile/vehicles/EPOCH_vehicle_checkTurretAmmo.sqf b/Sources/epoch_code/compile/vehicles/EPOCH_vehicle_checkTurretAmmo.sqf index 76c45158..ca16ce0b 100644 --- a/Sources/epoch_code/compile/vehicles/EPOCH_vehicle_checkTurretAmmo.sqf +++ b/Sources/epoch_code/compile/vehicles/EPOCH_vehicle_checkTurretAmmo.sqf @@ -34,7 +34,7 @@ if ((["flare", tolower _weaponTurret] call BIS_fnc_inString) || (["smoke", tolow _ammoTurret = getArray(configFile >> "CfgWeapons" >> _weaponTurret >> "magazines"); _availAmmo = (magazines player) arrayIntersect _ammoTurret; if (count _availAmmo == 0) then { - [format["You need a can of %1 or any of its variants",_ammoTurret select 0],5] call Epoch_message; + [format["You need a can of %1 or any of its variants",getText (configFile >> 'CfgMagazines' >> (_ammoTurret select 0) >> 'displayName')],5] call Epoch_message; } else { _ammo = _availAmmo select 0; diff --git a/Sources/epoch_code/compile/vehicles/EPOCH_vehicle_removeTurretAmmo.sqf b/Sources/epoch_code/compile/vehicles/EPOCH_vehicle_removeTurretAmmo.sqf index 4b0dc711..37b1c937 100644 --- a/Sources/epoch_code/compile/vehicles/EPOCH_vehicle_removeTurretAmmo.sqf +++ b/Sources/epoch_code/compile/vehicles/EPOCH_vehicle_removeTurretAmmo.sqf @@ -39,5 +39,6 @@ _msg = switch _return do { case 1: {format ["Removed 1 can %1 with %2 rounds from %3",_magtxt,_magAmmoCount, _weapontxt]}; case 2: {format ["Dropped 1 can of %1 with %2 rounds on the ground!",_magtxt,_magAmmoCount, _weapontxt]}; case 3: {format ["You dont have enough space for %1!",_magtxt]}; + case 4: {format ["Put 1 can of %1 with %2 rounds into Vehicle!",_magtxt,_magAmmoCount, _weapontxt]}; }; [_msg,5] call Epoch_message;