From dc7d24a3fd1007ad0bc4d09a049ab39bfb291fe4 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 26 Sep 2015 14:38:50 +0200 Subject: [PATCH] fix fixFloating resetting reflector hitpoints, close #2279 --- addons/common/functions/fnc_fixFloating.sqf | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/addons/common/functions/fnc_fixFloating.sqf b/addons/common/functions/fnc_fixFloating.sqf index 5fe94dcef7..24084d2c11 100644 --- a/addons/common/functions/fnc_fixFloating.sqf +++ b/addons/common/functions/fnc_fixFloating.sqf @@ -19,14 +19,17 @@ _object = _this; if (!local _object) exitWith {}; // save and restore hitpoints, see below why -private ["_hitPoints", "_hitPointDamages"]; +private "_hitPointDamages"; +_hitPointDamages = getAllHitPointsDamage _object; -_hitPoints = [_object] call FUNC(getHitpoints); -_hitPointDamages = [_hitPoints, {_object getHitPointDamage _this}] call FUNC(map); +// get correct format for objects without hitpoints +if (_hitPointDamages isEqualTo []) then { + _hitPointDamages = [[],[],[]]; +}; // this prevents physx objects from floating when near other physx objects with allowDamage false _object setDamage damage _object; { - _object setHitPointDamage [_x, _hitPointDamages select _forEachIndex]; -} forEach _hitPoints; + _object setHitIndex [_forEachIndex, _x]; +} forEach (_hitPointDamages select 2);