2015-01-11 16:42:31 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
|
|
|
*
|
|
|
|
* Returns all hitpoints of any vehicle. Non unique hitpoints in turrets are ignored.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: A vehicle, not the classname (Object)
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* The hitpoints (Array)
|
|
|
|
*/
|
2015-01-13 19:56:02 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-05-14 22:12:40 +00:00
|
|
|
private ["_config", "_hitpoints", "_i"];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-05-14 18:06:06 +00:00
|
|
|
PARAMS_1(_vehicle);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
|
|
|
|
|
|
|
_hitpoints = [];
|
|
|
|
|
|
|
|
// get all classes that can contain hitpoints
|
|
|
|
private "_hitpointClasses";
|
|
|
|
_hitpointClasses = [_config >> "HitPoints"];
|
|
|
|
{
|
2015-02-19 18:14:52 +00:00
|
|
|
private "_class";
|
|
|
|
_class = ([_config, _x] call FUNC(getTurretConfigPath)) >> "HitPoints";
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-02-19 18:14:52 +00:00
|
|
|
if (isClass _class) then {
|
|
|
|
_hitpointClasses pushBack _class;
|
|
|
|
};
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
} forEach allTurrets _vehicle;
|
|
|
|
|
|
|
|
// iterate through all classes with hitpoints and their parents
|
|
|
|
{
|
2015-02-19 18:14:52 +00:00
|
|
|
private "_class";
|
|
|
|
_class = _x;
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-02-19 18:14:52 +00:00
|
|
|
while {isClass _class} do {
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-02-19 18:14:52 +00:00
|
|
|
for "_i" from 0 to (count _class - 1) do {
|
|
|
|
private "_entry";
|
|
|
|
_entry = configName (_class select _i);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-02-19 18:14:52 +00:00
|
|
|
if (!(_entry in _hitpoints) && {!isNil {_vehicle getHitPointDamage _entry}}) then {
|
|
|
|
_hitpoints pushBack _entry;
|
|
|
|
};
|
|
|
|
};
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-02-19 18:14:52 +00:00
|
|
|
_class = inheritsFrom _class;
|
|
|
|
};
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
} forEach _hitpointClasses;
|
|
|
|
|
|
|
|
_hitpoints
|