2015-03-10 21:01:46 +00:00
|
|
|
/*
|
|
|
|
* Author: gpgpgpgp, edited by commy2, PabstMirror
|
|
|
|
* Starts cutting down a fence
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
* 1: Fence <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Nothing
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [player, berlinWall] call ace_logistics_wirecutter_fnc_cutDownFence
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-01-28 04:42:45 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-08-23 23:39:08 +00:00
|
|
|
params ["_unit", "_fenceObject"];
|
|
|
|
TRACE_2("params",_unit,_fenceObject);
|
|
|
|
|
|
|
|
private ["_timeToCut", "_progressCheck", "_onCompletion", "_onFail"];
|
2015-01-28 04:42:45 +00:00
|
|
|
|
2015-03-10 21:01:46 +00:00
|
|
|
if (_unit != ACE_player) exitWith {};
|
2015-01-28 04:42:45 +00:00
|
|
|
|
2015-04-15 23:32:47 +00:00
|
|
|
_timeToCut = if ([ACE_player] call EFUNC(common,isEngineer)) then {7.5} else {11};
|
2015-01-28 04:42:45 +00:00
|
|
|
|
|
|
|
[ACE_player, "AinvPknlMstpSnonWnonDr_medic5", 0] call EFUNC(common,doAnimation);
|
|
|
|
|
2015-08-23 23:39:08 +00:00
|
|
|
_onCompletion = {
|
|
|
|
TRACE_1("_onCompletion",_this);
|
|
|
|
(_this select 0) params ["_fenceObject", "", "_unit"];
|
|
|
|
_fenceObject setdamage 1;
|
|
|
|
[_unit, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation);
|
|
|
|
};
|
|
|
|
|
|
|
|
_onFail = {
|
|
|
|
TRACE_1("_onFail", _this);
|
|
|
|
(_this select 0) params ["", "", "_unit"];
|
|
|
|
[_unit, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation);
|
|
|
|
};
|
|
|
|
|
2015-04-15 23:32:47 +00:00
|
|
|
_progressCheck = {
|
2015-08-23 23:39:08 +00:00
|
|
|
params ["_args", "_passedTime"];
|
|
|
|
_args params ["_fenceObject", "_lastSoundEffectTime"];
|
|
|
|
|
2015-04-15 23:32:47 +00:00
|
|
|
if (_passedTime > (_lastSoundEffectTime + SOUND_CLIP_TIME_SPACEING)) then {
|
2015-04-16 03:27:12 +00:00
|
|
|
playSound3D [QUOTE(PATHTO_R(sound\wirecut.ogg)), objNull, false, (getPosASL ACE_player), 3, 1, 10];
|
2015-04-15 23:32:47 +00:00
|
|
|
_args set [1, _passedTime];
|
|
|
|
};
|
|
|
|
|
|
|
|
((!isNull _fenceObject) && {(damage _fenceObject) < 1} && {("ACE_wirecutter" in (items ACE_player))})
|
2015-01-28 04:42:45 +00:00
|
|
|
};
|
|
|
|
|
2015-08-23 23:39:08 +00:00
|
|
|
[_timeToCut, [_fenceObject,0,_unit], _onCompletion, _onFail, localize LSTRING(CuttingFence), _progressCheck] call EFUNC(common,progressBar);
|