From 225d15dcca2062a197ec37e9e462c96d154fe724 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ozan=20E=C4=9Fitmen?= Date: Thu, 8 Jun 2017 22:31:25 +0400 Subject: [PATCH] Add Ability to Change Repair Times of Vehicles (#5205) * Add ability to change repair time based on vehicle * Much better * Unary command not function * Allow changing of track or wheel object per vehicle * Lot more complicated than I thought --- addons/repair/functions/fnc_repair.sqf | 38 ++++++++++++++++---------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/addons/repair/functions/fnc_repair.sqf b/addons/repair/functions/fnc_repair.sqf index d4f5412e6f..3ee6d4097f 100644 --- a/addons/repair/functions/fnc_repair.sqf +++ b/addons/repair/functions/fnc_repair.sqf @@ -177,23 +177,31 @@ if (vehicle _caller == _caller && {_callerAnim != ""}) then { [_caller, _callerAnim] call EFUNC(common,doAnimation); }; -//Get repair time -_repairTime = if (isNumber (_config >> "repairingTime")) then { - getNumber (_config >> "repairingTime"); -} else { - if (isText (_config >> "repairingTime")) exitWith { - _repairTimeConfig = getText(_config >> "repairingTime"); - if (isNil _repairTimeConfig) then { - _repairTimeConfig = compile _repairTimeConfig; - } else { - _repairTimeConfig = missionNamespace getVariable _repairTimeConfig; +// Get repair time +_repairTime = [ + configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(repairTimes) >> configName _config, + "number", + -1 +] call CBA_fnc_getConfigEntry; + +if (_repairTime < 0) then { + _repairTime = if (isNumber (_config >> "repairingTime")) then { + getNumber (_config >> "repairingTime"); + } else { + if (isText (_config >> "repairingTime")) exitWith { + _repairTimeConfig = getText (_config >> "repairingTime"); + if (isNil _repairTimeConfig) then { + _repairTimeConfig = compile _repairTimeConfig; + } else { + _repairTimeConfig = missionNamespace getVariable _repairTimeConfig; + }; + if (_repairTimeConfig isEqualType 0) exitWith { + _repairTimeConfig; + }; + [_caller, _target, _hitPoint, _className] call _repairTimeConfig; }; - if (_repairTimeConfig isEqualType 0) exitWith { - _repairTimeConfig; - }; - [_caller, _target, _hitPoint, _className] call _repairTimeConfig; + 0; }; - 0; }; // Find localized string