Remove Ammo Tweaks

This commit is contained in:
He-Man 2017-10-15 18:19:41 +02:00
parent 3957d3e028
commit 35c9902232
3 changed files with 21 additions and 14 deletions

View File

@ -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

View File

@ -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;

View File

@ -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;