Cleaned up repair function headers and some code

This commit is contained in:
jonpas 2015-08-16 20:14:54 +02:00
parent 85cc662fa4
commit 701c98e0da
36 changed files with 325 additions and 166 deletions

View File

@ -1,12 +1,17 @@
/* /*
* Author: commy2 * 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: * Arguments:
* 0: vehicle <OBJECT> * 0: Vehicle <OBJECT>
* *
* Return Value: * Return Value:
* NONE * None
*
* Example:
* [vehicle] call ace_repair_fnc_addRepairActions
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
#define TRACK_HITPOINTS ["HitLTrack", "HitRTrack"] #define TRACK_HITPOINTS ["HitLTrack", "HitRTrack"]

View File

@ -4,11 +4,16 @@
* *
* Arguments: * Arguments:
* 0: Unit that does the repairing <OBJECT> * 0: Unit that does the repairing <OBJECT>
* 1: vehicle to repair <OBJECT> * 1: Vehicle to repair <OBJECT>
* 2: Selected hitpoint <STRING> * 2: Selected hitpoint <STRING>
* *
* Return Value: * Return Value:
* NONE * None
*
* Example:
* [unit, vehicle, "hitpoint"] call ace_repair_fnc_canRemoveTrack
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"

View File

@ -4,11 +4,16 @@
* *
* Arguments: * Arguments:
* 0: Unit that does the repairing <OBJECT> * 0: Unit that does the repairing <OBJECT>
* 1: vehicle to repair <OBJECT> * 1: Vehicle to repair <OBJECT>
* 2: Selected hitpoint <STRING> * 2: Selected hitpoint <STRING>
* *
* Return Value: * Return Value:
* NONE * None
*
* Example:
* [unit, vehicle, "hitpoint"] call ace_repair_fnc_canRemoveWheel
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"

View File

@ -3,17 +3,19 @@
* Check if the repair action can be performed. * Check if the repair action can be performed.
* *
* Arguments: * Arguments:
* 0: The caller <OBJECT> * 0: Unit that does the repairing <OBJECT>
* 1: The target <OBJECT> * 1: Vehicle to repair <OBJECT>
* 2: Selection name <STRING> * 2: Selected hitpoint <STRING>
* 3: ACE_Engineeral_Treatments Classname <STRING> * 3: Repair Action Classname <STRING>
* *
* ReturnValue: * Return Value:
* Can Treat <BOOL> * Can Repair <BOOL>
*
* Example:
* ["something", player] call ace_repair_fnc_canRepair
* *
* Public: Yes * Public: Yes
*/ */
#include "script_component.hpp" #include "script_component.hpp"
params ["_caller", "_target", "_hitPoint", "_className"]; params ["_caller", "_target", "_hitPoint", "_className"];

View File

@ -3,12 +3,17 @@
* Check if the unit can replace given wheel of the vehicle. * Check if the unit can replace given wheel of the vehicle.
* *
* Arguments: * Arguments:
* 0: Unit that does the repairing (Object) * 0: Unit that does the repairing <OBJECT>
* 1: vehicle to repair (Object) * 1: Vehicle to repair <OBJECT>
* 2: Selected hitpoint (String) * 2: Selected hitpoint <STRING>
* *
* Return Value: * Return Value:
* NONE * None
*
* Example:
* [unit, vehicle, "hitpoint"] call ace_repair_fnc_canRepairTrack
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
@ -34,4 +39,3 @@ if (typeName _wheel == "OBJECT") then {
if (isNull _wheel || damage _wheel >= 1) exitWith {false}; if (isNull _wheel || damage _wheel >= 1) exitWith {false};
alive _target && {_target getHitPointDamage _hitPoint > 0} alive _target && {_target getHitPointDamage _hitPoint > 0}

View File

@ -3,12 +3,17 @@
* Check if the unit can replace given wheel of the vehicle. * Check if the unit can replace given wheel of the vehicle.
* *
* Arguments: * Arguments:
* 0: Unit that does the repairing (Object) * 0: Unit that does the repairing <OBJECT>
* 1: vehicle to repair (Object) * 1: Vehicle to repair <OBJECT>
* 2: Selected hitpoint (String) * 2: Selected hitpoint <STRING>
* *
* Return Value: * Return Value:
* NONE * None
*
* Example:
* [unit, vehicle, "hipoint"] call ace_repair_fnc_canReplaceTrack
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
@ -34,4 +39,3 @@ if (typeName _wheel == "OBJECT") then {
if (isNull _wheel) exitWith {false}; if (isNull _wheel) exitWith {false};
alive _target && {_target getHitPointDamage _hitPoint >= 1} alive _target && {_target getHitPointDamage _hitPoint >= 1}

View File

@ -3,12 +3,17 @@
* Check if the unit can replace given wheel of the vehicle. * Check if the unit can replace given wheel of the vehicle.
* *
* Arguments: * Arguments:
* 0: Unit that does the repairing (Object) * 0: Unit that does the repairing <OBJECT>
* 1: vehicle to repair (Object) * 1: Vehicle to repair <OBJECT>
* 2: Selected hitpoint (String) * 2: Selected hitpoint <STRING>
* *
* Return Value: * Return Value:
* NONE * None
*
* Example:
* [unit, vehicle, "hitpoint"] call ace_repair_fnc_canReplaceWheel
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
@ -40,4 +45,3 @@ if (typeName _wheel == "OBJECT") then {
if (isNull _wheel) exitWith {false}; if (isNull _wheel) exitWith {false};
alive _target && {_target getHitPointDamage _hitPoint >= 1} alive _target && {_target getHitPointDamage _hitPoint >= 1}

View File

@ -1,13 +1,19 @@
/* /*
* Author: Glowbal * Author: Glowbal
*
* Called by repair action / progress bar. Raise events to set the new hitpoint damage. * Called by repair action / progress bar. Raise events to set the new hitpoint damage.
* *
* Arguments: * Arguments:
* Stuff from progress bar. * 0: Unit that does the repairing <OBJECT>
* 1: Vehicle to repair <OBJECT>
* 2: Selected hitpoint <STRING>
* *
* Return Value: * Return Value:
* NONE * None
*
* Example:
* [unit, vehicle, "hitpoint"] call ace_repair_fnc_doFullRepair
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"

View File

@ -1,13 +1,19 @@
/* /*
* Author: commy2 * Author: commy2
*
* Called by repair action / progress bar. Raise events to set the new hitpoint damage. * Called by repair action / progress bar. Raise events to set the new hitpoint damage.
* *
* Arguments: * Arguments:
* Stuff from progress bar. * 0: Unit that does the repairing <OBJECT>
* 1: Vehicle to repair <OBJECT>
* 2: Selected hitpoint <STRING>
* *
* Return Value: * Return Value:
* NONE * None
*
* Example:
* [unit, vehicle, "hitpoint"] call ace_repair_fnc_doRemoveTrack
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"

View File

@ -1,13 +1,19 @@
/* /*
* Author: commy2 * Author: commy2
*
* Called by repair action / progress bar. Raise events to set the new hitpoint damage. * Called by repair action / progress bar. Raise events to set the new hitpoint damage.
* *
* Arguments: * Arguments:
* Stuff from progress bar. * 0: Unit that does the repairing <OBJECT>
* 1: Vehicle to repair <OBJECT>
* 2: Selected hitpoint <STRING>
* *
* Return Value: * Return Value:
* NONE * None
*
* Example:
* [unit, vehicle, "hitpoint"] call ace_repair_fnc_doRemoveWheel
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"

View File

@ -3,10 +3,17 @@
* Called by repair action / progress bar. Raise events to set the new hitpoint damage. * Called by repair action / progress bar. Raise events to set the new hitpoint damage.
* *
* Arguments: * Arguments:
* 0: Stuff from progress bar. <ARRAY> * 0: Unit that does the repairing <OBJECT>
* 1: Vehicle to repair <OBJECT>
* 2: Selected hitpoint <STRING>
* *
* Return Value: * Return Value:
* NONE * None
*
* Example:
* [unit, vehicle, "hitpoint"] call ace_repair_fnc_doRepair
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"

View File

@ -3,10 +3,18 @@
* Called by repair action / progress bar. Raise events to set the new hitpoint damage. * Called by repair action / progress bar. Raise events to set the new hitpoint damage.
* *
* Arguments: * Arguments:
* 0: Stuff from progress bar. <ARRAY> * 0: Unit that does the repairing <OBJECT>
* 1: Vehicle to repair <OBJECT>
* 2: Selected hitpoint <STRING>
* 3: Repair Action Classname <STRING>
* *
* Return Value: * Return Value:
* NONE * None
*
* Example:
* [unit, vehicle, "hitpoint", "classname"] call ace_repair_fnc_doRepairTrack
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"

View File

@ -3,10 +3,18 @@
* Called by repair action / progress bar. Raise events to set the new hitpoint damage. * Called by repair action / progress bar. Raise events to set the new hitpoint damage.
* *
* Arguments: * Arguments:
* 0: Stuff from progress bar. <ARRAY> * 0: Unit that does the repairing <OBJECT>
* 1: Vehicle to repair <OBJECT>
* 2: Selected hitpoint <STRING>
* 3: Repair Action Classname <STRING>
* *
* Return Value: * Return Value:
* NONE * None
*
* Example:
* [unit, vehicle, "hitpoint", "classname"] call ace_repair_fnc_doReplaceTrack
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"

View File

@ -3,10 +3,18 @@
* Called by repair action / progress bar. Raise events to set the new hitpoint damage. * Called by repair action / progress bar. Raise events to set the new hitpoint damage.
* *
* Arguments: * Arguments:
* 0: Stuff from progress bar. <ARRAY> * 0: Unit that does the repairing <OBJECT>
* 1: Vehicle to repair <OBJECT>
* 2: Selected hitpoint <STRING>
* 3: Repair Action Classname <STRING>
* *
* Return Value: * Return Value:
* NONE * None
*
* Example:
* [unit, vehicle, "hitpoint", "classname"] call ace_repair_fnc_doReplaceWheel
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"

View File

@ -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 <OBJECT>
*
* Return Value:
* 0: Rpair Damage Threshold <NUMBER>
*
* Example:
* [unit] call ace_repair_fnc_getPostRepairDamage
*
* Public: No
*/
#include "script_component.hpp" #include "script_component.hpp"
params ["_unit"]; params ["_unit"];

View File

@ -3,10 +3,16 @@
* Returns the wheel hitpoints and their selections. * Returns the wheel hitpoints and their selections.
* *
* Arguments: * Arguments:
* 0: A vehicle <Object> * 0: Vehicle <OBJECT>
* *
* Return Value: * Return Value:
* Wheel positions in model coordinates. <Array> * 0: Wheel hitpoints <ARRAY>
* 1: Wheel hitpoint selections in model coordinates <ARRAY>
*
* Example:
* [unit, vehicle, "hitpoint"] call ace_repair_fnc_getWheelHitPointsWithSelections
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"

View File

@ -3,28 +3,30 @@
* Check if the engineer has all items. * Check if the engineer has all items.
* *
* Arguments: * Arguments:
* 0: Engineer <OBJECT> * 0: Unit that does the repairing <OBJECT>
* 1: Patient <OBJECT> * 1: Items required <ARRAY>
* 2: Items <ARRAY<STRING>>
* *
* ReturnValue: * Return Value:
* Has the items <BOOL> * Has Items <BOOL>
*
* Example:
* [engineer, [items]] call ace_repair_fnc_hasItems
* *
* Public: Yes * Public: Yes
*/ */
#include "script_component.hpp" #include "script_component.hpp"
params ["_engineer", "_items"]; params ["_unit", "_items"];
TRACE_2("params",_engineer,_items); TRACE_2("params",_unit,_items);
private ["_return"]; private ["_return"];
_return = true; _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; _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; _return = false;
}; };
} forEach _items; } forEach _items;

View File

@ -1,13 +1,16 @@
/* /*
* Author: Glowbal, KoffeinFlummi, commy2 * Author: Glowbal, KoffeinFlummi, commy2
* Check if a unit is any engineer class * Check if a unit is any engineer class.
* *
* Arguments: * Arguments:
* 0: The Unit <OBJECT> * 0: Unit <OBJECT>
* 1: Class <NUMBER> <OPTIONAL> * 1: Class <NUMBER> (Optional)
* *
* ReturnValue: * Return Value:
* Is in of engineer class <BOOL> * Is Engineer Class <BOOL>
*
* Example:
* [unit, 1] call ace_repair_fnc_isEngineer
* *
* Public: Yes * Public: Yes
*/ */

View File

@ -1,16 +1,18 @@
/* /*
* Author: Glowbal * Author: Glowbal
* Checks if a unit is in a repair facility * Checks if a unit is in a repair facility.
* *
* Arguments: * Arguments:
* 0: The Unit <OBJECT> * 0: Unit <OBJECT>
* *
* ReturnValue: * Return Value:
* Is inside a repair facility <BOOL> * Is inside a repair facility <BOOL>
* *
* Example:
* [unit] call ace_repair_fnc_isInRepairFacility
*
* Public: Yes * Public: Yes
*/ */
#include "script_component.hpp" #include "script_component.hpp"
params ["_object"]; params ["_object"];

View File

@ -1,16 +1,18 @@
/* /*
* Author: KoffeinFlummi * Author: KoffeinFlummi
* Checks if a unit is in a engineeral vehicle. * Checks if a unit is near an engineering vehicle.
* *
* Arguments: * Arguments:
* 0: unit to be checked <OBJECT> * 0: Unit <OBJECT>
* *
* Return Value: * Return Value:
* Is unit in engineeral vehicle? <BOOL> * Is near engineering vehicle <BOOL>
*
* Example:
* [unit] call ace_repair_fnc_isNearRepairVehicle
* *
* Public: Yes * Public: Yes
*/ */
#include "script_component.hpp" #include "script_component.hpp"
params ["_unit"]; params ["_unit"];

View File

@ -1,12 +1,15 @@
/* /*
* Author: Glowbal * Author: Glowbal
* Check if vehicle is a engineeral vehicle * Check if vehicle is a engineering vehicle.
* *
* Arguments: * Arguments:
* 0: The Vehicle <OBJECT> * 0: Vehicle <OBJECT>
* *
* ReturnValue: * ReturnValue:
* Is in of engineer class <BOOL> * Is engineering vehicle <BOOL>
*
* Example:
* [vehicle] call ace_repair_fnc_isRepairVehicle
* *
* Public: Yes * Public: Yes
*/ */

View File

@ -1,18 +1,20 @@
/* /*
* Author: Glowbal * Author: Glowbal
* Assign an engineer role to a unit * Assign an engineer role to a unit.
* *
* Arguments: * Arguments:
* 0: The module logic <LOGIC> * 0: The module logic <OBJECT>
* 1: units <ARRAY> * 1: Synchronized units <ARRAY>
* 2: activated <BOOL> * 2: Activated <BOOL>
* *
* Return Value: * Return Value:
* None <NIL> * None
*
* Example:
* function = "ace_repair_fnc_moduleAssignEngineer"
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
params ["_logic"]; params ["_logic"];

View File

@ -1,18 +1,20 @@
/* /*
* Author: Glowbal * Author: Glowbal
* Assign an repair facility * Assign a repair facility.
* *
* Arguments: * Arguments:
* 0: The module logic <LOGIC> * 0: The module logic <OBJECT>
* 1: units <ARRAY> * 1: Synchronized units <ARRAY>
* 2: activated <BOOL> * 2: Activated <BOOL>
* *
* Return Value: * Return Value:
* None <NIL> * None
*
* Example:
* function = "ace_repair_fnc_moduleAssignRepairFacility"
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
params ["_logic"]; params ["_logic"];

View File

@ -1,18 +1,20 @@
/* /*
* Author: Glowbal * Author: Glowbal
* Assign an repair vehicle * Assign a repair vehicle.
* *
* Arguments: * Arguments:
* 0: The module logic <LOGIC> * 0: The module logic <OBJECT>
* 1: units <ARRAY> * 1: Synchronized units <ARRAY>
* 2: activated <BOOL> * 2: Activated <BOOL>
* *
* Return Value: * Return Value:
* None <NIL> * None
*
* Example:
* function = "ace_repair_fnc_moduleAssignRepairVehicle"
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
params ["_logic"]; params ["_logic"];

View File

@ -1,12 +1,17 @@
/* /*
* Author: commy2 * Author: commy2
* Module for adjusting the repair damage settings * Adjusts repair damage settings.
* *
* Arguments: * Arguments:
* 0: The module logic <LOGIC> * 0: The module logic <OBJECT>
* 1: Synchronized units <ARRAY>
* 2: Activated <BOOL>
* *
* Return Value: * Return Value:
* None <NIL> * None
*
* Example:
* function = "ace_repair_fnc_moduleRepairSettings"
* *
* Public: No * Public: No
*/ */

View File

@ -3,29 +3,31 @@
* Used to normalize dependant hitpoints. May overwrite some global variables that are named like hitpoints or "Total" though... * Used to normalize dependant hitpoints. May overwrite some global variables that are named like hitpoints or "Total" though...
* *
* Arguments: * Arguments:
* 0: A local vehicle with hitpoints. <OBJECT> * 0: Local Vehicle <OBJECT>
* *
* Return Value: * Return Value:
* NONE * None
*
* Example:
* [vehicle] call ace_repair_fnc_normalizeHitPoints
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
params ["_vehicle"]; params ["_vehicle"];
TRACE_1("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 {}; if !(local _vehicle) exitWith {};
private ["_hitPoints", "_config"]; private ["_hitPoints", "_config", "_dependentHitPoints", "_dependentHitPointScripts", "_damage"];
_hitPoints = [_vehicle] call EFUNC(common,getHitPoints); _hitPoints = [_vehicle] call EFUNC(common,getHitPoints);
_config = configFile >> "CfgVehicles" >> typeOf _vehicle >> "HitPoints"; _config = configFile >> "CfgVehicles" >> typeOf _vehicle >> "HitPoints";
// define global variables. Needed to parse the depends config entries. Also find dependent hitpoints. // define global variables. Needed to parse the depends config entries. Also find dependent hitpoints.
private ["_dependentHitPoints", "_dependentHitPointScripts"];
_dependentHitPoints = []; _dependentHitPoints = [];
_dependentHitPointScripts = []; _dependentHitPointScripts = [];
@ -33,21 +35,14 @@ Total = damage _vehicle;
{ {
missionNamespace setVariable [_x, _vehicle getHitPointDamage _x]; missionNamespace setVariable [_x, _vehicle getHitPointDamage _x];
if (isText (_config >> _x >> "depends")) then { if (isText (_config >> _x >> "depends")) then {
_dependentHitPoints pushBack _x; _dependentHitPoints pushBack _x;
_dependentHitPointScripts pushBack compile getText (_config >> _x >> "depends"); _dependentHitPointScripts pushBack compile getText (_config >> _x >> "depends");
}; };
} forEach _hitPoints; } forEach _hitPoints;
// apply normalized damage to all dependand hitpoints // apply normalized damage to all dependand hitpoints
{ {
private "_damage";
_damage = call (_dependentHitPointScripts select _forEachIndex); _damage = call (_dependentHitPointScripts select _forEachIndex);
_vehicle setHitPointDamage [_x, _damage]; _vehicle setHitPointDamage [_x, _damage];
} forEach _dependentHitPoints; } forEach _dependentHitPoints;

View File

@ -1,19 +1,21 @@
/* /*
* Author: Glowbal, KoffeinFlummi * Author: Glowbal, KoffeinFlummi
* Starts the repair process * Starts the repair process.
* *
* Arguments: * Arguments:
* 0: The engineer <OBJECT> * 0: Unit that does the repairing <OBJECT>
* 1: The patient <OBJECT> * 1: Vehicle to repair <OBJECT
* 2: SelectionName <STRING> * 2: Selected hitpoint <STRING>
* 3: repair classname <STRING> * 3: Repair Action Classname <STRING>
* *
* Return Value: * Return Value:
* Succesful repair started <BOOL> * Succesful Repair Started <BOOL>
*
* Example:
* [unit, vehicle, "hitpoint", "classname"] call ace_repair_fnc_repair
* *
* Public: Yes * Public: Yes
*/ */
#include "script_component.hpp" #include "script_component.hpp"
params ["_caller", "_target", "_hitPoint", "_className"]; params ["_caller", "_target", "_hitPoint", "_className"];

View File

@ -1,15 +1,19 @@
/* /*
* Author: commy2 * Author: commy2
* * Starts a repair action with a progress bar.
* Start a repair action and open progress bar.
* *
* Arguments: * Arguments:
* 0: Unit that does the repairing (Object) * 0: Unit that does the repairing <OBJECT>
* 1: vehicle to repair (Object) * 1: Vehicle to repair <OBJECT
* 2: Selected hitpoint (String) * 2: Selected hitpoint <STRING>
* *
* Return Value: * Return Value:
* NONE * None
*
* Example:
* [unit, vehicle, "hitpoint"] call ace_repair_fnc_repairVehicle
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"

View File

@ -1,16 +1,21 @@
/* /*
* Author: KoffeinFlummi, Glowbal * Author: KoffeinFlummi, Glowbal
* Callback when the repair fails * Callback when repair fails.
* *
* Arguments: * Arguments:
* 0: The engineer <OBJECT> * 0: Arguments <ARRAY>
* 1: The patient <OBJECT> * 0: Unit that does the repairing <OBJECT>
* 2: SelectionName <STRING> * 1: Vehicle to repair <OBJECT
* 3: Treatment classname <STRING> * 2: Selected hitpoint <STRING>
* 4: Items available <ARRAY<STRING>> * 3: Repair Action Classname <STRING>
* 4: None
* 5: Items available <ARRAY>
* *
* Return Value: * Return Value:
* nil * None
*
* Example:
* [[unit, vehicle, "hitpoint", "classname", nil, [items]]] call ace_repair_fnc_repair_failure
* *
* Public: No * Public: No
*/ */

View File

@ -1,20 +1,22 @@
/* /*
* Author: KoffeinFlummi, Glowbal * Author: KoffeinFlummi, Glowbal
* Callback when the repair is completed * Callback when repair completes.
* *
* Arguments: * Arguments:
* 0: The engineer <OBJECT> * 0: Arguments <ARRAY>
* 1: The patient <OBJECT> * 0: Unit that does the repairing <OBJECT>
* 2: SelectionName <STRING> * 1: Vehicle to repair <OBJECT
* 3: Treatment classname <STRING> * 2: Selected hitpoint <STRING>
* 4: Items available <ARRAY<STRING>> * 3: Repair Action Classname <STRING>
* *
* Return Value: * Return Value:
* nil * None
*
* Example:
* [[unit, vehicle, "hitpoint", "classname"]] call ace_repair_fnc_repair_success
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
params ["_args"]; params ["_args"];

View File

@ -1,13 +1,18 @@
/* /*
* Author: commy2 * 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: * Arguments:
* 0: vehicle to damage <OBJECT> * 0: Local Vehicle to Damage <OBJECT>
* 1: Total damage <NUMBER> * 1: Total Damage <NUMBER>
* *
* Return Value: * Return Value:
* NONE * None
*
* Example:
* [vehicle, 0.5] call ace_repair_fnc_setDamage
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"

View File

@ -1,14 +1,19 @@
/* /*
* Author: commy2 * 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: * Arguments:
* 0: vehicle * 0: Local Vehicle to Damage <OBJECT>
* 1: hitpoint * 1: Selected hitpoint <STRING>
* 2: damage * 2: Total Damage <NUMBER>
* *
* Return Value: * Return Value:
* NONE * None
*
* Example:
* [vehicle, "hitpoint", 0.5] call ace_repair_fnc_setHitPointDamage
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"

View File

@ -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 <STRING>
* 1: Position <ARRAY>
* 2: Damage <NUMBER>
*
* Return Value:
* None
*
* Example:
* ["classname", [0, 0, 0], 1] call ace_repair_fnc_spawnObject
*
* Public: No
*/
#include "script_component.hpp" #include "script_component.hpp"
params ["_item", "_position", ["_damage", 0]]; params ["_item", "_position", ["_damage", 0]];

View File

@ -3,22 +3,24 @@
* Use Equipment if any is available. * Use Equipment if any is available.
* *
* Arguments: * Arguments:
* 0: Engineer <OBJECT> * 0: Unit <OBJECT>
* 2: Item <STRING> * 2: Item classname <STRING>
* *
* ReturnValue: * ReturnValue:
* <NIL> * None
*
* Example:
* [unit, "classname"] call ace_repair_fnc_useItem
* *
* Public: Yes * Public: Yes
*/ */
#include "script_component.hpp" #include "script_component.hpp"
params ["_engineer", "_item"]; params ["_unit", "_item"];
TRACE_2("params",_engineer,_item); TRACE_2("params",_unit,_item);
if ([_engineer, _item] call EFUNC(common,hasItem)) exitwith { if ([_unit, _item] call EFUNC(common,hasItem)) exitwith {
[[_engineer, _item], QUOTE(EFUNC(common,useItem)), _engineer] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ [[_unit, _item], QUOTE(EFUNC(common,useItem)), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
[true, _engineer]; [true, _unit];
}; };
[false, objNull]; [false, objNull];

View File

@ -3,19 +3,21 @@
* Use Equipment items if any is available. * Use Equipment items if any is available.
* *
* Arguments: * Arguments:
* 0: Engineer <OBJECT> * 0: Unit <OBJECT>
* 1: Items <ARRAY<STRING>> * 1: Item classnames <ARRAY>
* *
* ReturnValue: * ReturnValue:
* <NIL> * None
*
* Example:
* [unit, ["classname1", "classname2"]] call ace_repair_fnc_useItems
* *
* Public: Yes * Public: Yes
*/ */
#include "script_component.hpp" #include "script_component.hpp"
params ["_engineer", "_items"]; params ["_unit", "_items"];
TRACE_2("params",_engineer,_items); TRACE_2("params",_unit,_items);
private ["_itemUsedInfo", "_itemsUsedBy"]; private ["_itemUsedInfo", "_itemsUsedBy"];
@ -24,14 +26,14 @@ _itemsUsedBy = [];
// handle a one of type use item // handle a one of type use item
if (typeName _x == "ARRAY") then { 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]}; if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]};
} forEach _x; } forEach _x;
}; };
// handle required item // handle required item
if (typeName _x == "STRING") then { 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]}; if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]};
}; };
} forEach _items; } forEach _items;