ACE3/addons/repair/functions/fnc_patchRemovedWheel.sqf
BrettMayson 10c1085aba
Repair - Add wheel patching (#8835)
* patch wheels on vehicles

* all tire patching working

Co-authored-by: mp-singh <mandeep@mandeepsingh.ca>

* doc

* remove unused string

* Update CfgVehicles.hpp

* use strintable

* setting for where the wheel can be patched

* localize

* Update stringtable.xml

* can't patch a missing tire

* removal > replacement

* Update addons/repair/initSettings.sqf

Co-authored-by: PabstMirror <pabstmirror@gmail.com>

* Apply suggestions from code review

Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: PabstMirror <pabstmirror@gmail.com>

* Apply suggestions from code review

Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com>

* patch icon

* use PATCH_WHEEL_STEP_TIME

* fix wheel translation

---------

Co-authored-by: mp-singh <mandeep@mandeepsingh.ca>
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com>
Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com>
2023-06-28 13:39:08 +03:00

40 lines
1.0 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: Brett Mayson
* Patch a wheel that is not on a vehicle
*
* Arguments:
* 0: Unit that does the patching <OBJECT>
* 1: Wheel to patch <OBJECT>
*
* Return Value:
* None
*
* Example:
* [unit, vehicle] call ace_repair_fnc_patchRemovedWheel
*
* Public: No
*/
params ["_unit", "_target"];
[_unit, "Acts_carFixingWheel"] call EFUNC(common,doAnimation);
private _wheelDamage = (damage _target) - GVAR(patchWheelMaximumRepair);
[ceil (_wheelDamage / 0.05) * GVAR(patchWheelTime), [_target], {}, {}, LLSTRING(PatchingWheel), {
params ["_args"];
_args params ["_target"];
private _damage = damage _target;
private _iterationsRemaining = ceil ((_damage - GVAR(patchWheelMaximumRepair)) / 0.05) - 1;
if ((_totalTime - _elapsedTime) > _iterationsRemaining * GVAR(patchWheelTime)) exitWith {true};
_damage = (_damage - 0.05) max GVAR(patchWheelMaximumRepair);
_target setDamage _damage;
_damage > GVAR(patchWheelMaximumRepair)
}] call ace_common_fnc_progressBar;