Files
DayZ-Epoch/SQF/dayz_code/actions/player_tearClothes.sqf
AirwavesMan 9ad86a84a3 Group sounds and zombie calls
dayz_zombieSpeak and player_alertZombies are called often together or should be. fnc_alertZombies groups them together and uses the given parameters. This streamlines and corrects the missing or incorrect calls from dayz_zombieSpeak or player_alertZombies.
2020-09-12 01:30:45 +02:00

63 lines
1.5 KiB
Plaintext

if (dayz_actionInProgress) exitWith { localize "str_player_actionslimit" call dayz_rollingMessages; };
dayz_actionInProgress = true;
private ["_skin","_rnd","_rounded","_itemtocreate","_i","_config","_result","_finished"];
_skin = _this;
_config = configFile >> "CfgMagazines" >> _skin;
_itemtocreate = getText (_config >> "Craftoutput");
_rnd = random 3;
_rounded = round _rnd;
call gear_ui_init;
closeDialog 0;
//Tear the clothes
[player,(getPosATL player),10,"bandage"] spawn fnc_alertZombies;
_finished = ["Medic",1] call fn_loopAction;
if (!_finished) exitWith {
dayz_actionInProgress = false;
};
if !(_skin in magazines player) exitWith {
localize "str_tear_clothes_0" call dayz_rollingMessages;
dayz_actionInProgress = false;
};
player removeMagazine _skin;
switch (_rounded) do {
case 0: {
localize "str_tear_clothes_0" call dayz_rollingMessages;
};
case 1: {
localize "str_tear_clothes_1" call dayz_rollingMessages;
};
case 2: {
localize "str_tear_clothes_2" call dayz_rollingMessages;
};
case 3: {
localize "str_tear_clothes_3" call dayz_rollingMessages;
};
};
//Remove melee magazines (BIS_fnc_invAdd fix)
false call dz_fn_meleeMagazines;
_i = 0;
while {_i < _rounded} do {
_i = _i + 1;
_result = [player,_itemtocreate] call BIS_fnc_invAdd;
if (_rnd < 0.5) then {
[player,"equip_string"] call BIS_fnc_invAdd;
};
uiSleep 0.03;
if (!_result) then {
systemchat (localize ("str_tear_clothes_noroom"));
[_itemtocreate,1,1] call fn_dropItem;
};
};
true call dz_fn_meleeMagazines;
dayz_actionInProgress = false;