mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added support for when one of the grouped hitpoints is damaged but not main
This commit is contained in:
parent
f2bda7c434
commit
144af2ed17
@ -31,7 +31,7 @@ class ACE_Repair {
|
||||
class MiscRepair: ReplaceWheel {
|
||||
displayName = CSTRING(Repairing); // let's make empty string an auto generated string
|
||||
displayNameProgress = CSTRING(RepairingHitPoint);
|
||||
condition = QUOTE((_target getHitPointDamage _hitPoint) > ([_caller] call FUNC(getPostRepairDamage)));
|
||||
condition = QUOTE(call FUNC(canMiscRepair));
|
||||
requiredEngineer = 0;
|
||||
repairingTime = 15;
|
||||
callbackSuccess = QUOTE(call FUNC(doRepair));
|
||||
|
@ -3,6 +3,7 @@
|
||||
ADDON = false;
|
||||
|
||||
PREP(addRepairActions);
|
||||
PREP(canMiscRepair);
|
||||
PREP(canRemove);
|
||||
PREP(canRepair);
|
||||
PREP(canRepairTrack);
|
||||
|
40
addons/repair/functions/fnc_canMiscRepair.sqf
Normal file
40
addons/repair/functions/fnc_canMiscRepair.sqf
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Author: Jonpas
|
||||
* Check if misc repair action can be done, called from callbackSuccess.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit that does the repairing <OBJECT>
|
||||
* 1: Vehicle to repair <OBJECT>
|
||||
* 2: Selected hitpoint <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* Can Misc Repair <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [unit, vehicle, "hitpoint", "classname"] call ace_repair_fnc_canMiscRepair
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_hitpointGroup", "_postRepairDamage", "_return"];
|
||||
params ["_caller", "_target", "_hitPoint"];
|
||||
|
||||
// Check hitpoint group
|
||||
_hitpointGroup = configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(hitpointGroup);
|
||||
_hitpointGroup = if (isArray _hitpointGroup) then {getArray _hitpointGroup} else {[]};
|
||||
|
||||
if !(_hitPoint in _hitpointGroup) then {
|
||||
_hitpointGroup pushBack _hitPoint;
|
||||
};
|
||||
|
||||
_postRepairDamage = [_caller] call FUNC(getPostRepairDamage);
|
||||
|
||||
_return = false;
|
||||
{
|
||||
if ((_target getHitPointDamage _x) > _postRepairDamage) exitWith {
|
||||
_return = true;
|
||||
};
|
||||
} forEach _hitpointGroup;
|
||||
|
||||
_return
|
@ -31,7 +31,7 @@ _hitPointDamage = _hitPointDamage max ([_unit] call FUNC(getPostRepairDamage));
|
||||
// raise event to set the new hitpoint damage
|
||||
["setVehicleHitPointDamage", _vehicle, [_vehicle, _hitPoint, _hitPointDamage]] call EFUNC(common,targetEvent);
|
||||
|
||||
// Repair the rest in the group (don't need to worry about specific damage as it's not checked)
|
||||
// Repair the rest in the group (no specific damage, main hitpoint is enough)
|
||||
_hitpointGroup = configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(hitpointGroup);
|
||||
_hitpointGroup = if (isArray _hitpointGroup) then {getArray _hitpointGroup} else {[]};
|
||||
if (count _hitpointGroup > 0) then {
|
||||
|
Loading…
Reference in New Issue
Block a user