ACE3/addons/repair/functions/fnc_repair_success.sqf
Grim 04e41a4d5a
Repair - Make Full Repair Time dependent on vehicle damage (#8417)
* add variable full repair time

* enable compile cache

* Fix stupid

* whoops

* incremental full repair

* cleanup function header

* ignore hitpoints inFullRepairProgress

* fix getHitPointsToIgnore

* final cleanup

* don't show repair hint while doing full repair

* make this all work

* fix stupid

put this back in place

* Add setting for speedup when near repair facility/vehicle

enable compile cache

* refactor near repair facility/vehicle checks

* remove skipping hint from do_repair

better for feedback this way

* git diff stuff

* use functions directly in ACE_Repair.hpp

* add check for vehicle proximity

* add a new line

* switch to multiply by setting instead

* speed boost settings, remove exit addRepairActions

* stringtable

* remove speed boost settings

* fix things, add forceDisplayName

* name in function header

* fix TRACE

* add animation looping

* remove systemChat

Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com>

* add time coefficient setting

* move to repair category

* time coefficient max and default values

---------

Co-authored-by: Salluci <69561145+Salluci@users.noreply.github.com>
Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com>
2023-07-06 06:52:04 +03:00

68 lines
2.1 KiB
Plaintext

#include "script_component.hpp"
/*
* 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
*/
params ["_args"];
_args params ["_caller", "_target","_selectionName","_className","","","_claimedObjects"];
TRACE_4("params",_caller,_target,_selectionName,_className);
if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then {
_caller removeWeapon "ACE_FakePrimaryWeapon";
};
_caller removeEventHandler ["AnimDone", _caller getVariable [QGVAR(repairLoopAnimEh), -1]];
_caller setVariable [QGVAR(repairLoopAnimEh), nil];
if (vehicle _caller == _caller && {!(_caller call EFUNC(common,isSwimming))}) then {
[_caller, _caller getVariable [QGVAR(repairPrevAnimCaller), ""], 2] call EFUNC(common,doAnimation);
};
_caller setVariable [QGVAR(repairCurrentAnimCaller), nil];
_caller setVariable [QGVAR(repairPrevAnimCaller), nil];
private _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
private _config = (ConfigFile >> "ACE_Repair" >> "Actions" >> _className);
private _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?