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; _return = 3;
if(_canDrop)then{ if(_canDrop)then{
_wH = objNull; _wH = objNull;
if (isNil "_nearByHolder") then { if (player != vehicle player && vehicle player canAdd _item) then {
_nearByHolder = nearestObjects [player,["groundWeaponHolder"],3]; _return = 4;
}; _wh = vehicle player;
if (_nearByHolder isEqualTo []) then { }
_wHPos = player modelToWorld [0,1,0]; else {
if (surfaceIsWater _wHPos) then { _return = 2;
_wHPos = ASLToATL _wHPos; if (isNil "_nearByHolder") then {
}; _nearByHolder = nearestObjects [player,["groundWeaponHolder"],3];
_wH = createVehicle ["groundWeaponHolder",_wHPos, [], 0, "CAN_COLLIDE"]; };
} else { if (_nearByHolder isEqualTo []) then {
_wH = _nearByHolder select 0; _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 { if !(isNull _wh) then {
//_wh addItemCargoGlobal [_item,1]; //_wh addItemCargoGlobal [_item,1];
_wh addMagazineAmmoCargo [_item, 1, _count]; _wh addMagazineAmmoCargo [_item, 1, _count];
}; };
_return = 2;
}; };
}; };
_return _return

View File

@ -34,7 +34,7 @@ if ((["flare", tolower _weaponTurret] call BIS_fnc_inString) || (["smoke", tolow
_ammoTurret = getArray(configFile >> "CfgWeapons" >> _weaponTurret >> "magazines"); _ammoTurret = getArray(configFile >> "CfgWeapons" >> _weaponTurret >> "magazines");
_availAmmo = (magazines player) arrayIntersect _ammoTurret; _availAmmo = (magazines player) arrayIntersect _ammoTurret;
if (count _availAmmo == 0) then { 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 { else {
_ammo = _availAmmo select 0; _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 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 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 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; [_msg,5] call Epoch_message;