2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2015-07-03 21:14:23 +00:00
|
|
|
/*
|
|
|
|
* Author: KoffeinFlummi, Glowbal
|
2015-08-16 18:14:54 +00:00
|
|
|
* Callback when repair fails.
|
2015-07-03 21:14:23 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2015-08-16 18:14:54 +00:00
|
|
|
* 0: Arguments <ARRAY>
|
|
|
|
* 0: Unit that does the repairing <OBJECT>
|
|
|
|
* 1: Vehicle to repair <OBJECT
|
2015-09-26 04:36:35 +00:00
|
|
|
* 2: Selected hitpoint or hitpointIndex <STRING>or<NUMBER>
|
2015-08-16 18:14:54 +00:00
|
|
|
* 3: Repair Action Classname <STRING>
|
|
|
|
* 4: None
|
|
|
|
* 5: Items available <ARRAY>
|
2015-09-26 04:36:35 +00:00
|
|
|
* 6: Claimed Repair Objects <ARRAY>
|
2015-07-03 21:14:23 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2015-08-16 18:14:54 +00:00
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2015-09-26 04:36:35 +00:00
|
|
|
* [[unit, vehicle, "hitpoint", "classname", nil, [items], [aWheel]]] call ace_repair_fnc_repair_failure
|
2015-07-03 21:14:23 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2015-08-09 06:54:44 +00:00
|
|
|
params ["_args"];
|
2015-09-26 04:36:35 +00:00
|
|
|
_args params ["_caller", "_target","_selectionName","_className","","_usersOfItems", "_claimedObjects"];
|
2015-08-09 06:54:44 +00:00
|
|
|
TRACE_5("params",_caller,_target,_selectionName,_className,_usersOfItems);
|
2015-07-03 21:14:23 +00:00
|
|
|
|
|
|
|
if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then {
|
|
|
|
_caller removeWeapon "ACE_FakePrimaryWeapon";
|
|
|
|
};
|
2017-10-01 18:38:11 +00:00
|
|
|
if (vehicle _caller == _caller && {!(_caller call EFUNC(common,isSwimming))}) then {
|
2015-08-16 14:45:46 +00:00
|
|
|
[_caller, _caller getVariable [QGVAR(repairPrevAnimCaller), ""], 2] call EFUNC(common,doAnimation);
|
2015-07-03 21:14:23 +00:00
|
|
|
};
|
2015-11-30 16:27:09 +00:00
|
|
|
_caller setVariable [QGVAR(repairPrevAnimCaller), nil];
|
2015-07-03 21:14:23 +00:00
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _weaponSelect = (_caller getVariable [QGVAR(selectedWeaponOnrepair), ""]);
|
2015-07-03 21:14:23 +00:00
|
|
|
if (_weaponSelect != "") then {
|
|
|
|
_caller selectWeapon _weaponSelect;
|
|
|
|
} else {
|
2017-05-12 18:12:39 +00:00
|
|
|
_caller action ["SwitchWeapon", _caller, _caller, 299];
|
2015-07-03 21:14:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
{
|
|
|
|
(_x select 0) addItem (_x select 1);
|
2015-08-09 06:54:44 +00:00
|
|
|
} forEach _usersOfItems;
|
2015-07-03 21:14:23 +00:00
|
|
|
|
2015-09-26 04:36:35 +00:00
|
|
|
//Unclaim repair objects:
|
|
|
|
{
|
|
|
|
TRACE_2("Releasing", _x, (typeOf _x));
|
|
|
|
[objNull, _x, false] call EFUNC(common,claim);
|
|
|
|
} forEach _claimedObjects;
|
|
|
|
|
|
|
|
|
2015-07-03 21:14:23 +00:00
|
|
|
// Record specific callback
|
2017-10-10 14:39:59 +00:00
|
|
|
private _config = (ConfigFile >> "ACE_Repair" >> "Actions" >> _className);
|
2015-07-03 21:14:23 +00:00
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _callback = getText (_config >> "callbackFailure");
|
2015-07-03 21:14:23 +00:00
|
|
|
if (isNil _callback) then {
|
|
|
|
_callback = compile _callback;
|
|
|
|
} else {
|
2015-08-16 14:45:46 +00:00
|
|
|
_callback = missionNamespace getVariable _callback;
|
2015-07-03 21:14:23 +00:00
|
|
|
};
|
2016-02-21 17:34:25 +00:00
|
|
|
if (!(_callback isEqualType {})) then {_callback = {TRACE_1("callback was NOT code",_callback)};};
|
2015-07-03 21:14:23 +00:00
|
|
|
|
|
|
|
_args call _callback;
|
|
|
|
|
2015-09-26 04:36:35 +00:00
|
|
|
//todo: repair litter?
|