diff --git a/addons/repair/ACE_Settings.hpp b/addons/repair/ACE_Settings.hpp index c05be2e687..3d2685e172 100644 --- a/addons/repair/ACE_Settings.hpp +++ b/addons/repair/ACE_Settings.hpp @@ -1,32 +1,42 @@ class ACE_Settings { class GVAR(DisplayTextOnRepair) { + displayName = CSTRING(SettingDisplayTextName); + description = CSTRING(SettingDisplayTextDesc); typeName = "BOOL"; isClientSetable = 1; value = 1; - displayName = "$STR_ACE_Repair_SettingDisplayTextName"; - description = "$STR_ACE_Repair_SettingDisplayTextDesc"; }; class GVAR(engineerSetting_Repair) { + displayName = CSTRING(enginerSetting_Repair_name); + description = CSTRING(enginerSetting_Repair_description); typeName = "SCALAR"; value = 1; - values[] = {"Anyone", "Engineer only", "Repair Specialist only"}; + values[] = {CSTRING(engineerSetting_anyone), CSTRING(engineerSetting_EngineerOnly), CSTRING(engineerSetting_RepairSpecialistOnly)}; }; class GVAR(engineerSetting_Wheel) { + displayName = CSTRING(enginerSetting_Wheel_name); + description = CSTRING(enginerSetting_Wheel_description); typeName = "SCALAR"; value = 0; - values[] = {"Anyone", "Engineer only", "Repair Specialist only"}; - }; - class GVAR(consumeItem_ToolKit) { - typeName = "SCALAR"; - value = 1; - values[] = {"No", "Yes"}; + values[] = {CSTRING(engineerSetting_anyone), CSTRING(engineerSetting_EngineerOnly), CSTRING(engineerSetting_RepairSpecialistOnly)}; }; class GVAR(repairDamageThreshold) { + displayName = CSTRING(repairDamageThreshold_name); + description = CSTRING(repairDamageThreshold_description); typeName = "SCALAR"; value = 0; }; class GVAR(repairDamageThreshold_Engineer) { + displayName = CSTRING(repairDamageThreshold_Engineer_name); + description = CSTRING(repairDamageThreshold_Engineer_description); typeName = "SCALAR"; value = 0; }; + class GVAR(consumeItem_ToolKit) { + displayName = CSTRING(consumeItem_ToolKit_name); + description = CSTRING(consumeItem_ToolKit_description); + typeName = "SCALAR"; + value = 1; + values[] = {ECSTRING(common,No), ECSTRING(common,Yes)}; + }; }; diff --git a/addons/repair/ACE_repair.hpp b/addons/repair/ACE_repair.hpp index d0bae28f62..4d488b152a 100644 --- a/addons/repair/ACE_repair.hpp +++ b/addons/repair/ACE_repair.hpp @@ -1,39 +1,39 @@ class ACE_Repair { - class Actions { - class ReplaceWheel { - displayName = CSTRING(ReplaceWheel); - displayNameProgress = CSTRING(ReplacingWheel); + class Actions { + class ReplaceWheel { + displayName = CSTRING(ReplaceWheel); + displayNameProgress = CSTRING(ReplacingWheel); - locations[] = {"All"}; - requiredEngineer = 0; - repairingTime = 5; - repairingTimeSelfCoef = 1; - items[] = {}; - condition = ""; - itemConsumed = 0; + locations[] = {"All"}; + requiredEngineer = 0; + repairingTime = 5; + repairingTimeSelfCoef = 1; + items[] = {}; + condition = ""; + itemConsumed = 0; - callbackSuccess = QUOTE(DFUNC(repairBasic_bandage)); - callbackFailure = ""; - callbackProgress = ""; + callbackSuccess = QUOTE(DFUNC(repairBasic_bandage)); + callbackFailure = ""; + callbackProgress = ""; - animationCaller = "AinvPknlMstpSlayWrflDnon_medicOther"; - animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medicOther"; - animationCallerSelf = "AinvPknlMstpSlayW[wpn]Dnon_medic"; - animationCallerSelfProne = "AinvPpneMstpSlayW[wpn]Dnon_medic"; - litter[] = {}; - }; - class RemoveWheel: ReplaceWheel { + animationCaller = "AinvPknlMstpSlayWrflDnon_medicOther"; + animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medicOther"; + animationCallerSelf = "AinvPknlMstpSlayW[wpn]Dnon_medic"; + animationCallerSelfProne = "AinvPpneMstpSlayW[wpn]Dnon_medic"; + litter[] = {}; + }; + class RemoveWheel: ReplaceWheel { - }; - class RepairEngine { + }; + class RepairEngine { - }; - class Tracks: ReplaceWheel { + }; + class Tracks: ReplaceWheel { - }; - class MiscRepair: ReplaceWheel { - displayName = ""; // let's make empty string an auto generated string - displayNameProgress = CSTRING(Repairing); - }; - }; + }; + class MiscRepair: ReplaceWheel { + displayName = ""; // let's make empty string an auto generated string + displayNameProgress = CSTRING(Repairing); + }; + }; }; diff --git a/addons/repair/CfgVehicles.hpp b/addons/repair/CfgVehicles.hpp index 80af6b8afd..a69d2cb99f 100644 --- a/addons/repair/CfgVehicles.hpp +++ b/addons/repair/CfgVehicles.hpp @@ -3,7 +3,7 @@ class ACE_Actions { \ class ACE_MainActions { \ class GVAR(Repair) { \ - displayName = "$STR_ACE_Repair_Repair"; \ + displayName = CSTRING(Repair); \ condition = QUOTE([ARR_2(_this select 0, GVAR(engineerSetting_Repair))] call DFUNC(isEngineer)); \ statement = "'show a hint with the hitpart damage'"; \ runOnHover = 1; \ @@ -20,59 +20,59 @@ class CfgVehicles { // @todo localization for all the modules class ACE_moduleRepairSettings: ACE_Module { scope = 2; - displayName = "Repair Settings"; + displayName = CSTRING(moduleName); icon = QUOTE(PATHTOF(ui\Icon_Module_Repair_ca.paa)); //@todo category = "ACE"; function = QUOTE(DFUNC(moduleRepairSettings)); functionPriority = 1; isGlobal = 1; isTriggerActivated = 0; - author = "$STR_ACE_Common_ACETeam"; + author = ECSTRING(Common,ACETeam); class Arguments { class engineerSetting_Repair { - displayName = "Allow Repair"; - description = "Who can use the toolkit to fully repair?"; + displayName = CSTRING(enginerSetting_Repair_name); + description = CSTRING(enginerSetting_Repair_description); typeName = "NUMBER"; class values { - class anyone { name = "Anyone"; value = 0; }; - class Engineer { name = "Engineers only"; value = 1; default = 1; }; - class Special { name = "Repair Specialists only"; value = 2; }; + class anyone { name = CSTRING(engineerSetting_anyone); value = 0; }; + class Engineer { name = CSTRING(engineerSetting_EngineerOnly); value = 1; default = 1; }; + class Special { name = CSTRING(engineerSetting_RepairSpecialistOnly); value = 2; }; }; }; class engineerSetting_Wheel { - displayName = "Allow Wheel"; - description = "Who can remove and replace wheels?"; + displayName = CSTRING(enginerSetting_Wheel_name); + description = CSTRING(enginerSetting_Wheel_description); typeName = "NUMBER"; class values { - class anyone { name = "Anyone"; value = 0; default = 1; }; - class Engineer { name = "Engineers only"; value = 1; }; - class Special { name = "Repair Specialists only"; value = 2; }; + class anyone { name = CSTRING(engineerSetting_anyone); value = 0; default = 1; }; + class Engineer { name = CSTRING(engineerSetting_EngineerOnly); value = 1; }; + class Special { name = CSTRING(engineerSetting_RepairSpecialistOnly); value = 2; }; }; }; class repairDamageThreshold { - displayName = "Repair Threshold"; - description = "What is the maximum damage that can be repaired with a toolkit?"; + displayName = CSTRING(repairDamageThreshold_name); + description = CSTRING(repairDamageThreshold_description); typeName = "NUMBER"; defaultValue = 1; }; class repairDamageThreshold_Engineer { - displayName = "Repair Threshold (Engineer)"; - description = "What is the maximum damage that can be repaired by an engineer?"; + displayName = CSTRING(repairDamageThreshold_Engineer_name); + description = CSTRING(repairDamageThreshold_Engineer_description); typeName = "NUMBER"; defaultValue = 1; }; class consumeItem_ToolKit { - displayName = "Remove toolkit on use"; - description = "Should the toolkit be removed on usage?"; + displayName = CSTRING(consumeItem_ToolKit_name); + description = CSTRING(consumeItem_ToolKit_description); typeName = "NUMBER"; class values { - class keep { name = "No"; value = 0; default = 1; }; - class remove { name = "Yes"; value = 1; }; + class keep { name = ECSTRING(common,No); value = 0; default = 1; }; + class remove { name = ECSTRING(common,Yes); value = 1; }; }; }; }; class ModuleDescription { - description = "Provides a repair system for all types of vehicles."; + description = CSTRING(moduleDescription); sync[] = {}; }; }; diff --git a/addons/repair/functions/fnc_addRepairActions.sqf b/addons/repair/functions/fnc_addRepairActions.sqf index 6b63581c31..1bcaa3d87a 100644 --- a/addons/repair/functions/fnc_addRepairActions.sqf +++ b/addons/repair/functions/fnc_addRepairActions.sqf @@ -1,19 +1,17 @@ /* * Author: commy2 - * * Called from init eventhandler. Checks if the vehicles class already has the actions initialized. Otherwise add all available repair options. * * Arguments: - * 0: vehicle (Object) + * 0: vehicle * * Return Value: * NONE */ #include "script_component.hpp" -private "_vehicle"; - -_vehicle = _this select 0; +params ["_vehicle"]; +TRACE_1("params", _vehicle); private ["_type", "_initializedClasses"]; @@ -43,8 +41,6 @@ _wheelHitPointSelections = _wheelHitPointsWithSelections select 1; private ["_icon", "_selection"]; - _nameRemove = format ["Remove_%1", _x]; - _icon = QUOTE(PATHTOF(ui\tire_ca.paa)); _selection = _wheelHitPointSelections select (_wheelHitPoints find _x); @@ -64,7 +60,7 @@ _wheelHitPointSelections = _wheelHitPointsWithSelections select 1; // replace wheel action _name = format ["Replace_%1", _x]; - _text = localize "STR_ACE_Repair_ReplaceWheel"; + _text = localize LSTRING(ReplaceWheel); _condition = {[_this select 1, _this select 0, _this select 2 select 0] call DFUNC(canReplaceWheel)}; _statement = {[_this select 1, _this select 0, _this select 2 select 0] call DFUNC(replaceWheel)}; @@ -88,9 +84,9 @@ _wheelHitPointSelections = _wheelHitPointsWithSelections select 1; _text = format ["STR_ACE_Repair_%1", _x]; if (isLocalized _text) then { - _text = format [localize "STR_ACE_Repair_RepairHitpoint", localize _text]; + _text = format [localize LSTRING(RepairHitpoint), localize _text]; } else { - _text = format [localize "STR_ACE_Repair_RepairHitpoint", _x]; + _text = format [localize LSTRING(RepairHitpoint), _x]; }; _icon = ""; diff --git a/addons/repair/functions/fnc_canRemoveWheel.sqf b/addons/repair/functions/fnc_canRemoveWheel.sqf index 1938eb44be..b81a933c08 100644 --- a/addons/repair/functions/fnc_canRemoveWheel.sqf +++ b/addons/repair/functions/fnc_canRemoveWheel.sqf @@ -1,23 +1,19 @@ /* * Author: commy2 - * * Check if the unit can remove given wheel of the vehicle. * * Arguments: - * 0: Unit that does the repairing (Object) - * 1: vehicle to repair (Object) - * 2: Selected hitpoint (String) + * 0: Unit that does the repairing + * 1: vehicle to repair + * 2: Selected hitpoint * * Return Value: * NONE */ #include "script_component.hpp" -private ["_unit", "_target", "_hitPoint"]; - -_unit = _this select 0; -_target = _this select 1; -_hitPoint = _this select 2; +params ["_unit", "_target", "_hitPoint"]; +TRACE_3("params",_unit,_target,_hitPoint); if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false}; diff --git a/addons/repair/functions/fnc_canRepair.sqf b/addons/repair/functions/fnc_canRepair.sqf index 5a2a1580b1..0f1c71f689 100644 --- a/addons/repair/functions/fnc_canRepair.sqf +++ b/addons/repair/functions/fnc_canRepair.sqf @@ -16,11 +16,10 @@ #include "script_component.hpp" -private ["_caller", "_target", "_hitPoint", "_className", "_config", "_engineerRequired", "_items", "_locations", "_return", "_condition", "_vehicleStateCondition"]; -_caller = _this select 0; -_target = _this select 1; -_hitPoint = _this select 2; -_className = _this select 3; +params ["_caller", "_target", "_hitPoint", "_className"]; +TRACE_4("params",_caller,_target,_hitPoint,_className); + +private ["_config", "_engineerRequired", "_items", "_locations", "_return", "_condition", "_vehicleStateCondition"]; _config = (ConfigFile >> "ACE_Repair" >> "Actions" >> _className); if !(isClass _config) exitwith {false}; // or go for a default? @@ -86,6 +85,6 @@ _repairVeh = {([_caller] call FUNC(isNearRepairVehicle)) || ([_target] call FUNC _return = call _return; }; }; -}foreach _locations; +} forEach _locations; -_return && alive _target && {_target getHitPointDamage _hitPoint > ([_unit] call FUNC(getPostRepairDamage))} +_return && alive _target && {(_target getHitPointDamage _hitPoint) > ([_target] call FUNC(getPostRepairDamage))} diff --git a/addons/repair/functions/fnc_canReplaceWheel.sqf b/addons/repair/functions/fnc_canReplaceWheel.sqf index 585df1dd86..ad7f474932 100644 --- a/addons/repair/functions/fnc_canReplaceWheel.sqf +++ b/addons/repair/functions/fnc_canReplaceWheel.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Check if the unit can replace given wheel of the vehicle. * * Arguments: @@ -13,12 +12,8 @@ */ #include "script_component.hpp" -private ["_unit", "_target", "_hitPoint", "_wheel"]; - -_unit = _this select 0; -_target = _this select 1; -_hitPoint = _this select 2; -_wheel = ARR_SELECT(_this,3,false); +params ["_unit", "_target", "_hitPoint", ["_wheel",false]]; +TRACE_4("params",_unit,_target,_hitPoint,_wheel); if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false}; diff --git a/addons/repair/functions/fnc_doRemoveWheel.sqf b/addons/repair/functions/fnc_doRemoveWheel.sqf index 101ecc82d3..acf6b71213 100644 --- a/addons/repair/functions/fnc_doRemoveWheel.sqf +++ b/addons/repair/functions/fnc_doRemoveWheel.sqf @@ -11,12 +11,8 @@ */ #include "script_component.hpp" -private ["_unit", "_vehicle", "_hitPoint"]; - -_unit = _this select 0; -_vehicle = _this select 1; -_hitPoint = _this select 2; - +params ["_unit", "_vehicle", "_hitPoint"]; +TRACE_3("params",_unit,_vehicle,_hitPoint); // get current hitpoint damage private "_hitPointDamage"; @@ -38,5 +34,5 @@ _wheel setdamage _hitPointDamage; // display text message if enabled if (GVAR(DisplayTextOnRepair)) then { - [localize "STR_ACE_Repair_RemovedWheel"] call EFUNC(common,displayTextStructured); + [localize LSTRING(RemovedWheel)] call EFUNC(common,displayTextStructured); }; diff --git a/addons/repair/functions/fnc_doRepair.sqf b/addons/repair/functions/fnc_doRepair.sqf index e75dc024fd..69a3510444 100644 --- a/addons/repair/functions/fnc_doRepair.sqf +++ b/addons/repair/functions/fnc_doRepair.sqf @@ -1,24 +1,18 @@ /* * Author: commy2 - * * Called by repair action / progress bar. Raise events to set the new hitpoint damage. * * Arguments: - * Stuff from progress bar. + * 0: Stuff from progress bar. * * Return Value: * NONE */ #include "script_component.hpp" -private ["_unit", "_vehicle", "_hitPoint", "_elapsedTime", "_totalTime"]; - -_unit = _this select 0 select 0; -_vehicle = _this select 0 select 1; -_hitPoint = _this select 0 select 2; - -_elapsedTime = _this select 1; -_totalTime = _this select 2; +params ["_args", "_elapsedTime", "_totalTime"]; +_args params ["_unit", "_vehicle", "_hitPoint"]; +TRACE_5("params",_unit,_vehicle,_hitPoint,_elapsedTime,_totalTime); // get current hitpoint damage private "_hitPointDamage"; @@ -39,9 +33,9 @@ if (GVAR(DisplayTextOnRepair)) then { _text = format ["STR_ACE_Repair_%1", _hitPoint]; if (isLocalized _text) then { - _text = format [localize (["STR_ACE_Repair_RepairedHitPointFully", "STR_ACE_Repair_RepairedHitPointPartially"] select (_hitPointDamage > 0)), localize _text]; + _text = format [localize ([LSTRING(RepairedHitPointFully), LSTRING(RepairedHitPointPartially)] select (_hitPointDamage > 0)), localize _text]; } else { - _text = localize (["STR_ACE_Repair_RepairedFully", "STR_ACE_Repair_RepairedPartially"] select (_hitPointDamage > 0)); + _text = localize ([LSTRING(RepairedFully), LSTRING(RepairedPartially)] select (_hitPointDamage > 0)); }; [_text] call EFUNC(common,displayTextStructured); diff --git a/addons/repair/functions/fnc_doReplaceWheel.sqf b/addons/repair/functions/fnc_doReplaceWheel.sqf index 02e0a2e708..7b73137c6a 100644 --- a/addons/repair/functions/fnc_doReplaceWheel.sqf +++ b/addons/repair/functions/fnc_doReplaceWheel.sqf @@ -1,22 +1,17 @@ /* * Author: commy2 - * * Called by repair action / progress bar. Raise events to set the new hitpoint damage. * * Arguments: - * Stuff from progress bar. + * 0: Stuff from progress bar. * * Return Value: * NONE */ #include "script_component.hpp" -private ["_unit", "_vehicle", "_hitPoint", "_wheel"]; - -_unit = _this select 0; -_vehicle = _this select 1; -_hitPoint = _this select 2; -_wheel = _this select 3; +params ["_unit", "_vehicle", "_hitPoint", "_wheel"]; +TRACE_4("params",_unit,_vehicle,_hitPoint,_wheel); // get current hitpoint damage private "_hitPointDamage"; @@ -38,5 +33,5 @@ deleteVehicle _wheel; // display text message if enabled if (GVAR(DisplayTextOnRepair)) then { - [localize "STR_ACE_Repair_ReplacedWheel"] call EFUNC(common,displayTextStructured); + [LSTRING(ReplacedWheel)] call EFUNC(common,displayTextStructured); }; diff --git a/addons/repair/functions/fnc_getPostRepairDamage.sqf b/addons/repair/functions/fnc_getPostRepairDamage.sqf index 43ba23c26f..17ba7bdd82 100644 --- a/addons/repair/functions/fnc_getPostRepairDamage.sqf +++ b/addons/repair/functions/fnc_getPostRepairDamage.sqf @@ -1,9 +1,8 @@ // by comm2 #include "script_component.hpp" -private "_unit"; - -_unit = _this select 0; +params ["_unit"]; +TRACE_1("params",_unit); 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_getWheelHitPointsWithSelections.sqf b/addons/repair/functions/fnc_getWheelHitPointsWithSelections.sqf index 60a652d5fc..6719047737 100644 --- a/addons/repair/functions/fnc_getWheelHitPointsWithSelections.sqf +++ b/addons/repair/functions/fnc_getWheelHitPointsWithSelections.sqf @@ -1,19 +1,17 @@ /* * Author: commy2 - * * Returns the wheel hitpoints and their selections. * * Arguments: - * 0: A vehicle (Object) + * 0: A vehicle * * Return Value: - * Wheel positions in model coordinates. (Array) + * Wheel positions in model coordinates. */ #include "script_component.hpp" -private "_vehicle"; - -_vehicle = _this select 0; +params ["_vehicle"]; +TRACE_1("params",_vehicle); // get the vehicles wheel config private "_wheels"; diff --git a/addons/repair/functions/fnc_hasItems.sqf b/addons/repair/functions/fnc_hasItems.sqf index 86a8dc8307..6167689faf 100644 --- a/addons/repair/functions/fnc_hasItems.sqf +++ b/addons/repair/functions/fnc_hasItems.sqf @@ -12,21 +12,21 @@ * * Public: Yes */ - #include "script_component.hpp" -private ["_engineer", "_items", "_return"]; -_engineer = _this select 0; -_items = _this select 1; +params ["_engineer", "_items"]; +TRACE_2("params",_engineer,_items); + +private ["_return"]; _return = true; { - if (typeName _x == "ARRAY" && {({[_engineer, _x] call EFUNC(common,hasItem)}count _x == 0)}) exitwith { + if (typeName _x == "ARRAY" && {({[_engineer, _x] call EFUNC(common,hasItem)} count _x == 0)}) exitwith { _return = false; }; if (typeName _x == "STRING" && {!([_engineer, _x] call EFUNC(common,hasItem))}) exitwith { _return = false; }; -}foreach _items; +} forEach _items; _return; diff --git a/addons/repair/functions/fnc_isEngineer.sqf b/addons/repair/functions/fnc_isEngineer.sqf index 554dc98b37..8333273d7c 100644 --- a/addons/repair/functions/fnc_isEngineer.sqf +++ b/addons/repair/functions/fnc_isEngineer.sqf @@ -13,13 +13,13 @@ */ #include "script_component.hpp" -private ["_unit", "_engineerN", "_class"]; +params ["_unit", ["_engineerN", 1]]; +TRACE_2("params",_unit,_engineerN); -_unit = _this select 0; -_engineerN = if (count _this > 1) then {_this select 1} else {1}; +private ["_class"]; _class = _unit getVariable [QGVAR(engineerClass), getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "engineer") ]; -_class >= _engineerN min GVAR(engineerSetting_Repair) +_class >= (_engineerN min GVAR(engineerSetting_Repair)) diff --git a/addons/repair/functions/fnc_isInRepairFacility.sqf b/addons/repair/functions/fnc_isInRepairFacility.sqf index ec8a8de6a3..47ecbabf3a 100644 --- a/addons/repair/functions/fnc_isInRepairFacility.sqf +++ b/addons/repair/functions/fnc_isInRepairFacility.sqf @@ -13,8 +13,11 @@ #include "script_component.hpp" -private ["_object","_position","_objects","_isInBuilding","_repairFacility"]; -_object = _this select 0; +params ["_object"]; +TRACE_1("params",_object); + +private ["_position","_objects","_isInBuilding","_repairFacility"]; + _position = getPosASL _object; _isInBuilding = false; _repairFacility = []; @@ -24,7 +27,7 @@ _objects = (lineIntersectsWith [_object modelToWorldVisual [0, 0, (_position sel if (((typeOf _x) in _repairFacility) || (_x getVariable [QGVAR(isRepairFacility),false])) exitwith { _isInBuilding = true; }; -}foreach _objects; +} forEach _objects; if (!_isInBuilding) then { _objects = position _object nearObjects 7.5; @@ -32,6 +35,6 @@ if (!_isInBuilding) then { if (((typeOf _x) in _repairFacility) || (_x getVariable [QGVAR(isRepairFacility),false])) exitwith { _isInBuilding = true; }; - }foreach _objects; + } forEach _objects; }; _isInBuilding; diff --git a/addons/repair/functions/fnc_isNearRepairVehicle.sqf b/addons/repair/functions/fnc_isNearRepairVehicle.sqf index b5b3cfb9c4..126a0c40cb 100644 --- a/addons/repair/functions/fnc_isNearRepairVehicle.sqf +++ b/addons/repair/functions/fnc_isNearRepairVehicle.sqf @@ -13,14 +13,16 @@ #include "script_component.hpp" -private ["_unit", "_vehicle"]; +params ["_unit"]; +TRACE_1("params",_unit); + +private ["_nearObjects", "_return"]; -_unit = _this select 0; _nearObjects = nearestObjects [_unit, ["Air","LandVehicle"], 20]; _return = false; { if ([_x] call FUNC(isRepairVehicle)) exitwith {_return = true;}; -}foreach _nearObjects; +} forEach _nearObjects; _return; diff --git a/addons/repair/functions/fnc_isRepairVehicle.sqf b/addons/repair/functions/fnc_isRepairVehicle.sqf index 3045a0dc06..57f688f05d 100644 --- a/addons/repair/functions/fnc_isRepairVehicle.sqf +++ b/addons/repair/functions/fnc_isRepairVehicle.sqf @@ -12,8 +12,8 @@ */ #include "script_component.hpp" -private ["_vehicle"]; -_vehicle = _this select 0; +params ["_vehicle"]; +TRACE_1("params",_vehicle); if (_vehicle isKindOf "CAManBase") exitwith {false}; diff --git a/addons/repair/functions/fnc_moduleRepairSettings.sqf b/addons/repair/functions/fnc_moduleRepairSettings.sqf index 752b42a1f6..1501d23f3f 100644 --- a/addons/repair/functions/fnc_moduleRepairSettings.sqf +++ b/addons/repair/functions/fnc_moduleRepairSettings.sqf @@ -4,8 +4,6 @@ * * Arguments: * 0: The module logic - * 1: units - * 2: activated * * Return Value: * None @@ -14,16 +12,14 @@ */ #include "script_component.hpp" -private ["_logic", "_units", "_activated"]; +params ["_logic"]; -_logic = _this select 0; -_units = _this select 1; -_activated = _this select 2; - -if !(_activated) exitWith {}; +if (!isServer) exitWith {}; [_logic, QGVAR(engineerSetting_Repair), "engineerSetting_Repair"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(engineerSetting_Wheel), "engineerSetting_Wheel"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(consumeItem_ToolKit), "consumeItem_ToolKit"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(repairDamageThreshold), "repairDamageThreshold"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(repairDamageThreshold_Engineer), "repairDamageThreshold_Engineer"] call EFUNC(common,readSettingFromModule); + +diag_log text "[ACE]: Repair Module Initialized."; diff --git a/addons/repair/functions/fnc_normalizeHitPoints.sqf b/addons/repair/functions/fnc_normalizeHitPoints.sqf index 0e49c56a8e..7a39940794 100644 --- a/addons/repair/functions/fnc_normalizeHitPoints.sqf +++ b/addons/repair/functions/fnc_normalizeHitPoints.sqf @@ -1,19 +1,17 @@ /* * Author: commy2 - * * Used to normalize dependant hitpoints. May overwrite some global variables that are named like hitpoints or "Total" though... * * Arguments: - * 0: A local vehicle with hitpoints. (Object) + * 0: A local vehicle with hitpoints. * * Return Value: * NONE */ #include "script_component.hpp" -private "_vehicle"; - -_vehicle = _this select 0; +params ["_vehicle"]; +TRACE_1("params",_vehicle); // can't execute all commands if the vehicle isn't local. exit here. if !(local _vehicle) exitWith {}; diff --git a/addons/repair/functions/fnc_removeWheel.sqf b/addons/repair/functions/fnc_removeWheel.sqf index ca6d33c90f..592add5918 100644 --- a/addons/repair/functions/fnc_removeWheel.sqf +++ b/addons/repair/functions/fnc_removeWheel.sqf @@ -13,11 +13,8 @@ */ #include "script_component.hpp" -private ["_unit", "_vehicle", "_hitPoint"]; - -_unit = _this select 0; -_vehicle = _this select 1; -_hitPoint = _this select 2; +params ["_caller", "_vehicle", "_hitPoint"]; +TRACE_3("params",_caller,_vehicle,_hitPoint); // exit if not a valid hitpoint if !(_hitPoint in ([_vehicle] call EFUNC(common,getHitPoints))) exitWith {}; @@ -27,9 +24,9 @@ private "_time"; _time = 10; // open the loading bar -[_time, [_unit, _vehicle, _hitPoint], {(_this select 0) call DFUNC(doRemoveWheel)}, {[localize "STR_ACE_Common_ActionAborted"] call EFUNC(common,displayTextStructured);}, localize "STR_ACE_Repair_RemovingWheel", {(_this select 0) call DFUNC(canRemoveWheel)}, []] call EFUNC(common,progressBar); +[_time, [_caller, _vehicle, _hitPoint], {(_this select 0) call DFUNC(doRemoveWheel)}, {[localize "STR_ACE_Common_ActionAborted"] call EFUNC(common,displayTextStructured);}, localize "STR_ACE_Repair_RemovingWheel", {(_this select 0) call DFUNC(canRemoveWheel)}, []] call EFUNC(common,progressBar); // do animation -[_unit] call EFUNC(common,goKneeling); +[_caller] call EFUNC(common,goKneeling); // @todo play sound diff --git a/addons/repair/functions/fnc_repair.sqf b/addons/repair/functions/fnc_repair.sqf index 930e734efe..6e31c120c1 100644 --- a/addons/repair/functions/fnc_repair.sqf +++ b/addons/repair/functions/fnc_repair.sqf @@ -16,11 +16,10 @@ #include "script_component.hpp" -private ["_caller", "_target", "_hitPoint", "_className", "_config", "_engineerRequired", "_items", "_locations", "_return", "_condition", "_vehicleStateCondition"]; -_caller = _this select 0; -_target = _this select 1; -_hitPoint = _this select 2; -_className = _this select 3; +params ["_caller", "_target", "_hitPoint", "_className"]; +TRACE_4("params",_calller,_target,_hitPoint,_className); + +private ["_config", "_engineerRequired", "_items", "_locations", "_return", "_condition", "_vehicleStateCondition"]; _config = (ConfigFile >> "ACE_Repair" >> "Actions" >> _className); if !(isClass _config) exitwith {false}; // or go for a default? @@ -86,7 +85,7 @@ _repairVeh = {([_caller] call FUNC(isNearRepairVehicle)) || ([_target] call FUNC _return = call _return; }; }; -}foreach _locations; +} forEach _locations; if !(_return && alive _target && {_target getHitPointDamage _hitPoint > ([_unit] call FUNC(getPostRepairDamage))}) exitwith {false}; diff --git a/addons/repair/functions/fnc_repairVehicle.sqf b/addons/repair/functions/fnc_repairVehicle.sqf index 053a4172a1..becdcb366d 100644 --- a/addons/repair/functions/fnc_repairVehicle.sqf +++ b/addons/repair/functions/fnc_repairVehicle.sqf @@ -13,11 +13,8 @@ */ #include "script_component.hpp" -private ["_unit", "_vehicle", "_hitPoint"]; - -_unit = _this select 0; -_vehicle = _this select 1; -_hitPoint = _this select 2; +params ["_unit", "_vehicle", "_hitPoint"]; +TRACE_3("params",_unit,_vehicle,_hitPoint); // exit if not a valid hitpoint if !(_hitPoint in ([_vehicle] call EFUNC(common,getHitPoints))) exitWith {}; @@ -34,9 +31,9 @@ private "_text"; _text = format ["STR_ACE_Repair_%1", _hitPoint]; if (isLocalized _text) then { - _text = format [localize "STR_ACE_Repair_RepairingHitPoint", localize _text]; + _text = format [localize LSTRING(RepairingHitPoint), localize _text]; } else { - _text = localize "STR_ACE_Repair_Repairing"; + _text = localize LSTRING(Repairing); }; // open the loading bar diff --git a/addons/repair/functions/fnc_repair_failure.sqf b/addons/repair/functions/fnc_repair_failure.sqf index d74709ea60..7ec948fbbc 100644 --- a/addons/repair/functions/fnc_repair_failure.sqf +++ b/addons/repair/functions/fnc_repair_failure.sqf @@ -14,17 +14,13 @@ * * Public: No */ - #include "script_component.hpp" -private ["_args", "_caller", "_target","_selectionName","_className","_config","_callback", "_usersOfItems", "_weaponSelect"]; +params ["_args"]; +_args params ["_caller", "_target","_selectionName","_className","","_usersOfItems"]; +TRACE_5("params",_caller,_target,_selectionName,_className,_usersOfItems); -_args = _this select 0; -_caller = _args select 0; -_target = _args select 1; -_selectionName = _args select 2; -_className = _args select 3; -_usersOfItems = _args select 5; +private ["_config","_callback", "_usersOfItems", "_weaponSelect"]; if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then { _caller removeWeapon "ACE_FakePrimaryWeapon"; @@ -43,7 +39,7 @@ if (_weaponSelect != "") then { { (_x select 0) addItem (_x select 1); -}foreach _usersOfItems; +} forEach _usersOfItems; // Record specific callback _config = (ConfigFile >> "ACE_Repair" >> "Actions" >> _className); diff --git a/addons/repair/functions/fnc_repair_success.sqf b/addons/repair/functions/fnc_repair_success.sqf index d1ab931006..5e4e7d7d5d 100644 --- a/addons/repair/functions/fnc_repair_success.sqf +++ b/addons/repair/functions/fnc_repair_success.sqf @@ -17,12 +17,11 @@ #include "script_component.hpp" -private ["_args", "_caller", "_target","_selectionName","_className","_config","_callback", "_weaponSelect"]; -_args = _this select 0; -_caller = _args select 0; -_target = _args select 1; -_selectionName = _args select 2; -_className = _args select 3; +params ["_args"]; +_args params ["_caller", "_target","_selectionName","_className"]; +TRACE_4("params",_caller,_target,_selectionName,_className); + +private ["_config","_callback", "_weaponSelect"]; if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then { _caller removeWeapon "ACE_FakePrimaryWeapon"; diff --git a/addons/repair/functions/fnc_replaceWheel.sqf b/addons/repair/functions/fnc_replaceWheel.sqf index 9ae16f168d..1ca87880e9 100644 --- a/addons/repair/functions/fnc_replaceWheel.sqf +++ b/addons/repair/functions/fnc_replaceWheel.sqf @@ -4,20 +4,17 @@ * Start a replace wheel action and open progress bar. * * Arguments: - * 0: Unit that does the repairing (Object) - * 1: vehicle to repair (Object) - * 2: Selected hitpoint (String) + * 0: Unit that does the repairing + * 1: vehicle to repair + * 2: Selected hitpoint * * Return Value: * NONE */ #include "script_component.hpp" -private ["_unit", "_vehicle", "_hitPoint"]; - -_unit = _this select 0; -_vehicle = _this select 1; -_hitPoint = _this select 2; +params ["_unit", "_vehicle", "_hitPoint"]; +TRACE_3("params",_unit,_vehicle,_hitPoint); // exit if not a valid hitpoint if !(_hitPoint in ([_vehicle] call EFUNC(common,getHitPoints))) exitWith {}; @@ -41,7 +38,7 @@ private "_time"; _time = 10; // open the loading bar -[_time, [_unit, _vehicle, _hitPoint, _wheel], {(_this select 0) call DFUNC(doReplaceWheel)}, {[objNull, _this select 0 select 3] call DEFUNC(common,claim); [localize "STR_ACE_Common_ActionAborted"] call EFUNC(common,displayTextStructured);}, localize "STR_ACE_Repair_ReplacingWheel", {(_this select 0) call DFUNC(canReplaceWheel)}, []] call EFUNC(common,progressBar); +[_time, [_unit, _vehicle, _hitPoint, _wheel], {(_this select 0) call DFUNC(doReplaceWheel)}, {[objNull, _this select 0 select 3] call DEFUNC(common,claim); [localize ELSTRING(common,ActionAborted)] call EFUNC(common,displayTextStructured);}, localize LSTRING(ReplacingWheel), {(_this select 0) call DFUNC(canReplaceWheel)}, []] call EFUNC(common,progressBar); // do animation [_unit] call EFUNC(common,goKneeling); diff --git a/addons/repair/functions/fnc_setDamage.sqf b/addons/repair/functions/fnc_setDamage.sqf index 24e38ae5b2..c739a2c9fc 100644 --- a/addons/repair/functions/fnc_setDamage.sqf +++ b/addons/repair/functions/fnc_setDamage.sqf @@ -1,21 +1,18 @@ /* * Author: commy2 - * * Sets the structural damage of a vehicle without altering the hitPoints. Requires local vehicle. * * Arguments: - * 0: vehicle to damage (Object) - * 1: Total damage (Number) + * 0: vehicle to damage + * 1: Total damage * * Return Value: * NONE */ #include "script_component.hpp" -private ["_vehicle", "_damage"]; - -_vehicle = _this select 0; -_damage = _this select 1; +params ["_vehicle", "_damage"]; +TRACE_2("params",_vehicle,_damage); // can't execute all commands if the vehicle isn't local. exit here. if !(local _vehicle) exitWith {}; diff --git a/addons/repair/functions/fnc_setHitPointDamage.sqf b/addons/repair/functions/fnc_setHitPointDamage.sqf index 5d6020b7f1..8e609917e9 100644 --- a/addons/repair/functions/fnc_setHitPointDamage.sqf +++ b/addons/repair/functions/fnc_setHitPointDamage.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Set the hitpoint damage and change the structural damage acordingly. Requires local vehicle. * * Arguments: @@ -13,11 +12,8 @@ */ #include "script_component.hpp" -private ["_vehicle", "_hitPoint", "_hitPointDamage"]; - -_vehicle = _this select 0; -_hitPoint = _this select 1; -_hitPointDamage = _this select 2; +params ["_vehicle", "_hitPoint", "_hitPointDamage"]; +TRACE_3("params",_vehicle,_hitPoint,_hitPointDamage); // can't execute all commands if the vehicle isn't local. exit here. if !(local _vehicle) exitWith {}; diff --git a/addons/repair/functions/fnc_spawnObject.sqf b/addons/repair/functions/fnc_spawnObject.sqf index a37cbded07..efe64ec9d5 100644 --- a/addons/repair/functions/fnc_spawnObject.sqf +++ b/addons/repair/functions/fnc_spawnObject.sqf @@ -1,13 +1,8 @@ // by commy2 #include "script_component.hpp" -private ["_item", "_position", "_damage"]; - -_item = _this select 0; -_position = _this select 1; -_damage = _this select 2; - -if (isNil "_damage") then {_damage = 0}; +params ["_item", "_position", ["_damage", 0]]; +TRACE_3("params",_item,_position,_damage); // randomized end position _position = _position vectorAdd [1 - random 2, 1 - random 2, 0]; diff --git a/addons/repair/functions/fnc_useItem.sqf b/addons/repair/functions/fnc_useItem.sqf index 18090ecaf3..2309c25bd8 100644 --- a/addons/repair/functions/fnc_useItem.sqf +++ b/addons/repair/functions/fnc_useItem.sqf @@ -14,9 +14,8 @@ #include "script_component.hpp" -private ["_engineer", "_item", "_return","_crew"]; -_engineer = _this select 0; -_item = _this select 1; +params ["_engineer", "_item"]; +TRACE_2("params",_engineer,_item); if ([_engineer, _item] call EFUNC(common,hasItem)) exitwith { [[_engineer, _item], QUOTE(EFUNC(common,useItem)), _engineer] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ diff --git a/addons/repair/functions/fnc_useItems.sqf b/addons/repair/functions/fnc_useItems.sqf index c7e8254759..cf27105190 100644 --- a/addons/repair/functions/fnc_useItems.sqf +++ b/addons/repair/functions/fnc_useItems.sqf @@ -4,7 +4,7 @@ * * Arguments: * 0: Engineer - * 2: Items > + * 1: Items > * * ReturnValue: * @@ -14,9 +14,10 @@ #include "script_component.hpp" -private ["_engineer", "_patient", "_items", "_itemUsedInfo", "_itemsUsedBy"]; -_engineer = _this select 0; -_items = _this select 1; +params ["_engineer", "_items"]; +TRACE_2("params",_engineer,_items); + +private ["_itemUsedInfo", "_itemsUsedBy"]; _itemsUsedBy = []; { @@ -25,7 +26,7 @@ _itemsUsedBy = []; { _itemUsedInfo = [_engineer, _x] call FUNC(useItem); if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]}; - }foreach _x; + } forEach _x; }; // handle required item @@ -33,6 +34,6 @@ _itemsUsedBy = []; _itemUsedInfo = [_engineer, _x] call FUNC(useItem); if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]}; }; -}foreach _items; +} forEach _items; [count _items == count _itemsUsedBy, _itemsUsedBy]; diff --git a/addons/repair/stringtable.xml b/addons/repair/stringtable.xml index 447eb01679..84bbfc1441 100644 --- a/addons/repair/stringtable.xml +++ b/addons/repair/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -26,7 +26,6 @@ Pótkerék Запасное колесо - Change Wheel Reifen wechseln @@ -67,7 +66,6 @@ Wheel removed Reifen entfernt - Repair %1 Reparieren %1 @@ -92,14 +90,12 @@ Szerelés >> Ремонт >> - Display text on repair Display a notification whenever you repair a vehicle - Repairing ... Reparieren ... @@ -136,7 +132,6 @@ %1 megjavítva %1 отремонтирован - Fully repaired part Bauteil vollständig repariert @@ -153,7 +148,6 @@ Partially repaired %1 %1 teilweise repariert - Body Karosserie @@ -482,5 +476,50 @@ Üveg 6 Стекло 6 + + Repair Settings + + + Provides a repair system for all types of vehicles. + + + Anyone + + + Engineer only + + + Repair Specialist only + + + Allow Wheel + + + Who can remove and replace wheels? + + + Allow Repair + + + Who can use the toolkit to fully repair? + + + Repair Threshold + + + What is the maximum damage that can be repaired with a toolkit? + + + Repair Threshold (Engineer) + + + What is the maximum damage that can be repaired by an engineer? + + + Remove toolkit on use + + + Should the toolkit be removed on usage? + - + \ No newline at end of file