2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-08-11 19:35:13 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
|
|
|
* Called by repair action / progress bar. Raise events to set the new hitpoint damage.
|
|
|
|
*
|
|
|
|
* Arguments:
|
2015-08-16 18:14:54 +00:00
|
|
|
* 0: Unit that does the repairing <OBJECT>
|
|
|
|
* 1: Vehicle to repair <OBJECT>
|
|
|
|
* 2: Selected hitpoint <STRING>
|
2015-09-26 04:36:35 +00:00
|
|
|
* 3: Repair Action Classname (Not used) <STRING>
|
|
|
|
* 4: (Not used) <ARRAY>
|
|
|
|
* 5: (Not used) <ARRAY>
|
|
|
|
* 6: Required Repair Objects <ARRAY>
|
2015-08-11 19:35:13 +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", "RepairTrack", [], [], [aTrack]] call ace_repair_fnc_doRepairTrack
|
2015-08-16 18:14:54 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
2015-08-11 19:35:13 +00:00
|
|
|
*/
|
|
|
|
|
2015-09-26 04:36:35 +00:00
|
|
|
params ["_unit", "_vehicle", "_hitPoint", "", "", "", "_claimedObjects"];
|
|
|
|
TRACE_4("params",_unit,_vehicle,_hitPoint,_claimedObjects);
|
2015-08-11 19:35:13 +00:00
|
|
|
|
2015-09-26 04:36:35 +00:00
|
|
|
_claimedObjects params [["_track", objNull]];
|
|
|
|
if ((isNull _track) || {!([_unit, _track, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith))}) exitWith {
|
2016-10-02 10:55:31 +00:00
|
|
|
ERROR_1("Bad Track", _claimedObjects);
|
2015-09-26 04:36:35 +00:00
|
|
|
};
|
2015-08-11 19:35:13 +00:00
|
|
|
|
2015-09-26 04:36:35 +00:00
|
|
|
// can't use a destroyed track
|
|
|
|
if ((damage _track) >= 1) exitWith {};
|
2015-08-11 19:35:13 +00:00
|
|
|
|
|
|
|
// get current hitpoint damage
|
2015-11-10 02:11:48 +00:00
|
|
|
private _hitPointDamage = _vehicle getHitPointDamage _hitPoint;
|
|
|
|
private _damageRepaired = (1 - (damage _track)) / 4; // require 4 tracks to fully replace one side
|
2015-08-14 20:14:36 +00:00
|
|
|
|
2015-08-11 19:35:13 +00:00
|
|
|
// don't die by spawning / moving the wheel
|
2015-09-26 04:36:35 +00:00
|
|
|
_hitPointDamage = (_hitPointDamage - _damageRepaired) min 0;
|
|
|
|
deleteVehicle _track;
|
2015-08-11 19:35:13 +00:00
|
|
|
|
|
|
|
// raise event to set the new hitpoint damage
|
2016-05-24 16:58:27 +00:00
|
|
|
[QGVAR(setWheelHitPointDamage), [_vehicle, _hitPoint, _hitPointDamage], _vehicle] call CBA_fnc_targetEvent;
|
2015-08-11 19:35:13 +00:00
|
|
|
|
|
|
|
// display text message if enabled
|
|
|
|
if (GVAR(DisplayTextOnRepair)) then {
|
|
|
|
[LSTRING(ReplacedTrack)] call EFUNC(common,displayTextStructured);
|
|
|
|
};
|