2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2015-03-10 21:01:46 +00:00
|
|
|
/*
|
2018-07-13 16:30:13 +00:00
|
|
|
* Author: gpgpgpgp, commy2, PabstMirror, mharis001
|
|
|
|
* Starts cutting down a fence. Triggers global "ace_wireCuttingStarted" event.
|
2015-03-10 21:01:46 +00:00
|
|
|
*
|
|
|
|
* 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:
|
2018-07-13 16:30:13 +00:00
|
|
|
* [player, cursorObject] call ace_logistics_wirecutter_fnc_cutDownFence
|
2015-03-10 21:01:46 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-01-28 04:42:45 +00:00
|
|
|
|
2018-07-13 16:30:13 +00:00
|
|
|
params ["_unit", "_fence"];
|
|
|
|
TRACE_2("Fence cutting started",_unit,_fence);
|
2015-08-23 23:39:08 +00:00
|
|
|
|
2015-03-10 21:01:46 +00:00
|
|
|
if (_unit != ACE_player) exitWith {};
|
2015-01-28 04:42:45 +00:00
|
|
|
|
2018-07-13 16:30:13 +00:00
|
|
|
// Get cut time based on if unit is a engineer
|
|
|
|
private _cutTime = if (_unit call EFUNC(common,isEngineer)) then {CUT_TIME_ENGINEER} else {CUT_TIME_DEFAULT};
|
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
|
|
|
|
2018-07-13 16:30:13 +00:00
|
|
|
[
|
|
|
|
_cutTime,
|
|
|
|
[_unit, _fence, 0],
|
|
|
|
{
|
|
|
|
TRACE_1("Fence cutting successful",_this);
|
|
|
|
(_this select 0) params ["_unit", "_fence"];
|
2015-08-23 23:39:08 +00:00
|
|
|
|
2018-07-13 16:30:13 +00:00
|
|
|
_fence setDamage 1;
|
|
|
|
if !(_unit call EFUNC(common,isSwimming)) then {
|
|
|
|
[_unit, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation);
|
|
|
|
};
|
|
|
|
},
|
|
|
|
{
|
|
|
|
TRACE_1("Fence cutting failed",_this);
|
|
|
|
(_this select 0) params ["_unit"];
|
2015-08-23 23:39:08 +00:00
|
|
|
|
2018-07-13 16:30:13 +00:00
|
|
|
if !(_unit call EFUNC(common,isSwimming)) then {
|
|
|
|
[_unit, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation);
|
|
|
|
};
|
|
|
|
},
|
|
|
|
localize LSTRING(CuttingFence),
|
|
|
|
{
|
|
|
|
params ["_args", "_elapsedTime"];
|
|
|
|
_args params ["_unit", "_fence", "_lastSoundTime"];
|
2015-04-15 23:32:47 +00:00
|
|
|
|
2018-07-13 16:30:13 +00:00
|
|
|
if (_elapsedTime > _lastSoundTime + SOUND_CLIP_TIME_SPACING) then {
|
|
|
|
playSound3D [QPATHTO_R(sound\wirecut.ogg), objNull, false, getPosASL _unit, 3, 1, 10];
|
|
|
|
_args set [2, _elapsedTime];
|
|
|
|
};
|
2015-01-28 04:42:45 +00:00
|
|
|
|
2018-07-13 16:30:13 +00:00
|
|
|
!isNull _fence
|
|
|
|
&& {damage _fence < 1}
|
2018-07-27 17:26:26 +00:00
|
|
|
&& {HAS_WIRECUTTER(_player)}
|
2018-07-13 16:30:13 +00:00
|
|
|
},
|
|
|
|
["isNotSwimming"]
|
|
|
|
] call EFUNC(common,progressBar);
|
2017-11-17 05:43:49 +00:00
|
|
|
|
2018-07-13 16:30:13 +00:00
|
|
|
["ace_wireCuttingStarted", [_unit, _fence]] call CBA_fnc_globalEvent;
|