2016-01-23 23:45:59 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
if (isServer) then {
|
|
|
|
// Cancel dig on hard disconnection. Function is identical to killed
|
|
|
|
addMissionEventHandler ["HandleDisconnect", {_this call FUNC(handleKilled)}];
|
2023-10-04 18:21:50 +00:00
|
|
|
|
|
|
|
// Wrapper for blockTrench_place, on failure send hint back to source
|
|
|
|
[QGVAR(layTrenchline), {
|
|
|
|
params [["_source", objNull, [objNull]], ["_args", [], [[]]]];
|
|
|
|
private _return = _args call FUNC(blockTrench_place);
|
|
|
|
TRACE_3("layTrenchline EH",_source,_args,_return);
|
|
|
|
_return params ["_success", "_reason", ["_info", ""]];
|
|
|
|
if ((!_success) && {!isNull _source}) then {
|
|
|
|
[QEGVAR(common,displayTextStructured), [["%1:<br/>%2<br/>%3", "str_mis_state_failed", _reason, _info], 3], [_source]] call CBA_fnc_targetEvent;
|
|
|
|
};
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
2016-01-23 23:45:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if (!hasInterface) exitWith {};
|
|
|
|
|
2016-02-04 21:43:47 +00:00
|
|
|
GVAR(trenchId) = 0;
|
2016-01-23 23:45:59 +00:00
|
|
|
GVAR(trench) = objNull;
|
|
|
|
GVAR(digPFH) = -1;
|
|
|
|
GVAR(digDirection) = 0;
|
|
|
|
|
|
|
|
// Cancel dig sandbag if interact menu opened
|
2016-05-24 13:13:11 +00:00
|
|
|
["ace_interactMenuOpened", {[ACE_player] call FUNC(handleInteractMenuOpened)}] call CBA_fnc_addEventHandler;
|
2016-01-23 23:45:59 +00:00
|
|
|
|
|
|
|
// Cancel dig on player change. This does work when returning to lobby, but not when hard disconnecting.
|
2016-06-21 23:39:20 +00:00
|
|
|
["unit", FUNC(handlePlayerChanged)] call CBA_fnc_addPlayerEventHandler;
|
|
|
|
["loadout", FUNC(handlePlayerInventoryChanged)] call CBA_fnc_addPlayerEventHandler;
|
|
|
|
["vehicle", {[ACE_player, objNull] call FUNC(handlePlayerChanged)}] call CBA_fnc_addPlayerEventHandler;
|
2016-01-23 23:45:59 +00:00
|
|
|
|
|
|
|
// handle waking up dragged unit and falling unconscious while dragging
|
2016-06-03 18:57:21 +00:00
|
|
|
["ace_unconscious", {_this call FUNC(handleUnconscious)}] call CBA_fnc_addEventHandler;
|
2016-01-23 23:45:59 +00:00
|
|
|
|
|
|
|
//@todo Captivity?
|