2015-03-18 00:36:56 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
|
|
|
* Attempt to fix floating physx with disabled damage after setPosXXX commands.
|
|
|
|
*
|
|
|
|
* Arguments:
|
2015-09-20 14:56:35 +00:00
|
|
|
* PhysX object <OBJECT>
|
2015-03-18 00:36:56 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2015-09-20 14:56:35 +00:00
|
|
|
* None
|
2015-03-18 00:36:56 +00:00
|
|
|
*
|
2015-09-20 14:56:35 +00:00
|
|
|
* Public: No
|
2015-03-18 00:36:56 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
private "_object";
|
|
|
|
_object = _this;
|
|
|
|
|
|
|
|
// setHitPointDamage requires local object
|
|
|
|
if (!local _object) exitWith {};
|
|
|
|
|
|
|
|
// save and restore hitpoints, see below why
|
|
|
|
private ["_hitPoints", "_hitPointDamages"];
|
|
|
|
|
|
|
|
_hitPoints = [_object] call FUNC(getHitpoints);
|
|
|
|
_hitPointDamages = [_hitPoints, {_object getHitPointDamage _this}] call FUNC(map);
|
|
|
|
|
|
|
|
// 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;
|