mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 04:02:37 +03:00
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
28 lines
625 B
Plaintext
28 lines
625 B
Plaintext
private ["_cfgHitPoints", "_hps"];
|
|
_cfgHitPoints = configFile >> "CfgVehicles" >> (typeOf _this) >> "HitPoints";
|
|
_hps = [];
|
|
|
|
_funcGetHitPoints =
|
|
{
|
|
for "_i" from 0 to ((count (_this select 1)) - 1) do
|
|
{
|
|
private ["_hp"];
|
|
_hp = configName ((_this select 1) select _i);
|
|
|
|
if (!(_hp in _hps)) then
|
|
{
|
|
_HPCheck = (_this select 0) getHit (getText((_this select 1) >> _hp >> "name"));
|
|
if (!isNil "_HPCheck") then {
|
|
_hps set [count _hps, _hp];
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
while {(configName _cfgHitPoints) != ""} do
|
|
{
|
|
[_this, _cfgHitPoints] call _funcGetHitPoints;
|
|
_cfgHitPoints = inheritsFrom _cfgHitPoints;
|
|
};
|
|
|
|
_hps |