 sreV                prefix z\ace\addons\hitreactions Mikero DePbo.dll.7.46 version 109e12cc  ACE_Settings.hpp     S      _S  CfgEventHandlers.hpp           _  config.bin           #_  functions\fnc_fallDown.sqf           _  functions\fnc_getRandomAnimation.sqf     Z      _Z  functions\fnc_throwWeapon.sqf     K      _K  functions\script_component.hpp     :       \:   README.md            _   script_component.hpp           _  stringtable.xml           Q_  XEH_preInit.sqf            _   XEH_PREP.hpp     B       _B   XEH_preStart.sqf     <       _<                        
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;
        displayName = CSTRING(minDamageToTrigger_displayName);
        sliderSettings[] = {-1, 1, 0.1, 1};
    };
};

class Extended_PreStart_EventHandlers {
    class ADDON {
        init = QUOTE(call COMPILE_FILE(XEH_preStart));
    };
};

class Extended_PreInit_EventHandlers {
    class ADDON {
        init = QUOTE(call COMPILE_FILE(XEH_preInit));
    };
};

class Extended_Hit_EventHandlers {
    class CAManBase {
        class ADDON {
            hit = QUOTE(_this call FUNC(fallDown));
        };
    };
};
 raP           CfgPatches     ACE_Settings    Extended_PreStart_EventHandlers o   Extended_PreInit_EventHandlers    Extended_Hit_EventHandlers j      ace_hitreactions        name ACE3 - Hit Reactions units  weapons  requiredVersion    @requiredAddons  ace_common  author $STR_ace_common_ACETeam authors  commy2  url $STR_ace_main_URL version QH@ versionStr 3.13.5.57 versionAr          9       ace_hitreactions_minDamageToTrigger   o    typeName SCALAR value = displayName $STR_ace_hitreactions_minDamageToTrigger_displayName sliderSettings    =   o    ace_hitreactions       init call compile preprocessFileLineNumbers '\z\ace\addons\hitreactions\XEH_preStart.sqf'     ace_hitreactions 	  j    init call compile preprocessFileLineNumbers '\z\ace\addons\hitreactions\XEH_preInit.sqf' j    CAManBase       ace_hitreactions       hit _this call ace_hitreactions_fnc_fallDown       #include "script_component.hpp"
/*
 * Author: commy2
 * Adds reactions to a unit that was hit. EH only runs where to unit is local. Adds screams, falling down, falling from ladders, ejecting from static weapons and camshake for players
 *
 * Arguments:
 * 0: unit <OBJECT>
 * 1: firer <OBJECT>
 * 2: damage taken <NUMBER>
 *
 * Return Value:
 * None
 *
 * Example:
 * [player, kevin, 5] call ACE_hitreactions_fnc_fallDown
 *
 * Public: No
 */

params ["_unit", "_firer", "_damage"];

// exit if system is disabled
if (GVAR(minDamageToTrigger) == -1) exitWith {};

// don't fall after minor damage
if (_damage < GVAR(minDamageToTrigger)) exitWith {};

// don't fall on collision damage
if (_unit == _firer) exitWith {};

// camshake for player
if (_unit == ACE_player) then {
    if (visibleMap) then {
        openMap false;
    };
    addCamShake [3, 5, _damage + random 10];
};

private _vehicle = vehicle _unit;

// handle static weapons
if (_vehicle isKindOf "StaticWeapon") exitWith {
    if (!alive _unit) then {
        _unit action ["Eject", _vehicle];
        unassignVehicle _unit;
    };
};

// 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 {};

// handle ladders
if (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> animationState _unit >> "ACE_isLadder") == 1) exitWith {
    _unit action ["LadderOff", nearestObject [position _unit, "House"]];
};

// only play animation when standing due to lack of animations, sry
if !(stance _unit in ["CROUCH", "STAND"]) exitWith {};

private _velocity = vectorMagnitude velocity _unit;

// only fall when moving
if (_velocity < 2) exitWith {};

// get correct animation by weapon
private _anim = _unit call FUNC(getRandomAnimation);

// exit if no animation for this weapon exists, i.e. binocular or rocket launcher
if (_anim == "") exitWith {};

// don't mess with transitions. don't fall then.
if !([_unit] call EFUNC(common,inTransitionAnim)) then {
    [_unit, _anim, 2] call EFUNC(common,doAnimation);
};
#include "script_component.hpp"
/*
 * Author: commy2
 * Get a random fall animation for the unit.
 *
 * Arguments:
 * 0: unit <OBJECT>
 *
 * Return Value:
 * Fall animation <STRING>
 *
 * Example:
 * [bob] call ACE_hitreactions_fnc_getRandomAnimation
 *
 * Public: No
 */

params ["_unit"];

private _weapon = currentWeapon _unit;

if (_weapon == "") exitWith {
    "AmovPercMsprSnonWnonDf_AmovPpneMstpSnonWnonDnon"
};

if (_weapon == primaryWeapon _unit) exitWith {
    if (_unit call EFUNC(common,isPlayer)) then {
        private _isRunning = _velocity > 4;

        [
            ["AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon_2", "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"] select _isRunning,
            ["AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon_2", "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"] select _isRunning,
            "AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDleft",
            "AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDright"
        ] select floor random 4
    } else {
        "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"
    };
};

if (_weapon == handgunWeapon _unit) exitWith {
    if (_unit call EFUNC(common,isPlayer)) then {
        [
            "AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon",
            "AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon",
            "AmovPercMstpSrasWpstDnon_AadjPpneMstpSrasWpstDleft",
            "AmovPercMstpSrasWpstDnon_AadjPpneMstpSrasWpstDright"
        ] select floor random 4
    } else {
        "AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon"
    };
};

""
#include "script_component.hpp"
/*
 * Author: commy2
 * Makes the unit throw their currently selected weapon.
 * Unit must be local and not inside a vehicle or attached to another object.
 *
 * Arguments:
 * 0: Unit <OBJECT>
 *
 * Return Value:
 * Weapon Holder
 *
 * Example:
 * player call ace_hitreactions_fnc_throwWeapon
 *
 * Public: No
 */

#define OFFSET_LATERAL 0.59
#define THROW_ANGLE 63.43
#define THROW_VELOCITY 1.5
#define THROW_TORQUE 0.2

params ["_unit"];

private _weapon = currentWeapon _unit;
if (!isNull objectParent _unit || _weapon isEqualTo "") exitWith {objNull};

private _data = weaponsItems _unit select {_x select 0 == _weapon} select 0;

private _holder = createVehicle ["WeaponHolderSimulated", [0, 0, 0], [], 0, "CAN_COLLIDE"];
_holder addWeaponWithAttachmentsCargoGlobal [_data, 1];

private _vDir = _unit weaponDirection _weapon;
private _vLat = vectorNormalized (_vDir vectorCrossProduct [0, 0, 1]);
private _vUp = _vLat vectorCrossProduct _vDir;

private _position = _unit modelToWorldWorld (_unit selectionPosition "RightHand") vectorAdd (_vLat vectorMultiply OFFSET_LATERAL);
private _velocity = vectorNormalized (_vDir vectorAdd (_vUp vectorMultiply tan THROW_ANGLE)) vectorMultiply THROW_VELOCITY vectorAdd velocity _unit;

_unit removeWeapon _weapon;
_holder setPosWorld _position;
_holder setVectorDirAndUp [_vUp, _vLat];
_holder setVelocity _velocity;
_holder addTorque (call CBA_fnc_randomVector3D vectorMultiply THROW_TORQUE);

["ACE_weaponThrown", [_unit, _holder, _data]] call CBA_fnc_localEvent;

_holder // return
#include "\z\ace\addons\hitreactions\script_component.hpp"ace_hitreactions
===========

Adds reactions when getting shot.


## Maintainers

The people responsible for merging changes to this component or answering potential questions.

- [commy2](https://github.com/commy2)
#define COMPONENT hitreactions
#define COMPONENT_BEAUTIFIED Hit Reactions
#include "\z\ace\addons\main\script_mod.hpp"

// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define ENABLE_PERFORMANCE_COUNTERS

#ifdef DEBUG_ENABLED_HITREACTIONS
    #define DEBUG_MODE_FULL
#endif

#ifdef DEBUG_ENABLED_HITREACTIONS
    #define DEBUG_SETTINGS DEBUG_ENABLED_HITREACTIONS
#endif

#include "\z\ace\addons\main\script_macros.hpp"
<?xml version="1.0" encoding="utf-8"?>
<Project name="ACE">
    <Package name="HitReactions">
        <Key ID="STR_ACE_HitReactions_minDamageToTrigger_displayName">
            <English>Min Damage to trigger falling</English>
            <Italian>Danno Minimo da caduta</Italian>
            <Chinese>觸發倒下前最低需受到多少傷害</Chinese>
            <Chinesesimp>触发倒下前最低需受到多少伤害</Chinesesimp>
            <Japanese>崩れ落ちるまでの最低損傷値</Japanese>
            <Korean>방아쇠를 당기는 최소한의 피해</Korean>
            <German>Mindestschaden, um Sturz auszulösen</German>
            <Polish>Minimalne obrażenie, żeby aktywować spadanie</Polish>
            <Russian>Минимальный урон для активации падения</Russian>
            <Portuguese>Dano Mínimo para ativar queda</Portuguese>
            <French>Dommages minimaux pour faire tomber le joueur</French>
            <Czech>Minimum škody pro aktivaci spadnutí</Czech>
            <Turkish>Düşmeyi tetikleyen min hasar</Turkish>
            <Spanish>Daño mínimo para provocar la caída</Spanish>
        </Key>
    </Package>
</Project>
#include "script_component.hpp"

ADDON = false;

PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;

ADDON = true;

PREP(fallDown);
PREP(getRandomAnimation);
PREP(throwWeapon);
#include "script_component.hpp"

#include "XEH_PREP.hpp"
 4As ͅi`EJp%`