From 9ad86a84a319433f9faefe032950168718b324ee Mon Sep 17 00:00:00 2001 From: AirwavesMan Date: Sat, 12 Sep 2020 01:30:45 +0200 Subject: [PATCH] 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. --- SQF/dayz_code/actions/boil.sqf | 5 +-- SQF/dayz_code/actions/cook.sqf | 19 ++++++------ SQF/dayz_code/actions/gather_meat.sqf | 13 +++----- SQF/dayz_code/actions/hotwire_veh.sqf | 9 +++--- SQF/dayz_code/actions/jerry_fill.sqf | 20 ++++++------ SQF/dayz_code/actions/maintain_area.sqf | 3 +- SQF/dayz_code/actions/modular_build.sqf | 7 ++--- .../actions/player_attachAttachment.sqf | 10 +++--- SQF/dayz_code/actions/player_build.sqf | 7 ++--- .../actions/player_buildingDowngrade.sqf | 6 ++-- .../actions/player_buildingMaint.sqf | 27 +++++++--------- SQF/dayz_code/actions/player_consume.sqf | 23 +++++++------- SQF/dayz_code/actions/player_copyKey.sqf | 9 +++--- SQF/dayz_code/actions/player_craftItem.sqf | 3 +- .../actions/player_emptyContainer.sqf | 16 +++++++--- SQF/dayz_code/actions/player_gather.sqf | 15 ++++----- SQF/dayz_code/actions/player_harvestPlant.sqf | 3 +- SQF/dayz_code/actions/player_loadCrate.sqf | 24 +++++++------- SQF/dayz_code/actions/player_mineStone.sqf | 23 ++++++-------- .../actions/player_removeAttachment.sqf | 10 +++--- SQF/dayz_code/actions/player_sharpen.sqf | 3 +- SQF/dayz_code/actions/player_tearClothes.sqf | 16 +++++----- SQF/dayz_code/actions/player_upgrade.sqf | 5 ++- SQF/dayz_code/actions/refuel.sqf | 7 ++--- SQF/dayz_code/actions/remove.sqf | 31 ++++++++++--------- SQF/dayz_code/actions/repair.sqf | 7 ++--- SQF/dayz_code/actions/salvage.sqf | 7 ++--- SQF/dayz_code/actions/siphonFuel.sqf | 15 +++++---- SQF/dayz_code/actions/water_fill.sqf | 27 ++++++++-------- SQF/dayz_code/compile/player_lockVault.sqf | 4 +-- SQF/dayz_code/compile/player_packTent.sqf | 3 +- SQF/dayz_code/compile/player_packVault.sqf | 2 +- SQF/dayz_code/compile/player_unlockDoor.sqf | 3 +- SQF/dayz_code/compile/player_unlockVault.sqf | 4 +-- SQF/dayz_code/init/compiles.sqf | 12 +++++++ 35 files changed, 193 insertions(+), 205 deletions(-) diff --git a/SQF/dayz_code/actions/boil.sqf b/SQF/dayz_code/actions/boil.sqf index 14159c013..92363d4cf 100644 --- a/SQF/dayz_code/actions/boil.sqf +++ b/SQF/dayz_code/actions/boil.sqf @@ -29,10 +29,7 @@ if !(_hastinitem) exitWith { }; if (_qty > 0) then { - _dis=10; - _sfx = "cook"; - [player,_sfx,0,false,_dis] call dayz_zombieSpeak; - [player,_dis,true,(getPosATL player)] call player_alertZombies; + [player,(getPosATL player),10,"cook"] spawn fnc_alertZombies; _finished = ["Medic",1] call fn_loopAction; diff --git a/SQF/dayz_code/actions/cook.sqf b/SQF/dayz_code/actions/cook.sqf index b4afc8b7c..ea3b2f0ef 100644 --- a/SQF/dayz_code/actions/cook.sqf +++ b/SQF/dayz_code/actions/cook.sqf @@ -1,6 +1,8 @@ -private ["_rawmeat","_cookedmeat","_meat","_meatcooked","_text","_qty","_dis","_sfx","_finished"]; if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; dayz_actionInProgress = true; + +private ["_rawmeat","_cookedmeat","_meat","_meatcooked","_text","_qty","_finished"]; + //diag_log ("Cook Enabled"); player removeAction s_player_cook; s_player_cook = -1; @@ -16,16 +18,13 @@ _finished = true; if (_meat in magazines player) then { _text = getText (configFile >> "CfgMagazines" >> _meat >> "displayName"); - _dis=6; - _sfx = "cook"; - [player,_sfx,0,false,_dis] call dayz_zombieSpeak; - [player,_dis,true,(getPosATL player)] call player_alertZombies; - + [player,(getPosATL player),10,"cook"] spawn fnc_alertZombies; + _finished = ["Medic",1] call fn_loopAction; if (!_finished) exitWith {}; - + _qty = {_x == _meat} count magazines player; - + for "_x" from 1 to _qty do { player removeMagazine _meat; player addMagazine _meatcooked; @@ -34,9 +33,9 @@ _finished = true; }; format[localize "str_success_cooked",_qty,_text] call dayz_rollingMessages; }; - + if (!_finished) exitWith {}; } forEach _rawmeat; a_player_cooking = false; -dayz_actionInProgress = false; \ No newline at end of file +dayz_actionInProgress = false; diff --git a/SQF/dayz_code/actions/gather_meat.sqf b/SQF/dayz_code/actions/gather_meat.sqf index 3a8d03435..002912ab3 100644 --- a/SQF/dayz_code/actions/gather_meat.sqf +++ b/SQF/dayz_code/actions/gather_meat.sqf @@ -1,4 +1,4 @@ -private ["_item","_type","_hasHarvested","_knifeArray","_PlayerNear","_isListed","_activeKnife","_text","_dis","_sfx","_qty","_string","_isZombie","_humanity","_finished"]; +private ["_item","_type","_hasHarvested","_knifeArray","_PlayerNear","_isListed","_activeKnife","_text","_qty","_string","_isZombie","_humanity","_finished"]; if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; dayz_actionInProgress = true; @@ -31,16 +31,13 @@ if ((count _knifeArray) < 1) exitWith { if ((count _knifeArray > 0) and !_hasHarvested) then { //Use sharpest knife player has - _activeKnife = _knifeArray select 0; + _activeKnife = _knifeArray select 0; //Get Animal Type _isListed = isClass (configFile >> "CfgSurvival" >> "Meat" >> _type); _text = getText (configFile >> "CfgVehicles" >> _type >> "displayName"); - _dis=10; - _sfx = "gut"; - [player,_sfx,0,false,_dis] call dayz_zombieSpeak; - [player,_dis,true,(getPosATL player)] call player_alertZombies; + [player,(getPosATL player),10,"gut"] spawn fnc_alertZombies; _finished = ["Medic",1] call fn_loopAction; if (!_finished) exitWith {}; @@ -55,7 +52,7 @@ if ((count _knifeArray > 0) and !_hasHarvested) then { if (local _item) then { [_item,_qty] spawn local_gutObject; //leave as spawn (sleeping in loops will work but can freeze the script) - } else { + } else { PVCDZ_obj_GutBody =[_item,_qty]; publicVariable "PVCDZ_obj_GutBody"; @@ -78,4 +75,4 @@ if ((count _knifeArray > 0) and !_hasHarvested) then { _string call dayz_rollingMessages; }; -dayz_actionInProgress = false; \ No newline at end of file +dayz_actionInProgress = false; diff --git a/SQF/dayz_code/actions/hotwire_veh.sqf b/SQF/dayz_code/actions/hotwire_veh.sqf index 52ec81f7e..b59cd4128 100644 --- a/SQF/dayz_code/actions/hotwire_veh.sqf +++ b/SQF/dayz_code/actions/hotwire_veh.sqf @@ -1,9 +1,9 @@ -private ["_time","_vehicle","_removed","_vehType","_finished"]; -_vehicle = _this select 3; - if (dayz_actionInProgress) exitWith {localize "STR_EPOCH_PLAYER_32" call dayz_rollingMessages;}; dayz_actionInProgress = true; +private ["_time","_vehicle","_removed","_vehType","_finished"]; +_vehicle = _this select 3; + {player removeAction _x} count s_player_lockunlock;s_player_lockunlock = []; s_player_lockUnlock_crtl = 1; {DZE_myVehicle removeAction _x} count s_player_lockUnlockInside;s_player_lockUnlockInside = []; @@ -12,8 +12,7 @@ s_player_lockUnlockInside_ctrl = 1; _removed = ([player,"ItemHotwireKit",1] call BIS_fnc_invRemove); if (_removed == 1) then { - [player,"repair",0,false] call dayz_zombieSpeak; - [player,50,true,(getPosATL player)] spawn player_alertZombies; + [player,(getPosATL player),40,"repair"] spawn fnc_alertZombies; _finished = ["Medic",1] call fn_loopAction; if (!_finished) exitWith { diff --git a/SQF/dayz_code/actions/jerry_fill.sqf b/SQF/dayz_code/actions/jerry_fill.sqf index 83426ce2f..9c8cd2221 100644 --- a/SQF/dayz_code/actions/jerry_fill.sqf +++ b/SQF/dayz_code/actions/jerry_fill.sqf @@ -1,6 +1,7 @@ if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; dayz_actionInProgress = true; -private ["_qty","_dis","_sfx","_finished","_qty20","_qty5","_qty210","_magazines","_cursorTarget","_fuelAmount","_fuelNeeded"]; + +private ["_qty","_finished","_qty20","_qty5","_qty210","_magazines","_cursorTarget","_fuelAmount","_fuelNeeded"]; player removeAction s_player_fillfuel; //s_player_fillfuel = -1; @@ -29,20 +30,17 @@ if (_fuelAmount < _fuelNeeded) then {format[localize "str_fill_notenough",typeOf if (_fuelAmount < 5 or (_fuelAmount < 20 && _qty5 == 0) or (_fuelAmount < 210 && (_qty5 == 0 && _qty20 == 0))) exitWith {dayz_actionInProgress = false;}; if (_qty > 0) then { - _dis=5; - _sfx = "refuel"; - [player,_sfx,0,false,_dis] call dayz_zombieSpeak; - [player,_dis,true,(getPosATL player)] call player_alertZombies; - + [player,(getPosATL player),20,"refuel"] spawn fnc_alertZombies; + _finished = ["Medic",1] call fn_loopAction; if (!_finished) exitWith {}; - + // Added Nutrition-Factor for work ["Working",0,[20,40,15,0]] call dayz_NutritionSystem; - + for "_x" from 1 to _qty5 do { _fuelAmount = _cursorTarget getVariable "FuelAmount"; - + if (_fuelAmount >= 5) then { _fuelAmount = _fuelAmount - 5; _cursorTarget setVariable ["FuelAmount",_fuelAmount,true]; @@ -54,7 +52,7 @@ if (_qty > 0) then { }; for "_x" from 1 to _qty20 do { _fuelAmount = _cursorTarget getVariable "FuelAmount"; - + if (_fuelAmount >= 20) then { _fuelAmount = _fuelAmount - 20; _cursorTarget setVariable ["FuelAmount",_fuelAmount,true]; @@ -66,7 +64,7 @@ if (_qty > 0) then { }; for "_x" from 1 to _qty210 do { _fuelAmount = _cursorTarget getVariable "FuelAmount"; - + if (_fuelAmount >= 210) then { _fuelAmount = _fuelAmount - 210; _cursorTarget setVariable ["FuelAmount",_fuelAmount,true]; diff --git a/SQF/dayz_code/actions/maintain_area.sqf b/SQF/dayz_code/actions/maintain_area.sqf index 4f03c2543..8cf514afb 100644 --- a/SQF/dayz_code/actions/maintain_area.sqf +++ b/SQF/dayz_code/actions/maintain_area.sqf @@ -74,8 +74,7 @@ _maintain = { if (_enoughMoney) then { closeDialog 1; - [player,"repair",0,false,20] call dayz_zombieSpeak; - [player,DZE_maintainRange,true,(getPosATL player)] spawn player_alertZombies; + [player,(getPosATL player),DZE_maintainRange,"repair"] spawn fnc_alertZombies; _finished = ["Medic",1] call fn_loopAction; if !(_finished) exitWith {}; diff --git a/SQF/dayz_code/actions/modular_build.sqf b/SQF/dayz_code/actions/modular_build.sqf index d54b1fd39..d2d7eebba 100644 --- a/SQF/dayz_code/actions/modular_build.sqf +++ b/SQF/dayz_code/actions/modular_build.sqf @@ -1,7 +1,7 @@ if (dayz_actionInProgress) exitWith {localize "str_epoch_player_40" call dayz_rollingMessages;}; dayz_actionInProgress = true; -private ["_abort","_reason","_distance","_isNear","_lockable","_isAllowedUnderGround","_offset","_classname","_zheightdirection","_zheightchanged","_rotate","_objectHelperPos","_objHDiff","_position","_isOk","_dir","_vector","_cancel","_location2","_buildOffset","_location","_limit","_finished","_proceed","_counter","_dis","_sfx","_combination_1_Display","_combination_1","_combination_2","_combination_3","_combination","_combinationDisplay","_combination_4","_num_removed","_tmpbuilt","_vUp","_classnametmp","_text","_ghost","_objectHelper","_location1","_object","_helperColor","_canDo","_pos","_onLadder","_vehicle","_inVehicle","_needNear","_canBuild","_friendsArr"]; +private ["_abort","_reason","_distance","_isNear","_lockable","_isAllowedUnderGround","_offset","_classname","_zheightdirection","_zheightchanged","_rotate","_objectHelperPos","_objHDiff","_position","_isOk","_dir","_vector","_cancel","_location2","_buildOffset","_location","_limit","_finished","_proceed","_counter","_combination_1_Display","_combination_1","_combination_2","_combination_3","_combination","_combinationDisplay","_combination_4","_num_removed","_tmpbuilt","_vUp","_classnametmp","_text","_ghost","_objectHelper","_location1","_object","_helperColor","_canDo","_pos","_onLadder","_vehicle","_inVehicle","_needNear","_canBuild","_friendsArr"]; _pos = [player] call FNC_GetPos; @@ -407,10 +407,7 @@ if (_canBuild select 0) then { while {_isOk} do { format[localize "str_epoch_player_139",_text, (_counter + 1),_limit] call dayz_rollingMessages; //report how many steps are done out of total limit - _dis=20; - _sfx = "repair"; - [player,_sfx,0,false,_dis] call dayz_zombieSpeak; - [player,_dis,true,(getPosATL player)] spawn player_alertZombies; + [player,(getPosATL player),40,"repair"] spawn fnc_alertZombies; _finished = ["Medic",1,{player getVariable["combattimeout",0] >= diag_tickTime or DZE_cancelBuilding}] call fn_loopAction; diff --git a/SQF/dayz_code/actions/player_attachAttachment.sqf b/SQF/dayz_code/actions/player_attachAttachment.sqf index 9703ad2b8..f1b0894ed 100644 --- a/SQF/dayz_code/actions/player_attachAttachment.sqf +++ b/SQF/dayz_code/actions/player_attachAttachment.sqf @@ -38,7 +38,7 @@ else { _weapon = Player_GetSidearm(); if (isNil "_weapon") then { "" } else { _w if (_weapon == "") exitWith { closedialog 0; - + localize ( if ((_this select 1) == 1) @@ -54,7 +54,7 @@ _config = configFile >> "CfgWeapons" >> _weapon >> "Attachments"; if (!isClass(_config) || {!isText(_config >> _attachment)}) exitWith { closeDialog 0; - + localize ( if ((_this select 1) == 1) @@ -66,7 +66,7 @@ if (!isClass(_config) || {!isText(_config >> _attachment)}) exitWith _newWeapon = getText (_config >> _attachment); _weaponInUse = (currentWeapon player == _weapon); -[player,"attach_weap",0,false] call dayz_zombieSpeak; +[player,(getPosATL player),10,"attach_weap"] spawn fnc_alertZombies; call gear_ui_init; player playActionNow "Medic"; @@ -82,7 +82,7 @@ player addWeapon _newWeapon; if (_weaponInUse) then { _muzzle = (getArray (configFile >> "CfgWeapons" >> _newWeapon >> "muzzles")) select 0; - + if (_muzzle == "this") then { player selectWeapon _newWeapon; @@ -91,4 +91,4 @@ if (_weaponInUse) then { player selectWeapon _muzzle; }; -}; \ No newline at end of file +}; diff --git a/SQF/dayz_code/actions/player_build.sqf b/SQF/dayz_code/actions/player_build.sqf index f99430a90..aac47ccaa 100644 --- a/SQF/dayz_code/actions/player_build.sqf +++ b/SQF/dayz_code/actions/player_build.sqf @@ -5,7 +5,7 @@ if (dayz_actionInProgress) exitWith {localize "str_epoch_player_40" call dayz_rollingMessages;}; dayz_actionInProgress = true; -private ["_location","_pos","_dir","_classname","_item","_cancel","_reason","_finished","_dis","_sfx","_tmpbuilt","_onLadder","_text","_offset","_isOk","_location1","_location2","_counter","_limit","_proceed","_num_removed","_position","_object","_distance","_classnametmp","_ghost","_lockable","_zheightchanged","_rotate","_combination_1","_combination_2","_combination_3","_combination_4","_combination","_combination_1_Display","_combinationDisplay","_zheightdirection","_abort","_isNear","_needNear","_vehicle","_inVehicle","_objHDiff","_isAllowedUnderGround","_canBuild","_friendsArr","_vector"]; +private ["_location","_pos","_dir","_classname","_item","_cancel","_reason","_finished","_tmpbuilt","_onLadder","_text","_offset","_isOk","_location1","_location2","_counter","_limit","_proceed","_num_removed","_position","_object","_distance","_classnametmp","_ghost","_lockable","_zheightchanged","_rotate","_combination_1","_combination_2","_combination_3","_combination_4","_combination","_combination_1_Display","_combinationDisplay","_zheightdirection","_abort","_isNear","_needNear","_vehicle","_inVehicle","_objHDiff","_isAllowedUnderGround","_canBuild","_friendsArr","_vector"]; _pos = [player] call FNC_GetPos; _onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1; @@ -326,10 +326,7 @@ if (_canBuild select 0) then { while {_isOk} do { format[localize "str_epoch_player_139",_text, (_counter + 1),_limit] call dayz_rollingMessages; - _dis=20; - _sfx = "repair"; - [player,_sfx,0,false,_dis] call dayz_zombieSpeak; - [player,_dis,true,(getPosATL player)] spawn player_alertZombies; + [player,(getPosATL player),40,"repair"] spawn fnc_alertZombies; _finished = ["Medic",1,{player getVariable["combattimeout",0] >= diag_tickTime or DZE_cancelBuilding}] call fn_loopAction; diff --git a/SQF/dayz_code/actions/player_buildingDowngrade.sqf b/SQF/dayz_code/actions/player_buildingDowngrade.sqf index dcba3c34e..61ac6be4a 100644 --- a/SQF/dayz_code/actions/player_buildingDowngrade.sqf +++ b/SQF/dayz_code/actions/player_buildingDowngrade.sqf @@ -2,11 +2,11 @@ DayZ Base Building Upgrades Made for DayZ Epoch please ask permission to use/edit/distribute email vbawol@veteranbastards.com. */ -private ["_location","_dir","_classname","_text","_object","_objectID","_objectUID","_newclassname","_refund","_obj","_upgrade","_objectCharacterID","_ownerID","_i","_invResult","_itemOut","_countOut","_abortInvAdd","_addedItems","_finished","_playerNear"]; - if (dayz_actionInProgress) exitWith {localize "str_epoch_player_48" call dayz_rollingMessages;}; dayz_actionInProgress = true; +private ["_location","_dir","_classname","_text","_object","_objectID","_objectUID","_newclassname","_refund","_obj","_upgrade","_objectCharacterID","_ownerID","_i","_invResult","_itemOut","_countOut","_abortInvAdd","_addedItems","_finished","_playerNear"]; + player removeAction s_player_downgrade_build; s_player_downgrade_build = 1; @@ -33,7 +33,7 @@ if ((count _upgrade) > 0) then { _newclassname = _upgrade select 0; _refund = _upgrade select 1; - [player,20,true,(getPosATL player)] spawn player_alertZombies; + [player,(getPosATL player),40,"repair"] spawn fnc_alertZombies; _finished = ["Medic",1] call fn_loopAction; if (!_finished) exitWith {}; diff --git a/SQF/dayz_code/actions/player_buildingMaint.sqf b/SQF/dayz_code/actions/player_buildingMaint.sqf index c94a6f59e..4039caac2 100644 --- a/SQF/dayz_code/actions/player_buildingMaint.sqf +++ b/SQF/dayz_code/actions/player_buildingMaint.sqf @@ -2,11 +2,11 @@ DayZ Base Building Maintenance Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com. */ -private ["_location","_dir","_classname","_missing","_text","_proceed","_num_removed","_object","_missingQty","_itemIn","_countIn","_qty","_removed","_removed_total","_tobe_removed_total","_objectID","_objectUID","_temp_removed_array","_textMissing","_requirements","_obj","_upgrade","_objectCharacterID","_finished"]; - if (dayz_actionInProgress) exitWith {localize "str_epoch_player_52" call dayz_rollingMessages;}; dayz_actionInProgress = true; +private ["_classname","_missing","_proceed","_num_removed","_missingQty","_itemIn","_countIn","_qty","_removed","_removed_total","_tobe_removed_total","_objectID","_objectUID","_temp_removed_array","_textMissing","_requirements","_obj","_upgrade","_finished"]; + player removeAction s_player_maint_build; s_player_maint_build = 1; @@ -24,9 +24,6 @@ if (_objectID == "0" && _objectUID == "0") exitWith {dayz_actionInProgress = fal // Get classname _classname = typeOf _obj; -// Find display name -_text = getText (configFile >> "CfgVehicles" >> _classname >> "displayName"); - // Find next maintain _upgrade = getArray (configFile >> "CfgVehicles" >> _classname >> "maintainBuilding"); @@ -47,18 +44,18 @@ _proceed = true; if(_qty < _countIn) exitWith { _missing = _itemIn; _missingQty = (_countIn - _qty); _proceed = false; }; } forEach _requirements; -if (_proceed) then { - [player,20,true,(getPosATL player)] spawn player_alertZombies; - +if (_proceed) then { + [player,(getPosATL player),40,"repair"] spawn fnc_alertZombies; + _finished = ["Medic",1] call fn_loopAction; if (!_finished) exitWith {}; - + ["Working",0,[20,40,15,0]] call dayz_NutritionSystem; _temp_removed_array = []; _removed_total = 0; _tobe_removed_total = 0; - + { _removed = 0; _itemIn = _x select 0; @@ -66,7 +63,7 @@ if (_proceed) then { // diag_log format["Recipe Finish: %1 %2", _itemIn,_countIn]; _tobe_removed_total = _tobe_removed_total + _countIn; - { + { if( (_removed < _countIn) && ((_x == _itemIn) || configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn)) then { _num_removed = ([player,_x] call BIS_fnc_invRemove); _removed = _removed + _num_removed; @@ -74,7 +71,7 @@ if (_proceed) then { if(_num_removed >= 1) then { _temp_removed_array set [count _temp_removed_array,_x]; }; - }; + }; } forEach magazines player; } forEach _requirements; @@ -83,9 +80,9 @@ if (_proceed) then { format[localize "STR_EPOCH_ACTIONS_4",1] call dayz_rollingMessages; PVDZE_maintainArea = [player,2,[_obj, _objectID, _objectUID]]; publicVariableServer "PVDZE_maintainArea"; - } else { + } else { {player addMagazine _x;} count _temp_removed_array; - format[localize "str_epoch_player_145",_removed_total,_tobe_removed_total] call dayz_rollingMessages; + format[localize "str_epoch_player_145",_removed_total,_tobe_removed_total] call dayz_rollingMessages; }; } else { _textMissing = getText(configFile >> "CfgMagazines" >> _missing >> "displayName"); @@ -93,4 +90,4 @@ if (_proceed) then { }; dayz_actionInProgress = false; -s_player_maint_build = -1; \ No newline at end of file +s_player_maint_build = -1; diff --git a/SQF/dayz_code/actions/player_consume.sqf b/SQF/dayz_code/actions/player_consume.sqf index 4d07bf6b4..fc04632b8 100644 --- a/SQF/dayz_code/actions/player_consume.sqf +++ b/SQF/dayz_code/actions/player_consume.sqf @@ -1,9 +1,9 @@ /* Player action for consuming items - + Single parameter: string item classname - + Author: Foxy */ @@ -11,7 +11,7 @@ #define PILE_SEARCH_RADIUS 2 #define PILE_PLAYER_OFFSET [0,1,0] -private ["_cfg","_nutrition","_bloodRegen","_infectionChance","_sound","_output","_hungerCount","_thirstCount","_soundDistance"]; +private ["_cfg","_nutrition","_bloodRegen","_infectionChance","_sound","_output","_hungerCount","_thirstCount"]; _cfg = (ConfigFile >> "CfgMagazines" >> _this); @@ -62,21 +62,21 @@ _output = getText (_cfg >> "consumeOutput"); if (dayz_nutritionValuesSystem) then { _hungerCount = _nutrition select 1; _thirstCount = _nutrition select 2; - + if (_hungerCount > 0) then { dayz_lastMeal = time; }; if (_thirstCount > 0) then { dayz_lastDrink = time; }; - + ["FoodDrink",_bloodRegen,_nutrition] call dayz_NutritionSystem; r_player_foodstack = r_player_foodstack + 1; } else { _hungerCount = _nutrition select 1; _thirstCount = _nutrition select 2; - + if (_hungerCount > 0) then { dayz_hunger = 0; dayz_lastMeal = time; }; if (_thirstCount > 0) then { dayz_thirst = 0; dayz_lastDrink = time; }; - + r_player_blood = r_player_blood + _bloodRegen; - + if (r_player_blood > r_player_bloodTotal) then { r_player_blood = r_player_bloodTotal; }; @@ -107,9 +107,8 @@ if (_sound != "") then { private ["_soundDistance"]; _soundDistance = getNumber (_cfg >> "consumeSoundDistance"); - - [player,_sound,0,false,_soundDistance] call dayz_zombieSpeak; - [player,_soundDistance,true,(getPosATL player)] call player_alertZombies; + + [player,(getPosATL player),_soundDistance,_sound] spawn fnc_alertZombies; }; //If item has a consumeOutput item defined add that to player @@ -133,4 +132,4 @@ if (_output != "") then [_output,1,1] call fn_dropItem; }; }; -}; \ No newline at end of file +}; diff --git a/SQF/dayz_code/actions/player_copyKey.sqf b/SQF/dayz_code/actions/player_copyKey.sqf index 78ffa8ccf..f0fc381e9 100644 --- a/SQF/dayz_code/actions/player_copyKey.sqf +++ b/SQF/dayz_code/actions/player_copyKey.sqf @@ -1,8 +1,8 @@ -private ["_item","_config","_pos","_onLadder","_create","_finished","_num_removed","_text","_haskey","_hastoolweapon","_isNear","_hasTinBar"]; - if (dayz_actionInProgress) exitWith {localize "str_epoch_player_56" call dayz_rollingMessages;}; dayz_actionInProgress = true; +private ["_item","_config","_pos","_onLadder","_create","_finished","_num_removed","_text","_haskey","_hastoolweapon","_isNear","_hasTinBar"]; + _item = _this; _config = configFile >> "cfgWeapons" >> _item; @@ -26,9 +26,8 @@ call gear_ui_init; _hasTinBar = "ItemTinBar" in magazines player; if (!_hasTinBar) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_59" call dayz_rollingMessages;}; -[player,"repair",0,false] call dayz_zombieSpeak; -[player,50,true,_pos] spawn player_alertZombies; - +[player,(getPosATL player),20,"repair"] spawn fnc_alertZombies; + _finished = ["Medic",1] call fn_loopAction; if (_finished) then { diff --git a/SQF/dayz_code/actions/player_craftItem.sqf b/SQF/dayz_code/actions/player_craftItem.sqf index b559ec7c7..3ccfb3f12 100644 --- a/SQF/dayz_code/actions/player_craftItem.sqf +++ b/SQF/dayz_code/actions/player_craftItem.sqf @@ -121,8 +121,7 @@ if (_canDo) then { if (_proceed) then { localize "str_epoch_player_62" call dayz_rollingMessages; - [player,_sfx,0,false] call dayz_zombieSpeak; - [player,50,true,(getPosATL player)] spawn player_alertZombies; + [player,(getPosATL player),50,_sfx] spawn fnc_alertZombies; _finished = ["Medic",1] call fn_loopAction; diff --git a/SQF/dayz_code/actions/player_emptyContainer.sqf b/SQF/dayz_code/actions/player_emptyContainer.sqf index 06885e95e..bbfdd89b0 100644 --- a/SQF/dayz_code/actions/player_emptyContainer.sqf +++ b/SQF/dayz_code/actions/player_emptyContainer.sqf @@ -1,14 +1,17 @@ /* Player action for emptying containers e.g. water bottle - + Single parameter: string item classname - + Author: Foxy */ -private ["_cfg","_nutrition","_bloodRegen","_infectionChance","_sound","_output"]; +if (dayz_actionInProgress) exitWith {localize "str_epoch_player_56" call dayz_rollingMessages;}; +dayz_actionInProgress = true; + +private "_cfg"; _cfg = (ConfigFile >> "CfgMagazines" >> _this); @@ -33,6 +36,9 @@ if ((getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState p //player doesn't have the consumable item if (!(_this in magazines player)) exitWith { localize "str_misplaced_container" call dayz_rollingMessages; }; +[player,(getPosATL player),5,"refuel"] spawn fnc_alertZombies; +player playActionNow "PutDown"; + //Remove container player removeMagazine _this; player addMagazine getText (_cfg >> "containerEmpty"); @@ -45,4 +51,6 @@ if (vehicle player == player) then else { (findDisplay 106) closeDisplay 0; -}; \ No newline at end of file +}; + +dayz_actionInProgress = false; diff --git a/SQF/dayz_code/actions/player_gather.sqf b/SQF/dayz_code/actions/player_gather.sqf index 70e4e1a29..b16f4e670 100644 --- a/SQF/dayz_code/actions/player_gather.sqf +++ b/SQF/dayz_code/actions/player_gather.sqf @@ -7,9 +7,9 @@ _originalCount = getNumber (configFile >> "CfgVehicles" >> (typeOf _plant) >> "T if !([ [[["equip_comfreyleafs"],[_originalCount]],[[],[]]] , [getMagazineCargo _plant, getWeaponCargo _plant] ] call BIS_fnc_areEqual) then { //diag_log [ [getMagazineCargo _plant, getWeaponCargo _plant], "!=", [[["equip_comfreyleafs"],[_originalCount]],[[],[]]] ]; _plant setVariable["Gathering",true]; // avoid multiple call because the fn_selfActions is called in an infinite loop - [_this] spawn { // in background to be called after fn_selfActions - private ["_mags","_weps","_item","_magcounts","_wepcounts","_dis","_sfx"]; - _plant = _this select 0; + _plant spawn { // in background to be called after fn_selfActions + private ["_mags","_weps","_item","_magcounts","_wepcounts","_plant"]; + _plant = _this; _mags = (getMagazineCargo _plant) select 0; _weps = (getWeaponCargo _plant) select 0; if (count _mags != 0 OR count _weps != 0) then { // if not empty @@ -24,7 +24,7 @@ if !([ [[["equip_comfreyleafs"],[_originalCount]],[[],[]]] , [getMagazineCargo _ _item addWeaponCargoGlobal [_x, _wepcounts select _forEachIndex]; } forEach _weps; }; - + //remove vehicle, Need to ask server to remove. PVDZ_obj_Delete = [_plant,player]; publicVariableServer "PVDZ_obj_Delete"; @@ -32,9 +32,6 @@ if !([ [[["equip_comfreyleafs"],[_originalCount]],[[],[]]] , [getMagazineCargo _ deleteVehicle _plant; //Make some noise - _dis=2; - _sfx = "tentpack"; - [player,_sfx,0,false,_dis] call dayz_zombieSpeak; - [player,_dis,true,(getPosATL player)] call player_alertZombies; + [player,(getPosATL player),2,"tentpack"] spawn fnc_alertZombies; }; -}; \ No newline at end of file +}; diff --git a/SQF/dayz_code/actions/player_harvestPlant.sqf b/SQF/dayz_code/actions/player_harvestPlant.sqf index 0258a93d1..c8f0ce003 100644 --- a/SQF/dayz_code/actions/player_harvestPlant.sqf +++ b/SQF/dayz_code/actions/player_harvestPlant.sqf @@ -32,8 +32,7 @@ if (count _findNearestPlant >= 1) then { _isOk = true; _proceed = false; while {_isOk} do { - [player,20,true,(getPosATL player)] spawn player_alertZombies; - [player,"chopwood",0,false] call dayz_zombieSpeak; + [player,(getPosATL player),20,"chopwood"] spawn fnc_alertZombies; _finished = ["Medic",1] call fn_loopAction; diff --git a/SQF/dayz_code/actions/player_loadCrate.sqf b/SQF/dayz_code/actions/player_loadCrate.sqf index 9dc33f42f..c405d1687 100644 --- a/SQF/dayz_code/actions/player_loadCrate.sqf +++ b/SQF/dayz_code/actions/player_loadCrate.sqf @@ -1,23 +1,23 @@ -private ["_dir","_classname","_b0x1337","_location","_item","_config","_create_raw","_create","_qty","_type","_hasCrate","_hasTool","_finished"]; - if (dayz_actionInProgress) exitWith {localize "str_epoch_player_75" call dayz_rollingMessages;}; dayz_actionInProgress = true; -_hasTool = "ItemCrowbar" in items player; -if(!_hasTool) exitWith { +private ["_dir","_classname","_b0x1337","_location","_item","_config","_create_raw","_create","_qty","_type","_hasCrate","_hasTool","_finished"]; + +_hasTool = "ItemCrowbar" in items player; +if(!_hasTool) exitWith { localize "str_epoch_player_76" call dayz_rollingMessages; dayz_actionInProgress = false; }; -_item = _this; -_hasCrate = _item in magazines player; +_item = _this; +_hasCrate = _item in magazines player; if (!_hasCrate) exitWith { localize "str_epoch_player_77" call dayz_rollingMessages; dayz_actionInProgress = false; }; -_config = configFile >> "CfgMagazines" >> _item; -_create_raw = getArray (_config >> "ItemActions" >> "CreateMags" >> "output"); +_config = configFile >> "CfgMagazines" >> _item; +_create_raw = getArray (_config >> "ItemActions" >> "CreateMags" >> "output"); _create = _create_raw select 0; _qty = _create_raw select 1; _type = _create_raw select 2; @@ -27,6 +27,8 @@ if ((_location select 2) < 0) then { _location set [2,0]; }; +[player,(getPosATL player),20,"repair"] spawn fnc_alertZombies; + _finished = ["Medic",1] call fn_loopAction; if (!_finished or !(_item in magazines player)) exitWith { dayz_actionInProgress = false; @@ -41,7 +43,7 @@ _classname = "WeaponHolder"; player addMagazine "bulk_empty"; ["Working",0,[20,40,15,0]] call dayz_NutritionSystem; - + _b0x1337 = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"]; _b0x1337 setDir _dir; @@ -64,7 +66,7 @@ if (surfaceIsWater _location) then { player reveal _b0x1337; DZE_GearCheckBypass = true; //Bypass gear menu checks since dialog will always open on crate player action ["Gear", _b0x1337]; - + localize "str_epoch_player_78" call dayz_rollingMessages; - + dayz_actionInProgress = false; diff --git a/SQF/dayz_code/actions/player_mineStone.sqf b/SQF/dayz_code/actions/player_mineStone.sqf index e9bf1b0f0..8d842bf7b 100644 --- a/SQF/dayz_code/actions/player_mineStone.sqf +++ b/SQF/dayz_code/actions/player_mineStone.sqf @@ -1,4 +1,4 @@ -private ["_mineChance","_item","_dis","_sfx","_breaking","_counter","_rocks","_findNearestRock","_objName","_countOut","_isOk","_proceed","_finished","_itemOut","_weapons"]; +private ["_mineChance","_breaking","_counter","_rocks","_findNearestRock","_objName","_countOut","_isOk","_proceed","_finished","_itemOut","_weapons"]; _item = _this; call gear_ui_init; @@ -25,20 +25,17 @@ if (!isNull _findNearestRock) then { _counter = 0; _isOk = true; _proceed = false; - + //check chance before loop, for a maximum amount of 5 loops allowing 5 possiable chances _mineChance = dayz_HarvestingChance call fn_chance; while {_isOk} do { - _dis=20; - _sfx = "minestone"; - [player,_sfx,0,false,_dis] call dayz_zombieSpeak; - [player,_dis,true,(getPosATL player)] call player_alertZombies; + [player,(getPosATL player),20,"minestone"] spawn fnc_alertZombies; _finished = ["Medic",1] call fn_loopAction; _weapons = weapons player; _weapons set [count _weapons,dayz_onBack]; - + //Make sure player did not drop pickaxe if (!_finished or !("MeleePickaxe" in _weapons or ("ItemPickaxe" in _weapons))) exitWith { _isOk = false; @@ -47,7 +44,7 @@ if (!isNull _findNearestRock) then { if (_finished) then { ["Working",0,[100,15,10,0]] call dayz_NutritionSystem; - + _breaking = false; if (dayz_toolBreaking && _mineChance) then { _breaking = true; @@ -67,14 +64,14 @@ if (!isNull _findNearestRock) then { player addWeapon "ItemPickaxeBroken"; }; }; - + _counter = _counter + 1; _itemOut = "ItemStone"; - + //Drop Item to ground [_itemOut,1,1] call fn_dropItem; }; - + if ((_counter >= _countOut) || _breaking) exitWith { if (_breaking) then { localize "str_PickAxeHandleBreaks" call dayz_rollingMessages; @@ -87,11 +84,11 @@ if (!isNull _findNearestRock) then { format[localize "str_mining_progress", _counter,(_countOut - _counter)] call dayz_rollingMessages; }; - if (!_proceed) then { + if (!_proceed) then { localize "str_mining_canceled" call dayz_rollingMessages; }; } else { localize "str_mining_no_rocks" call dayz_rollingMessages; }; -dayz_actionInProgress = false; \ No newline at end of file +dayz_actionInProgress = false; diff --git a/SQF/dayz_code/actions/player_removeAttachment.sqf b/SQF/dayz_code/actions/player_removeAttachment.sqf index bd6430144..a150aa24a 100644 --- a/SQF/dayz_code/actions/player_removeAttachment.sqf +++ b/SQF/dayz_code/actions/player_removeAttachment.sqf @@ -1,11 +1,11 @@ /* Attempts to remove an attachment from the player's current primary weapon or sidearm. - + Parameters: string attachment item classname string current weapon classname string resulting weapon classname - + Author: Foxy */ @@ -53,7 +53,7 @@ if (!isClass(_newWeaponConfig) || {getText(_newWeaponConfig >> _attachment) != _ _weaponInUse = (currentWeapon player == _weapon); -[player,"detach_weap",0,false] call dayz_zombieSpeak; +[player,(getPosATL player),10,"detach_weap"] spawn fnc_alertZombies; call gear_ui_init; player playActionNow "Medic"; @@ -69,7 +69,7 @@ player addMagazine _attachment; if (_weaponInUse) then { _muzzle = (getArray (configFile >> "CfgWeapons" >> _newWeapon >> "muzzles")) select 0; - + if (_muzzle == "this") then { player selectWeapon _newWeapon; @@ -78,4 +78,4 @@ if (_weaponInUse) then { player selectWeapon _muzzle; }; -}; \ No newline at end of file +}; diff --git a/SQF/dayz_code/actions/player_sharpen.sqf b/SQF/dayz_code/actions/player_sharpen.sqf index ceba37e20..251b6a701 100644 --- a/SQF/dayz_code/actions/player_sharpen.sqf +++ b/SQF/dayz_code/actions/player_sharpen.sqf @@ -1,7 +1,7 @@ if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; dayz_actionInProgress = true; -private ["_item","_use","_repair","_waterUsed","_displayName"]; +private ["_item","_use","_repair","_waterUsed","_displayName","_finished"]; //['ItemKnifeBlunt','ItemKnife'] _item = _this select 0; //Item to be sharpened @@ -30,6 +30,7 @@ if !("equip_brick" IN magazines player) exitWith { dayz_actionInProgress = false; }; +[player,(getPosATL player),5,"repair"] spawn fnc_alertZombies; _finished = ["Medic",1] call fn_loopAction; if (!_finished) exitWith { diff --git a/SQF/dayz_code/actions/player_tearClothes.sqf b/SQF/dayz_code/actions/player_tearClothes.sqf index da89a2fc5..79eb51255 100644 --- a/SQF/dayz_code/actions/player_tearClothes.sqf +++ b/SQF/dayz_code/actions/player_tearClothes.sqf @@ -1,3 +1,6 @@ +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; @@ -9,11 +12,8 @@ _rounded = round _rnd; call gear_ui_init; closeDialog 0; -if (dayz_actionInProgress) exitWith { localize "str_player_actionslimit" call dayz_rollingMessages; }; -dayz_actionInProgress = true; - //Tear the clothes -[player,"bandage",0,false] call dayz_zombieSpeak; +[player,(getPosATL player),10,"bandage"] spawn fnc_alertZombies; _finished = ["Medic",1] call fn_loopAction; if (!_finished) exitWith { dayz_actionInProgress = false; @@ -44,14 +44,14 @@ switch (_rounded) do { false call dz_fn_meleeMagazines; _i = 0; while {_i < _rounded} do { - _i = _i + 1; + _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; @@ -59,4 +59,4 @@ while {_i < _rounded} do { }; true call dz_fn_meleeMagazines; -dayz_actionInProgress = false; \ No newline at end of file +dayz_actionInProgress = false; diff --git a/SQF/dayz_code/actions/player_upgrade.sqf b/SQF/dayz_code/actions/player_upgrade.sqf index 12ea3b1f9..c15be4f98 100644 --- a/SQF/dayz_code/actions/player_upgrade.sqf +++ b/SQF/dayz_code/actions/player_upgrade.sqf @@ -55,9 +55,11 @@ if ((count _upgrade) > 0) then { } forEach _requirements; if (_proceed) then { - [player,20,true,(getPosATL player)] spawn player_alertZombies; + [player,(getPosATL player),25,"repair"] spawn fnc_alertZombies; + _finished = ["Medic",1] call fn_loopAction; if (!_finished) exitWith {}; + ["Working",0,[3,2,4,0]] call dayz_NutritionSystem; _temp_removed_array = []; @@ -105,6 +107,7 @@ if ((count _upgrade) > 0) then { } forEach _requirements; if (_tobe_removed_total == _removed_total) then { + call player_forceSave; _location = _obj getVariable["OEMPos",(getposATL _obj)]; _dir = getDir _obj; _vector = [(vectorDir _obj),(vectorUp _obj)]; diff --git a/SQF/dayz_code/actions/refuel.sqf b/SQF/dayz_code/actions/refuel.sqf index 8c037cafd..8e4b690e3 100644 --- a/SQF/dayz_code/actions/refuel.sqf +++ b/SQF/dayz_code/actions/refuel.sqf @@ -1,7 +1,7 @@ if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; dayz_actionInProgress = true; -private ["_vehicle","_canSize","_configVeh","_capacity","_nameType","_curFuel","_newFuel","_dis","_sfx","_array","_cantype", +private ["_vehicle","_canSize","_configVeh","_capacity","_nameType","_curFuel","_newFuel","_array","_cantype", "_emptycan","_finished","_type"]; _array = _this select 3; @@ -20,10 +20,7 @@ if (fuel _vehicle == 1 || {!(_canType in magazines player)}) exitWith {dayz_acti player removeAction s_player_fillfuel + _capacity; -_dis=5; -_sfx = "refuel"; -[player,_sfx,0,false,_dis] call dayz_zombieSpeak; -[player,_dis,true,(getPosATL player)] call player_alertZombies; +[player,(getPosATL player),25,"refuel"] spawn fnc_alertZombies; _finished = ["Medic",1] call fn_loopAction; diff --git a/SQF/dayz_code/actions/remove.sqf b/SQF/dayz_code/actions/remove.sqf index 331e91a04..f9bdc26ad 100644 --- a/SQF/dayz_code/actions/remove.sqf +++ b/SQF/dayz_code/actions/remove.sqf @@ -1,10 +1,11 @@ -if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; -dayz_actionInProgress = true; /* delete object from db with extra waiting by [VB]AWOL parameters: _obj */ -private ["_plotcheck","_PlayerNear","_isMine","_obj","_objectID","_objectUID","_finished","_isOk","_proceed","_counter","_limit","_objType","_itemOut","_countOut","_selectedRemoveOutput","_nearestPole","_refundpart","_isWreck","_IsNearPlot","_brokenTool","_removeTool","_isDestructable","_isRemovable","_objOwnerID","_isOwnerOfObj","_preventRefund","_ipos","_item","_isWreckBuilding","_nameVehicle","_isModular","_success","_lootGroupIndex","_output"]; +if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; +dayz_actionInProgress = true; + +private ["_type","_plotcheck","_PlayerNear","_isMine","_obj","_objectID","_objectUID","_finished","_isOk","_proceed","_counter","_limit","_objType","_itemOut","_countOut","_selectedRemoveOutput","_nearestPole","_refundpart","_isWreck","_IsNearPlot","_brokenTool","_removeTool","_isDestructable","_isRemovable","_objOwnerID","_isOwnerOfObj","_preventRefund","_ipos","_item","_isWreckBuilding","_nameVehicle","_isModular","_success","_lootGroupIndex","_output"]; player removeAction s_player_deleteBuild; s_player_deleteBuild = 1; @@ -23,8 +24,8 @@ if (DZE_permanentPlot) then { if (_obj getVariable ["GeneratorRunning", false]) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_89" call dayz_rollingMessages;}; -_objectID = _obj getVariable ["ObjectID","0"]; -_objectUID = _obj getVariable ["ObjectUID","0"]; +_objectID = _obj getVariable ["ObjectID","0"]; +_objectUID = _obj getVariable ["ObjectUID","0"]; _isOk = true; _proceed = false; @@ -93,7 +94,8 @@ while {_isOk} do { format[localize "str_epoch_player_163",_nameVehicle,(_counter + 1),_limit] call dayz_rollingMessages; - [player,"repair",0,false,20] call dayz_zombieSpeak; + [player,(getPosATL player),25,"repair"] spawn fnc_alertZombies; + _finished = ["Medic",1] call fn_loopAction; if(!_finished) exitWith { @@ -176,20 +178,20 @@ if (_proceed && _success) then { _selectedRemoveOutput set [count _selectedRemoveOutput,[_refundpart,1]]; } else { if(_isWreckBuilding) then { - switch true do { - case (_isMine): { + call { + if (_isMine) exitwith { _lootGroupIndex = dz_loot_groups find _objType; _output = [_lootGroupIndex,3] call dz_fn_loot_select; {_selectedRemoveOutput set [count _selectedRemoveOutput, [_x select 1,[_x select 2,_x select 3]]]} forEach _output; }; - case (_objType == "Land_ammo_supply_wreck"): { + if (_objType == "Land_ammo_supply_wreck") exitwith { _lootGroupIndex = dz_loot_groups find _objType; _output = [_lootGroupIndex,5] call dz_fn_loot_select; {_selectedRemoveOutput set [count _selectedRemoveOutput, [_x select 1,1,_x select 0]]} forEach _output; }; - default {_selectedRemoveOutput = getArray (configFile >> "CfgVehicles" >> _objType >> "removeoutput")}; + _selectedRemoveOutput = getArray (configFile >> "CfgVehicles" >> _objType >> "removeoutput"); }; } else { if ({_objType in _x} count DZE_modularConfig > 0) then { @@ -249,10 +251,11 @@ if (_proceed && _success) then { _countOut = round((random (_countOut select 1)) max (_countOut select 0)); }; if (count _x > 2) then { - switch (_x select 2) do { - case 2: {_item addWeaponCargoGlobal [_itemOut,_countOut]}; - case 3: {_item addMagazineCargoGlobal [_itemOut,_countOut]}; - case 5: {_item addBackpackCargoGlobal [_itemOut,_countOut]}; // Needs to make sure object can handle Backpacks or will dump on the ground. + _type = _x select 2; + call { + if (_type == 2) exitwith {_item addWeaponCargoGlobal [_itemOut,_countOut]}; + if (_type == 3) exitwith {_item addMagazineCargoGlobal [_itemOut,_countOut]}; + if (_type == 5) exitwith {_item addBackpackCargoGlobal [_itemOut,_countOut]}; // Needs to make sure object can handle Backpacks or will dump on the ground. }; } else { _item addMagazineCargoGlobal [_itemOut,_countOut]; diff --git a/SQF/dayz_code/actions/repair.sqf b/SQF/dayz_code/actions/repair.sqf index aeec54224..aebb13939 100644 --- a/SQF/dayz_code/actions/repair.sqf +++ b/SQF/dayz_code/actions/repair.sqf @@ -1,7 +1,7 @@ if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; dayz_actionInProgress = true; -private ["_id","_hits","_array","_vehicle","_part","_hitpoint","_type","_nameType","_namePart","_damage","_selection","_dis","_sfx","_finished"]; +private ["_id","_hits","_array","_vehicle","_part","_hitpoint","_type","_nameType","_namePart","_damage","_selection","_finished"]; _id = _this select 2; _array = _this select 3; @@ -20,10 +20,7 @@ _nameType = getText(configFile >> "cfgVehicles" >> _type >> "displayName"); _namePart = getText(configFile >> "cfgMagazines" >> _part >> "displayName"); if ("ItemToolbox" in items player && {_part in magazines player}) then { - _dis=20; - _sfx = "repair"; - [player,_sfx,0,false,_dis] call dayz_zombieSpeak; - [player,_dis,true,(getPosATL player)] call player_alertZombies; + [player,(getPosATL player),30,"repair"] spawn fnc_alertZombies; _finished = ["Medic",1] call fn_loopAction; diff --git a/SQF/dayz_code/actions/salvage.sqf b/SQF/dayz_code/actions/salvage.sqf index affe8c8ac..8c0ae5720 100644 --- a/SQF/dayz_code/actions/salvage.sqf +++ b/SQF/dayz_code/actions/salvage.sqf @@ -4,8 +4,8 @@ dayz_actionInProgress = true; private ["_array","_vehicle","_part","_hitpoint","_type","_isOK","_brokenPart","_finished","_hasToolbox","_nameType","_namePart","_damage","_BreakableParts","_selection","_wpn","_hits","_ismelee"]; _array = _this select 3; -_vehicle = _array select 0; -_part = _array select 1; +_vehicle = _array select 0; +_part = _array select 1; _hitpoint = _array select 2; _type = typeOf _vehicle; _isOK = false; @@ -22,8 +22,7 @@ s_player_repair_crtl = 1; if (_hasToolbox) then { if ([_vehicle] call DZE_SafeZonePosCheck) exitWith {(localize "str_salvage_safezone") call dayz_rollingMessages;}; - [player,"repair",0,false] call dayz_zombieSpeak; - [player,50,true,(getPosATL player)] call player_alertZombies; + [player,(getPosATL player),50,"repair"] spawn fnc_alertZombies; _finished = ["Medic",1] call fn_loopAction; diff --git a/SQF/dayz_code/actions/siphonFuel.sqf b/SQF/dayz_code/actions/siphonFuel.sqf index 08350b855..4e6e8e178 100644 --- a/SQF/dayz_code/actions/siphonFuel.sqf +++ b/SQF/dayz_code/actions/siphonFuel.sqf @@ -1,10 +1,10 @@ -private ["_vehicle","_curFuel","_newFuel","_finished","_location1","_location2","_abort", -"_canNameEmpty","_canSizeEmpty","_canTypeEmpty","_canName","_canSize","_configCanEmpty","_configVeh","_capacity","_nameText", -"_availableCansEmpty","_hasHose","_PlayerNear"]; - if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; dayz_actionInProgress = true; +private ["_vehicle","_curFuel","_newFuel","_finished","_location1","_location2","_abort", +"_canNameEmpty","_canSizeEmpty","_canTypeEmpty","_canName","_canSize","_configCanEmpty","_configVeh","_capacity","_nameText", +"_hasHose","_PlayerNear"]; + _vehicle = _this select 3; player removeAction s_player_siphonfuel; _hasHose = "equip_hose" in magazines player; @@ -29,7 +29,7 @@ _nameText = getText(_configVeh >> "displayName"); _canName = getText(_configCanEmpty >> "fullCan"); _canSize = getNumber(configFile >> "cfgMagazines" >> _canName >> "fuelQuantity"); - + if (_canSizeEmpty == 0) then { _curFuel = ((fuel _vehicle) * _capacity); _newFuel = (_curFuel - _canSize); @@ -44,8 +44,7 @@ _nameText = getText(_configVeh >> "displayName"); if (_newFuel > 0) then { format[localize "str_siphon_preparing",_canTypeEmpty] call dayz_rollingMessages; _finished = false; - - [player,20,true,(getPosATL player)] call player_alertZombies; + [player,(getPosATL player),20,"refuel"] spawn fnc_alertZombies; if (!dayz_isSwimming) then { _finished = ["Medic",1] call fn_loopAction; @@ -113,4 +112,4 @@ _nameText = getText(_configVeh >> "displayName"); if (_abort) exitWith {}; } forEach magazines player; -dayz_actionInProgress = false; \ No newline at end of file +dayz_actionInProgress = false; diff --git a/SQF/dayz_code/actions/water_fill.sqf b/SQF/dayz_code/actions/water_fill.sqf index de0307dcb..6e41bbd30 100644 --- a/SQF/dayz_code/actions/water_fill.sqf +++ b/SQF/dayz_code/actions/water_fill.sqf @@ -20,14 +20,14 @@ _posATL = ASLtoATL _posASL; //"Land_water_tank" has no spout or opening, doesn't make sense to include _wells = ["Land_pumpa","Land_Barrel_water","Land_Misc_Well_C_EP1","Land_Misc_Well_L_EP1","land_smd_water_pump"]; -_canFill = switch true do { +_canFill = call { //Return: [nearWaterHole, isPond] - case (count nearestObjects [_posATL,_wells,4] > 0): {[true,false]}; - case (toLower worldName in ["chernarus","namalsk","napf"]): {(call fn_nearWaterHole)}; + if (count nearestObjects [_posATL,_wells,4] > 0) exitwith {[true,false]}; + if (toLower worldName in ["chernarus","namalsk","napf"]) exitwith {(call fn_nearWaterHole)}; //Slow searches for maps without waterHoleProxy objects added yet - case ({["_well",str _x] call fnc_inString} count nearestObjects [_posATL,[],4] > 0): {[true,false]}; - case ({["pond",str _x] call fnc_inString && {_posASL select 2 < ((getPosASL _x) select 2)}} count nearestObjects [player,[],50] > 0): {[true,true]}; - default {[false,false]}; + if ({["_well",str _x] call fnc_inString} count nearestObjects [_posATL,[],4] > 0) exitwith {[true,false]}; + if ({["pond",str _x] call fnc_inString && {_posASL select 2 < ((getPosASL _x) select 2)}} count nearestObjects [player,[],50] > 0) exitwith {[true,true]}; + [false,false]; }; if !(_canFill select 0) exitWith { @@ -59,26 +59,25 @@ if (!dayz_isSwimming) then { if (_drinking) then { ["FoodDrink",0,[0,0,_recover,0]] call dayz_NutritionSystem; //[Energy,food,water,temp] - [player,"drink",0,false,5] call dayz_zombieSpeak; - [player,10,true,_posATL] call player_alertZombies; - + [player,_posATL,10,"drink"] spawn fnc_alertZombies; + if (_water == "containerwaterinfected") then { r_player_infected = true; }; - + localize "str_drinkwithhands" call dayz_rollingMessages; } else { { if (isText (configFile >> "CfgMagazines" >> _x >> _water)) then - { + { _filled = _filled + 1; - + player removeMagazine _x; player addMagazine getText (configFile >> "CfgMagazines" >> _x >> _water); }; } foreach magazines player; - + if (_filled > 0) then { [player, "fillwater", 0, false, 5] call dayz_zombieSpeak; [player, 5, true, _posATL] call player_alertZombies; @@ -86,4 +85,4 @@ if (_drinking) then { } else { localize "str_player_02" call dayz_rollingMessages; }; -}; \ No newline at end of file +}; diff --git a/SQF/dayz_code/compile/player_lockVault.sqf b/SQF/dayz_code/compile/player_lockVault.sqf index 4057fcf42..c72bc71cd 100644 --- a/SQF/dayz_code/compile/player_lockVault.sqf +++ b/SQF/dayz_code/compile/player_lockVault.sqf @@ -32,9 +32,9 @@ if (!isNull _obj) then { [_lockedClass,objNull] call fn_waitForObject; if (_lockedClass == "LockboxStorageLocked") then { - [player,"lockboxclose",0,false] call dayz_zombieSpeak; + [player,(getPosATL player),20,"lockboxclose"] spawn fnc_alertZombies; } else { - [player,"safeclose",0,false] call dayz_zombieSpeak; + [player,(getPosATL player),20,"safeclose"] spawn fnc_alertZombies; }; _code = [_obj getVariable["CharacterID","0"],dayz_combination] select (_ComboMatch); diff --git a/SQF/dayz_code/compile/player_packTent.sqf b/SQF/dayz_code/compile/player_packTent.sqf index 6a29e58a1..f9010b36d 100644 --- a/SQF/dayz_code/compile/player_packTent.sqf +++ b/SQF/dayz_code/compile/player_packTent.sqf @@ -37,8 +37,7 @@ if (_ownerID in [dayz_characterID,dayz_playerUID] || {_typeOf in _campItems}) th _dir = direction _obj; _pos = getPosATL _obj; - [player,"tentpack",0,false,20] call dayz_zombieSpeak; - [player,20,true,getPosATL player] call player_alertZombies; + [player,(getPosATL player),20,"tentpack"] spawn fnc_alertZombies; _text = getText (configFile >> "CfgVehicles" >> _typeOf >> "displayName"); format[localize "str_epoch_player_121",_text] call dayz_rollingMessages; diff --git a/SQF/dayz_code/compile/player_packVault.sqf b/SQF/dayz_code/compile/player_packVault.sqf index cae2f37ed..306aa130e 100644 --- a/SQF/dayz_code/compile/player_packVault.sqf +++ b/SQF/dayz_code/compile/player_packVault.sqf @@ -31,7 +31,7 @@ if (_objectID == "0" && _objectUID == "0") exitWith {dayz_actionInProgress = fal if (!_ComboMatch && (_ownerID != dayz_playerUID)) exitWith {dayz_actionInProgress = false; s_player_packvault = -1; format[localize "str_epoch_player_119",_text] call dayz_rollingMessages;}; if (isNull _obj && {!alive _obj}) exitWith {s_player_packvault = -1;dayz_actionInProgress = false;}; -[player,"tentpack",0,false] call dayz_zombieSpeak; +[player,(getPosATL player),20,"tentpack"] spawn fnc_alertZombies; format[localize "str_epoch_player_121",_text] call dayz_rollingMessages; diff --git a/SQF/dayz_code/compile/player_unlockDoor.sqf b/SQF/dayz_code/compile/player_unlockDoor.sqf index 0eb84a99e..42b9a670c 100644 --- a/SQF/dayz_code/compile/player_unlockDoor.sqf +++ b/SQF/dayz_code/compile/player_unlockDoor.sqf @@ -74,8 +74,7 @@ if (!isNull dayz_selectedDoor) then { publicVariableServer "PVDZE_handleSafeGear"; DZE_Lock_Door = ""; - [player,"combo_locked",0,false] call dayz_zombieSpeak; - [player,20,true,(getPosATL player)] spawn player_alertZombies; + [player,(getPosATL player),20,"combo_locked"] spawn fnc_alertZombies; if (_doorMethod == "Eye") then { localize "STR_EPOCH_DOORACCESS_FAILURE" call dayz_rollingMessages; diff --git a/SQF/dayz_code/compile/player_unlockVault.sqf b/SQF/dayz_code/compile/player_unlockVault.sqf index 5adb2e40f..e4adef760 100644 --- a/SQF/dayz_code/compile/player_unlockVault.sqf +++ b/SQF/dayz_code/compile/player_unlockVault.sqf @@ -38,9 +38,9 @@ if (_ComboMatch || (_ownerID == dayz_playerUID)) then { [_unlockedClass,objNull] call fn_waitForObject; if (_unlockedClass == "LockboxStorage") then { - [player,"lockboxopen",0,false] call dayz_zombieSpeak; + [player,(getPosATL player),20,"lockboxopen"] spawn fnc_alertZombies; } else { - [player,"safeopen",0,false] call dayz_zombieSpeak; + [player,(getPosATL player),20,"safeopen"] spawn fnc_alertZombies; }; _code = [_obj getVariable["CharacterID","0"],dayz_combination] select (_ComboMatch); diff --git a/SQF/dayz_code/init/compiles.sqf b/SQF/dayz_code/init/compiles.sqf index 0f152551e..20afedc14 100644 --- a/SQF/dayz_code/init/compiles.sqf +++ b/SQF/dayz_code/init/compiles.sqf @@ -208,6 +208,18 @@ if (!isDedicated) then { // Advanced trading default inits for maintaining, Advanced Trading and custom scripts to utilize gem based currency. call compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\AdvancedTrading\defaultInit.sqf"; + fnc_alertZombies = { + private ["_unit","_pos","_dis","_sfx"]; + + _unit = _this select 0; + _pos = _this select 1; + _dis = _this select 2; + _sfx = _this select 3; + + [_unit,_sfx,0,false,_dis] spawn dayz_zombieSpeak; + [_unit,_dis,true,_pos] spawn player_alertZombies; + }; + dayz_losChance = { private["_agent","_maxDis","_dis","_val","_maxExp","_myExp"]; _agent = _this select 0;