diff --git a/SQF/dayz_code/actions/modular_build.sqf b/SQF/dayz_code/actions/modular_build.sqf index 9239fef30..b67b9c7c0 100644 --- a/SQF/dayz_code/actions/modular_build.sqf +++ b/SQF/dayz_code/actions/modular_build.sqf @@ -3,8 +3,9 @@ if (!isNil "_this" && {typeName _this == "ARRAY"} && {count _this > 0}) exitWith private ["_abort","_reason","_distance","_isNear","_lockable","_isAllowedUnderGround","_offset","_classname","_zheightdirection","_zheightchanged","_rotate","_objectHelperPos","_objectHelperDir","_objHDiff","_position","_isOk","_dir","_vector","_cancel","_location2","_buildOffset","_location","_limit","_started","_finished","_animState","_isMedic","_proceed","_counter","_dis","_sfx","_combination_1_Display","_combination_1","_combination_2","_combination_3","_combination","_combinationDisplay","_combination_4","_playerUID","_num_removed","_tmpbuilt","_vUp","_classnametmp","_text","_ghost","_objectHelper","_location1","_object","_helperColor","_canDo","_pos","_onLadder","_vehicle","_inVehicle","_needNear","_canBuild"]; //Check if building already in progress, exit if so. -if (DZE_ActionInProgress) exitWith {localize "str_epoch_player_40" call dayz_rollingMessages;}; +if (DZE_ActionInProgress || {r_action_count > 0}) exitWith {localize "str_epoch_player_40" call dayz_rollingMessages;}; DZE_ActionInProgress = true; +r_action_count = r_action_count + 1; _pos = [player] call FNC_GetPos; _onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1; @@ -38,10 +39,10 @@ DZE_memLeftRight = 0; call gear_ui_init; closeDialog 1; -if (dayz_isSwimming) exitWith {DZE_ActionInProgress = false; localize "str_player_26" call dayz_rollingMessages;}; -if (_inVehicle) exitWith {DZE_ActionInProgress = false; localize "str_epoch_player_42" call dayz_rollingMessages;}; -if (_onLadder) exitWith {DZE_ActionInProgress = false; localize "str_player_21" call dayz_rollingMessages;}; -if (player getVariable["combattimeout",0] >= diag_tickTime) exitWith {DZE_ActionInProgress = false; localize "str_epoch_player_43" call dayz_rollingMessages;}; +if (dayz_isSwimming) exitWith {r_action_count = 0; DZE_ActionInProgress = false; localize "str_player_26" call dayz_rollingMessages;}; +if (_inVehicle) exitWith {r_action_count = 0; DZE_ActionInProgress = false; localize "str_epoch_player_42" call dayz_rollingMessages;}; +if (_onLadder) exitWith {r_action_count = 0; DZE_ActionInProgress = false; localize "str_player_21" call dayz_rollingMessages;}; +if (player getVariable["combattimeout",0] >= diag_tickTime) exitWith {r_action_count = 0; DZE_ActionInProgress = false; localize "str_epoch_player_43" call dayz_rollingMessages;}; DZE_buildItem = _this; //This is a magazine! It's global to allow access to it from outside functions @@ -86,6 +87,7 @@ _needNear = getArray (configFile >> "CfgMagazines" >> DZE_buildItem >> "ItemActi if (_abort) exitWith { format[localize "str_epoch_player_135",_reason,_distance] call dayz_rollingMessages; DZE_ActionInProgress = false; + r_action_count = 0; }; _canBuild = [_pos, _this, true] call dze_buildChecks; @@ -588,3 +590,4 @@ if (_canBuild select 0) then { }; DZE_ActionInProgress = false; +r_action_count = 0; diff --git a/SQF/dayz_code/actions/player_build.sqf b/SQF/dayz_code/actions/player_build.sqf index c0ec31152..a0ebcf28c 100644 --- a/SQF/dayz_code/actions/player_build.sqf +++ b/SQF/dayz_code/actions/player_build.sqf @@ -6,8 +6,9 @@ if (!isNil "_this" && {typeName _this == "ARRAY"} && {count _this > 0}) exitWith */ private ["_location","_pos","_dir","_classname","_item","_cancel","_reason","_started","_finished","_animState","_isMedic","_dis","_sfx","_tmpbuilt","_onLadder","_require","_text","_offset","_isOk","_location1","_location2","_counter","_limit","_proceed","_num_removed","_position","_object","_canBuildOnPlot","_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","_playerUID","_canBuild"]; -if (DZE_ActionInProgress) exitWith {localize "str_epoch_player_40" call dayz_rollingMessages;}; +if (DZE_ActionInProgress || {r_action_count > 0}) exitWith {localize "str_epoch_player_40" call dayz_rollingMessages;}; DZE_ActionInProgress = true; +r_action_count = r_action_count + 1; _pos = [player] call FNC_GetPos; _onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1; @@ -37,10 +38,10 @@ DZE_cancelBuilding = false; call gear_ui_init; closeDialog 1; -if (dayz_isSwimming) exitWith {DZE_ActionInProgress = false; localize "str_player_26" call dayz_rollingMessages;}; -if (_inVehicle) exitWith {DZE_ActionInProgress = false; localize "str_epoch_player_42" call dayz_rollingMessages;}; -if (_onLadder) exitWith {DZE_ActionInProgress = false; localize "str_player_21" call dayz_rollingMessages;}; -if (player getVariable["combattimeout",0] >= diag_tickTime) exitWith {DZE_ActionInProgress = false; localize "str_epoch_player_43" call dayz_rollingMessages;}; +if (dayz_isSwimming) exitWith {r_action_count = 0; DZE_ActionInProgress = false; localize "str_player_26" call dayz_rollingMessages;}; +if (_inVehicle) exitWith {r_action_count = 0; DZE_ActionInProgress = false; localize "str_epoch_player_42" call dayz_rollingMessages;}; +if (_onLadder) exitWith {r_action_count = 0; DZE_ActionInProgress = false; localize "str_player_21" call dayz_rollingMessages;}; +if (player getVariable["combattimeout",0] >= diag_tickTime) exitWith {r_action_count = 0; DZE_ActionInProgress = false; localize "str_epoch_player_43" call dayz_rollingMessages;}; _item = _this; @@ -86,6 +87,7 @@ _needNear = getArray (configFile >> "CfgMagazines" >> _item >> "ItemActions" >> if(_abort) exitWith { format[localize "str_epoch_player_135",_reason,_distance] call dayz_rollingMessages; DZE_ActionInProgress = false; + r_action_count = 0; }; _canBuild = [_pos, _item, true] call dze_buildChecks; @@ -494,3 +496,4 @@ if (_canBuild select 0) then { }; DZE_ActionInProgress = false; +r_action_count = 0;