Add optional parameter useEffects for damage (#5318)

Since 1.67, you can  skip destruction effects if you want to. see  :
https://community.bistudio.com/wiki/setDamage and
https://community.bistudio.com/wiki/setHitPointDamage
This add an optional parameter  to ace_repair_fnc_setHitPointDamage to
allow this new choice
This commit is contained in:
Vdauphin 2017-08-22 19:56:14 +02:00 committed by PabstMirror
parent b7e42cb7a4
commit c3986b0a04

View File

@ -7,6 +7,7 @@
* 0: Local Vehicle to Damage <OBJECT>
* 1: Selected hitpoint INDEX <NUMBER>
* 2: Total Damage <NUMBER>
* 3: Skip destruction effects <BOOL>
*
* Return Value:
* None
@ -18,7 +19,7 @@
*/
#include "script_component.hpp"
params ["_vehicle", "_hitPointIndex", "_hitPointDamage"];
params ["_vehicle", "_hitPointIndex", "_hitPointDamage", ["_useEffects", true]];
TRACE_4("params",_vehicle,typeOf _vehicle,_hitPointIndex,_hitPointDamage);
private ["_damageNew", "_damageOld", "_hitPointDamageRepaired", "_hitPointDamageSumOld", "_realHitpointCount", "_selectionName"];
@ -63,14 +64,14 @@ if (_hitPointDamageSumOld > 0) then {
TRACE_5("structuralDamage",_damageOld,_damageNew,_hitPointDamageRepaired,_hitPointDamageSumOld,_realHitpointCount);
// set new structural damage value
_vehicle setDamage _damageNew;
_vehicle setDamage [_damageNew, _useEffects];
//Repair the hitpoint in the damages array:
_allHitPointDamages set [_hitPointIndex, _hitPointDamage];
//Set the new damage for all hitpoints
{
_vehicle setHitIndex [_forEachIndex, _x];
_vehicle setHitIndex [_forEachIndex, _x, _useEffects];
} forEach _allHitPointDamages;
// normalize hitpoints