2015-03-10 20:49:53 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
|
|
|
*
|
|
|
|
* Start a repair action and open progress bar.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit that does the repairing (Object)
|
|
|
|
* 1: vehicle to repair (Object)
|
|
|
|
* 2: Selected hitpoint (String)
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* NONE
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-08-09 06:54:44 +00:00
|
|
|
params ["_unit", "_vehicle", "_hitPoint"];
|
|
|
|
TRACE_3("params",_unit,_vehicle,_hitPoint);
|
2015-03-10 20:49:53 +00:00
|
|
|
|
|
|
|
// exit if not a valid hitpoint
|
|
|
|
if !(_hitPoint in ([_vehicle] call EFUNC(common,getHitPoints))) exitWith {};
|
|
|
|
|
|
|
|
// calculate time to fully repair the hitpoint
|
|
|
|
private ["_damage", "_time"];
|
|
|
|
|
|
|
|
_damage = _vehicle getHitPointDamage _hitPoint;
|
|
|
|
|
2015-04-22 19:01:22 +00:00
|
|
|
_time = (5 + 10 * _damage) * ([1.5, 1] select ([_unit, GVAR(engineerSetting_Repair) + 1] call FUNC(isEngineer)));
|
2015-03-10 20:49:53 +00:00
|
|
|
|
|
|
|
// get string of the hitpoint
|
|
|
|
private "_text";
|
2015-03-10 21:16:24 +00:00
|
|
|
_text = format ["STR_ACE_Repair_%1", _hitPoint];
|
|
|
|
|
|
|
|
if (isLocalized _text) then {
|
2015-08-09 06:54:44 +00:00
|
|
|
_text = format [localize LSTRING(RepairingHitPoint), localize _text];
|
2015-03-10 21:16:24 +00:00
|
|
|
} else {
|
2015-08-09 06:54:44 +00:00
|
|
|
_text = localize LSTRING(Repairing);
|
2015-03-10 21:16:24 +00:00
|
|
|
};
|
2015-03-10 20:49:53 +00:00
|
|
|
|
|
|
|
// open the loading bar
|
2015-04-22 19:31:42 +00:00
|
|
|
[_time, [_unit, _vehicle, _hitPoint], {_this call DFUNC(doRepair)}, {_this call DFUNC(doRepair)}, _text, {(_this select 0) call DFUNC(canRepair)}, []] call EFUNC(common,progressBar);
|
2015-03-11 20:52:34 +00:00
|
|
|
|
|
|
|
// do animation
|
|
|
|
[_unit] call EFUNC(common,goKneeling);
|
2015-03-28 10:08:17 +00:00
|
|
|
|
|
|
|
// @todo play sound
|