From 701c98e0da35bb4b3e02a285caa914bbad773d84 Mon Sep 17 00:00:00 2001 From: jonpas Date: Sun, 16 Aug 2015 20:14:54 +0200 Subject: [PATCH] Cleaned up repair function headers and some code --- .../repair/functions/fnc_addRepairActions.sqf | 11 ++++++--- .../repair/functions/fnc_canRemoveTrack.sqf | 9 ++++++-- .../repair/functions/fnc_canRemoveWheel.sqf | 9 ++++++-- addons/repair/functions/fnc_canRepair.sqf | 16 +++++++------ .../repair/functions/fnc_canRepairTrack.sqf | 14 +++++++---- .../repair/functions/fnc_canReplaceTrack.sqf | 14 +++++++---- .../repair/functions/fnc_canReplaceWheel.sqf | 14 +++++++---- addons/repair/functions/fnc_doFullRepair.sqf | 12 +++++++--- addons/repair/functions/fnc_doRemoveTrack.sqf | 12 +++++++--- addons/repair/functions/fnc_doRemoveWheel.sqf | 12 +++++++--- addons/repair/functions/fnc_doRepair.sqf | 11 +++++++-- addons/repair/functions/fnc_doRepairTrack.sqf | 12 ++++++++-- .../repair/functions/fnc_doReplaceTrack.sqf | 12 ++++++++-- .../repair/functions/fnc_doReplaceWheel.sqf | 12 ++++++++-- .../functions/fnc_getPostRepairDamage.sqf | 16 ++++++++++++- .../fnc_getWheelHitPointsWithSelections.sqf | 10 ++++++-- addons/repair/functions/fnc_hasItems.sqf | 20 ++++++++-------- addons/repair/functions/fnc_isEngineer.sqf | 15 +++++++----- .../functions/fnc_isInRepairFacility.sqf | 10 ++++---- .../functions/fnc_isNearRepairVehicle.sqf | 10 ++++---- .../repair/functions/fnc_isRepairVehicle.sqf | 9 +++++--- .../functions/fnc_moduleAssignEngineer.sqf | 14 ++++++----- .../fnc_moduleAssignRepairFacility.sqf | 14 ++++++----- .../fnc_moduleAssignRepairVehicle.sqf | 14 ++++++----- .../functions/fnc_moduleRepairSettings.sqf | 11 ++++++--- .../functions/fnc_normalizeHitPoints.sqf | 23 ++++++++----------- addons/repair/functions/fnc_repair.sqf | 16 +++++++------ addons/repair/functions/fnc_repairVehicle.sqf | 16 ++++++++----- .../repair/functions/fnc_repair_failure.sqf | 19 +++++++++------ .../repair/functions/fnc_repair_success.sqf | 18 ++++++++------- addons/repair/functions/fnc_setDamage.sqf | 13 +++++++---- .../functions/fnc_setHitPointDamage.sqf | 15 ++++++++---- addons/repair/functions/fnc_spawnObject.sqf | 18 ++++++++++++++- addons/repair/functions/fnc_useItem.sqf | 20 ++++++++-------- addons/repair/functions/fnc_useItems.sqf | 18 ++++++++------- addons/repair/functions/script_component.hpp | 2 +- 36 files changed, 325 insertions(+), 166 deletions(-) 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_canRemoveTrack.sqf index e428ac00a8..ef1e3a6a00 100644 --- a/addons/repair/functions/fnc_canRemoveTrack.sqf +++ b/addons/repair/functions/fnc_canRemoveTrack.sqf @@ -4,11 +4,16 @@ * * Arguments: * 0: Unit that does the repairing - * 1: vehicle to repair + * 1: Vehicle to repair * 2: Selected hitpoint * * Return Value: - * NONE + * None + * + * Example: + * [unit, vehicle, "hitpoint"] call ace_repair_fnc_canRemoveTrack + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/repair/functions/fnc_canRemoveWheel.sqf b/addons/repair/functions/fnc_canRemoveWheel.sqf index e428ac00a8..079f5e1fff 100644 --- a/addons/repair/functions/fnc_canRemoveWheel.sqf +++ b/addons/repair/functions/fnc_canRemoveWheel.sqf @@ -4,11 +4,16 @@ * * Arguments: * 0: Unit that does the repairing - * 1: vehicle to repair + * 1: Vehicle to repair * 2: Selected hitpoint * * Return Value: - * NONE + * None + * + * Example: + * [unit, vehicle, "hitpoint"] call ace_repair_fnc_canRemoveWheel + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/repair/functions/fnc_canRepair.sqf b/addons/repair/functions/fnc_canRepair.sqf index 19d1ccce88..aadbea57c9 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"]; 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..0d584e0544 100644 --- a/addons/repair/functions/fnc_canReplaceTrack.sqf +++ b/addons/repair/functions/fnc_canReplaceTrack.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, "hipoint"] call ace_repair_fnc_canReplaceTrack + * + * Public: No */ #include "script_component.hpp" @@ -34,4 +39,3 @@ if (typeName _wheel == "OBJECT") then { if (isNull _wheel) 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..2c4339ea18 100644 --- a/addons/repair/functions/fnc_canReplaceWheel.sqf +++ b/addons/repair/functions/fnc_canReplaceWheel.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_canReplaceWheel + * + * Public: No */ #include "script_component.hpp" @@ -40,4 +45,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..453ba5b229 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 (Optional) * - * 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 a273b2a750..9fb9ed8431 100644 --- a/addons/repair/functions/fnc_moduleAssignEngineer.sqf +++ b/addons/repair/functions/fnc_moduleAssignEngineer.sqf @@ -1,18 +1,20 @@ /* * 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"]; diff --git a/addons/repair/functions/fnc_moduleAssignRepairFacility.sqf b/addons/repair/functions/fnc_moduleAssignRepairFacility.sqf index 2c1020f48a..00cb847866 100644 --- a/addons/repair/functions/fnc_moduleAssignRepairFacility.sqf +++ b/addons/repair/functions/fnc_moduleAssignRepairFacility.sqf @@ -1,18 +1,20 @@ /* * 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"]; diff --git a/addons/repair/functions/fnc_moduleAssignRepairVehicle.sqf b/addons/repair/functions/fnc_moduleAssignRepairVehicle.sqf index 77b4d10f7a..69d2a2c52f 100644 --- a/addons/repair/functions/fnc_moduleAssignRepairVehicle.sqf +++ b/addons/repair/functions/fnc_moduleAssignRepairVehicle.sqf @@ -1,18 +1,20 @@ /* * 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"]; 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 91ae0c6c46..68dd93d083 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"]; diff --git a/addons/repair/functions/fnc_repairVehicle.sqf b/addons/repair/functions/fnc_repairVehicle.sqf index becdcb366d..8313e4cdf1 100644 --- a/addons/repair/functions/fnc_repairVehicle.sqf +++ b/addons/repair/functions/fnc_repairVehicle.sqf @@ -1,15 +1,19 @@ /* * Author: commy2 - * - * Start a repair action and open progress bar. + * Starts a repair action with a 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 * * Return Value: - * NONE + * None + * + * Example: + * [unit, vehicle, "hitpoint"] call ace_repair_fnc_repairVehicle + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/repair/functions/fnc_repair_failure.sqf b/addons/repair/functions/fnc_repair_failure.sqf index e478fca3f9..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 */ diff --git a/addons/repair/functions/fnc_repair_success.sqf b/addons/repair/functions/fnc_repair_success.sqf index 5cbe045685..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"]; 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"