2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-08-09 16:08:53 +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-08-09 16:08:53 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2015-08-16 18:14:54 +00:00
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [unit, vehicle, "hitpoint"] call ace_repair_fnc_doRemoveTrack
|
|
|
|
*
|
|
|
|
* Public: No
|
2015-08-09 16:08:53 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
params ["_unit", "_vehicle", "_hitPoint"];
|
|
|
|
TRACE_3("params",_unit,_vehicle,_hitPoint);
|
2015-11-10 02:11:48 +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 remove destroyed or already removed wheel
|
|
|
|
if (_hitPointDamage >= 1) exitWith {};
|
|
|
|
|
|
|
|
// don't die by spawning / moving the wheel
|
2016-06-04 10:12:56 +00:00
|
|
|
[QEGVAR(common,fixCollision), _unit] call CBA_fnc_localEvent;
|
2015-08-09 16:08:53 +00:00
|
|
|
|
2015-11-10 02:11:48 +00:00
|
|
|
// spawn track
|
|
|
|
private _newTrack = ["ACE_Track", getPosASL _unit, _hitPointDamage] call FUNC(spawnObject);
|
|
|
|
TRACE_2("new track created",_newTrack,damage _newTrack);
|
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, 1], _vehicle] call CBA_fnc_targetEvent;
|
2015-08-09 16:08:53 +00:00
|
|
|
|
|
|
|
// display text message if enabled
|
|
|
|
if (GVAR(DisplayTextOnRepair)) then {
|
|
|
|
[localize LSTRING(RemovedTrack)] call EFUNC(common,displayTextStructured);
|
|
|
|
};
|