mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
fall down after getting shot while moving
This commit is contained in:
parent
6317dccb52
commit
20dd8f34fc
1
addons/hitreactions/$PBOPREFIX$
Normal file
1
addons/hitreactions/$PBOPREFIX$
Normal file
@ -0,0 +1 @@
|
|||||||
|
z\ace\addons\hitreactions
|
14
addons/hitreactions/CfgEventHandlers.hpp
Normal file
14
addons/hitreactions/CfgEventHandlers.hpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
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));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
7
addons/hitreactions/XEH_preInit.sqf
Normal file
7
addons/hitreactions/XEH_preInit.sqf
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
ADDON = false;
|
||||||
|
|
||||||
|
PREP(fallDown);
|
||||||
|
|
||||||
|
ADDON = true;
|
15
addons/hitreactions/config.cpp
Normal file
15
addons/hitreactions/config.cpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
class CfgPatches {
|
||||||
|
class ADDON {
|
||||||
|
units[] = {};
|
||||||
|
weapons[] = {};
|
||||||
|
requiredVersion = REQUIRED_VERSION;
|
||||||
|
requiredAddons[] = {"ace_common"};
|
||||||
|
author[] = {"commy2"};
|
||||||
|
authorUrl = "https://github.com/commy2";
|
||||||
|
VERSION_CONFIG;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
#include "CfgEventHandlers.hpp"
|
57
addons/hitreactions/functions/fnc_fallDown.sqf
Normal file
57
addons/hitreactions/functions/fnc_fallDown.sqf
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
// by commy2
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
private "_unit";
|
||||||
|
|
||||||
|
_unit = _this select 0;
|
||||||
|
_firer = _this select 1;
|
||||||
|
_damage = _this select 2;
|
||||||
|
|
||||||
|
// don't fall on collision damage
|
||||||
|
if (_unit == _firer) exitWith {};
|
||||||
|
|
||||||
|
// don't fall after minor damage
|
||||||
|
if (_damage < 0.1) exitWith {};
|
||||||
|
|
||||||
|
// this checks most things, so it doesn't mess with being inside vehicles or while dragging etc.
|
||||||
|
if !([_unit, vehicle _unit] call EFUNC(common,canInteractWith)) exitWith {};
|
||||||
|
|
||||||
|
// only play animation when standing due to lack of animations, sry
|
||||||
|
if !(stance _unit in ["CROUCH", "STAND"]) exitWith {};
|
||||||
|
|
||||||
|
private "_velocity";
|
||||||
|
_velocity = vectorMagnitude velocity _unit;
|
||||||
|
|
||||||
|
// only fall when moving
|
||||||
|
if (_velocity < 2) exitWith {};
|
||||||
|
|
||||||
|
// get correct animation by weapon
|
||||||
|
private "_anim";
|
||||||
|
_anim = switch (currentWeapon _unit) do {
|
||||||
|
case (""): {"AmovPercMsprSnonWnonDf_AmovPpneMstpSnonWnonDnon"};
|
||||||
|
case (primaryWeapon _unit): {
|
||||||
|
[
|
||||||
|
["AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon_2", "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"] select (_velocity > 4),
|
||||||
|
["AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon_2", "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"] select (_velocity > 4),
|
||||||
|
"AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDleft",
|
||||||
|
"AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDright"
|
||||||
|
] select floor random 4;
|
||||||
|
};
|
||||||
|
case (handgunWeapon _unit): {
|
||||||
|
[
|
||||||
|
"AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon",
|
||||||
|
"AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon",
|
||||||
|
"AmovPercMstpSrasWpstDnon_AadjPpneMstpSrasWpstDleft",
|
||||||
|
"AmovPercMstpSrasWpstDnon_AadjPpneMstpSrasWpstDright"
|
||||||
|
] select floor random 4;
|
||||||
|
};
|
||||||
|
default {""};
|
||||||
|
};
|
||||||
|
|
||||||
|
// 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)) exitWith {};
|
||||||
|
|
||||||
|
[_unit, _anim, 2] call EFUNC(common,doAnimation);
|
1
addons/hitreactions/functions/script_component.hpp
Normal file
1
addons/hitreactions/functions/script_component.hpp
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include "\z\ace\addons\hitreactions\script_component.hpp"
|
12
addons/hitreactions/script_component.hpp
Normal file
12
addons/hitreactions/script_component.hpp
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#define COMPONENT hitreactions
|
||||||
|
#include "\z\ace\addons\main\script_mod.hpp"
|
||||||
|
|
||||||
|
#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"
|
Loading…
Reference in New Issue
Block a user