diff --git a/addons/m119/XEH_PREP.hpp b/addons/m119/XEH_PREP.hpp index 6c9efe1..288dd65 100644 --- a/addons/m119/XEH_PREP.hpp +++ b/addons/m119/XEH_PREP.hpp @@ -7,3 +7,5 @@ PREP(canFold); PREP(canUnfold); PREP(fold); PREP(unfold); +PREP(fired); +PREP(eject); \ No newline at end of file diff --git a/addons/m119/XEH_preInit.sqf b/addons/m119/XEH_preInit.sqf index 7ad3f0c..d4d5ed5 100644 --- a/addons/m119/XEH_preInit.sqf +++ b/addons/m119/XEH_preInit.sqf @@ -3,5 +3,6 @@ #include "XEH_PREP.hpp" [QUOTE(TBD_M119), "init", {_this call FUNC(init)}] call CBA_fnc_addClassEventHandler; +[QUOTE(TBD_M119), "fired", {_this call FUNC(fired)}] call CBA_fnc_addClassEventHandler; ADDON = true; diff --git a/addons/m119/functions/fnc_eject.sqf b/addons/m119/functions/fnc_eject.sqf new file mode 100644 index 0000000..8f54e17 --- /dev/null +++ b/addons/m119/functions/fnc_eject.sqf @@ -0,0 +1,28 @@ +/* + FILE: fnc_eject.sqf + + Name: tbd_m119_m119_fnc_eject + + Author(s): + ilbinek + + Description: + Open the M119 breech + + Parameters: + _arty - object - M119 to spawn the spent casing + + Returns: + Nothing + + Examples: + > [_arty] call tbd_m119_m119_fnc_eject; + + Public: + No +*/ + +#include "..\script_component.hpp" + +params ["_arty"]; + diff --git a/addons/m119/functions/fnc_fired.sqf b/addons/m119/functions/fnc_fired.sqf new file mode 100644 index 0000000..3be67a4 --- /dev/null +++ b/addons/m119/functions/fnc_fired.sqf @@ -0,0 +1,34 @@ +/* + FILE: fnc_fired.sqf + + Name: tbd_m119_m119_fnc_fired + + Author(s): + ilbinek + + Description: + Fired EH for the M119. This script is called when the M119 is fired. It animates the recoil of the M119. + + Parameters: + _arty - object - M119 that fired + + Returns: + Nothing + + Examples: + > [_arty] call tbd_m119_m119_fnc_fired; + + Public: + No +*/ + +#include "..\script_component.hpp" + +params ["_arty"]; +_arty animateSource ["recoil_rest_source", 0.5, 5]; +_arty animateSource ["recoil_barrel_source", 1.2, 5]; + +[{params ["_arty"]; _arty animateSource ["recoil_barrel_source", 0];}, [_arty], 0.2] call CBA_fnc_waitAndExecute; +[{params ["_arty"]; _arty animateSource ["recoil_rest_source", 0, 0.2];}, [_arty], 0.1] call CBA_fnc_waitAndExecute; + +_arty setVariable [QGVAR(fired), true, true]; diff --git a/addons/m119/functions/fnc_openBreech.sqf b/addons/m119/functions/fnc_openBreech.sqf index c0ff23c..debe0b7 100644 --- a/addons/m119/functions/fnc_openBreech.sqf +++ b/addons/m119/functions/fnc_openBreech.sqf @@ -1,4 +1,3 @@ - /* FILE: fnc_openBreech.sqf @@ -32,3 +31,8 @@ if !([_arty] call FUNC(canOpenBrach)) exitWith {}; _arty animateSource ["open_breech_source", 1]; _arty animateSource ["handle_breech_source", 1]; _arty setVariable [QGVAR(breech), true, true]; + +if (_arty getVariable [QGVAR(fired), false]) then { + [_arty] call FUNC(eject); + _arty setVariable [QGVAR(fired), false, true]; +}; diff --git a/addons/m119/script_component.hpp b/addons/m119/script_component.hpp index d72c6aa..b33abb3 100644 --- a/addons/m119/script_component.hpp +++ b/addons/m119/script_component.hpp @@ -23,4 +23,10 @@ #define TBD_M119_SHOT_SOUNDSET tbd_m119_shot_soundset #define TBD_M119_SHOT_SOUNDSHADER tbd_M119_shot_soundshader -#define TBD_MORTAR_105mm_ROUND_HE tbd_mortar_105mm_round_he \ No newline at end of file +#define TBD_MORTARS_105mm_ROUND_HE_CHARGE_MAG_1 tbd_mortars_105mm_round_he_charge_mag_1 +#define TBD_MORTARS_105mm_ROUND_HE_CHARGE_MAG_2 tbd_mortars_105mm_round_he_charge_mag_2 +#define TBD_MORTARS_105mm_ROUND_HE_CHARGE_MAG_3 tbd_mortars_105mm_round_he_charge_mag_3 +#define TBD_MORTARS_105mm_ROUND_HE_CHARGE_MAG_4 tbd_mortars_105mm_round_he_charge_mag_4 +#define TBD_MORTARS_105mm_ROUND_HE_CHARGE_MAG_5 tbd_mortars_105mm_round_he_charge_mag_5 +#define TBD_MORTARS_105mm_ROUND_HE_CHARGE_MAG_6 tbd_mortars_105mm_round_he_charge_mag_6 +#define TBD_MORTARS_105mm_ROUND_HE_CHARGE_MAG_7 tbd_mortars_105mm_round_he_charge_mag_7 diff --git a/addons/m119/tbd_m119/CfgMagazines.hpp b/addons/m119/tbd_m119/CfgMagazines.hpp deleted file mode 100644 index a0137b5..0000000 --- a/addons/m119/tbd_m119/CfgMagazines.hpp +++ /dev/null @@ -1,19 +0,0 @@ - class CfgMagazines { - class Default; - class CA_Magazine: Default {}; - class VehicleMagazine: CA_Magazine {}; - class 32Rnd_155mm_Mo_shells: VehicleMagazine {}; - class 8Rnd_82mm_Mo_shells: 32Rnd_155mm_Mo_shells {}; - - class TBD_MORTAR_105mm_ROUND_HE: 8Rnd_82mm_Mo_shells { - scope = 2; - scopeArsenal = 2; - author = "TBD Team"; - displayName = "105mm HE"; - displayNameShort = "105mm HE"; - initSpeed = 800; - mass = 70; - count = 8; - type = 256; - }; -}; diff --git a/addons/m119/tbd_m119/CfgVehicles.hpp b/addons/m119/tbd_m119/CfgVehicles.hpp index fb4ce7c..24ab688 100644 --- a/addons/m119/tbd_m119/CfgVehicles.hpp +++ b/addons/m119/tbd_m119/CfgVehicles.hpp @@ -94,6 +94,7 @@ class CfgVehicles { memoryPointsGetInGunnerDir = "pos_gunner_dir"; proxyType = "CPGunner"; proxyIndex = 1; + magazines[] = {QUOTE(TBD_MORTARS_105mm_ROUND_HE_CHARGE_MAG_4)}; }; }; htMin = 1; @@ -177,7 +178,6 @@ class CfgVehicles { source = "user"; initPhase = 0; animPeriod = 0.5; - }; class hydraulics_source { diff --git a/addons/m119/tbd_m119/CfgWeapons.hpp b/addons/m119/tbd_m119/CfgWeapons.hpp index 07db915..b0db27c 100644 --- a/addons/m119/tbd_m119/CfgWeapons.hpp +++ b/addons/m119/tbd_m119/CfgWeapons.hpp @@ -11,63 +11,30 @@ class CfgWeapons { class TBD_M119_WEAPON: mortar_82mm { displayName = "M119 howitzer"; - //magazines[] = {QUOTE(TBD_M119_MAGAZINE_DUMMY)}; - modes[] = {"Single1", "Single2", "Single3", "Single4", "Single5", "Single6", "Single7"}; + magazines[] = {QUOTE(TBD_MORTARS_105mm_ROUND_HE_CHARGE_MAG_1), QUOTE(TBD_MORTARS_105mm_ROUND_HE_CHARGE_MAG_2), QUOTE(TBD_MORTARS_105mm_ROUND_HE_CHARGE_MAG_3), QUOTE(TBD_MORTARS_105mm_ROUND_HE_CHARGE_MAG_4), QUOTE(TBD_MORTARS_105mm_ROUND_HE_CHARGE_MAG_5), QUOTE(TBD_MORTARS_105mm_ROUND_HE_CHARGE_MAG_6), QUOTE(TBD_MORTARS_105mm_ROUND_HE_CHARGE_MAG_7)}; + modes[] = {"Single"}; reloadSound[] = {QPATHTOF(TBD_M119\sounds\reload.ogg), 3, 1, 50}; reloadMagazineSound[] = {QPATHTOF(TBD_M119\sounds\reload.ogg), 3, 1, 50}; magazineReloadTime = 0.5; - class Single1: Mode_SemiAuto { - displayName="105mm howitzer charge 1"; - sounds[]= - { - "StandardSound" - }; + class Single: Mode_SemiAuto { + displayName="105mm howitzer"; + sounds[]= {"StandardSound"}; class StandardSound { soundSetShot[] = {QUOTE(TBD_M119_SHOT_SOUNDSET)}; }; - reloadSound[]= - {QPATHTOF(TBD_M119\sounds\reload.ogg), 3, 1, 50}; - reloadTime=0.35; - artilleryDispersion=1.9; - artilleryCharge = 0.14; - aiRateOfFire=1; - aiRateOfFireDistance=10; - minRange=0; - minRangeProbab=0.0099999998; - midRange=1; - midRangeProbab=0.0099999998; - maxRange=2; - maxRangeProbab=0.0099999998; - }; - class Single2: Single1 { - displayName="105mm howitzer charge 2"; - artilleryCharge = 0.28; - }; - - class Single3: Single1 { - displayName="105mm howitzer charge 3"; - artilleryCharge = 0.42; - }; - - class Single4: Single1 { - displayName="105mm howitzer charge 4"; - artilleryCharge = 0.56; - }; - - class Single5: Single1 { - displayName="105mm howitzer charge 5"; - artilleryCharge = 0.70; - }; - - class Single6: Single1 { - displayName="105mm howitzer charge 6"; - artilleryCharge = 0.84; - }; - - class Single7: Single1 { - displayName="105mm howitzer charge 7"; + reloadSound[] = {QPATHTOF(TBD_M119\sounds\reload.ogg), 3, 1, 50}; + reloadTime = 0.35; + artilleryDispersion = 1.9; artilleryCharge = 1; + aiRateOfFire = 1; + aiRateOfFireDistance = 10; + minRange = 0; + minRangeProbab = 0.0099999998; + midRange = 1; + midRangeProbab = 0.0099999998; + maxRange = 2; + maxRangeProbab = 0.0099999998; }; }; }; diff --git a/addons/m119/tbd_m119/cfgMoves.hpp b/addons/m119/tbd_m119/cfgMoves.hpp index ec0fb0a..44a01be 100644 --- a/addons/m119/tbd_m119/cfgMoves.hpp +++ b/addons/m119/tbd_m119/cfgMoves.hpp @@ -1,17 +1,3 @@ -//class CfgPatches { -// class M119pose { -// author = "Tvoje_mama"; - // requiredVersion = 0.1; - // requiredAddons[]= { - // "A3_Anims_F" - // }; -// units[] = {}; - // weapons[] = {}; -// }; -//}; - - - class CfgMovesBasic { class defaultDie; class ManActions { @@ -19,7 +5,6 @@ class CfgMovesBasic { }; }; - class CfgMovesMaleSdr: CfgMovesBasic { skeletonName = "OFP2_ManSkeleton"; gestures = "CfgGesturesMale"; @@ -29,4 +14,4 @@ class CfgMovesMaleSdr: CfgMovesBasic { file = QPATHTOF(TBD_M119\animations\M119pose.rtm); }; }; -}; \ No newline at end of file +}; diff --git a/addons/m119/tbd_m119/config.cpp b/addons/m119/tbd_m119/config.cpp index a1629d9..52d654a 100644 --- a/addons/m119/tbd_m119/config.cpp +++ b/addons/m119/tbd_m119/config.cpp @@ -15,6 +15,5 @@ class Mode_SemiAuto; #include "CfgSoundSets.hpp" #include "CfgWeapons.hpp" #include "CfgVehicles.hpp" -#include "CfgMagazines.hpp" #include "CfgAnimationSourceSounds.hpp" #include "CfgMoves.hpp"