diff --git a/addons/repair/ACE_repair.hpp b/addons/repair/ACE_Repair.hpp similarity index 96% rename from addons/repair/ACE_repair.hpp rename to addons/repair/ACE_Repair.hpp index 01ad3aee23..c12566d5b1 100644 --- a/addons/repair/ACE_repair.hpp +++ b/addons/repair/ACE_Repair.hpp @@ -25,7 +25,7 @@ class ACE_Repair { class RemoveWheel: ReplaceWheel { displayName = CSTRING(RemoveWheel); displayNameProgress = CSTRING(RemovingWheel); - condition = QUOTE(call FUNC(canRemoveWheel)); + condition = QUOTE(call FUNC(canRemove)); callbackSuccess = QUOTE(call FUNC(doRemoveWheel)); }; class MiscRepair: ReplaceWheel { @@ -46,7 +46,7 @@ class ACE_Repair { class RemoveTrack: MiscRepair { displayName = CSTRING(RemoveTrack); displayNameProgress = CSTRING(RemovingTrack); - condition = QUOTE(call FUNC(canRemoveTrack)); + condition = QUOTE(call FUNC(canRemove)); callbackSuccess = QUOTE(call FUNC(doRemoveTrack)); requiredEngineer = QGVAR(engineerSetting_Wheel); }; diff --git a/addons/repair/ACE_Settings.hpp b/addons/repair/ACE_Settings.hpp index 0762b51ec9..e956e853de 100644 --- a/addons/repair/ACE_Settings.hpp +++ b/addons/repair/ACE_Settings.hpp @@ -45,7 +45,6 @@ class ACE_Settings { values[] = {ECSTRING(common,No), ECSTRING(common,Yes)}; category = CSTRING(categoryName); }; - class GVAR(fullRepairLocation) { displayName = CSTRING(fullRepairLocation); description = CSTRING(fullRepairLocation_description); diff --git a/addons/repair/CfgActions.hpp b/addons/repair/CfgActions.hpp new file mode 100644 index 0000000000..5dbd0ca7a6 --- /dev/null +++ b/addons/repair/CfgActions.hpp @@ -0,0 +1,9 @@ +class CfgActions { + class None; + class Repair: None { + show = 0; + }; + class RepairVehicle: None { + show = 0; + }; +}; diff --git a/addons/repair/CfgEventHandlers.hpp b/addons/repair/CfgEventHandlers.hpp index d03936c59b..27e14937cf 100644 --- a/addons/repair/CfgEventHandlers.hpp +++ b/addons/repair/CfgEventHandlers.hpp @@ -1,4 +1,3 @@ - class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/repair/CfgVehicleClasses.hpp b/addons/repair/CfgVehicleClasses.hpp index 0cd2e70942..585b8f2858 100644 --- a/addons/repair/CfgVehicleClasses.hpp +++ b/addons/repair/CfgVehicleClasses.hpp @@ -1,4 +1,3 @@ - class CfgVehicleClasses { class GVAR(items) { displayName = "ACE"; diff --git a/addons/repair/CfgVehicles.hpp b/addons/repair/CfgVehicles.hpp index b70e415b53..f24cd9bc9a 100644 --- a/addons/repair/CfgVehicles.hpp +++ b/addons/repair/CfgVehicles.hpp @@ -1,4 +1,3 @@ - #define MACRO_REPAIRVEHICLE \ class ACE_Actions { \ class ACE_MainActions { \ @@ -23,7 +22,7 @@ class CfgVehicles { displayName = CSTRING(moduleName); icon = QUOTE(PATHTOF(ui\Icon_Module_Repair_ca.paa)); //@todo category = "ACE"; - function = QUOTE(DFUNC(moduleRepairSettings)); + function = QFUNC(moduleRepairSettings); functionPriority = 1; isGlobal = 1; isTriggerActivated = 0; @@ -105,7 +104,7 @@ class CfgVehicles { displayName = CSTRING(AssignEngineerRole_Module_DisplayName); icon = QUOTE(PATHTOF(ui\Icon_Module_Repair_ca.paa)); category = "ACE"; - function = QUOTE(DFUNC(moduleAssignEngineer)); + function = QFUNC(moduleAssignEngineer); functionPriority = 10; isGlobal = 2; isTriggerActivated = 0; @@ -149,7 +148,7 @@ class CfgVehicles { displayName = CSTRING(AssignRepairVehicle_Module_DisplayName); icon = QUOTE(PATHTOF(ui\Icon_Module_Repair_ca.paa)); category = "ACE"; - function = QUOTE(DFUNC(moduleAssignRepairVehicle)); + function = QFUNC(moduleAssignRepairVehicle); functionPriority = 10; isGlobal = 2; isTriggerActivated = 0; @@ -186,7 +185,7 @@ class CfgVehicles { }; class ACE_moduleAssignRepairFacility: ACE_moduleAssignRepairVehicle { displayName = CSTRING(AssignRepairFacility_Module_DisplayName); - function = QUOTE(DFUNC(moduleAssignRepairFacility)); + function = QFUNC(moduleAssignRepairFacility); class Arguments { class EnableList { displayName = CSTRING(AssignRepairFacility_EnableList_DisplayName); @@ -221,7 +220,6 @@ class CfgVehicles { class LandVehicle; class Car: LandVehicle { MACRO_REPAIRVEHICLE - class ACE_Cargo { class Cargo { class ACE_Wheel { @@ -261,8 +259,8 @@ class CfgVehicles { }; class ACE_Track: ACE_RepairItem_Base { - ace_cargo_size = 2; - ace_cargo_canLoad = 1; + EGVAR(cargo,size) = 2; + EGVAR(cargo,canLoad) = 1; author = "Hawkins"; scope = 2; model = QUOTE(PATHTOF(data\ace_track.p3d)); @@ -270,8 +268,8 @@ class CfgVehicles { }; class ACE_Wheel: ACE_RepairItem_Base { - ace_cargo_size = 1; - ace_cargo_canLoad = 1; + EGVAR(cargo,size) = 1; + EGVAR(cargo,canLoad) = 1; author = "Hawkins"; scope = 2; model = QUOTE(PATHTOF(data\ace_wheel.p3d)); diff --git a/addons/repair/XEH_preInit.sqf b/addons/repair/XEH_preInit.sqf index 38de84a452..ebf4c87537 100644 --- a/addons/repair/XEH_preInit.sqf +++ b/addons/repair/XEH_preInit.sqf @@ -3,19 +3,18 @@ ADDON = false; PREP(addRepairActions); -PREP(canRemoveWheel); -PREP(canRemoveTrack); +PREP(canRemove); PREP(canRepair); PREP(canRepairTrack); -PREP(canReplaceWheel); PREP(canReplaceTrack); -PREP(doRemoveWheel); -PREP(doRemoveTrack); -PREP(doRepair); +PREP(canReplaceWheel); PREP(doFullRepair); +PREP(doRemoveTrack); +PREP(doRemoveWheel); +PREP(doRepair); PREP(doRepairTrack); -PREP(doReplaceWheel); PREP(doReplaceTrack); +PREP(doReplaceWheel); PREP(getPostRepairDamage); PREP(getWheelHitPointsWithSelections); PREP(hasItems); @@ -23,10 +22,10 @@ PREP(isEngineer); PREP(isInRepairFacility); PREP(isNearRepairVehicle); PREP(isRepairVehicle); -PREP(moduleRepairSettings); PREP(moduleAssignEngineer); PREP(moduleAssignRepairVehicle); PREP(moduleAssignRepairFacility); +PREP(moduleRepairSettings); PREP(normalizeHitPoints); PREP(repair); PREP(repair_failure); diff --git a/addons/repair/config.cpp b/addons/repair/config.cpp index 9d447ffe5f..d97f9e30e5 100644 --- a/addons/repair/config.cpp +++ b/addons/repair/config.cpp @@ -5,7 +5,7 @@ class CfgPatches { units[] = {"ACE_Wheel", "ACE_Track"}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ace_common","ace_interact_menu"}; + requiredAddons[] = {"ace_interaction"}; author[] = {"commy2", "Glowbal"}; authorUrl = "https://ace3mod.com"; VERSION_CONFIG; @@ -14,18 +14,9 @@ class CfgPatches { #include "CfgEventHandlers.hpp" +#include "CfgActions.hpp" #include "CfgVehicleClasses.hpp" #include "CfgVehicles.hpp" #include "ACE_Settings.hpp" -#include "ACE_repair.hpp" - -class CfgActions { - class None; - class Repair: None { - show = 0; - }; - class RepairVehicle: None { - show = 0; - }; -}; \ No newline at end of file +#include "ACE_Repair.hpp" diff --git a/addons/repair/functions/fnc_addRepairActions.sqf b/addons/repair/functions/fnc_addRepairActions.sqf index c267832298..3503dff3f0 100644 --- a/addons/repair/functions/fnc_addRepairActions.sqf +++ b/addons/repair/functions/fnc_addRepairActions.sqf @@ -1,12 +1,17 @@ /* * Author: commy2 - * Called from init eventhandler. Checks if the vehicles class already has the actions initialized. Otherwise add all available repair options. + * Checks if the vehicles class already has the actions initialized, otherwise add all available repair options. Calleed from init EH. * * Arguments: - * 0: vehicle + * 0: Vehicle * * Return Value: - * NONE + * None + * + * Example: + * [vehicle] call ace_repair_fnc_addRepairActions + * + * Public: No */ #include "script_component.hpp" #define TRACK_HITPOINTS ["HitLTrack", "HitRTrack"] diff --git a/addons/repair/functions/fnc_canRemoveTrack.sqf b/addons/repair/functions/fnc_canRemove.sqf similarity index 59% rename from addons/repair/functions/fnc_canRemoveTrack.sqf rename to addons/repair/functions/fnc_canRemove.sqf index e428ac00a8..9fa657a2bb 100644 --- a/addons/repair/functions/fnc_canRemoveTrack.sqf +++ b/addons/repair/functions/fnc_canRemove.sqf @@ -1,14 +1,19 @@ /* * Author: commy2 - * Check if the unit can remove given wheel of the vehicle. + * Check if the unit can remove given wheel/track of the vehicle. * * Arguments: * 0: Unit that does the repairing - * 1: vehicle to repair + * 1: Vehicle to repair * 2: Selected hitpoint * * Return Value: - * NONE + * Can Remove + * + * Example: + * [unit, vehicle, "hitpoint"] call ace_repair_fnc_canRemove + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/repair/functions/fnc_canRemoveWheel.sqf b/addons/repair/functions/fnc_canRemoveWheel.sqf deleted file mode 100644 index e428ac00a8..0000000000 --- a/addons/repair/functions/fnc_canRemoveWheel.sqf +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Author: commy2 - * Check if the unit can remove given wheel of the vehicle. - * - * Arguments: - * 0: Unit that does the repairing - * 1: vehicle to repair - * 2: Selected hitpoint - * - * Return Value: - * NONE - */ -#include "script_component.hpp" - -params ["_unit", "_target", "_hitPoint"]; -TRACE_3("params",_unit,_target,_hitPoint); - -alive _target && {_target getHitPointDamage _hitPoint < 1} diff --git a/addons/repair/functions/fnc_canRepair.sqf b/addons/repair/functions/fnc_canRepair.sqf index 4a8524e518..bb44a3dcd4 100644 --- a/addons/repair/functions/fnc_canRepair.sqf +++ b/addons/repair/functions/fnc_canRepair.sqf @@ -3,17 +3,19 @@ * Check if the repair action can be performed. * * Arguments: - * 0: The caller - * 1: The target - * 2: Selection name - * 3: ACE_Engineeral_Treatments Classname + * 0: Unit that does the repairing + * 1: Vehicle to repair + * 2: Selected hitpoint + * 3: Repair Action Classname * - * ReturnValue: - * Can Treat + * Return Value: + * Can Repair + * + * Example: + * ["something", player] call ace_repair_fnc_canRepair * * Public: Yes */ - #include "script_component.hpp" params ["_caller", "_target", "_hitPoint", "_className"]; @@ -30,7 +32,7 @@ _engineerRequired = if (isNumber (_config >> "requiredEngineer")) then { } else { // Check for required class if (isText (_config >> "requiredEngineer")) exitwith { - missionNamespace getvariable [(getText (_config >> "requiredEngineer")), 0]; + missionNamespace getVariable [(getText (_config >> "requiredEngineer")), 0]; }; 0; }; @@ -45,7 +47,7 @@ if (getText (_config >> "condition") != "") then { if (isnil _condition) then { _condition = compile _condition; } else { - _condition = missionNamespace getvariable _condition; + _condition = missionNamespace getVariable _condition; }; if (typeName _condition == "BOOL") then { _return = _condition; @@ -57,7 +59,7 @@ if (getText (_config >> "condition") != "") then { if (!_return) exitwith {false}; _vehicleStateCondition = if (isText(_config >> "vehicleStateCondition")) then { - missionNamespace getvariable [getText(_config >> "vehicleStateCondition"), 0] + missionNamespace getVariable [getText(_config >> "vehicleStateCondition"), 0] } else { getNumber(_config >> "vehicleStateCondition") }; @@ -76,7 +78,7 @@ _repairVeh = {([_caller] call FUNC(isNearRepairVehicle)) || ([_target] call FUNC if (_x == "RepairVehicle" && _repairVeh) exitwith {_return = true;}; if !(isnil _x) exitwith { private "_val"; - _val = missionNamespace getvariable _x; + _val = missionNamespace getVariable _x; if (typeName _val == "SCALAR") then { _return = switch (_val) do { case 0: {true}; //useAnywhere diff --git a/addons/repair/functions/fnc_canRepairTrack.sqf b/addons/repair/functions/fnc_canRepairTrack.sqf index 847715c5cb..34165068d7 100644 --- a/addons/repair/functions/fnc_canRepairTrack.sqf +++ b/addons/repair/functions/fnc_canRepairTrack.sqf @@ -3,12 +3,17 @@ * Check if the unit can replace 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 + * None + * + * Example: + * [unit, vehicle, "hitpoint"] call ace_repair_fnc_canRepairTrack + * + * Public: No */ #include "script_component.hpp" @@ -34,4 +39,3 @@ if (typeName _wheel == "OBJECT") then { if (isNull _wheel || damage _wheel >= 1) exitWith {false}; alive _target && {_target getHitPointDamage _hitPoint > 0} - diff --git a/addons/repair/functions/fnc_canReplaceTrack.sqf b/addons/repair/functions/fnc_canReplaceTrack.sqf index 8ced60d63e..94a62a5289 100644 --- a/addons/repair/functions/fnc_canReplaceTrack.sqf +++ b/addons/repair/functions/fnc_canReplaceTrack.sqf @@ -3,35 +3,40 @@ * Check if the unit can replace 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 + * 3: Track / (default: false) * * Return Value: - * NONE + * None + * + * Example: + * [unit, vehicle, "hitpoint"] call ace_repair_fnc_canReplaceTrack + * + * Public: No */ #include "script_component.hpp" -params ["_unit", "_target", "_hitPoint", ["_wheel",false]]; -TRACE_4("params",_unit,_target,_hitPoint,_wheel); -// TODO [_unit, _wheel] call EFUNC(common,claim); on start of action +params ["_unit", "_target", "_hitPoint", ["_track", false]]; +TRACE_4("params",_unit,_target,_hitPoint,_track); +// TODO [_unit, _track] call EFUNC(common,claim); on start of action -if (typeName _wheel == "OBJECT") then { +if (typeName _track == "OBJECT") then { // not near interpret as objNull - if !(_wheel in nearestObjects [_unit, ["ACE_Track"], 5]) then { - _wheel = objNull; + if !(_track in nearestObjects [_unit, ["ACE_Track"], 5]) then { + _track = objNull; }; } else { - _wheel = objNull; + _track = objNull; { if ([_unit, _x, ["isNotDragging", "isNotCarrying"]] call EFUNC(common,canInteractWith)) exitWith { - _wheel = _x; + _track = _x; }; } forEach nearestObjects [_unit, ["ACE_Track"], 5]; }; -if (isNull _wheel) exitWith {false}; +if (isNull _track) exitWith {false}; alive _target && {_target getHitPointDamage _hitPoint >= 1} - diff --git a/addons/repair/functions/fnc_canReplaceWheel.sqf b/addons/repair/functions/fnc_canReplaceWheel.sqf index 9251650e7f..9497504370 100644 --- a/addons/repair/functions/fnc_canReplaceWheel.sqf +++ b/addons/repair/functions/fnc_canReplaceWheel.sqf @@ -3,16 +3,22 @@ * Check if the unit can replace 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 + * 3: Wheel / (default: false) * * Return Value: - * NONE + * None + * + * Example: + * [unit, vehicle, "hitpoint"] call ace_repair_fnc_canReplaceWheel + * + * Public: No */ #include "script_component.hpp" -params ["_unit", "_target", "_hitPoint", ["_wheel",false]]; +params ["_unit", "_target", "_hitPoint", ["_wheel", false]]; TRACE_4("params",_unit,_target,_hitPoint,_wheel); // TODO [_unit, _wheel] call EFUNC(common,claim); on start of action //if !([_unit, _target, _hitpoint, "ReplaceWheel"] call FUNC(canRepair)) exitwith {false}; @@ -40,4 +46,3 @@ if (typeName _wheel == "OBJECT") then { if (isNull _wheel) exitWith {false}; alive _target && {_target getHitPointDamage _hitPoint >= 1} - diff --git a/addons/repair/functions/fnc_doFullRepair.sqf b/addons/repair/functions/fnc_doFullRepair.sqf index 24454bbd62..6beec4c4c7 100644 --- a/addons/repair/functions/fnc_doFullRepair.sqf +++ b/addons/repair/functions/fnc_doFullRepair.sqf @@ -1,13 +1,19 @@ /* * Author: Glowbal - * * Called by repair action / progress bar. Raise events to set the new hitpoint damage. * * Arguments: - * Stuff from progress bar. + * 0: Unit that does the repairing + * 1: Vehicle to repair + * 2: Selected hitpoint * * Return Value: - * NONE + * None + * + * Example: + * [unit, vehicle, "hitpoint"] call ace_repair_fnc_doFullRepair + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/repair/functions/fnc_doRemoveTrack.sqf b/addons/repair/functions/fnc_doRemoveTrack.sqf index 740edabf09..68755658ca 100644 --- a/addons/repair/functions/fnc_doRemoveTrack.sqf +++ b/addons/repair/functions/fnc_doRemoveTrack.sqf @@ -1,13 +1,19 @@ /* * Author: commy2 - * * Called by repair action / progress bar. Raise events to set the new hitpoint damage. * * Arguments: - * Stuff from progress bar. + * 0: Unit that does the repairing + * 1: Vehicle to repair + * 2: Selected hitpoint * * Return Value: - * NONE + * None + * + * Example: + * [unit, vehicle, "hitpoint"] call ace_repair_fnc_doRemoveTrack + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/repair/functions/fnc_doRemoveWheel.sqf b/addons/repair/functions/fnc_doRemoveWheel.sqf index 89fc76a341..0ffeb7ad23 100644 --- a/addons/repair/functions/fnc_doRemoveWheel.sqf +++ b/addons/repair/functions/fnc_doRemoveWheel.sqf @@ -1,13 +1,19 @@ /* * Author: commy2 - * * Called by repair action / progress bar. Raise events to set the new hitpoint damage. * * Arguments: - * Stuff from progress bar. + * 0: Unit that does the repairing + * 1: Vehicle to repair + * 2: Selected hitpoint * * Return Value: - * NONE + * None + * + * Example: + * [unit, vehicle, "hitpoint"] call ace_repair_fnc_doRemoveWheel + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/repair/functions/fnc_doRepair.sqf b/addons/repair/functions/fnc_doRepair.sqf index 8059003845..dfc21830c9 100644 --- a/addons/repair/functions/fnc_doRepair.sqf +++ b/addons/repair/functions/fnc_doRepair.sqf @@ -3,10 +3,17 @@ * Called by repair action / progress bar. Raise events to set the new hitpoint damage. * * Arguments: - * 0: Stuff from progress bar. + * 0: Unit that does the repairing + * 1: Vehicle to repair + * 2: Selected hitpoint * * Return Value: - * NONE + * None + * + * Example: + * [unit, vehicle, "hitpoint"] call ace_repair_fnc_doRepair + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/repair/functions/fnc_doRepairTrack.sqf b/addons/repair/functions/fnc_doRepairTrack.sqf index 621d933d64..4803518e3d 100644 --- a/addons/repair/functions/fnc_doRepairTrack.sqf +++ b/addons/repair/functions/fnc_doRepairTrack.sqf @@ -3,10 +3,18 @@ * Called by repair action / progress bar. Raise events to set the new hitpoint damage. * * Arguments: - * 0: Stuff from progress bar. + * 0: Unit that does the repairing + * 1: Vehicle to repair + * 2: Selected hitpoint + * 3: Repair Action Classname * * Return Value: - * NONE + * None + * + * Example: + * [unit, vehicle, "hitpoint", "classname"] call ace_repair_fnc_doRepairTrack + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/repair/functions/fnc_doReplaceTrack.sqf b/addons/repair/functions/fnc_doReplaceTrack.sqf index 224508684b..13e53b3f3a 100644 --- a/addons/repair/functions/fnc_doReplaceTrack.sqf +++ b/addons/repair/functions/fnc_doReplaceTrack.sqf @@ -3,10 +3,18 @@ * Called by repair action / progress bar. Raise events to set the new hitpoint damage. * * Arguments: - * 0: Stuff from progress bar. + * 0: Unit that does the repairing + * 1: Vehicle to repair + * 2: Selected hitpoint + * 3: Repair Action Classname * * Return Value: - * NONE + * None + * + * Example: + * [unit, vehicle, "hitpoint", "classname"] call ace_repair_fnc_doReplaceTrack + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/repair/functions/fnc_doReplaceWheel.sqf b/addons/repair/functions/fnc_doReplaceWheel.sqf index 5051699497..62db39aa6d 100644 --- a/addons/repair/functions/fnc_doReplaceWheel.sqf +++ b/addons/repair/functions/fnc_doReplaceWheel.sqf @@ -3,10 +3,18 @@ * Called by repair action / progress bar. Raise events to set the new hitpoint damage. * * Arguments: - * 0: Stuff from progress bar. + * 0: Unit that does the repairing + * 1: Vehicle to repair + * 2: Selected hitpoint + * 3: Repair Action Classname * * Return Value: - * NONE + * None + * + * Example: + * [unit, vehicle, "hitpoint", "classname"] call ace_repair_fnc_doReplaceWheel + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/repair/functions/fnc_getPostRepairDamage.sqf b/addons/repair/functions/fnc_getPostRepairDamage.sqf index c425f6569e..797f7a4f22 100644 --- a/addons/repair/functions/fnc_getPostRepairDamage.sqf +++ b/addons/repair/functions/fnc_getPostRepairDamage.sqf @@ -1,4 +1,18 @@ -// by comm2 +/* + * Author: commy2 + * Returns the damage threshold based on settings and unit type. + * + * Arguments: + * 0: Unit that does the repairing + * + * Return Value: + * 0: Rpair Damage Threshold + * + * Example: + * [unit] call ace_repair_fnc_getPostRepairDamage + * + * Public: No + */ #include "script_component.hpp" params ["_unit"]; diff --git a/addons/repair/functions/fnc_getWheelHitPointsWithSelections.sqf b/addons/repair/functions/fnc_getWheelHitPointsWithSelections.sqf index 6719047737..182c6f54f0 100644 --- a/addons/repair/functions/fnc_getWheelHitPointsWithSelections.sqf +++ b/addons/repair/functions/fnc_getWheelHitPointsWithSelections.sqf @@ -3,10 +3,16 @@ * Returns the wheel hitpoints and their selections. * * Arguments: - * 0: A vehicle + * 0: Vehicle * * Return Value: - * Wheel positions in model coordinates. + * 0: Wheel hitpoints + * 1: Wheel hitpoint selections in model coordinates + * + * Example: + * [unit, vehicle, "hitpoint"] call ace_repair_fnc_getWheelHitPointsWithSelections + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/repair/functions/fnc_hasItems.sqf b/addons/repair/functions/fnc_hasItems.sqf index 6167689faf..2f070c8bb6 100644 --- a/addons/repair/functions/fnc_hasItems.sqf +++ b/addons/repair/functions/fnc_hasItems.sqf @@ -3,28 +3,30 @@ * Check if the engineer has all items. * * Arguments: - * 0: Engineer - * 1: Patient - * 2: Items > + * 0: Unit that does the repairing + * 1: Items required * - * ReturnValue: - * Has the items + * Return Value: + * Has Items + * + * Example: + * [engineer, [items]] call ace_repair_fnc_hasItems * * Public: Yes */ #include "script_component.hpp" -params ["_engineer", "_items"]; -TRACE_2("params",_engineer,_items); +params ["_unit", "_items"]; +TRACE_2("params",_unit,_items); private ["_return"]; _return = true; { - if (typeName _x == "ARRAY" && {({[_engineer, _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" && {!([_engineer, _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_isEngineer.sqf b/addons/repair/functions/fnc_isEngineer.sqf index aa2368184a..9d6af3a1ff 100644 --- a/addons/repair/functions/fnc_isEngineer.sqf +++ b/addons/repair/functions/fnc_isEngineer.sqf @@ -1,13 +1,16 @@ /* * Author: Glowbal, KoffeinFlummi, commy2 - * Check if a unit is any engineer class + * Check if a unit is any engineer class. * * Arguments: - * 0: The Unit - * 1: Class + * 0: Unit + * 1: Class (default: 1) * - * ReturnValue: - * Is in of engineer class + * Return Value: + * Is Engineer Class + * + * Example: + * [unit, 1] call ace_repair_fnc_isEngineer * * Public: Yes */ @@ -23,4 +26,4 @@ _class = _unit getVariable ["ACE_IsEngineer", getNumber (configFile >> "CfgVehic // We cannot move this function to common because we require the GVAR(engineerSetting_Repair), which only makes sense to include in the repair module. if (typeName _class == "BOOL") then {_class = 1}; -_class >= (_engineerN min GVAR(engineerSetting_Repair)); \ No newline at end of file +_class >= (_engineerN min GVAR(engineerSetting_Repair)); diff --git a/addons/repair/functions/fnc_isInRepairFacility.sqf b/addons/repair/functions/fnc_isInRepairFacility.sqf index 725cddd4c2..0c062ff0b3 100644 --- a/addons/repair/functions/fnc_isInRepairFacility.sqf +++ b/addons/repair/functions/fnc_isInRepairFacility.sqf @@ -1,16 +1,18 @@ /* * Author: Glowbal - * Checks if a unit is in a repair facility + * Checks if a unit is in a repair facility. * * Arguments: - * 0: The Unit + * 0: Unit * - * ReturnValue: + * Return Value: * Is inside a repair facility * + * Example: + * [unit] call ace_repair_fnc_isInRepairFacility + * * Public: Yes */ - #include "script_component.hpp" params ["_object"]; diff --git a/addons/repair/functions/fnc_isNearRepairVehicle.sqf b/addons/repair/functions/fnc_isNearRepairVehicle.sqf index 126a0c40cb..677f489a88 100644 --- a/addons/repair/functions/fnc_isNearRepairVehicle.sqf +++ b/addons/repair/functions/fnc_isNearRepairVehicle.sqf @@ -1,16 +1,18 @@ /* * Author: KoffeinFlummi - * Checks if a unit is in a engineeral vehicle. + * Checks if a unit is near an engineering vehicle. * * Arguments: - * 0: unit to be checked + * 0: Unit * * Return Value: - * Is unit in engineeral vehicle? + * Is near engineering vehicle + * + * Example: + * [unit] call ace_repair_fnc_isNearRepairVehicle * * Public: Yes */ - #include "script_component.hpp" params ["_unit"]; diff --git a/addons/repair/functions/fnc_isRepairVehicle.sqf b/addons/repair/functions/fnc_isRepairVehicle.sqf index 72da9783d1..121bda0fe3 100644 --- a/addons/repair/functions/fnc_isRepairVehicle.sqf +++ b/addons/repair/functions/fnc_isRepairVehicle.sqf @@ -1,12 +1,15 @@ /* * Author: Glowbal - * Check if vehicle is a engineeral vehicle + * Check if vehicle is a engineering vehicle. * * Arguments: - * 0: The Vehicle + * 0: Vehicle * * ReturnValue: - * Is in of engineer class + * Is engineering vehicle + * + * Example: + * [vehicle] call ace_repair_fnc_isRepairVehicle * * Public: Yes */ diff --git a/addons/repair/functions/fnc_moduleAssignEngineer.sqf b/addons/repair/functions/fnc_moduleAssignEngineer.sqf index e5310bfa5a..9fb9ed8431 100644 --- a/addons/repair/functions/fnc_moduleAssignEngineer.sqf +++ b/addons/repair/functions/fnc_moduleAssignEngineer.sqf @@ -1,26 +1,28 @@ /* * Author: Glowbal - * Assign an engineer role to a unit + * Assign an engineer role to a unit. * * Arguments: - * 0: The module logic - * 1: units - * 2: activated + * 0: The module logic + * 1: Synchronized units + * 2: Activated * * Return Value: - * None + * None + * + * Example: + * function = "ace_repair_fnc_moduleAssignEngineer" * * Public: No */ - #include "script_component.hpp" params ["_logic"]; if (!isNull _logic) then { private ["_list", "_setting"]; - _list = _logic getvariable ["EnableList",""]; - _setting = _logic getvariable ["role",0]; + _list = _logic getVariable ["EnableList",""]; + _setting = _logic getVariable ["role",0]; [_list, "ACE_IsEngineer", _setting, true] call EFUNC(common,assignObjectsInList); [synchronizedObjects _logic, "ACE_IsEngineer", _setting, true] call EFUNC(common,assignObjectsInList); diff --git a/addons/repair/functions/fnc_moduleAssignRepairFacility.sqf b/addons/repair/functions/fnc_moduleAssignRepairFacility.sqf index e9e60f4190..00cb847866 100644 --- a/addons/repair/functions/fnc_moduleAssignRepairFacility.sqf +++ b/addons/repair/functions/fnc_moduleAssignRepairFacility.sqf @@ -1,26 +1,28 @@ /* * Author: Glowbal - * Assign an repair facility + * Assign a repair facility. * * Arguments: - * 0: The module logic - * 1: units - * 2: activated + * 0: The module logic + * 1: Synchronized units + * 2: Activated * * Return Value: - * None + * None + * + * Example: + * function = "ace_repair_fnc_moduleAssignRepairFacility" * * Public: No */ - #include "script_component.hpp" params ["_logic"]; if (!isNull _logic) then { private ["_list", "_setting"]; - _list = _logic getvariable ["EnableList",""]; - _setting = _logic getvariable ["role",0]; + _list = _logic getVariable ["EnableList",""]; + _setting = _logic getVariable ["role",0]; [_list, "ACE_isRepairFacility", _setting, true] call EFUNC(common,assignObjectsInList); [synchronizedObjects _logic, "ACE_isRepairFacility", _setting, true] call EFUNC(common,assignObjectsInList); diff --git a/addons/repair/functions/fnc_moduleAssignRepairVehicle.sqf b/addons/repair/functions/fnc_moduleAssignRepairVehicle.sqf index 991de2d8d6..69d2a2c52f 100644 --- a/addons/repair/functions/fnc_moduleAssignRepairVehicle.sqf +++ b/addons/repair/functions/fnc_moduleAssignRepairVehicle.sqf @@ -1,26 +1,28 @@ /* * Author: Glowbal - * Assign an repair vehicle + * Assign a repair vehicle. * * Arguments: - * 0: The module logic - * 1: units - * 2: activated + * 0: The module logic + * 1: Synchronized units + * 2: Activated * * Return Value: - * None + * None + * + * Example: + * function = "ace_repair_fnc_moduleAssignRepairVehicle" * * Public: No */ - #include "script_component.hpp" params ["_logic"]; if (!isNull _logic) then { private ["_list", "_setting"]; - _list = _logic getvariable ["EnableList",""]; - _setting = _logic getvariable ["role",0]; + _list = _logic getVariable ["EnableList",""]; + _setting = _logic getVariable ["role",0]; [_list, "ACE_isRepairVehicle", _setting, true] call EFUNC(common,assignObjectsInList); [synchronizedObjects _logic, "ACE_isRepairVehicle", _setting, true] call EFUNC(common,assignObjectsInList); diff --git a/addons/repair/functions/fnc_moduleRepairSettings.sqf b/addons/repair/functions/fnc_moduleRepairSettings.sqf index 7517d819c5..3b97d2f168 100644 --- a/addons/repair/functions/fnc_moduleRepairSettings.sqf +++ b/addons/repair/functions/fnc_moduleRepairSettings.sqf @@ -1,12 +1,17 @@ /* * Author: commy2 - * Module for adjusting the repair damage settings + * Adjusts repair damage settings. * * Arguments: - * 0: The module logic + * 0: The module logic + * 1: Synchronized units + * 2: Activated * * Return Value: - * None + * None + * + * Example: + * function = "ace_repair_fnc_moduleRepairSettings" * * Public: No */ diff --git a/addons/repair/functions/fnc_normalizeHitPoints.sqf b/addons/repair/functions/fnc_normalizeHitPoints.sqf index 7a39940794..88c72f4de8 100644 --- a/addons/repair/functions/fnc_normalizeHitPoints.sqf +++ b/addons/repair/functions/fnc_normalizeHitPoints.sqf @@ -3,29 +3,31 @@ * 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. + * 0: Local Vehicle * * Return Value: - * NONE + * None + * + * Example: + * [vehicle] call ace_repair_fnc_normalizeHitPoints + * + * Public: No */ #include "script_component.hpp" params ["_vehicle"]; TRACE_1("params",_vehicle); -// can't execute all commands if the vehicle isn't local. exit here. +// Can't execute all commands if the vehicle isn't local, exit if that's so if !(local _vehicle) exitWith {}; -private ["_hitPoints", "_config"]; +private ["_hitPoints", "_config", "_dependentHitPoints", "_dependentHitPointScripts", "_damage"]; _hitPoints = [_vehicle] call EFUNC(common,getHitPoints); - _config = configFile >> "CfgVehicles" >> typeOf _vehicle >> "HitPoints"; // define global variables. Needed to parse the depends config entries. Also find dependent hitpoints. -private ["_dependentHitPoints", "_dependentHitPointScripts"]; - _dependentHitPoints = []; _dependentHitPointScripts = []; @@ -33,21 +35,14 @@ 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; // apply normalized damage to all dependand hitpoints - { - private "_damage"; - _damage = call (_dependentHitPointScripts select _forEachIndex); - _vehicle setHitPointDamage [_x, _damage]; - } forEach _dependentHitPoints; diff --git a/addons/repair/functions/fnc_repair.sqf b/addons/repair/functions/fnc_repair.sqf index 3eb8f77ca6..92af5df80e 100644 --- a/addons/repair/functions/fnc_repair.sqf +++ b/addons/repair/functions/fnc_repair.sqf @@ -1,19 +1,21 @@ /* * Author: Glowbal, KoffeinFlummi - * Starts the repair process + * Starts the repair process. * * Arguments: - * 0: The engineer - * 1: The patient - * 2: SelectionName - * 3: repair classname + * 0: Unit that does the repairing + * 1: Vehicle to repair + * 3: Repair Action Classname * * Return Value: - * Succesful repair started + * Succesful Repair Started + * + * Example: + * [unit, vehicle, "hitpoint", "classname"] call ace_repair_fnc_repair * * Public: Yes */ - #include "script_component.hpp" params ["_caller", "_target", "_hitPoint", "_className"]; @@ -29,7 +31,7 @@ _engineerRequired = if (isNumber (_config >> "requiredEngineer")) then { } else { // Check for required class if (isText (_config >> "requiredEngineer")) exitwith { - missionNamespace getvariable [(getText (_config >> "requiredEngineer")), 0]; + missionNamespace getVariable [(getText (_config >> "requiredEngineer")), 0]; }; 0; }; @@ -44,7 +46,7 @@ if (getText (_config >> "condition") != "") then { if (isnil _condition) then { _condition = compile _condition; } else { - _condition = missionNamespace getvariable _condition; + _condition = missionNamespace getVariable _condition; }; if (typeName _condition == "BOOL") then { _return = _condition; @@ -55,7 +57,7 @@ if (getText (_config >> "condition") != "") then { if (!_return) exitwith {false}; _vehicleStateCondition = if (isText(_config >> "vehicleStateCondition")) then { - missionNamespace getvariable [getText(_config >> "vehicleStateCondition"), 0] + missionNamespace getVariable [getText(_config >> "vehicleStateCondition"), 0] } else { getNumber(_config >> "vehicleStateCondition") }; @@ -74,7 +76,7 @@ _repairVeh = {([_caller] call FUNC(isNearRepairVehicle)) || ([_target] call FUNC if (_x == "RepairVehicle" && _repairVeh) exitwith {_return = true;}; if !(isnil _x) exitwith { private "_val"; - _val = missionNamespace getvariable _x; + _val = missionNamespace getVariable _x; if (typeName _val == "SCALAR") then { _return = switch (_val) do { case 0: {true}; //useAnywhere @@ -94,7 +96,7 @@ _consumeItems = if (isNumber (_config >> "itemConsumed")) then { } else { // Check for required class if (isText (_config >> "itemConsumed")) exitwith { - missionNamespace getvariable [(getText (_config >> "itemConsumed")), 0]; + missionNamespace getVariable [(getText (_config >> "itemConsumed")), 0]; }; 0; }; @@ -112,7 +114,7 @@ if (_callbackProgress == "") then { if (isNil _callbackProgress) then { _callbackProgress = compile _callbackProgress; } else { - _callbackProgress = missionNamespace getvariable _callbackProgress; + _callbackProgress = missionNamespace getVariable _callbackProgress; }; @@ -152,7 +154,7 @@ _repairTime = if (isNumber (_config >> "repairingTime")) then { if (isnil _repairTimeConfig) then { _repairTimeConfig = compile _repairTimeConfig; } else { - _repairTimeConfig = missionNamespace getvariable _repairTimeConfig; + _repairTimeConfig = missionNamespace getVariable _repairTimeConfig; }; if (typeName _repairTimeConfig == "SCALAR") exitwith { _repairTimeConfig; diff --git a/addons/repair/functions/fnc_repairVehicle.sqf b/addons/repair/functions/fnc_repairVehicle.sqf deleted file mode 100644 index becdcb366d..0000000000 --- a/addons/repair/functions/fnc_repairVehicle.sqf +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Author: commy2 - * - * Start a repair action and open progress bar. - * - * Arguments: - * 0: Unit that does the repairing (Object) - * 1: vehicle to repair (Object) - * 2: Selected hitpoint (String) - * - * Return Value: - * NONE - */ -#include "script_component.hpp" - -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 {}; - -// calculate time to fully repair the hitpoint -private ["_damage", "_time"]; - -_damage = _vehicle getHitPointDamage _hitPoint; - -_time = (5 + 10 * _damage) * ([1.5, 1] select ([_unit, GVAR(engineerSetting_Repair) + 1] call FUNC(isEngineer))); - -// get string of the hitpoint -private "_text"; -_text = format ["STR_ACE_Repair_%1", _hitPoint]; - -if (isLocalized _text) then { - _text = format [localize LSTRING(RepairingHitPoint), localize _text]; -} else { - _text = localize LSTRING(Repairing); -}; - -// open the loading bar -[_time, [_unit, _vehicle, _hitPoint], {_this call DFUNC(doRepair)}, {_this call DFUNC(doRepair)}, _text, {(_this select 0) call DFUNC(canRepair)}, []] call EFUNC(common,progressBar); - -// do animation -[_unit] call EFUNC(common,goKneeling); - -// @todo play sound diff --git a/addons/repair/functions/fnc_repair_failure.sqf b/addons/repair/functions/fnc_repair_failure.sqf index b1f62cecb9..6e27ab07a7 100644 --- a/addons/repair/functions/fnc_repair_failure.sqf +++ b/addons/repair/functions/fnc_repair_failure.sqf @@ -1,16 +1,21 @@ /* * Author: KoffeinFlummi, Glowbal - * Callback when the repair fails + * Callback when repair fails. * * Arguments: - * 0: The engineer - * 1: The patient - * 2: SelectionName - * 3: Treatment classname - * 4: Items available > + * 0: Arguments + * 0: Unit that does the repairing + * 1: Vehicle to repair + * 3: Repair Action Classname + * 4: None + * 5: Items available * * Return Value: - * nil + * None + * + * Example: + * [[unit, vehicle, "hitpoint", "classname", nil, [items]]] call ace_repair_fnc_repair_failure * * Public: No */ @@ -26,11 +31,11 @@ if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then { _caller removeWeapon "ACE_FakePrimaryWeapon"; }; if (vehicle _caller == _caller) then { - [_caller, _caller getvariable [QGVAR(repairPrevAnimCaller), ""], 2] call EFUNC(common,doAnimation); + [_caller, _caller getVariable [QGVAR(repairPrevAnimCaller), ""], 2] call EFUNC(common,doAnimation); }; _caller setvariable [QGVAR(repairPrevAnimCaller), nil]; -_weaponSelect = (_caller getvariable [QGVAR(selectedWeaponOnrepair), ""]); +_weaponSelect = (_caller getVariable [QGVAR(selectedWeaponOnrepair), ""]); if (_weaponSelect != "") then { _caller selectWeapon _weaponSelect; } else { @@ -48,7 +53,7 @@ _callback = getText (_config >> "callbackFailure"); if (isNil _callback) then { _callback = compile _callback; } else { - _callback = missionNamespace getvariable _callback; + _callback = missionNamespace getVariable _callback; }; _args call _callback; diff --git a/addons/repair/functions/fnc_repair_success.sqf b/addons/repair/functions/fnc_repair_success.sqf index 7b19ef64de..ccad93663f 100644 --- a/addons/repair/functions/fnc_repair_success.sqf +++ b/addons/repair/functions/fnc_repair_success.sqf @@ -1,20 +1,22 @@ /* * Author: KoffeinFlummi, Glowbal - * Callback when the repair is completed + * Callback when repair completes. * * Arguments: - * 0: The engineer - * 1: The patient - * 2: SelectionName - * 3: Treatment classname - * 4: Items available > + * 0: Arguments + * 0: Unit that does the repairing + * 1: Vehicle to repair + * 3: Repair Action Classname * * Return Value: - * nil + * None + * + * Example: + * [[unit, vehicle, "hitpoint", "classname"]] call ace_repair_fnc_repair_success * * Public: No */ - #include "script_component.hpp" params ["_args"]; @@ -27,11 +29,11 @@ if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then { _caller removeWeapon "ACE_FakePrimaryWeapon"; }; if (vehicle _caller == _caller) then { - [_caller, _caller getvariable [QGVAR(repairPrevAnimCaller), ""], 2] call EFUNC(common,doAnimation); + [_caller, _caller getVariable [QGVAR(repairPrevAnimCaller), ""], 2] call EFUNC(common,doAnimation); }; _caller setvariable [QGVAR(repairPrevAnimCaller), nil]; -_weaponSelect = (_caller getvariable [QGVAR(selectedWeaponOnrepair), ""]); +_weaponSelect = (_caller getVariable [QGVAR(selectedWeaponOnrepair), ""]); if (_weaponSelect != "") then { _caller selectWeapon _weaponSelect; } else { @@ -45,7 +47,7 @@ _callback = getText (_config >> "callbackSuccess"); if (isNil _callback) then { _callback = compile _callback; } else { - _callback = missionNamespace getvariable _callback; + _callback = missionNamespace getVariable _callback; }; _args call _callback; diff --git a/addons/repair/functions/fnc_setDamage.sqf b/addons/repair/functions/fnc_setDamage.sqf index c739a2c9fc..410a9b0396 100644 --- a/addons/repair/functions/fnc_setDamage.sqf +++ b/addons/repair/functions/fnc_setDamage.sqf @@ -1,13 +1,18 @@ /* * Author: commy2 - * Sets the structural damage of a vehicle without altering the hitPoints. Requires local vehicle. + * Sets the structural damage of a vehicle without altering the hitPoints, requires local vehicle. * * Arguments: - * 0: vehicle to damage - * 1: Total damage + * 0: Local Vehicle to Damage + * 1: Total Damage * * Return Value: - * NONE + * None + * + * Example: + * [vehicle, 0.5] call ace_repair_fnc_setDamage + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/repair/functions/fnc_setHitPointDamage.sqf b/addons/repair/functions/fnc_setHitPointDamage.sqf index d4595960e4..a8b4cd347b 100644 --- a/addons/repair/functions/fnc_setHitPointDamage.sqf +++ b/addons/repair/functions/fnc_setHitPointDamage.sqf @@ -1,14 +1,19 @@ /* * Author: commy2 - * Set the hitpoint damage and change the structural damage acordingly. Requires local vehicle. + * Set the hitpoint damage and change the structural damage acordingly, requires local vehicle. * * Arguments: - * 0: vehicle - * 1: hitpoint - * 2: damage + * 0: Local Vehicle to Damage + * 1: Selected hitpoint + * 2: Total Damage * * Return Value: - * NONE + * None + * + * Example: + * [vehicle, "hitpoint", 0.5] call ace_repair_fnc_setHitPointDamage + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/repair/functions/fnc_spawnObject.sqf b/addons/repair/functions/fnc_spawnObject.sqf index efe64ec9d5..1ea4b7363a 100644 --- a/addons/repair/functions/fnc_spawnObject.sqf +++ b/addons/repair/functions/fnc_spawnObject.sqf @@ -1,4 +1,20 @@ -// by commy2 +/* + * Author: commy2 + * Spawns an object of specified string, at specified position with specified damage taken. + * + * Arguments: + * 0: Item classname + * 1: Position + * 2: Damage + * + * Return Value: + * None + * + * Example: + * ["classname", [0, 0, 0], 1] call ace_repair_fnc_spawnObject + * + * Public: No + */ #include "script_component.hpp" params ["_item", "_position", ["_damage", 0]]; diff --git a/addons/repair/functions/fnc_useItem.sqf b/addons/repair/functions/fnc_useItem.sqf index 2309c25bd8..218a7a1ee4 100644 --- a/addons/repair/functions/fnc_useItem.sqf +++ b/addons/repair/functions/fnc_useItem.sqf @@ -3,22 +3,24 @@ * Use Equipment if any is available. * * Arguments: - * 0: Engineer - * 2: Item + * 0: Unit + * 2: Item classname * * ReturnValue: - * + * None + * + * Example: + * [unit, "classname"] call ace_repair_fnc_useItem * * Public: Yes */ - #include "script_component.hpp" -params ["_engineer", "_item"]; -TRACE_2("params",_engineer,_item); +params ["_unit", "_item"]; +TRACE_2("params",_unit,_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 */ - [true, _engineer]; +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]; }; [false, objNull]; diff --git a/addons/repair/functions/fnc_useItems.sqf b/addons/repair/functions/fnc_useItems.sqf index cf27105190..f8aa176018 100644 --- a/addons/repair/functions/fnc_useItems.sqf +++ b/addons/repair/functions/fnc_useItems.sqf @@ -3,19 +3,21 @@ * Use Equipment items if any is available. * * Arguments: - * 0: Engineer - * 1: Items > + * 0: Unit + * 1: Item classnames * * ReturnValue: - * + * None + * + * Example: + * [unit, ["classname1", "classname2"]] call ace_repair_fnc_useItems * * Public: Yes */ - #include "script_component.hpp" -params ["_engineer", "_items"]; -TRACE_2("params",_engineer,_items); +params ["_unit", "_items"]; +TRACE_2("params",_unit,_items); private ["_itemUsedInfo", "_itemsUsedBy"]; @@ -24,14 +26,14 @@ _itemsUsedBy = []; // handle a one of type use item if (typeName _x == "ARRAY") then { { - _itemUsedInfo = [_engineer, _x] call FUNC(useItem); + _itemUsedInfo = [_unit, _x] call FUNC(useItem); if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]}; } forEach _x; }; // handle required item if (typeName _x == "STRING") then { - _itemUsedInfo = [_engineer, _x] call FUNC(useItem); + _itemUsedInfo = [_unit, _x] call FUNC(useItem); if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]}; }; } forEach _items; diff --git a/addons/repair/functions/script_component.hpp b/addons/repair/functions/script_component.hpp index ea8f8ef9f9..80a7b2eb74 100644 --- a/addons/repair/functions/script_component.hpp +++ b/addons/repair/functions/script_component.hpp @@ -1 +1 @@ -#include "\z\ace\addons\repair\script_component.hpp" \ No newline at end of file +#include "\z\ace\addons\repair\script_component.hpp"