HitReactions - Don't do when mounted, add setting

This commit is contained in:
PabstMirror 2015-05-31 16:16:14 -05:00
parent 3a2fd9dc08
commit e2217220eb
3 changed files with 15 additions and 1 deletions

View File

@ -0,0 +1,7 @@
class ACE_Settings {
class GVAR(minDamageToTrigger) {
//Minimum mamage needed to trigger falling down while moving. Set to -1 to disable completely.
typeName = "SCALAR";
value = 0.1;
};
};

View File

@ -12,4 +12,5 @@ class CfgPatches {
};
};
#include "ACE_Settings.hpp"
#include "CfgEventHandlers.hpp"

View File

@ -10,6 +10,9 @@ _damage = _this select 2;
// don't fall on collision damage
if (_unit == _firer) exitWith {};
//Exit if system disabled:
if (GVAR(minDamageToTrigger) == -1) exitWith {};
// cam shake for player
if (_unit == ACE_player) then {
addCamShake [3, 5, _damage + random 10];
@ -27,13 +30,16 @@ if (_vehicle isKindOf "StaticWeapon") exitwith {
};
// don't fall after minor damage
if (_damage < 0.1) exitWith {};
if (_damage < GVAR(minDamageToTrigger)) exitWith {};
// play sound
if (!isNil QUOTE(EFUNC(medical,playInjuredSound))) then {
[_unit] call EFUNC(medical,playInjuredSound);
};
//Don't do animations if in a vehicle (looks weird and animations never reset):
if (_vehicle != _unit) exitWith {};
// this checks most things, so it doesn't mess with being inside vehicles or while dragging etc.
if !([_unit, _vehicle] call EFUNC(common,canInteractWith)) exitWith {};