diff --git a/addons/functions/functions/fnc_addDigger.sqf b/addons/functions/functions/fnc_addDigger.sqf index c9b8331..8ef9dea 100644 --- a/addons/functions/functions/fnc_addDigger.sqf +++ b/addons/functions/functions/fnc_addDigger.sqf @@ -54,14 +54,10 @@ private _condition = if (!isNil "_diggingType" && {_diggingType == "DOWN"}) then [ { params ["_args", "_handle"]; - _args params ["_unit", "_trench", "_condition"]; - - systemChat "Helping"; + _args params ["_unit", "_trench", "_condition","_finishCondition"]; if (isNull _trench || {[_trench] call _condition} || {!alive _unit}) exitWith { - systemChat "Stopped PFH Help 1"; - [_handle] call CBA_fnc_removePerFrameHandler; _unit setVariable [QGVAR(diggingTrench), false, true]; [QGVAR(handleDiggerToGVAR), [_trench, _unit, true]] call CBA_fnc_serverEvent; @@ -69,17 +65,19 @@ private _condition = if (!isNil "_diggingType" && {_diggingType == "DOWN"}) then if (_unit getVariable [QGVAR(diggingTrench), false] && {((_trench getVariable [QGVAR(diggers), []]) select 0) isEqualTo ([] call CBA_fnc_currentUnit)}) exitWith { - systemChat "Stopped PFH Help 2"; - [_handle] call CBA_fnc_removePerFrameHandler; - [_trench, _unit, true] call FUNC(continueDiggingTrench); + + if (_finishCondition) then { + [{_this call FUNC(continueDiggingTrench);}, [_trench, _unit, true]] call CBA_fnc_ExecNextFrame; + } else { + [{_this call FUNC(continueDiggingTrench);}, [_trench, _unit, true]] call CBA_fnc_ExecNextFrame; + }; + _unit setVariable [QGVAR(helpingFunctionRunning), false]; }; if !(_unit getVariable [QGVAR(diggingTrench), false]) exitWith { - systemChat "Stopped PFH Help 3"; - [_handle] call CBA_fnc_removePerFrameHandler; [QGVAR(handleDiggerToGVAR), [_trench, _unit, true]] call CBA_fnc_serverEvent; }; @@ -88,7 +86,7 @@ private _condition = if (!isNil "_diggingType" && {_diggingType == "DOWN"}) then [QGVAR(applyFatigue), [_trench, _unit], _unit] call CBA_fnc_targetEvent; }, 0.1, - [_unit, _trench, _condition] + [_unit, _trench, _condition, _finishCondition] ] call CBA_fnc_addPerFrameHandler; // Create progress bar @@ -104,8 +102,6 @@ private _fnc_onFinish = { private _fnc_onFailure = { (_this select 0) params ["_unit", "_trench", ""]; - systemChat "Stopped Help Bar"; - // Reset animation [_unit, "", 1] call ace_common_fnc_doAnimation; }; diff --git a/addons/functions/functions/fnc_continueDiggingTrench.sqf b/addons/functions/functions/fnc_continueDiggingTrench.sqf index c073dd9..f83f5c6 100644 --- a/addons/functions/functions/fnc_continueDiggingTrench.sqf +++ b/addons/functions/functions/fnc_continueDiggingTrench.sqf @@ -25,7 +25,6 @@ if (_actualProgress >= 1) exitWith {}; // Mark trench as being worked on -systemChat "Set in Continue line 28"; _trench setVariable ["ace_trenches_digging", true, true]; _trench setVariable [QGVAR(diggingType), "UP", true]; _unit setVariable [QGVAR(diggingTrench), true, true]; @@ -45,8 +44,6 @@ private _digTime = missionNamespace getVariable [getText (configOf _trench >> "a private _fnc_onFinish = { (_this select 0) params ["_unit", "_trench"]; - systemChat "Done"; - _unit setVariable [QGVAR(diggingTrench), false, true]; [QGVAR(handleTrenchState), [_trench]] call CBA_fnc_serverEvent; [QGVAR(handleDiggerToGVAR), [_trench, _unit, false, true]] call CBA_fnc_serverEvent; @@ -60,9 +57,6 @@ private _fnc_onFinish = { private _fnc_onFailure = { (_this select 0) params ["_unit", "_trench"]; - systemChat "Stopped Continue Bar"; - diag_log "Stopped Continue Bar"; - _unit setVariable [QGVAR(diggingTrench), false, true]; [QGVAR(handleDiggerToGVAR), [_trench, _unit, true]] call CBA_fnc_serverEvent; @@ -76,18 +70,10 @@ private _fnc_onFailure = { private _fnc_condition = { (_this select 0) params ["_unit", "_trench"]; - if !(_trench getVariable ["ace_trenches_digging", false]) exitWith { - systemChat format ["Trench: %1",(_trench getVariable ["ace_trenches_digging", false])]; - false}; - if !(_unit getVariable [QGVAR(diggingTrench), false]) exitWith { - systemChat format ["Unit: %1", (_unit getVariable [QGVAR(diggingTrench), false])]; - false}; - if (count (_trench getVariable [QGVAR(diggers),[]]) <= 0) exitWith { - systemChat format ["Diggers: %1", (count (_trench getVariable [QGVAR(diggers),[]]))]; - false}; - if (GVAR(stopBuildingAtFatigueMax) && (ace_advanced_fatigue_anReserve <= 0)) exitWith { - systemChat format ["Stamina: %1", ace_advanced_fatigue_anReserve]; - false}; + if !(_trench getVariable ["ace_trenches_digging", false]) exitWith {false}; + if !(_unit getVariable [QGVAR(diggingTrench), false]) exitWith {false}; + if (count (_trench getVariable [QGVAR(diggers),[]]) <= 0) exitWith {false}; + if (GVAR(stopBuildingAtFatigueMax) && (ace_advanced_fatigue_anReserve <= 0)) exitWith {false}; true }; @@ -109,8 +95,6 @@ if (_actualProgress == 0) then { params ["_args", "_handle"]; _args params ["_trench", "_unit", "_digTime"]; - systemChat "UP"; - private _actualProgress = _trench getVariable ["ace_trenches_progress", 0]; private _diggerCount = count (_trench getVariable [QGVAR(diggers), []]); @@ -120,8 +104,6 @@ if (_actualProgress == 0) then { {_diggerCount <= 0} ) exitWith { - systemChat "Stopped PFH continue 1"; - [_handle] call CBA_fnc_removePerFrameHandler; if (_diggerCount < 1) then { _trench setVariable ["ace_trenches_digging", false, true]; @@ -131,9 +113,6 @@ if (_actualProgress == 0) then { }; if (_actualProgress >= 1) exitWith { - - systemChat "Stopped PFH continue 2"; - [_handle] call CBA_fnc_removePerFrameHandler; }; diff --git a/addons/functions/functions/fnc_deleteTrench.sqf b/addons/functions/functions/fnc_deleteTrench.sqf index 215a9e8..ae1a488 100644 --- a/addons/functions/functions/fnc_deleteTrench.sqf +++ b/addons/functions/functions/fnc_deleteTrench.sqf @@ -18,7 +18,6 @@ params ["_trench", ["_unit", objNull]]; -systemChat "Set in Delete line 21"; _trench setVariable ["ace_trenches_digging", false, true]; _trench setVariable [QGVAR(diggingType), nil, true]; [QGVAR(handleDiggerToGVAR), [_trench, _unit, false, true]] call CBA_fnc_serverEvent; diff --git a/addons/functions/functions/fnc_handleTrenchState.sqf b/addons/functions/functions/fnc_handleTrenchState.sqf index 5d2f306..f5b6358 100644 --- a/addons/functions/functions/fnc_handleTrenchState.sqf +++ b/addons/functions/functions/fnc_handleTrenchState.sqf @@ -20,6 +20,5 @@ params ["_trench"]; -systemChat "Set in Handle line 23"; _trench setVariable ["ace_trenches_digging", false, true]; _trench setVariable [QGVAR(diggingType), nil, true]; \ No newline at end of file diff --git a/addons/functions/functions/fnc_removeTrench.sqf b/addons/functions/functions/fnc_removeTrench.sqf index 93edf92..0731c00 100644 --- a/addons/functions/functions/fnc_removeTrench.sqf +++ b/addons/functions/functions/fnc_removeTrench.sqf @@ -24,7 +24,6 @@ private _actualProgress = _trench getVariable ["ace_trenches_progress", 0]; if (_actualProgress <= 0) exitWith {}; // Mark trench as being worked on -systemChat "Set in Remove line 27"; _trench setVariable ["ace_trenches_digging", true, true]; _trench setVariable [QGVAR(diggingType), "DOWN", true]; _unit setVariable [QGVAR(diggingTrench), true, true]; @@ -47,8 +46,6 @@ _trench setVariable [QGVAR(diggers), [_unit], true]; private _fnc_onFinish = { (_this select 0) params ["_unit", "_trench"]; - systemChat "Deleted"; - [_trench, _unit] call FUNC(deleteTrench); // Reset animation @@ -57,8 +54,6 @@ private _fnc_onFinish = { private _fnc_onFailure = { (_this select 0) params ["_unit", "_trench"]; - systemChat "Stopped"; - _unit setVariable [QGVAR(diggingTrench), false, true]; [QGVAR(handleDiggerToGVAR), [_trench, _unit, true]] call CBA_fnc_serverEvent; @@ -89,8 +84,6 @@ private _fnc_condition = { params ["_args", "_handle"]; _args params ["_trench", "_unit", "_removeTime"]; - systemChat "Down"; - private _actualProgress = _trench getVariable ["ace_trenches_progress", 0]; private _diggerCount = count (_trench getVariable [QGVAR(diggers), []]); @@ -100,8 +93,6 @@ private _fnc_condition = { {_diggerCount <= 0} ) exitWith { - systemChat "Stopped PFH remove 1"; - [_handle] call CBA_fnc_removePerFrameHandler; if (_diggerCount < 1) then { _trench setVariable ["ace_trenches_digging", false, true]; @@ -110,8 +101,6 @@ private _fnc_condition = { }; if (_actualProgress <= 0) exitWith { - - systemChat "Stopped PFH remove 2"; [_handle] call CBA_fnc_removePerFrameHandler; };