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:
|
2017-06-08 13:31:51 +00:00
|
|
|
* None
|
2015-03-10 21:01:46 +00:00
|
|
|
*
|
|
|
|
* 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);
|
|
|
|
|
2015-03-10 21:01:46 +00:00
|
|
|
if (_unit != ACE_player) exitWith {};
|
2015-01-28 04:42:45 +00:00
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _timeToCut = if ([_unit] call EFUNC(common,isEngineer)) then {7.5} else {11};
|
2015-01-28 04:42:45 +00:00
|
|
|
|
2017-10-01 18:38:11 +00:00
|
|
|
if !(_unit call EFUNC(common,isSwimming)) then {
|
2017-08-22 18:30:56 +00:00
|
|
|
[_unit, "AinvPknlMstpSnonWnonDr_medic5", 0] call EFUNC(common,doAnimation);
|
|
|
|
};
|
2015-01-28 04:42:45 +00:00
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _onCompletion = {
|
2015-08-23 23:39:08 +00:00
|
|
|
TRACE_1("_onCompletion",_this);
|
|
|
|
(_this select 0) params ["_fenceObject", "", "_unit"];
|
|
|
|
_fenceObject setdamage 1;
|
2017-10-01 18:38:11 +00:00
|
|
|
if !(_unit call EFUNC(common,isSwimming)) then {
|
2017-08-22 18:30:56 +00:00
|
|
|
[_unit, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation);
|
|
|
|
};
|
2015-08-23 23:39:08 +00:00
|
|
|
};
|
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _onFail = {
|
2015-08-23 23:39:08 +00:00
|
|
|
TRACE_1("_onFail", _this);
|
|
|
|
(_this select 0) params ["", "", "_unit"];
|
2017-10-01 18:38:11 +00:00
|
|
|
if !(_unit call EFUNC(common,isSwimming)) then {
|
2017-08-22 18:30:56 +00:00
|
|
|
[_unit, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation);
|
|
|
|
};
|
2015-08-23 23:39:08 +00:00
|
|
|
};
|
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _progressCheck = {
|
2015-08-23 23:39:08 +00:00
|
|
|
params ["_args", "_passedTime"];
|
2017-08-22 18:30:56 +00:00
|
|
|
_args params ["_fenceObject", "_lastSoundEffectTime", "_unit"];
|
2015-08-23 23:39:08 +00:00
|
|
|
|
2015-04-15 23:32:47 +00:00
|
|
|
if (_passedTime > (_lastSoundEffectTime + SOUND_CLIP_TIME_SPACEING)) then {
|
2017-08-22 18:30:56 +00:00
|
|
|
playSound3D [QUOTE(PATHTO_R(sound\wirecut.ogg)), objNull, false, (getPosASL _unit), 3, 1, 10];
|
2015-04-15 23:32:47 +00:00
|
|
|
_args set [1, _passedTime];
|
|
|
|
};
|
|
|
|
|
2017-08-22 18:30:56 +00:00
|
|
|
((!isNull _fenceObject) && {(damage _fenceObject) < 1} && {("ACE_wirecutter" in (items _unit))})
|
2015-01-28 04:42:45 +00:00
|
|
|
};
|
|
|
|
|
2017-08-22 18:30:56 +00:00
|
|
|
[_timeToCut, [_fenceObject,0,_unit], _onCompletion, _onFail, localize LSTRING(CuttingFence), _progressCheck, ["isNotSwimming"]] call EFUNC(common,progressBar);
|
2017-11-17 05:43:49 +00:00
|
|
|
|
|
|
|
["ace_wireCuttingStarted", [_unit, _fenceObject]] call CBA_fnc_globalEvent;
|