diff --git a/addons/main/ACE_Medical_Injuries.hpp b/addons/main/ACE_Medical_Injuries.hpp new file mode 100644 index 0000000..e5d22d2 --- /dev/null +++ b/addons/main/ACE_Medical_Injuries.hpp @@ -0,0 +1,40 @@ +class ACE_Medical_Injuries { + class damageTypes { + class woundHandlers; + class bullet { + class woundHandlers: woundHandlers { + ADDON = QFUNC(aceDamageHandler); + }; + }; + class grenade { + class woundHandlers: woundHandlers { + ADDON = QFUNC(aceDamageHandler); + }; + }; + class explosive { + class woundHandlers: woundHandlers { + ADDON = QFUNC(aceDamageHandler); + }; + }; + class shell { + class woundHandlers: woundHandlers { + ADDON = QFUNC(aceDamageHandler); + }; + }; + class stab { + class woundHandlers: woundHandlers { + ADDON = QFUNC(aceDamageHandler); + }; + }; + class punch { + class woundHandlers: woundHandlers { + ADDON = QFUNC(aceDamageHandler); + }; + }; + class unknown { + class woundHandlers: woundHandlers { + ADDON = QFUNC(aceDamageHandler); + }; + }; + }; +}; diff --git a/addons/main/CfgGesturesMale.hpp b/addons/main/CfgGesturesMale.hpp new file mode 100644 index 0000000..39bcb76 --- /dev/null +++ b/addons/main/CfgGesturesMale.hpp @@ -0,0 +1,93 @@ +class CfgMovesBasic { + class ManActions { + GVAR(addPlate_base)= QGVAR(addPlate_base); + GVAR(addPlate_2)= QGVAR(addPlate_2); + GVAR(addPlate_3)= QGVAR(addPlate_3); + GVAR(addPlate_4)= QGVAR(addPlate_4); + GVAR(addPlate_5)= QGVAR(addPlate_5); + GVAR(addPlate_6)= QGVAR(addPlate_6); + GVAR(addPlate_7)= QGVAR(addPlate_7); + GVAR(addPlate_8)= QGVAR(addPlate_8); + GVAR(addPlate_9)= QGVAR(addPlate_9); + GVAR(addPlate_10)= QGVAR(addPlate_10); + GVAR(addPlate_11)= QGVAR(addPlate_11); + GVAR(addPlate_12)= QGVAR(addPlate_12); + GVAR(addPlate_13)= QGVAR(addPlate_13); + GVAR(addPlate_14)= QGVAR(addPlate_14); + GVAR(addPlate_15)= QGVAR(addPlate_15); + GVAR(addPlate_16)= QGVAR(addPlate_16); + GVAR(stopGesture) = QGVAR(stopGesture); + }; + class Actions { + class Default; + class NoActions: ManActions { + GVAR(addPlate_base)[]= {QGVAR(addPlate_base), "Gesture"}; + GVAR(addPlate_2)[]= {QGVAR(addPlate_2), "Gesture"}; + GVAR(addPlate_3)[]= {QGVAR(addPlate_3), "Gesture"}; + GVAR(addPlate_4)[]= {QGVAR(addPlate_4), "Gesture"}; + GVAR(addPlate_5)[]= {QGVAR(addPlate_5), "Gesture"}; + GVAR(addPlate_6)[]= {QGVAR(addPlate_6), "Gesture"}; + GVAR(addPlate_7)[]= {QGVAR(addPlate_7), "Gesture"}; + GVAR(addPlate_8)[]= {QGVAR(addPlate_8), "Gesture"}; + GVAR(addPlate_9)[]= {QGVAR(addPlate_9), "Gesture"}; + GVAR(addPlate_10)[]= {QGVAR(addPlate_10), "Gesture"}; + GVAR(addPlate_11)[]= {QGVAR(addPlate_11), "Gesture"}; + GVAR(addPlate_12)[]= {QGVAR(addPlate_12), "Gesture"}; + GVAR(addPlate_13)[]= {QGVAR(addPlate_13), "Gesture"}; + GVAR(addPlate_14)[]= {QGVAR(addPlate_14), "Gesture"}; + GVAR(addPlate_15)[]= {QGVAR(addPlate_15), "Gesture"}; + GVAR(addPlate_16)[]= {QGVAR(addPlate_16), "Gesture"}; + GVAR(stopGesture)[] = {QGVAR(stopGesture), "Gesture"}; + }; + }; +}; + +#define ADDPLATE(SECONDS) \ + class TRIPLES(ADDON,addPlate,SECONDS): GVAR(addPlate_base) { \ + speed = QUOTE(-SECONDS + 0.5); \ + } + +class CfgGesturesMale { + class Default; + class States { + class GVAR(addPlate_base): Default { + speed = 0; + looped = 0; + file = QPATHTOF(anims\add_plate.rtm); + mask = "handsWeapon"; + headBobStrength = -1; + headBobMode = 4; + disableWeapons = 1; + interpolationRestart = 2; + leftHandIKCurve[] = {0.01,1,0.1,0,0.94,0,0.98,1}; + rightHandIKBeg = 1; + leftHandIKEnd = 1; + rightHandIKCurve[] = {1}; + weaponIK = 1; + canReload = 0; + }; + ADDPLATE(2); + ADDPLATE(3); + ADDPLATE(4); + ADDPLATE(5); + ADDPLATE(6); + ADDPLATE(7); + ADDPLATE(8); + ADDPLATE(9); + ADDPLATE(10); + ADDPLATE(11); + ADDPLATE(12); + ADDPLATE(13); + ADDPLATE(14); + ADDPLATE(15); + ADDPLATE(16); + class GestureNod; + class GVAR(stopGesture): GestureNod { + file = "a3\anims_f\data\anim\sdr\gst\gestureEmpty.rtm"; + disableWeapons = 0; + disableWeaponsLong = 0; + enableOptics = 1; + mask = "empty"; + }; + }; +}; diff --git a/addons/main/XEH_PREP.hpp b/addons/main/XEH_PREP.hpp index 3761f12..b20d64e 100644 --- a/addons/main/XEH_PREP.hpp +++ b/addons/main/XEH_PREP.hpp @@ -4,6 +4,7 @@ PREP(canAddPlate); PREP(canPressKey); PREP(createProgressBar); PREP(deleteProgressBar); +PREP(doGesture); PREP(fillVestWithPlates); PREP(handleArmorDamage); PREP(initAIUnit); diff --git a/addons/main/XEH_postInit.sqf b/addons/main/XEH_postInit.sqf index 7b56f9a..8111d10 100644 --- a/addons/main/XEH_postInit.sqf +++ b/addons/main/XEH_postInit.sqf @@ -457,12 +457,15 @@ if (_aceInteractLoaded) then { "\a3\ui_f\data\gui\rsc\rscdisplayarsenal\vest_ca.paa", { params ["", "_player"]; GVAR(addingPlate) = true; + [_player] call FUNC(doGesture); [GVAR(timeToAddPlate), [_player], { param [0] params ["_player"]; [_player] call FUNC(addPlate); GVAR(addingPlate) = false; }, { + param [0] params ["_player"]; GVAR(addingPlate) = false; + [_player, false] call FUNC(doGesture); }, LLSTRING(addPlateToVest), { param [0] params ["_player"]; (stance _player) != "PRONE" && { diff --git a/addons/main/anims/add_plate.rtm b/addons/main/anims/add_plate.rtm new file mode 100644 index 0000000..a04040f Binary files /dev/null and b/addons/main/anims/add_plate.rtm differ diff --git a/addons/main/config.cpp b/addons/main/config.cpp index 04de87f..6ecc152 100644 --- a/addons/main/config.cpp +++ b/addons/main/config.cpp @@ -21,44 +21,5 @@ class CfgPatches { #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" #include "CfgFunctions.hpp" - -class ACE_Medical_Injuries { - class damageTypes { - class woundHandlers; - class bullet { - class woundHandlers: woundHandlers { - ADDON = QFUNC(aceDamageHandler); - }; - }; - class grenade { - class woundHandlers: woundHandlers { - ADDON = QFUNC(aceDamageHandler); - }; - }; - class explosive { - class woundHandlers: woundHandlers { - ADDON = QFUNC(aceDamageHandler); - }; - }; - class shell { - class woundHandlers: woundHandlers { - ADDON = QFUNC(aceDamageHandler); - }; - }; - class stab { - class woundHandlers: woundHandlers { - ADDON = QFUNC(aceDamageHandler); - }; - }; - class punch { - class woundHandlers: woundHandlers { - ADDON = QFUNC(aceDamageHandler); - }; - }; - class unknown { - class woundHandlers: woundHandlers { - ADDON = QFUNC(aceDamageHandler); - }; - }; - }; -}; +#include "CfgGesturesMale.hpp" +#include "ACE_Medical_Injuries.hpp" diff --git a/addons/main/functions/fnc_aceDamageHandler.sqf b/addons/main/functions/fnc_aceDamageHandler.sqf index 3ff8998..ec38392 100644 --- a/addons/main/functions/fnc_aceDamageHandler.sqf +++ b/addons/main/functions/fnc_aceDamageHandler.sqf @@ -4,9 +4,16 @@ private _copy = +_allDamages; if ((_copy select 0 select 0) > 0) then { (_copy select 0) params ["_damage", "_bodyPart"]; - if (_damage isEqualTo 0 || {_bodyPart == "#structural"}) then {continue}; + private _parentShooter = _shooter; + if (GVAR(disallowFriendfire) && + {!isNull _parentShooter && { + _parentShooter isNotEqualTo _unit && { + (side group _unit) isEqualTo (side group _parentShooter)}}}) exitWith { + _copy = []; + }; + if (_damage isEqualTo 0 || {_bodyPart == "#structural"}) exitWith {}; private _isTorso = _bodyPart isEqualTo "Body"; - if (GVAR(protectOnlyTorso) && {!_isTorso}) then {continue}; + if (GVAR(protectOnlyTorso) && {!_isTorso}) exitWith {}; // _aceSelection is HitBody, HitLegs etc private _aceSelection = format ["Hit%1", _bodyPart]; @@ -23,9 +30,10 @@ if ((_copy select 0 select 0) > 0) then { }; // _shooter and _ammo exist in the scope above - private _damageLeft = [_unit, _damage, _actualDamage, _shooter, _ammo, _isTorso] call FUNC(receiveDamageACE); + private _damageLeft = [_unit, _damage, _actualDamage, _parentShooter, _ammo, _isTorso] call FUNC(receiveDamageACE); (_copy select 0) set [0, _damageLeft]; }; // if you want to do nothing, just exitWith {_this}. if you return nil or [] it will block further handling +if (_copy isEqualTo []) exitWith {[]}; [_unit, _copy, _typeOfDamage] //return diff --git a/addons/main/functions/fnc_addPlateKeyPress.sqf b/addons/main/functions/fnc_addPlateKeyPress.sqf index 2b16932..460f7dc 100644 --- a/addons/main/functions/fnc_addPlateKeyPress.sqf +++ b/addons/main/functions/fnc_addPlateKeyPress.sqf @@ -8,6 +8,7 @@ _player setVariable [QGVAR(wasSprintingAllowed), isSprintAllowed _player]; _player allowSprint false; _player setVariable [QGVAR(wasForceWalked), isForcedWalk _player]; _player forceWalk true; +[_player] call FUNC(doGesture); [{ params ["_player", "_ctrl"]; @@ -21,6 +22,7 @@ _player forceWalk true; _player allowSprint (_player getVariable [QGVAR(wasSprintingAllowed), true]); _player forceWalk (_player getVariable [QGVAR(wasForceWalked), true]); call FUNC(deleteProgressBar); + [_player, false] call FUNC(doGesture); if (GVAR(addPlateKeyUp) || { (stance _player) == "PRONE" || { diff --git a/addons/main/functions/fnc_doGesture.sqf b/addons/main/functions/fnc_doGesture.sqf new file mode 100644 index 0000000..a177847 --- /dev/null +++ b/addons/main/functions/fnc_doGesture.sqf @@ -0,0 +1,42 @@ +#include "script_component.hpp" +params ["_player", ["_add", true]]; + +// easier editing when adding new gesture speeds +#define MIN 2 +#define MAX 16 + +// prevent gesture eating your current mag when reloading +if (missionNamespace getVariable ["ace_common_isReloading", false]) exitWith {}; +if (_add) then { + private _seconds = (floor GVAR(timeToAddPlate)) min MAX; + if (_seconds < MIN) exitWith {}; + _player playActionNow (format [QGVAR(addPlate_%1), _seconds]); + + // prevent button spam for sound + _player setVariable [QGVAR(gestureStart), cba_missionTime]; + if ((_player getVariable [QGVAR(nextGestureSound), -1]) < cba_missionTime) then { + _player setVariable [QGVAR(nextGestureSound), cba_missionTime + (_seconds * 0.15) + 1]; + [{ + params ["_player", "_gestureTime"]; + if ((_player getVariable [QGVAR(gestureStart), -1]) isNotEqualTo _gestureTime) exitWith {}; + playSound3D [format [QPATHTO_R(sounds\platesOpen%1.ogg), floor random 4], _player, false, getPosASL _player, 0.75, 1, 7]; + }, [_player, cba_missionTime], _seconds * 0.15] call CBA_fnc_waitAndExecute; + }; + + if (_seconds > 3) then { + [{ + params ["_player", "_gestureTime"]; + if ((_player getVariable [QGVAR(gestureStart), -1]) isNotEqualTo _gestureTime) exitWith {}; + playSound3D [format [QPATHTO_R(sounds\platesMid%1.ogg), floor random 4], _player, false, getPosASL _player, 1, 1, 7]; + }, [_player, cba_missionTime], _seconds * 0.55] call CBA_fnc_waitAndExecute; + }; + + [{ + params ["_player", "_gestureTime"]; + if ((_player getVariable [QGVAR(gestureStart), -1]) isNotEqualTo _gestureTime) exitWith {}; + playSound3D [format [QPATHTO_R(sounds\platesClose%1.ogg), floor random 4], _player, false, getPosASL _player, 0.75, 1, 7]; + }, [_player, cba_missionTime], _seconds * 0.75] call CBA_fnc_waitAndExecute; +} else { + _player playActionNow QGVAR(stopGesture); + _player setVariable [QGVAR(gestureStart), nil]; +}; diff --git a/addons/main/script_mod.hpp b/addons/main/script_mod.hpp index 82b7d76..7335930 100644 --- a/addons/main/script_mod.hpp +++ b/addons/main/script_mod.hpp @@ -8,11 +8,10 @@ #define VERSION_AR MAJOR,MINOR,PATCHLVL,BUILD #define VERSION_PLUGIN MAJOR.MINOR.PATCHLVL.BUILD -#define REQUIRED_VERSION 2.04 +#define REQUIRED_VERSION 2.08 #ifdef COMPONENT_BEAUTIFIED #define COMPONENT_NAME QUOTE(Armor Plates System - COMPONENT_BEAUTIFIED) #else #define COMPONENT_NAME QUOTE(Armor Plates System - COMPONENT) #endif - diff --git a/addons/main/sounds/platesClose0.ogg b/addons/main/sounds/platesClose0.ogg new file mode 100644 index 0000000..ea8b448 Binary files /dev/null and b/addons/main/sounds/platesClose0.ogg differ diff --git a/addons/main/sounds/platesClose1.ogg b/addons/main/sounds/platesClose1.ogg new file mode 100644 index 0000000..da668f7 Binary files /dev/null and b/addons/main/sounds/platesClose1.ogg differ diff --git a/addons/main/sounds/platesClose2.ogg b/addons/main/sounds/platesClose2.ogg new file mode 100644 index 0000000..45534f0 Binary files /dev/null and b/addons/main/sounds/platesClose2.ogg differ diff --git a/addons/main/sounds/platesClose3.ogg b/addons/main/sounds/platesClose3.ogg new file mode 100644 index 0000000..9566d8f Binary files /dev/null and b/addons/main/sounds/platesClose3.ogg differ diff --git a/addons/main/sounds/platesMid0.ogg b/addons/main/sounds/platesMid0.ogg new file mode 100644 index 0000000..1b6438d Binary files /dev/null and b/addons/main/sounds/platesMid0.ogg differ diff --git a/addons/main/sounds/platesMid1.ogg b/addons/main/sounds/platesMid1.ogg new file mode 100644 index 0000000..b706880 Binary files /dev/null and b/addons/main/sounds/platesMid1.ogg differ diff --git a/addons/main/sounds/platesMid2.ogg b/addons/main/sounds/platesMid2.ogg new file mode 100644 index 0000000..f7e9f38 Binary files /dev/null and b/addons/main/sounds/platesMid2.ogg differ diff --git a/addons/main/sounds/platesMid3.ogg b/addons/main/sounds/platesMid3.ogg new file mode 100644 index 0000000..913ca65 Binary files /dev/null and b/addons/main/sounds/platesMid3.ogg differ diff --git a/addons/main/sounds/platesOpen0.ogg b/addons/main/sounds/platesOpen0.ogg new file mode 100644 index 0000000..a0d65a2 Binary files /dev/null and b/addons/main/sounds/platesOpen0.ogg differ diff --git a/addons/main/sounds/platesOpen1.ogg b/addons/main/sounds/platesOpen1.ogg new file mode 100644 index 0000000..4a7c064 Binary files /dev/null and b/addons/main/sounds/platesOpen1.ogg differ diff --git a/addons/main/sounds/platesOpen2.ogg b/addons/main/sounds/platesOpen2.ogg new file mode 100644 index 0000000..1be41a0 Binary files /dev/null and b/addons/main/sounds/platesOpen2.ogg differ diff --git a/addons/main/sounds/platesOpen3.ogg b/addons/main/sounds/platesOpen3.ogg new file mode 100644 index 0000000..b7fa937 Binary files /dev/null and b/addons/main/sounds/platesOpen3.ogg differ diff --git a/authors.txt b/authors.txt index 2a0fc5b..ae52c59 100644 --- a/authors.txt +++ b/authors.txt @@ -5,3 +5,4 @@ Contributors: audiocustoms Alacrritas Alien314 +WebKnight diff --git a/hemtt.toml b/hemtt.toml index 934650c..426f65b 100644 --- a/hemtt.toml +++ b/hemtt.toml @@ -17,6 +17,7 @@ files = [ "*.paa", "LICENSE", "readme.txt", + "authors.txt", "readme.md" ] include = ["./include"]