Update for A2 1.64 GetHit

Replaced vehicle sethit/setvariable method with sethit/gethit and removed setvariable "Hit_" commands for vehicles (hit_partname can now probably be added to the setvariable filters list).

Modified object_getHit.sqf return to now provide the selection name in order to reduce redundant config lookups. Returns '[Damage, Part Name]', instead of just 'Damage'

Modified vehicle_GetHitpoints.sqf to remove incorrect hipoints from returning. Previously this script would return all hitpoints from any vehicle the current vehicle config inherited from, even if the hitpoint didn't exist in the calling vehicle. this posed a problem since getHit on an invalid part name returns Nil
This commit is contained in:
icomrade
2018-01-21 17:26:35 -05:00
parent d48c9070e8
commit f03f2454c9
19 changed files with 50 additions and 71 deletions

View File

@@ -1,25 +1,27 @@
private ["_cfgHitPoints", "_hps", "_funcGetHitPoints"];
private ["_cfgHitPoints", "_hps"];
_cfgHitPoints = configFile >> "CfgVehicles" >> (typeOf _this) >> "HitPoints";
_hps = [];
_funcGetHitPoints =
{
for "_i" from 0 to ((count _this) - 1) do
for "_i" from 0 to ((count (_this select 1)) - 1) do
{
private ["_hp"];
_hp = configName (_this select _i);
_hp = configName ((_this select 1) select _i);
if (!(_hp in _hps)) then
{
_hps set [count _hps, _hp];
_HPCheck = (_this select 0) getHit (getText((_this select 1) >> _hp >> "name"));
if (!isNil "_HPCheck") then {
_hps set [count _hps, _hp];
};
};
};
};
//Explore inheritance structure fully
while {(configName _cfgHitPoints) != ""} do
{
_cfgHitPoints call _funcGetHitPoints;
[_this, _cfgHitPoints] call _funcGetHitPoints;
_cfgHitPoints = inheritsFrom _cfgHitPoints;
};