ACE3/addons/repair/functions/fnc_repair_success.sqf
jonpas 711e1fc026 Fix Underwater interactions (magrepack, loading, refuel, medical legs, dragging) (#5521)
* Fix Magazine Repack underwater - fix #5513
Also prevent common goKneeling function underwater

* Fix loading patients underwater - fix #5515

* Fix load object underwater

* Fix take nozzle on jerry can underwater

* Fix refuel underwater conditions further

* Use isTouchingGround, Make refuel semi-compatible
 reports false if head is out of the water, we want true even if we are not diving

* Less interact exceptions duplication

* Use animationState to determine if unit is swimming, create common function and use it instead of isTouchingGround

* Fix condition

* Support dragging underwater
No carrying due to animation timing issues and other misc things

* Allow Medical Legs SelfActions underwater

* Fix fixPosition function underwater (use getPosATL instead of getPos)

* Fix fixPosition's slope adjustment for non-gravity objects, Do the same for objects without simulation as well
2017-10-01 13:38:11 -05:00

66 lines
1.9 KiB
Plaintext

/*
* Author: KoffeinFlummi, Glowbal
* Callback when repair completes.
*
* Arguments:
* 0: Arguments <ARRAY>
* 0: Unit that does the repairing <OBJECT>
* 1: Vehicle to repair <OBJECT
* 2: Selected hitpoint or hitpointIndex <STRING>or<NUMBER>
* 3: Repair Action Classname <STRING>
* 4: Items <ARRAY>
* 5: User of Items <ARRAY>
* 6: Claimed Repair Objects <ARRAY>
*
* Return Value:
* None
*
* Example:
* [[unit, vehicle, "hitpoint", "classname", [], [], [aWheel]]] call ace_repair_fnc_repair_success
*
* Public: No
*/
#include "script_component.hpp"
params ["_args"];
_args params ["_caller", "_target","_selectionName","_className","","","_claimedObjects"];
TRACE_4("params",_caller,_target,_selectionName,_className);
private ["_config","_callback", "_weaponSelect"];
if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then {
_caller removeWeapon "ACE_FakePrimaryWeapon";
};
if (vehicle _caller == _caller && {!(_caller call EFUNC(common,isSwimming))}) then {
[_caller, _caller getVariable [QGVAR(repairPrevAnimCaller), ""], 2] call EFUNC(common,doAnimation);
};
_caller setVariable [QGVAR(repairPrevAnimCaller), nil];
_weaponSelect = (_caller getVariable [QGVAR(selectedWeaponOnrepair), ""]);
if (_weaponSelect != "") then {
_caller selectWeapon _weaponSelect;
} else {
_caller action ["SwitchWeapon", _caller, _caller, 299];
};
//Unclaim repair objects:
{
TRACE_2("Releasing", _x, (typeOf _x));
[objNull, _x, false] call EFUNC(common,claim);
} forEach _claimedObjects;
// Record specific callback
_config = (ConfigFile >> "ACE_Repair" >> "Actions" >> _className);
_callback = getText (_config >> "callbackSuccess");
if (isNil _callback) then {
_callback = compile _callback;
} else {
_callback = missionNamespace getVariable _callback;
};
if (!(_callback isEqualType {})) then {_callback = {TRACE_1("callback was NOT code",_callback)};};
_args call _callback;
//todo: repair litter?