ACE3/addons/repair/functions/fnc_repair_failure.sqf
Dedmen Miller e2ac18a05d [WIP] Fix script errors reporting wrong line numbers (#6407)
* advanced_ballistics

* advanced_fatigue

* advanced_throwing

* ai

* aircraft

* arsenal

* atragmx

* attach

* backpacks

* ballistics

* captives

* cargo

* chemlights

* common

* concertina_wire

* cookoff

* dagr

* disarming

* disposable

* dogtags

* dragging

* explosives

* fastroping

* fcs

* finger

* frag

* gestures

* gforces

* goggles

* grenades

* gunbag

* hearing

* hitreactions

* huntir

* interact_menu

* interaction

* inventory

* kestrel4500

* laser

* laserpointer

* logistics_uavbattery

* logistics_wirecutter

* magazinerepack

* map

* map_gestures

* maptools

* markers

* medical

* medical_ai

* medical_blood

* medical_menu

* microdagr

* minedetector

* missileguidance

* missionmodules

* mk6mortar

* modules

* movement

* nametags

* nightvision

* nlaw

* optics

* optionsmenu

* overheating

* overpressure

* parachute

* pylons

* quickmount

* rangecard

* rearm

* recoil

* refuel

* reload

* reloadlaunchers

* repair

* respawn

* safemode

* sandbag

* scopes

* slideshow

* spectator

* spottingscope

* switchunits

* tacticalladder

* tagging

* trenches

* tripod

* ui

* vector

* vehiclelock

* vehicles

* viewdistance

* weaponselect

* weather

* winddeflection

* yardage450

* zeus

* arsenal defines.hpp

* optionals

* DEBUG_MODE_FULL 1

* DEBUG_MODE_FULL 2

* Manual fixes

* Add SQF Validator check for #include after block comment

* explosives fnc_openTimerUI

* fix uniqueItems
2018-09-17 14:19:29 -05:00

69 lines
2.0 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: KoffeinFlummi, Glowbal
* Callback when repair fails.
*
* 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: None
* 5: Items available <ARRAY>
* 6: Claimed Repair Objects <ARRAY>
*
* Return Value:
* None
*
* Example:
* [[unit, vehicle, "hitpoint", "classname", nil, [items], [aWheel]]] call ace_repair_fnc_repair_failure
*
* Public: No
*/
params ["_args"];
_args params ["_caller", "_target","_selectionName","_className","","_usersOfItems", "_claimedObjects"];
TRACE_5("params",_caller,_target,_selectionName,_className,_usersOfItems);
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];
private _weaponSelect = (_caller getVariable [QGVAR(selectedWeaponOnrepair), ""]);
if (_weaponSelect != "") then {
_caller selectWeapon _weaponSelect;
} else {
_caller action ["SwitchWeapon", _caller, _caller, 299];
};
{
(_x select 0) addItem (_x select 1);
} forEach _usersOfItems;
//Unclaim repair objects:
{
TRACE_2("Releasing", _x, (typeOf _x));
[objNull, _x, false] call EFUNC(common,claim);
} forEach _claimedObjects;
// Record specific callback
private _config = (ConfigFile >> "ACE_Repair" >> "Actions" >> _className);
private _callback = getText (_config >> "callbackFailure");
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?