2015-03-29 01:35:55 +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-03-29 01:35:55 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2015-08-16 18:14:54 +00:00
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [unit, vehicle, "hitpoint"] call ace_repair_fnc_doRemoveWheel
|
|
|
|
*
|
|
|
|
* Public: No
|
2015-03-29 01:35:55 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-08-09 06:54:44 +00:00
|
|
|
params ["_unit", "_vehicle", "_hitPoint"];
|
|
|
|
TRACE_3("params",_unit,_vehicle,_hitPoint);
|
2015-08-09 13:53:52 +00:00
|
|
|
// TODO [_unit, _wheel] call EFUNC(common,claim); on start of action
|
2015-03-29 01:35:55 +00:00
|
|
|
// get current hitpoint damage
|
|
|
|
private "_hitPointDamage";
|
|
|
|
_hitPointDamage = _vehicle getHitPointDamage _hitPoint;
|
|
|
|
|
|
|
|
// can't remove destroyed or already removed wheel
|
|
|
|
if (_hitPointDamage >= 1) exitWith {};
|
|
|
|
|
|
|
|
// don't die by spawning / moving the wheel
|
|
|
|
["fixCollision", _unit] call EFUNC(common,localEvent);
|
|
|
|
|
|
|
|
// spawn wheel
|
|
|
|
private "_wheel";
|
|
|
|
_wheel = ["ACE_Wheel", getPosASL _unit] call FUNC(spawnObject);
|
2015-04-22 19:01:22 +00:00
|
|
|
_wheel setdamage _hitPointDamage;
|
2015-03-29 01:35:55 +00:00
|
|
|
|
|
|
|
// raise event to set the new hitpoint damage
|
|
|
|
["setWheelHitPointDamage", _vehicle, [_vehicle, _hitPoint, 1]] call EFUNC(common,targetEvent);
|
|
|
|
|
|
|
|
// display text message if enabled
|
|
|
|
if (GVAR(DisplayTextOnRepair)) then {
|
2015-08-09 06:54:44 +00:00
|
|
|
[localize LSTRING(RemovedWheel)] call EFUNC(common,displayTextStructured);
|
2015-03-29 01:35:55 +00:00
|
|
|
};
|