From 58cc686aac9b21d802e9b5d20985329a31d7c715 Mon Sep 17 00:00:00 2001 From: jonpas Date: Thu, 12 May 2016 21:49:45 +0200 Subject: [PATCH 1/2] Remove initial spare part adding for classes not Car or Tank, Improve addSpareParts --- addons/repair/CfgEventHandlers.hpp | 7 ++----- addons/repair/functions/fnc_addSpareParts.sqf | 12 ++---------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/addons/repair/CfgEventHandlers.hpp b/addons/repair/CfgEventHandlers.hpp index 06647d8dd5..a2f9587524 100644 --- a/addons/repair/CfgEventHandlers.hpp +++ b/addons/repair/CfgEventHandlers.hpp @@ -22,32 +22,29 @@ class Extended_InitPost_EventHandlers { class Car { class ADDON { init = QUOTE(_this call DFUNC(addRepairActions)); - serverInit = QUOTE(_this call DFUNC(addSpareParts)); + serverInit = QUOTE([ARR_3(_this select 0,1,'ACE_Wheel')] call DFUNC(addSpareParts)); }; }; class Tank { class ADDON { init = QUOTE(_this call DFUNC(addRepairActions)); - serverInit = QUOTE(_this call DFUNC(addSpareParts)); + serverInit = QUOTE([ARR_3(_this select 0,1,'ACE_Wheel')] call DFUNC(addSpareParts)); }; }; class Helicopter { class ADDON { init = QUOTE(_this call DFUNC(addRepairActions)); - serverInit = QUOTE(_this call DFUNC(addSpareParts)); exclude[] = {QEGVAR(fastroping,helper), "ACE_friesBase"}; }; }; class Plane { class ADDON { init = QUOTE(_this call DFUNC(addRepairActions)); - serverInit = QUOTE(_this call DFUNC(addSpareParts)); }; }; class Ship_F { class ADDON { init = QUOTE(_this call DFUNC(addRepairActions)); - serverInit = QUOTE(_this call DFUNC(addSpareParts)); }; }; }; diff --git a/addons/repair/functions/fnc_addSpareParts.sqf b/addons/repair/functions/fnc_addSpareParts.sqf index 74ea0d4c10..3d7247fcaa 100644 --- a/addons/repair/functions/fnc_addSpareParts.sqf +++ b/addons/repair/functions/fnc_addSpareParts.sqf @@ -21,8 +21,8 @@ params ["_vehicle", ["_amount", 1], ["_part", ""], ["_force", false]]; TRACE_2("params",_vehicle,_amount); -// Exit if ace_cargo is not loaded -if !(["ace_cargo"] call EFUNC(common,isModLoaded)) exitWith {}; +// Exit if ace_cargo is not loaded or no part supplied +if (!(["ace_cargo"] call EFUNC(common,isModLoaded)) || {_part == ""}) exitWith {}; // Collect until SettingsInitialized if (!EGVAR(common,settingsInitFinished)) exitWith { @@ -32,13 +32,5 @@ if (!EGVAR(common,settingsInitFinished)) exitWith { // Exit if not forced and add spare parts is disabled (after settings initted to make sure it really is) if (!_force && !GVAR(addSpareParts)) exitWith {}; -// Select appropriate part -if (_part == "") then { - if (_vehicle isKindOf "Car") then { _part = "ACE_Wheel" }; - if (_vehicle isKindOf "Tank") then { _part = "ACE_Track" }; -}; -// Exit if no appropriate part -if (_part == "") exitWith {}; - // Load ["AddCargoByClass", [_part, _vehicle, _amount]] call EFUNC(common,localEvent); From e984fcf7154bf147c5ec98c40779a84a04055e6e Mon Sep 17 00:00:00 2001 From: jonpas Date: Thu, 12 May 2016 21:56:12 +0200 Subject: [PATCH 2/2] Fix part name for Tank class --- addons/repair/CfgEventHandlers.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/repair/CfgEventHandlers.hpp b/addons/repair/CfgEventHandlers.hpp index a2f9587524..6ec3a2cefd 100644 --- a/addons/repair/CfgEventHandlers.hpp +++ b/addons/repair/CfgEventHandlers.hpp @@ -28,7 +28,7 @@ class Extended_InitPost_EventHandlers { class Tank { class ADDON { init = QUOTE(_this call DFUNC(addRepairActions)); - serverInit = QUOTE([ARR_3(_this select 0,1,'ACE_Wheel')] call DFUNC(addSpareParts)); + serverInit = QUOTE([ARR_3(_this select 0,1,'ACE_Track')] call DFUNC(addSpareParts)); }; }; class Helicopter {