2015-08-09 16:08:53 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
2015-09-26 04:36:35 +00:00
|
|
|
* Replaces a track.
|
2015-08-09 16:08:53 +00:00
|
|
|
*
|
|
|
|
* 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-09 16:08:53 +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", "ReplaceTrack", [], [], [aTrack]] call ace_repair_fnc_doReplaceTrack
|
2015-08-16 18:14:54 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
2015-08-09 16:08:53 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-09-26 04:36:35 +00:00
|
|
|
params ["_unit", "_vehicle", "_hitPoint", "", "", "", "_claimedObjects"];
|
|
|
|
TRACE_4("params",_unit,_vehicle,_hitPoint,_claimedObjects);
|
2015-08-09 16:08:53 +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-09 16:08:53 +00:00
|
|
|
|
|
|
|
// get current hitpoint damage
|
2015-11-10 02:11:48 +00:00
|
|
|
private _hitPointDamage = _vehicle getHitPointDamage _hitPoint;
|
2015-08-09 16:08:53 +00:00
|
|
|
|
|
|
|
// can't replace not destroyed wheel
|
|
|
|
if (_hitPointDamage < 1) exitWith {};
|
|
|
|
|
2015-09-26 04:36:35 +00:00
|
|
|
// get track's damage
|
2015-11-10 02:11:48 +00:00
|
|
|
private _newHitPointDamage = damage _track;
|
2015-08-09 16:08:53 +00:00
|
|
|
|
2015-09-26 04:36:35 +00:00
|
|
|
// can't replace with a destroyed wheel
|
|
|
|
if (_newHitPointDamage >= 1) exitWith {};
|
2015-08-09 16:08:53 +00:00
|
|
|
|
2015-09-26 04:36:35 +00:00
|
|
|
deleteVehicle _track;
|
2015-08-09 16:08:53 +00:00
|
|
|
|
|
|
|
// raise event to set the new hitpoint damage
|
2016-05-24 16:58:27 +00:00
|
|
|
[QGVAR(setWheelHitPointDamage), [_vehicle, _hitPoint, _newHitPointDamage], _vehicle] call CBA_fnc_targetEvent;
|
2015-08-09 16:08:53 +00:00
|
|
|
|
|
|
|
// display text message if enabled
|
|
|
|
if (GVAR(DisplayTextOnRepair)) then {
|
|
|
|
[LSTRING(ReplacedTrack)] call EFUNC(common,displayTextStructured);
|
|
|
|
};
|