From ab769757d973d7708dd01796418c59efcd704ea8 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Mon, 9 Nov 2015 20:11:48 -0600 Subject: [PATCH] Skip Depends Hitpoints - Use HitPoints selPos for wheels Stuff Normalize Depends - Skip Glass Repair Fix spawned wheel/track not having correct damage getHitpointString robustness, hatchback fuelHitpoint, fix count errors - Formatting local -> private Fix Stuff --- addons/common/functions/fnc_isEngineer.sqf | 2 +- addons/repair/CfgVehicles.hpp | 2 +- .../repair/functions/fnc_addRepairActions.sqf | 45 ++++++++++------ addons/repair/functions/fnc_canRepair.sqf | 40 +++++++-------- addons/repair/functions/fnc_doRemoveTrack.sqf | 12 ++--- addons/repair/functions/fnc_doRemoveWheel.sqf | 10 ++-- addons/repair/functions/fnc_doRepair.sqf | 20 ++++---- addons/repair/functions/fnc_doRepairTrack.sqf | 4 +- .../repair/functions/fnc_doReplaceTrack.sqf | 4 +- .../repair/functions/fnc_doReplaceWheel.sqf | 4 +- .../repair/functions/fnc_getClaimObjects.sqf | 11 ++-- .../functions/fnc_getHitPointString.sqf | 8 +-- .../functions/fnc_getPostRepairDamage.sqf | 2 +- addons/repair/functions/fnc_hasItems.sqf | 4 +- .../functions/fnc_isInRepairFacility.sqf | 4 +- .../functions/fnc_isNearRepairVehicle.sqf | 2 +- .../repair/functions/fnc_isRepairVehicle.sqf | 2 +- .../functions/fnc_moduleAddSpareParts.sqf | 1 + .../functions/fnc_normalizeHitPoints.sqf | 42 +++++++++------ addons/repair/functions/fnc_repair.sqf | 51 ++++++++++--------- .../functions/fnc_setHitPointDamage.sqf | 8 +-- addons/repair/functions/fnc_spawnObject.sqf | 14 ++--- addons/repair/functions/fnc_useItem.sqf | 2 +- addons/repair/functions/fnc_useItems.sqf | 4 +- addons/repair/script_component.hpp | 2 - 25 files changed, 163 insertions(+), 137 deletions(-) diff --git a/addons/common/functions/fnc_isEngineer.sqf b/addons/common/functions/fnc_isEngineer.sqf index 738b77e6a3..a3c9191c4f 100644 --- a/addons/common/functions/fnc_isEngineer.sqf +++ b/addons/common/functions/fnc_isEngineer.sqf @@ -17,7 +17,7 @@ params ["_unit"]; -local _isEngineer = _unit getVariable ["ACE_isEngineer", getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "engineer") == 1]; +private _isEngineer = _unit getVariable ["ACE_isEngineer", getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "engineer") == 1]; //Handle ace_repair modules setting this to a number if ((typeName _isEngineer) == "SCALAR") then {_isEngineer = _isEngineer > 0}; diff --git a/addons/repair/CfgVehicles.hpp b/addons/repair/CfgVehicles.hpp index ea15256bf3..3736050543 100644 --- a/addons/repair/CfgVehicles.hpp +++ b/addons/repair/CfgVehicles.hpp @@ -405,6 +405,6 @@ class CfgVehicles { GVAR(hitpointPositions[]) = { {"HitEngine", {0, 0.5, -0.7}}, {"HitFuel", {0, 0, -0.5}} }; }; class Hatchback_01_base_F: Car_F { - GVAR(hitpointPositions[]) = {{"HitBody", {0, 0.7, -0.5}}}; + GVAR(hitpointPositions[]) = {{"HitBody", {0, 0.7, -0.5}}, {"HitFuel", {0, -1.75, -0.75}}}; }; }; diff --git a/addons/repair/functions/fnc_addRepairActions.sqf b/addons/repair/functions/fnc_addRepairActions.sqf index b7be5690c8..3887d9eff7 100644 --- a/addons/repair/functions/fnc_addRepairActions.sqf +++ b/addons/repair/functions/fnc_addRepairActions.sqf @@ -13,13 +13,14 @@ * * Public: No */ - #include "script_component.hpp" -params ["_vehicle"]; -TRACE_1("params", _vehicle); +if (!hasInterface) exitWith {}; -private ["_type", "_initializedClasses", "_condition", "_statement", "_action", "_processedHitPoints", "_hitPointsAddedNames", "_hitPointsAddedStrings", "_hitPointsAddedAmount"]; +params ["_vehicle"]; +TRACE_2("params", _vehicle,typeOf _vehicle); + +private["_action", "_childHitPoint", "_condition", "_groupsConfig", "_hitPoint", "_hitPointsAddedAmount", "_hitPointsAddedNames", "_hitPointsAddedStrings", "_icon", "_initializedClasses", "_name", "_position", "_positionsConfig", "_processedHitPoints", "_selection", "_statement", "_target", "_type"]; _type = typeOf _vehicle; @@ -46,37 +47,48 @@ _processedHitpoints = []; _hitpoint = _hitPoints select _forEachIndex; if (_selection in _wheelHitSelections) then { - // Wheels should always be unique + // Wheels should always be unique if (_hitpoint in _processedHitpoints) exitWith {TRACE_3("Duplicate Wheel",_hitpoint,_forEachIndex,_selection);}; _icon = "A3\ui_f\data\igui\cfg\actions\repair_ca.paa"; + _position = compile format ["_target selectionPosition ['%1', 'HitPoints'];", _selection]; + + TRACE_3("Adding Wheel Actions",_hitpoint,_forEachIndex,_selection); + // An action to remove the wheel is required _name = format ["Remove_%1_%2", _forEachIndex, _hitpoint]; _text = localize LSTRING(RemoveWheel); - TRACE_4("Adding Wheel Actions",_name,_forEachIndex,_selection,_text); _condition = {[_this select 1, _this select 0, _this select 2 select 0, "RemoveWheel"] call DFUNC(canRepair)}; _statement = {[_this select 1, _this select 0, _this select 2 select 0, "RemoveWheel"] call DFUNC(repair)}; - _action = [_name, _text, _icon, _statement, _condition, {}, [_hitpoint], _selection, 2] call EFUNC(interact_menu,createAction); + _action = [_name, _text, _icon, _statement, _condition, {}, [_hitpoint], _position, 2] call EFUNC(interact_menu,createAction); [_type, 0, [], _action] call EFUNC(interact_menu,addActionToClass); // An action to replace the wheel is required - _name = format ["Replace_%1_%2", _forEachIndex, _selection]; + _name = format ["Replace_%1_%2", _forEachIndex, _hitpoint]; _text = localize LSTRING(ReplaceWheel); _condition = {[_this select 1, _this select 0, _this select 2 select 0, "ReplaceWheel"] call DFUNC(canRepair)}; _statement = {[_this select 1, _this select 0, _this select 2 select 0, "ReplaceWheel"] call DFUNC(repair)}; - _action = [_name, _text, _icon, _statement, _condition, {}, [_hitpoint], _selection, 2] call EFUNC(interact_menu,createAction); + _action = [_name, _text, _icon, _statement, _condition, {}, [_hitpoint], _position, 2] call EFUNC(interact_menu,createAction); [_type, 0, [], _action] call EFUNC(interact_menu,addActionToClass); } else { + //Skip glass hitpoints + if (((toLower _hitPoint) find "glass") != -1) exitWith { + TRACE_3("Skipping Glass",_hitpoint,_forEachIndex,_selection); + }; // Empty selections don't exist // Empty hitpoints don't contain enough information - if (_selection isEqualTo "") exitWith {}; - if (_hitpoint isEqualTo "") exitWith {}; + if (_selection isEqualTo "") exitWith { TRACE_3("Selection Empty",_hitpoint,_forEachIndex,_selection); }; + if (_hitpoint isEqualTo "") exitWith { TRACE_3("Hitpoint Empty",_hitpoint,_forEachIndex,_selection); }; + //Depends hitpoints shouldn't be modified directly (will be normalized) + if (isText (configFile >> "CfgVehicles" >> _type >> "HitPoints" >> _hitpoint >> "depends")) exitWith { + TRACE_3("Skip Depends",_hitpoint,_forEachIndex,_selection); + }; // Associated hitpoints can be grouped via config to produce a single repair action _groupsConfig = configFile >> "CfgVehicles" >> _type >> QGVAR(hitpointGroups); + _childHitPoint = false; if (isArray _groupsConfig) then { - _childHitPoint = false; { { if (_hitpoint == _x) exitWith { @@ -89,7 +101,8 @@ _processedHitpoints = []; if (_childHitPoint) exitWith { TRACE_3("childHitpoint",_hitpoint,_forEachIndex,_selection); }; // Find the action position - _position = _vehicle selectionPosition [_selection,"HitPoints"]; + _position = compile format ["_target selectionPosition ['%1', 'HitPoints'];", _selection]; + // Custom position can be defined via config for associated hitpoint _positionsConfig = configFile >> "CfgVehicles" >> _type >> QGVAR(hitpointPositions); if (isArray _positionsConfig) then { @@ -100,7 +113,7 @@ _processedHitpoints = []; _position = _pos; // Position in model space }; if (typeName _pos == "STRING") exitWith { - _position = _vehicle selectionPosition [_pos,"HitPoints"]; // Selection name + _position = compile format ["_target selectionPosition ['%1', 'HitPoints'];", _pos]; }; ACE_LOGERROR_3("Invalid custom position %1 of hitpoint %2 in vehicle %3.",_position,_hitpoint,_type); }; @@ -125,13 +138,13 @@ _processedHitpoints = []; } else { _position = [1.75, 0, -1.75]; }; - TRACE_5("Adding RepairTrack",_name,_forEachIndex,_selection,_text,_position); + TRACE_4("Adding RepairTrack",_hitpoint,_forEachIndex,_selection,_text); _condition = {[_this select 1, _this select 0, _this select 2 select 0, "RepairTrack"] call DFUNC(canRepair)}; _statement = {[_this select 1, _this select 0, _this select 2 select 0, "RepairTrack"] call DFUNC(repair)}; _action = [_name, _text, _icon, _statement, _condition, {}, [_hitpoint], _position, 4] call EFUNC(interact_menu,createAction); [_type, 0, [], _action] call EFUNC(interact_menu,addActionToClass); } else { - TRACE_5("Adding MiscRepair",_name,_forEachIndex,_selection,_text,_position); + TRACE_4("Adding MiscRepair",_hitpoint,_forEachIndex,_selection,_text); _condition = {[_this select 1, _this select 0, _this select 2 select 0, "MiscRepair"] call DFUNC(canRepair)}; _statement = {[_this select 1, _this select 0, _this select 2 select 0, "MiscRepair"] call DFUNC(repair)}; _action = [_name, _text, _icon, _statement, _condition, {}, [_forEachIndex], _position, 5] call EFUNC(interact_menu,createAction); diff --git a/addons/repair/functions/fnc_canRepair.sqf b/addons/repair/functions/fnc_canRepair.sqf index 6ba7b6b23a..74a4b07dc6 100644 --- a/addons/repair/functions/fnc_canRepair.sqf +++ b/addons/repair/functions/fnc_canRepair.sqf @@ -21,22 +21,22 @@ params ["_caller", "_target", "_hitPoint", "_className"]; TRACE_4("params",_caller,_target,_hitPoint,_className); -private ["_config", "_engineerRequired", "_items", "_locations", "_return", "_condition", "_vehicleStateCondition", "_settingName", "_settingItemsArray"]; +private ["_config", "_engineerRequired", "_items", "_return", "_condition", "_vehicleStateCondition", "_settingName", "_settingItemsArray"]; _config = (ConfigFile >> "ACE_Repair" >> "Actions" >> _className); -if !(isClass _config) exitwith {false}; // or go for a default? -if(isEngineOn _target) exitwith {false}; +if !(isClass _config) exitWith {false}; // or go for a default? +if(isEngineOn _target) exitWith {false}; _engineerRequired = if (isNumber (_config >> "requiredEngineer")) then { getNumber (_config >> "requiredEngineer"); } else { // Check for required class - if (isText (_config >> "requiredEngineer")) exitwith { + if (isText (_config >> "requiredEngineer")) exitWith { missionNamespace getVariable [(getText (_config >> "requiredEngineer")), 0]; }; 0; }; -if !([_caller, _engineerRequired] call FUNC(isEngineer)) exitwith {false}; +if !([_caller, _engineerRequired] call FUNC(isEngineer)) exitWith {false}; //Items can be an array of required items or a string to a ACE_Setting array _items = if (isArray (_config >> "items")) then { @@ -49,12 +49,12 @@ _items = if (isArray (_config >> "items")) then { }; _settingItemsArray select (missionNamespace getVariable _settingName); }; -if (count _items > 0 && {!([_caller, _items] call FUNC(hasItems))}) exitwith {false}; +if (count _items > 0 && {!([_caller, _items] call FUNC(hasItems))}) exitWith {false}; _return = true; if (getText (_config >> "condition") != "") then { _condition = getText (_config >> "condition"); - if (isnil _condition) then { + if (isNil _condition) then { _condition = compile _condition; } else { _condition = missionNamespace getVariable _condition; @@ -66,25 +66,25 @@ if (getText (_config >> "condition") != "") then { }; }; -if (!_return) exitwith {false}; +if (!_return) exitWith {false}; // _vehicleStateCondition = if (isText(_config >> "vehicleStateCondition")) then { // missionNamespace getVariable [getText(_config >> "vehicleStateCondition"), 0] // } else { // getNumber(_config >> "vehicleStateCondition") // }; -// if (_vehicleStateCondition == 1 && {!([_target] call FUNC(isInStableCondition))}) exitwith {false}; +// if (_vehicleStateCondition == 1 && {!([_target] call FUNC(isInStableCondition))}) exitWith {false}; -local _repairLocations = getArray (_config >> "repairLocations"); +private _repairLocations = getArray (_config >> "repairLocations"); if (!("All" in _repairLocations)) then { - local _repairFacility = {([_caller] call FUNC(isInRepairFacility)) || ([_target] call FUNC(isInRepairFacility))}; - local _repairVeh = {([_caller] call FUNC(isNearRepairVehicle)) || ([_target] call FUNC(isNearRepairVehicle))}; + private _repairFacility = {([_caller] call FUNC(isInRepairFacility)) || ([_target] call FUNC(isInRepairFacility))}; + private _repairVeh = {([_caller] call FUNC(isNearRepairVehicle)) || ([_target] call FUNC(isNearRepairVehicle))}; { - if (_x == "field") exitwith {_return = true;}; - if (_x == "RepairFacility" && _repairFacility) exitwith {_return = true;}; - if (_x == "RepairVehicle" && _repairVeh) exitwith {_return = true;}; - if !(isnil _x) exitwith { - local _val = missionNamespace getVariable _x; + if (_x == "field") exitWith {_return = true;}; + if (_x == "RepairFacility" && _repairFacility) exitWith {_return = true;}; + if (_x == "RepairVehicle" && _repairVeh) exitWith {_return = true;}; + if !(isNil _x) exitWith { + private _val = missionNamespace getVariable _x; if (typeName _val == "SCALAR") then { _return = switch (_val) do { case 0: {true}; //useAnywhere @@ -97,12 +97,12 @@ if (!("All" in _repairLocations)) then { }; } forEach _repairLocations; }; -if (!_return) exitwith {false}; +if (!_return) exitWith {false}; //Check that there are required objects nearby -local _requiredObjects = getArray (_config >> "claimObjects"); +private _requiredObjects = getArray (_config >> "claimObjects"); if (!(_requiredObjects isEqualTo [])) then { - local _objectsAvailable = [_caller, 5, _requiredObjects] call FUNC(getClaimObjects); + private _objectsAvailable = [_caller, 5, _requiredObjects] call FUNC(getClaimObjects); if (_objectsAvailable isEqualTo []) then { TRACE_2("Missing Required Objects",_requiredObjects,_objectsAvailable); _return = false diff --git a/addons/repair/functions/fnc_doRemoveTrack.sqf b/addons/repair/functions/fnc_doRemoveTrack.sqf index 68755658ca..d36407b197 100644 --- a/addons/repair/functions/fnc_doRemoveTrack.sqf +++ b/addons/repair/functions/fnc_doRemoveTrack.sqf @@ -19,10 +19,9 @@ params ["_unit", "_vehicle", "_hitPoint"]; TRACE_3("params",_unit,_vehicle,_hitPoint); -// TODO [_unit, _wheel] call EFUNC(common,claim); on start of action + // get current hitpoint damage -private "_hitPointDamage"; -_hitPointDamage = _vehicle getHitPointDamage _hitPoint; +private _hitPointDamage = _vehicle getHitPointDamage _hitPoint; // can't remove destroyed or already removed wheel if (_hitPointDamage >= 1) exitWith {}; @@ -30,10 +29,9 @@ if (_hitPointDamage >= 1) exitWith {}; // don't die by spawning / moving the wheel ["fixCollision", _unit] call EFUNC(common,localEvent); -// spawn wheel -private "_wheel"; -_wheel = ["ACE_Track", getPosASL _unit] call FUNC(spawnObject); -_wheel setdamage _hitPointDamage; +// spawn track +private _newTrack = ["ACE_Track", getPosASL _unit, _hitPointDamage] call FUNC(spawnObject); +TRACE_2("new track created",_newTrack,damage _newTrack); // raise event to set the new hitpoint damage ["setWheelHitPointDamage", _vehicle, [_vehicle, _hitPoint, 1]] call EFUNC(common,targetEvent); diff --git a/addons/repair/functions/fnc_doRemoveWheel.sqf b/addons/repair/functions/fnc_doRemoveWheel.sqf index 0ffeb7ad23..21a152c597 100644 --- a/addons/repair/functions/fnc_doRemoveWheel.sqf +++ b/addons/repair/functions/fnc_doRemoveWheel.sqf @@ -19,10 +19,9 @@ params ["_unit", "_vehicle", "_hitPoint"]; TRACE_3("params",_unit,_vehicle,_hitPoint); -// TODO [_unit, _wheel] call EFUNC(common,claim); on start of action + // get current hitpoint damage -private "_hitPointDamage"; -_hitPointDamage = _vehicle getHitPointDamage _hitPoint; +private _hitPointDamage = _vehicle getHitPointDamage _hitPoint; // can't remove destroyed or already removed wheel if (_hitPointDamage >= 1) exitWith {}; @@ -31,9 +30,8 @@ if (_hitPointDamage >= 1) exitWith {}; ["fixCollision", _unit] call EFUNC(common,localEvent); // spawn wheel -private "_wheel"; -_wheel = ["ACE_Wheel", getPosASL _unit] call FUNC(spawnObject); -_wheel setdamage _hitPointDamage; +private _newWheel = ["ACE_Wheel", getPosASL _unit, _hitPointDamage] call FUNC(spawnObject); +TRACE_2("new wheel created",_newWheel,damage _newWheel); // raise event to set the new hitpoint damage ["setWheelHitPointDamage", _vehicle, [_vehicle, _hitPoint, 1]] call EFUNC(common,targetEvent); diff --git a/addons/repair/functions/fnc_doRepair.sqf b/addons/repair/functions/fnc_doRepair.sqf index 014adf8af4..4c063c6c73 100644 --- a/addons/repair/functions/fnc_doRepair.sqf +++ b/addons/repair/functions/fnc_doRepair.sqf @@ -20,16 +20,16 @@ params ["_unit", "_vehicle", "_hitPointIndex"]; TRACE_3("params",_unit,_vehicle,_hitPointIndex); -local _postRepairDamageMin = [_unit] call FUNC(getPostRepairDamage); +private _postRepairDamageMin = [_unit] call FUNC(getPostRepairDamage); (getAllHitPointsDamage _vehicle) params ["_allHitPoints"]; -local _hitPointClassname = _allHitPoints select _hitPointIndex; +private _hitPointClassname = _allHitPoints select _hitPointIndex; // get current hitpoint damage -local _hitPointCurDamage = _vehicle getHitIndex _hitPointIndex; +private _hitPointCurDamage = _vehicle getHitIndex _hitPointIndex; // repair a max of 0.5, don't use negative values for damage -local _hitPointNewDamage = (_hitPointCurDamage - 0.5) max _postRepairDamageMin; +private _hitPointNewDamage = (_hitPointCurDamage - 0.5) max _postRepairDamageMin; if (_hitPointNewDamage < _hitPointCurDamage) then { // raise event to set the new hitpoint damage @@ -39,7 +39,7 @@ if (_hitPointNewDamage < _hitPointCurDamage) then { }; // Get hitpoint groups if available -local _hitpointGroupConfig = configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(hitpointGroups); +private _hitpointGroupConfig = configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(hitpointGroups); if (isArray _hitpointGroupConfig) then { // Retrieve hitpoint subgroup if current hitpoint is main hitpoint of a group { @@ -47,12 +47,12 @@ if (isArray _hitpointGroupConfig) then { // Exit using found hitpoint group if this hitpoint is leader of any if (_masterHitpoint == _hitPointClassname) exitWith { { - local _subHitIndex = _allHitPoints find _x; //convert hitpoint classname to index + private _subHitIndex = _allHitPoints find _x; //convert hitpoint classname to index if (_subHitIndex == -1) then { ACE_LOGERROR_2("Invalid hitpoint %1 in hitpointGroups of %2",_x,_vehicle); } else { - local _subPointCurDamage = _vehicle getHitIndex _hitPointIndex; - local _subPointNewDamage = (_subPointCurDamage - 0.5) max _postRepairDamageMin; + private _subPointCurDamage = _vehicle getHitIndex _hitPointIndex; + private _subPointNewDamage = (_subPointCurDamage - 0.5) max _postRepairDamageMin; if (_subPointNewDamage < _subPointCurDamage) then { TRACE_3("repairing sub point", _vehicle, _subHitIndex, _subPointNewDamage); ["setVehicleHitPointDamage", _vehicle, [_vehicle, _subHitIndex, _subPointNewDamage]] call EFUNC(common,targetEvent); @@ -66,8 +66,8 @@ if (isArray _hitpointGroupConfig) then { // display text message if enabled if (GVAR(DisplayTextOnRepair)) then { // Find localized string - local _textLocalized = localize ([LSTRING(RepairedHitPointFully), LSTRING(RepairedHitPointPartially)] select (_hitPointCurDamage > 0)); - local _textDefault = localize ([LSTRING(RepairedFully), LSTRING(RepairedPartially)] select (_hitPointCurDamage > 0)); + private _textLocalized = localize ([LSTRING(RepairedHitPointFully), LSTRING(RepairedHitPointPartially)] select (_hitPointCurDamage > 0)); + private _textDefault = localize ([LSTRING(RepairedFully), LSTRING(RepairedPartially)] select (_hitPointCurDamage > 0)); ([_hitPointClassname, _textLocalized, _textDefault] call FUNC(getHitPointString)) params ["_text"]; // Display text diff --git a/addons/repair/functions/fnc_doRepairTrack.sqf b/addons/repair/functions/fnc_doRepairTrack.sqf index cde22f3dd7..46c94c29f9 100644 --- a/addons/repair/functions/fnc_doRepairTrack.sqf +++ b/addons/repair/functions/fnc_doRepairTrack.sqf @@ -33,8 +33,8 @@ if ((isNull _track) || {!([_unit, _track, ["isNotDragging", "isNotCarrying", "is if ((damage _track) >= 1) exitWith {}; // get current hitpoint damage -local _hitPointDamage = _vehicle getHitPointDamage _hitPoint; -local _damageRepaired = (1 - (damage _track)) / 4; // require 4 tracks to fully replace one side +private _hitPointDamage = _vehicle getHitPointDamage _hitPoint; +private _damageRepaired = (1 - (damage _track)) / 4; // require 4 tracks to fully replace one side // don't die by spawning / moving the wheel _hitPointDamage = (_hitPointDamage - _damageRepaired) min 0; diff --git a/addons/repair/functions/fnc_doReplaceTrack.sqf b/addons/repair/functions/fnc_doReplaceTrack.sqf index 75f7f70723..9eafe68c9e 100644 --- a/addons/repair/functions/fnc_doReplaceTrack.sqf +++ b/addons/repair/functions/fnc_doReplaceTrack.sqf @@ -30,13 +30,13 @@ if ((isNull _track) || {!([_unit, _track, ["isNotDragging", "isNotCarrying", "is }; // get current hitpoint damage -local _hitPointDamage = _vehicle getHitPointDamage _hitPoint; +private _hitPointDamage = _vehicle getHitPointDamage _hitPoint; // can't replace not destroyed wheel if (_hitPointDamage < 1) exitWith {}; // get track's damage -local _newHitPointDamage = damage _track; +private _newHitPointDamage = damage _track; // can't replace with a destroyed wheel if (_newHitPointDamage >= 1) exitWith {}; diff --git a/addons/repair/functions/fnc_doReplaceWheel.sqf b/addons/repair/functions/fnc_doReplaceWheel.sqf index 20bcfe95a3..ce5e9220dd 100644 --- a/addons/repair/functions/fnc_doReplaceWheel.sqf +++ b/addons/repair/functions/fnc_doReplaceWheel.sqf @@ -30,13 +30,13 @@ if ((isNull _wheel) || {!([_unit, _wheel, ["isNotDragging", "isNotCarrying", "is }; // get current hitpoint damage -local _hitPointDamage = _vehicle getHitPointDamage _hitPoint; +private _hitPointDamage = _vehicle getHitPointDamage _hitPoint; // can't replace not destroyed wheel if (_hitPointDamage < 1) exitWith {}; // get replacement wheel's damage -local _newHitPointDamage = damage _wheel; +private _newHitPointDamage = damage _wheel; // can't replace a destroyed wheel if (_newHitPointDamage >= 1) exitWith {}; diff --git a/addons/repair/functions/fnc_getClaimObjects.sqf b/addons/repair/functions/fnc_getClaimObjects.sqf index 01229f0c9f..bc15975d1c 100644 --- a/addons/repair/functions/fnc_getClaimObjects.sqf +++ b/addons/repair/functions/fnc_getClaimObjects.sqf @@ -20,14 +20,14 @@ params ["_unit", "_maxRange", "_objectsToClaim"]; TRACE_3("params",_unit,_maxRange,_objectsToClaim); -local _return = []; +private _return = []; { - local _requiredList = _x; //eg ["ace_track", "ace_track"] - local _ableToAquire = []; //will be array of ojbects + private _requiredList = _x; //eg ["ace_track", "ace_track"] + private _ableToAquire = []; //will be array of ojbects { - local _nearObjects = nearestObjects [_unit, [_x], _maxRange]; - local _canClaimObject = objNull; + private _nearObjects = nearestObjects [_unit, [_x], _maxRange]; + private _canClaimObject = objNull; { if ((!(_x in _ableToAquire)) && {[_unit, _x, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)} @@ -39,6 +39,7 @@ local _return = []; } forEach _x; TRACE_2("Check required equals available",_requiredList,_ableToAquire); if ((count _ableToAquire) == (count _requiredList)) exitWith {_return = _ableToAquire}; + false } count _objectsToClaim; _return diff --git a/addons/repair/functions/fnc_getHitPointString.sqf b/addons/repair/functions/fnc_getHitPointString.sqf index 1358e99595..fd108e4b1f 100644 --- a/addons/repair/functions/fnc_getHitPointString.sqf +++ b/addons/repair/functions/fnc_getHitPointString.sqf @@ -13,15 +13,16 @@ * 1: Added Hitpoint (default: []) * * Example: - * [unit, vehicle, "hitpoint"] call ace_repair_fnc_getHitPointString + * ["HitFuel", "Repairing %1 ...", "Repairing HitFuel"] call ace_repair_fnc_getHitPointString * * Public: No */ #include "script_component.hpp" -private ["_track", "_trackNames", "_trackStrings", "_trackAmount", "_text", "_toFind", "_trackIndex", "_combinedString"]; params ["_hitPoint", "_textLocalized", "_textDefault", ["_trackArray", []]]; +private ["_track", "_trackNames", "_trackStrings", "_trackAmount", "_text", "_toFind", "_trackIndex", "_combinedString"]; + _track = if (count _trackArray > 0) then {true} else {false}; _trackNames = []; _trackStrings = []; @@ -37,7 +38,7 @@ if (_track) then { _text = LSTRING(Hit); // Remove "Hit" from hitpoint name if one exists -_toFind = if (_hitPoint find "Hit" == 0) then { +_toFind = if ((toLower _hitPoint) find "hit" == 0) then { [_hitPoint, 3] call CBA_fnc_substr } else { _hitPoint @@ -83,6 +84,7 @@ for "_i" from 0 to (count _hitPoint) do { // Don't display part name if no string is found in stringtable if (_text == LSTRING(Hit)) then { + if (_hitPoint != "") then { ACE_LOGWARNING_1("Hitpoint [%1] - could not be localized", _hitPoint); }; _text = _textDefault; }; diff --git a/addons/repair/functions/fnc_getPostRepairDamage.sqf b/addons/repair/functions/fnc_getPostRepairDamage.sqf index 797f7a4f22..36e4bf39ae 100644 --- a/addons/repair/functions/fnc_getPostRepairDamage.sqf +++ b/addons/repair/functions/fnc_getPostRepairDamage.sqf @@ -19,7 +19,7 @@ params ["_unit"]; TRACE_1("params",_unit); // TODO when near repair station, full repair? -if (([_unit] call FUNC(isInRepairFacility) || {[_unit] call FUNC(isNearRepairVehicle)})) exitwith {0}; +if (([_unit] call FUNC(isInRepairFacility) || {[_unit] call FUNC(isNearRepairVehicle)})) exitWith {0}; if ([_unit, GVAR(engineerSetting_Repair) + 1] call FUNC(isEngineer)) exitWith {GVAR(repairDamageThreshold_Engineer)}; if ([_unit, GVAR(engineerSetting_Repair)] call FUNC(isEngineer)) exitWith {GVAR(repairDamageThreshold)}; diff --git a/addons/repair/functions/fnc_hasItems.sqf b/addons/repair/functions/fnc_hasItems.sqf index 2f070c8bb6..d0030b3c07 100644 --- a/addons/repair/functions/fnc_hasItems.sqf +++ b/addons/repair/functions/fnc_hasItems.sqf @@ -23,10 +23,10 @@ private ["_return"]; _return = true; { - if (typeName _x == "ARRAY" && {({[_unit, _x] call EFUNC(common,hasItem)} count _x == 0)}) exitwith { + if (typeName _x == "ARRAY" && {({[_unit, _x] call EFUNC(common,hasItem)} count _x == 0)}) exitWith { _return = false; }; - if (typeName _x == "STRING" && {!([_unit, _x] call EFUNC(common,hasItem))}) exitwith { + if (typeName _x == "STRING" && {!([_unit, _x] call EFUNC(common,hasItem))}) exitWith { _return = false; }; } forEach _items; diff --git a/addons/repair/functions/fnc_isInRepairFacility.sqf b/addons/repair/functions/fnc_isInRepairFacility.sqf index 0c062ff0b3..b72d8a5985 100644 --- a/addons/repair/functions/fnc_isInRepairFacility.sqf +++ b/addons/repair/functions/fnc_isInRepairFacility.sqf @@ -26,7 +26,7 @@ _repairFacility = []; _objects = (lineIntersectsWith [_object modelToWorldVisual [0, 0, (_position select 2)], _object modelToWorldVisual [0, 0, (_position select 2) +10], _object]); { - if (((typeOf _x) in _repairFacility) || (_x getVariable ["ACE_isRepairFacility",0]) > 0) exitwith { + if (((typeOf _x) in _repairFacility) || (_x getVariable ["ACE_isRepairFacility",0]) > 0) exitWith { _isInBuilding = true; }; } forEach _objects; @@ -34,7 +34,7 @@ _objects = (lineIntersectsWith [_object modelToWorldVisual [0, 0, (_position sel if (!_isInBuilding) then { _objects = position _object nearObjects 7.5; { - if (((typeOf _x) in _repairFacility) || (_x getVariable ["ACE_isRepairFacility",0]) > 0) exitwith { + if (((typeOf _x) in _repairFacility) || (_x getVariable ["ACE_isRepairFacility",0]) > 0) exitWith { _isInBuilding = true; }; } forEach _objects; diff --git a/addons/repair/functions/fnc_isNearRepairVehicle.sqf b/addons/repair/functions/fnc_isNearRepairVehicle.sqf index 677f489a88..463e281faa 100644 --- a/addons/repair/functions/fnc_isNearRepairVehicle.sqf +++ b/addons/repair/functions/fnc_isNearRepairVehicle.sqf @@ -24,7 +24,7 @@ _nearObjects = nearestObjects [_unit, ["Air","LandVehicle"], 20]; _return = false; { - if ([_x] call FUNC(isRepairVehicle)) exitwith {_return = true;}; + if ([_x] call FUNC(isRepairVehicle)) exitWith {_return = true;}; } forEach _nearObjects; _return; diff --git a/addons/repair/functions/fnc_isRepairVehicle.sqf b/addons/repair/functions/fnc_isRepairVehicle.sqf index 121bda0fe3..2c0b5a1e21 100644 --- a/addons/repair/functions/fnc_isRepairVehicle.sqf +++ b/addons/repair/functions/fnc_isRepairVehicle.sqf @@ -18,6 +18,6 @@ params ["_vehicle"]; TRACE_1("params",_vehicle); -if (_vehicle isKindOf "CAManBase") exitwith {false}; +if (_vehicle isKindOf "CAManBase") exitWith {false}; ((_vehicle getVariable ["ACE_isRepairVehicle", getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(canRepair))]) > 0); diff --git a/addons/repair/functions/fnc_moduleAddSpareParts.sqf b/addons/repair/functions/fnc_moduleAddSpareParts.sqf index 0435244dc7..bc2502c0f4 100644 --- a/addons/repair/functions/fnc_moduleAddSpareParts.sqf +++ b/addons/repair/functions/fnc_moduleAddSpareParts.sqf @@ -41,5 +41,6 @@ if (!isNull _logic) then { // Add spare parts { [_x, _amount, _part, true] call FUNC(addSpareParts); + false } count _list; }; diff --git a/addons/repair/functions/fnc_normalizeHitPoints.sqf b/addons/repair/functions/fnc_normalizeHitPoints.sqf index 88c72f4de8..a73dfcfe0d 100644 --- a/addons/repair/functions/fnc_normalizeHitPoints.sqf +++ b/addons/repair/functions/fnc_normalizeHitPoints.sqf @@ -16,33 +16,45 @@ #include "script_component.hpp" params ["_vehicle"]; -TRACE_1("params",_vehicle); +TRACE_2("params",_vehicle, typeOf _vehicle); // Can't execute all commands if the vehicle isn't local, exit if that's so -if !(local _vehicle) exitWith {}; +if !(local _vehicle) exitWith {ACE_LOGERROR_1("Vehicle Not Local %1", _vehicle);}; -private ["_hitPoints", "_config", "_dependentHitPoints", "_dependentHitPointScripts", "_damage"]; +(getAllHitPointsDamage _vehicle) params [["_allHitPoints", []]]; -_hitPoints = [_vehicle] call EFUNC(common,getHitPoints); -_config = configFile >> "CfgVehicles" >> typeOf _vehicle >> "HitPoints"; +private _config = configFile >> "CfgVehicles" >> typeOf _vehicle >> "HitPoints"; -// define global variables. Needed to parse the depends config entries. Also find dependent hitpoints. +private _realHitPoints = []; +private _dependentHitPoints = []; +private _dependentHitPointScripts = []; -_dependentHitPoints = []; -_dependentHitPointScripts = []; +// Find dependent hitpoints +{ + if ((_x != "") && {isClass (_config >> _x)} && {!(_x in _realHitPoints)}) then { + _realHitPoints pushBack _x; + if (isText (_config >> _x >> "depends")) then { + _dependentHitPoints pushBack _x; + _dependentHitPointScripts pushBack compile getText (_config >> _x >> "depends"); + }; + }; +} forEach _allHitPoints; +TRACE_2("",_realHitPoints,_dependentHitPoints); + +// Don't bother setting variables if no depends on vehicle: +if (_dependentHitPoints isEqualTo []) exitWith {}; + + +// Define global variables Total = damage _vehicle; - { missionNamespace setVariable [_x, _vehicle getHitPointDamage _x]; - if (isText (_config >> _x >> "depends")) then { - _dependentHitPoints pushBack _x; - _dependentHitPointScripts pushBack compile getText (_config >> _x >> "depends"); - }; -} forEach _hitPoints; +} forEach _realHitPoints; // apply normalized damage to all dependand hitpoints { - _damage = call (_dependentHitPointScripts select _forEachIndex); + private _damage = call (_dependentHitPointScripts select _forEachIndex); + TRACE_2("setting depend hitpoint", _x, _damage); _vehicle setHitPointDamage [_x, _damage]; } forEach _dependentHitPoints; diff --git a/addons/repair/functions/fnc_repair.sqf b/addons/repair/functions/fnc_repair.sqf index fc0c19f914..09a5ffa27f 100644 --- a/addons/repair/functions/fnc_repair.sqf +++ b/addons/repair/functions/fnc_repair.sqf @@ -21,22 +21,22 @@ params ["_caller", "_target", "_hitPoint", "_className"]; TRACE_4("params",_calller,_target,_hitPoint,_className); -private["_callbackProgress", "_callerAnim", "_calller", "_condition", "_config", "_consumeItems", "_displayText", "_engineerRequired", "_iconDisplayed", "_items", "_locations", "_repairTime", "_repairTimeConfig", "_return", "_usersOfItems", "_vehicleStateCondition", "_wpn", "_settingName", "_settingItemsArray", "_hitPointClassname"]; +private["_callbackProgress", "_callerAnim", "_calller", "_condition", "_config", "_consumeItems", "_displayText", "_engineerRequired", "_iconDisplayed", "_items", "_repairTime", "_repairTimeConfig", "_return", "_usersOfItems", "_vehicleStateCondition", "_wpn", "_settingName", "_settingItemsArray", "_hitPointClassname"]; _config = (ConfigFile >> "ACE_Repair" >> "Actions" >> _className); -if !(isClass _config) exitwith {false}; // or go for a default? +if !(isClass _config) exitWith {false}; // or go for a default? _engineerRequired = if (isNumber (_config >> "requiredEngineer")) then { getNumber (_config >> "requiredEngineer"); } else { // Check for required class - if (isText (_config >> "requiredEngineer")) exitwith { + if (isText (_config >> "requiredEngineer")) exitWith { missionNamespace getVariable [(getText (_config >> "requiredEngineer")), 0]; }; 0; }; -if !([_caller, _engineerRequired] call FUNC(isEngineer)) exitwith {false}; -if (isEngineOn _target) exitwith {false}; +if !([_caller, _engineerRequired] call FUNC(isEngineer)) exitWith {false}; +if (isEngineOn _target) exitWith {false}; //Items can be an array of required items or a string to a ACE_Setting array _items = if (isArray (_config >> "items")) then { @@ -49,12 +49,12 @@ _items = if (isArray (_config >> "items")) then { }; _settingItemsArray select (missionNamespace getVariable _settingName); }; -if (count _items > 0 && {!([_caller, _items] call FUNC(hasItems))}) exitwith {false}; +if (count _items > 0 && {!([_caller, _items] call FUNC(hasItems))}) exitWith {false}; _return = true; if (getText (_config >> "condition") != "") then { _condition = getText (_config >> "condition"); - if (isnil _condition) then { + if (isNil _condition) then { _condition = compile _condition; } else { _condition = missionNamespace getVariable _condition; @@ -65,25 +65,25 @@ if (getText (_config >> "condition") != "") then { _return = [_caller, _target, _hitPoint, _className] call _condition; }; }; -if (!_return) exitwith {false}; +if (!_return) exitWith {false}; // _vehicleStateCondition = if (isText(_config >> "vehicleStateCondition")) then { // missionNamespace getVariable [getText(_config >> "vehicleStateCondition"), 0] // } else { // getNumber(_config >> "vehicleStateCondition") // }; -// if (_vehicleStateCondition == 1 && {!([_target] call FUNC(isInStableCondition))}) exitwith {false}; +// if (_vehicleStateCondition == 1 && {!([_target] call FUNC(isInStableCondition))}) exitWith {false}; -local _repairLocations = getArray (_config >> "repairLocations"); +private _repairLocations = getArray (_config >> "repairLocations"); if (!("All" in _repairLocations)) then { - local _repairFacility = {([_caller] call FUNC(isInRepairFacility)) || ([_target] call FUNC(isInRepairFacility))}; - local _repairVeh = {([_caller] call FUNC(isNearRepairVehicle)) || ([_target] call FUNC(isNearRepairVehicle))}; + private _repairFacility = {([_caller] call FUNC(isInRepairFacility)) || ([_target] call FUNC(isInRepairFacility))}; + private _repairVeh = {([_caller] call FUNC(isNearRepairVehicle)) || ([_target] call FUNC(isNearRepairVehicle))}; { - if (_x == "field") exitwith {_return = true;}; - if (_x == "RepairFacility" && _repairFacility) exitwith {_return = true;}; - if (_x == "RepairVehicle" && _repairVeh) exitwith {_return = true;}; - if !(isnil _x) exitwith { - local _val = missionNamespace getVariable _x; + if (_x == "field") exitWith {_return = true;}; + if (_x == "RepairFacility" && _repairFacility) exitWith {_return = true;}; + if (_x == "RepairVehicle" && _repairVeh) exitWith {_return = true;}; + if !(isNil _x) exitWith { + private _val = missionNamespace getVariable _x; if (typeName _val == "SCALAR") then { _return = switch (_val) do { case 0: {true}; //useAnywhere @@ -97,8 +97,8 @@ if (!("All" in _repairLocations)) then { } forEach _repairLocations; }; -local _requiredObjects = getArray (_config >> "claimObjects"); -local _claimObjectsAvailable = []; +private _requiredObjects = getArray (_config >> "claimObjects"); +private _claimObjectsAvailable = []; if (!(_requiredObjects isEqualTo [])) then { _claimObjectsAvailable = [_caller, 5, _requiredObjects] call FUNC(getClaimObjects); if (_claimObjectsAvailable isEqualTo []) then { @@ -107,7 +107,7 @@ if (!(_requiredObjects isEqualTo [])) then { }; }; -if !(_return && alive _target) exitwith {false}; +if !(_return && alive _target) exitWith {false}; //Last exitWith: repair_success or repair_failure will be run //Claim required objects @@ -120,7 +120,7 @@ _consumeItems = if (isNumber (_config >> "itemConsumed")) then { getNumber (_config >> "itemConsumed"); } else { // Check for required class - if (isText (_config >> "itemConsumed")) exitwith { + if (isText (_config >> "itemConsumed")) exitWith { missionNamespace getVariable [(getText (_config >> "itemConsumed")), 0]; }; 0; @@ -174,14 +174,14 @@ if (vehicle _caller == _caller && {_callerAnim != ""}) then { _repairTime = if (isNumber (_config >> "repairingTime")) then { getNumber (_config >> "repairingTime"); } else { - if (isText (_config >> "repairingTime")) exitwith { + if (isText (_config >> "repairingTime")) exitWith { _repairTimeConfig = getText(_config >> "repairingTime"); - if (isnil _repairTimeConfig) then { + if (isNil _repairTimeConfig) then { _repairTimeConfig = compile _repairTimeConfig; } else { _repairTimeConfig = missionNamespace getVariable _repairTimeConfig; }; - if (typeName _repairTimeConfig == "SCALAR") exitwith { + if (typeName _repairTimeConfig == "SCALAR") exitWith { _repairTimeConfig; }; [_caller, _target, _hitPoint, _className] call _repairTimeConfig; @@ -197,7 +197,8 @@ _hitPointClassname = if ((typeName _hitPoint) == "STRING") then { ((getAllHitPointsDamage _target) select 0) select _hitPoint }; _processText = getText (_config >> "displayNameProgress"); -([_hitPointClassname, _processText, _processText] call FUNC(getHitPointString)) params ["_text"]; +private _backupText = format [localize LSTRING(RepairingHitPoint), _hitPointClassname]; +([_hitPointClassname, _processText, _backupText] call FUNC(getHitPointString)) params ["_text"]; TRACE_4("display",_hitPoint,_hitPointClassname,_processText,_text); diff --git a/addons/repair/functions/fnc_setHitPointDamage.sqf b/addons/repair/functions/fnc_setHitPointDamage.sqf index 399f390767..018a03723b 100644 --- a/addons/repair/functions/fnc_setHitPointDamage.sqf +++ b/addons/repair/functions/fnc_setHitPointDamage.sqf @@ -19,7 +19,7 @@ #include "script_component.hpp" params ["_vehicle", "_hitPointIndex", "_hitPointDamage"]; -TRACE_3("params",_vehicle,_hitPointIndex,_hitPointDamage); +TRACE_4("params",_vehicle,typeOf _vehicle,_hitPointIndex,_hitPointDamage); private["_damageNew", "_damageOld", "_hitPointDamageRepaired", "_hitPointDamageSumOld", "_realHitpointCount", "_selectionName"]; @@ -50,8 +50,8 @@ _hitPointDamageRepaired = 0; //positive for repairs : newSum = (oldSum - repaire //Filter out all the bad hitpoints (HitPoint="" or no selection) if ((!isNil {_vehicle getHit _selectionName}) && {_x != ""}) then { _realHitpointCount = _realHitpointCount + 1; - - if ((!(_x in IGNORED_HITPOINTS)) && {!isText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "HitPoints" >> _x >> "depends")}) then { + + if ((((toLower _x) find "glass") == -1) && {!isText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "HitPoints" >> _x >> "depends")}) then { _hitPointDamageSumOld = _hitPointDamageSumOld + (_allHitPointDamages select _forEachIndex); if (_forEachIndex == _hitPointIndex) then { _hitPointDamageRepaired = (_allHitPointDamages select _forEachIndex) - _hitPointDamage; @@ -80,4 +80,4 @@ _allHitPointDamages set [_hitPointIndex, _hitPointDamage]; } forEach _allHitPointDamages; // normalize hitpoints -// [_vehicle] call FUNC(normalizeHitPoints); +[_vehicle] call FUNC(normalizeHitPoints); diff --git a/addons/repair/functions/fnc_spawnObject.sqf b/addons/repair/functions/fnc_spawnObject.sqf index 9c092d9c3a..86d0b563ac 100644 --- a/addons/repair/functions/fnc_spawnObject.sqf +++ b/addons/repair/functions/fnc_spawnObject.sqf @@ -8,7 +8,7 @@ * 2: Damage * * Return Value: - * None + * The new object * * Example: * ["classname", [0, 0, 0], 1] call ace_repair_fnc_spawnObject @@ -23,10 +23,12 @@ TRACE_3("params",_item,_position,_damage); // randomized end position _position = _position vectorAdd [1 - random 2, 1 - random 2, 0]; -_item = createVehicle [_item, _position, [], 0, "NONE"]; -_item setPosASL _position; +private _newObject = createVehicle [_item, _position, [], 0, "NONE"]; +_newObject setPosASL _position; -["fixCollision", _item] call EFUNC(common,localEvent); -["fixPosition", _item] call EFUNC(common,localEvent); +_newObject setDamage _damage; -_item setDamage _damage; +["fixCollision", _newObject] call EFUNC(common,localEvent); +["fixPosition", _newObject] call EFUNC(common,localEvent); + +_newObject diff --git a/addons/repair/functions/fnc_useItem.sqf b/addons/repair/functions/fnc_useItem.sqf index 72619657a2..024ee76c29 100644 --- a/addons/repair/functions/fnc_useItem.sqf +++ b/addons/repair/functions/fnc_useItem.sqf @@ -19,7 +19,7 @@ params ["_unit", "_item"]; TRACE_2("params",_unit,_item); -if ([_unit, _item] call EFUNC(common,hasItem)) exitwith { +if ([_unit, _item] call EFUNC(common,hasItem)) exitWith { [[_unit, _item], QUOTE(EFUNC(common,useItem)), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ [true, _unit]; }; diff --git a/addons/repair/functions/fnc_useItems.sqf b/addons/repair/functions/fnc_useItems.sqf index 5e5cba0063..dd781ff371 100644 --- a/addons/repair/functions/fnc_useItems.sqf +++ b/addons/repair/functions/fnc_useItems.sqf @@ -27,14 +27,14 @@ _itemsUsedBy = []; if (typeName _x == "ARRAY") then { { _itemUsedInfo = [_unit, _x] call FUNC(useItem); - if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]}; + if (_itemUsedInfo select 0) exitWith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]}; } forEach _x; }; // handle required item if (typeName _x == "STRING") then { _itemUsedInfo = [_unit, _x] call FUNC(useItem); - if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]}; + if (_itemUsedInfo select 0) exitWith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]}; }; } forEach _items; diff --git a/addons/repair/script_component.hpp b/addons/repair/script_component.hpp index a6aa1db61f..ff5d40a6ae 100644 --- a/addons/repair/script_component.hpp +++ b/addons/repair/script_component.hpp @@ -13,6 +13,4 @@ #include "\z\ace\addons\main\script_macros.hpp" - -#define IGNORED_HITPOINTS ["HitGlass1", "HitGlass2", "HitGlass3", "HitGlass4", "HitGlass5", "HitGlass6", "HitGlass7", "HitGlass8", "HitGlass9", "HitGlass10", "HitGlass11", "HitGlass12", "HitGlass13", "HitGlass14", "HitGlass15", "HitRGlass", "HitLGlass", "Glass_1_hitpoint", "Glass_2_hitpoint", "Glass_3_hitpoint", "Glass_4_hitpoint", "Glass_5_hitpoint", "Glass_6_hitpoint", "Glass_7_hitpoint", "Glass_8_hitpoint", "Glass_9_hitpoint", "Glass_10_hitpoint", "Glass_11_hitpoint", "Glass_12_hitpoint", "Glass_13_hitpoint", "Glass_14_hitpoint", "Glass_15_hitpoint", "Glass_16_hitpoint", "Glass_17_hitpoint", "Glass_18_hitpoint", "Glass_19_hitpoint", "Glass_20_hitpoint"] #define TRACK_HITPOINTS ["HitLTrack", "HitRTrack"]