From af6f969ba3c4ee5cef8b47c2cb89f08c60d848cc Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Tue, 17 Sep 2024 18:59:54 +0200 Subject: [PATCH] SPE Compat - Add CSW support (#10285) Co-authored-by: PabstMirror --- .../compat_cup_weapons_csw/CfgWeapons.hpp | 1 + .../compat_rhs_usf3_csw/CfgWeapons.hpp | 1 + .../compat_spe_csw/ACE_CSW_Groups.hpp | 50 --- .../compat_spe_csw/CfgMagazineGroups.hpp | 94 +++++ .../compat_spe_csw/CfgMagazines.hpp | 26 ++ .../compat_spe/compat_spe_csw/CfgVehicles.hpp | 387 +++++++++++------- .../compat_spe/compat_spe_csw/CfgWeapons.hpp | 154 ++++++- addons/compat_spe/compat_spe_csw/config.cpp | 23 +- .../functions/fnc_alter_height.sqf | 106 +++++ .../functions/fnc_can_Reload.sqf | 42 ++ .../functions/fnc_can_alter_height.sqf | 31 ++ .../functions/fnc_can_assemble_weapon.sqf | 27 ++ .../functions/fnc_can_disassemble_weapon.sqf | 29 ++ .../functions/fnc_can_prepare_ammo.sqf | 38 ++ .../functions/fnc_can_resupply_ammo.sqf | 27 ++ .../functions/fnc_can_unload_ammo.sqf | 27 ++ .../compat_spe_csw/script_component.hpp | 7 + .../compat_spe/compat_spe_csw/stringtable.xml | 20 + .../StaticWeapons_U1_m/SPE_M3_Tripod.p3d | 0 .../SPE_Lafette_Tripod_High.p3d | 0 .../SPE_Lafette_Tripod_Low.p3d | 0 .../StaticWeapons_m/SPE_M2_Tripod_Low.p3d | 0 .../Weapons/Launchers/Gear_M3_Tripod_X_ca.paa | 0 .../Launchers/Gear_Lafette_Tripod_X_ca.paa | 0 .../Weapons/Launchers/Gear_M2_Tripod_X_ca.paa | 0 25 files changed, 869 insertions(+), 221 deletions(-) delete mode 100644 addons/compat_spe/compat_spe_csw/ACE_CSW_Groups.hpp create mode 100644 addons/compat_spe/compat_spe_csw/CfgMagazineGroups.hpp create mode 100644 addons/compat_spe/compat_spe_csw/CfgMagazines.hpp create mode 100644 addons/compat_spe/compat_spe_csw/functions/fnc_alter_height.sqf create mode 100644 addons/compat_spe/compat_spe_csw/functions/fnc_can_Reload.sqf create mode 100644 addons/compat_spe/compat_spe_csw/functions/fnc_can_alter_height.sqf create mode 100644 addons/compat_spe/compat_spe_csw/functions/fnc_can_assemble_weapon.sqf create mode 100644 addons/compat_spe/compat_spe_csw/functions/fnc_can_disassemble_weapon.sqf create mode 100644 addons/compat_spe/compat_spe_csw/functions/fnc_can_prepare_ammo.sqf create mode 100644 addons/compat_spe/compat_spe_csw/functions/fnc_can_resupply_ammo.sqf create mode 100644 addons/compat_spe/compat_spe_csw/functions/fnc_can_unload_ammo.sqf create mode 100644 addons/compat_spe/compat_spe_csw/stringtable.xml create mode 100644 tools/pDummies/WW2/SPE_Assets_m/Vehicles/StaticWeapons_U1_m/SPE_M3_Tripod.p3d create mode 100644 tools/pDummies/WW2/SPE_Assets_m/Vehicles/StaticWeapons_m/SPE_Lafette_Tripod_High.p3d create mode 100644 tools/pDummies/WW2/SPE_Assets_m/Vehicles/StaticWeapons_m/SPE_Lafette_Tripod_Low.p3d create mode 100644 tools/pDummies/WW2/SPE_Assets_m/Vehicles/StaticWeapons_m/SPE_M2_Tripod_Low.p3d create mode 100644 tools/pDummies/WW2/SPE_Assets_t/Weapons/Equipment_U1_t/Weapons/Launchers/Gear_M3_Tripod_X_ca.paa create mode 100644 tools/pDummies/WW2/SPE_Assets_t/Weapons/Equipment_t/Weapons/Launchers/Gear_Lafette_Tripod_X_ca.paa create mode 100644 tools/pDummies/WW2/SPE_Assets_t/Weapons/Equipment_t/Weapons/Launchers/Gear_M2_Tripod_X_ca.paa diff --git a/addons/compat_cup_weapons/compat_cup_weapons_csw/CfgWeapons.hpp b/addons/compat_cup_weapons/compat_cup_weapons_csw/CfgWeapons.hpp index 9ff8519ce11..56213219040 100644 --- a/addons/compat_cup_weapons/compat_cup_weapons_csw/CfgWeapons.hpp +++ b/addons/compat_cup_weapons/compat_cup_weapons_csw/CfgWeapons.hpp @@ -60,6 +60,7 @@ class CfgWeapons { class assembleTo { ace_csw_m3Tripod = "CUP_I_M2StaticMG_AAF"; ace_csw_m3TripodLow = "CUP_I_M2StaticMG_MiniTripod_AAF"; + EGVAR(compat_spe,m3Tripod) = "CUP_I_M2StaticMG_MiniTripod_AAF"; }; }; class WeaponSlotsInfo: WeaponSlotsInfo { diff --git a/addons/compat_rhs_usf3/compat_rhs_usf3_csw/CfgWeapons.hpp b/addons/compat_rhs_usf3/compat_rhs_usf3_csw/CfgWeapons.hpp index fa939ea80e0..b1a8bd88593 100644 --- a/addons/compat_rhs_usf3/compat_rhs_usf3_csw/CfgWeapons.hpp +++ b/addons/compat_rhs_usf3/compat_rhs_usf3_csw/CfgWeapons.hpp @@ -44,6 +44,7 @@ class CfgWeapons { class assembleTo { EGVAR(csw,m3Tripod) = "RHS_M2StaticMG_WD"; EGVAR(csw,m3TripodLow) = "RHS_M2StaticMG_MiniTripod_WD"; + EGVAR(compat_spe,m3Tripod) = "RHS_M2StaticMG_MiniTripod_WD"; }; }; class WeaponSlotsInfo: WeaponSlotsInfo { diff --git a/addons/compat_spe/compat_spe_csw/ACE_CSW_Groups.hpp b/addons/compat_spe/compat_spe_csw/ACE_CSW_Groups.hpp deleted file mode 100644 index 35758ed5333..00000000000 --- a/addons/compat_spe/compat_spe_csw/ACE_CSW_Groups.hpp +++ /dev/null @@ -1,50 +0,0 @@ -class ACE_CSW_Groups { - - // --- Gun Turrets ------------------------------------------------------------- - - class SPE_100Rnd_762x63 { - SPE_100Rnd_762x63 = 1; - }; - - class SPE_100Rnd_762x63_M1 { - SPE_100Rnd_762x63_M1 = 1; - }; - - class SPE_100Rnd_762x63_M2_AP { - SPE_100Rnd_762x63_M2_AP = 1; - }; - - class SPE_100Rnd_792x57 { - SPE_100Rnd_792x57 = 1; - }; - - class SPE_100Rnd_792x57_sS { - SPE_100Rnd_792x57_sS = 1; - }; - - class SPE_100Rnd_792x57_SMK { - SPE_100Rnd_792x57_SMK = 1; - }; - - // --- Mortars ------------------------------------------------------------- - - class SPE_1Rnd_81mmHE_M1_M43A1 { - SPE_1Rnd_81mmHE_M1_M43A1 = 1; - }; - class SPE_1Rnd_81mmWP_M1_M57 { - SPE_1Rnd_81mmWP_M1_M57 = 1; - }; - class SPE_81mm_M1_M57_SmokeShell { - SPE_81mm_M1_M57_SmokeShell = 1; - }; - - class SPE_1Rnd_81mm_FA_Mle_1932_HE { - SPE_1Rnd_81mm_FA_Mle_1932_HE = 1; - }; - class SPE_81mm_FA_Mle_1932_Smoke { - SPE_81mm_FA_Mle_1932_Smoke = 1; - }; - class SPE_81mm_FA_Mle_1932_Illu { - SPE_81mm_FA_Mle_1932_Illu = 1; - }; -}; diff --git a/addons/compat_spe/compat_spe_csw/CfgMagazineGroups.hpp b/addons/compat_spe/compat_spe_csw/CfgMagazineGroups.hpp new file mode 100644 index 00000000000..78f6d0629dd --- /dev/null +++ b/addons/compat_spe/compat_spe_csw/CfgMagazineGroups.hpp @@ -0,0 +1,94 @@ +class EGVAR(csw,groups) { + // --- Gun Turrets ------------------------------------------------------------- + class SPE_50Rnd_762x63 { + SPE_50Rnd_762x63 = 1; + }; + class SPE_100Rnd_762x63 { + SPE_100Rnd_762x63 = 1; + }; + + class SPE_50Rnd_762x63_M1 { + SPE_50Rnd_762x63_M1 = 1; + }; + class SPE_100Rnd_762x63_M1 { + SPE_100Rnd_762x63_M1 = 1; + }; + + class SPE_50Rnd_762x63_M2_AP { + SPE_50Rnd_762x63_M2_AP = 1; + }; + class SPE_100Rnd_762x63_M2_AP { + SPE_100Rnd_762x63_M2_AP = 1; + }; + + class SPE_50Rnd_762x63_Tracer { + SPE_50Rnd_762x63_Tracer = 1; + }; + class SPE_100Rnd_762x63_Tracer { + SPE_100Rnd_762x63_Tracer = 1; + }; + + class SPE_50Rnd_792x57 { + SPE_50Rnd_792x57 = 1; + }; + class SPE_100Rnd_792x57 { + SPE_100Rnd_792x57 = 1; + SPE_250Rnd_792x57 = 1; + }; + + class SPE_50Rnd_792x57_sS { + SPE_50Rnd_792x57_sS = 1; + }; + class SPE_100Rnd_792x57_sS { + SPE_100Rnd_792x57_sS = 1; + SPE_250Rnd_792x57_sS = 1; + }; + + class SPE_50Rnd_792x57_SMK { + SPE_50Rnd_792x57_SMK = 1; + }; + class SPE_100Rnd_792x57_SMK { + SPE_100Rnd_792x57_SMK = 1; + SPE_250Rnd_792x57_SMK = 1; + }; + + class SPE_50Rnd_792x57_Tracer { + SPE_50Rnd_792x57_Tracer = 1; + }; + class SPE_100Rnd_792x57_Tracer { + SPE_100Rnd_792x57_Tracer = 1; + }; + + // Makes it compatible with other mods' .50 BMG + class EGVAR(csw,100Rnd_127x99_mag) { + SPE_100Rnd_127x99_M2 = 1; + }; + class SPE_100Rnd_127x99_M2: EGVAR(csw,100Rnd_127x99_mag) {}; + + // --- Mortars ------------------------------------------------------------- + class SPE_1Rnd_81mmHE_M1_M43A1 { + SPE_8Rnd_81mmHE_M1_M43A1 = 1; + SPE_1Rnd_81mmHE_M1_M43A1 = 1; + }; + class SPE_1Rnd_81mmWP_M1_M57 { + SPE_8Rnd_81mmWP_M1_M57 = 1; + SPE_1Rnd_81mmWP_M1_M57 = 1; + }; + class SPE_81mm_M1_M57_SmokeShell { + SPE_8rnd_81mm_M1_M57_SmokeShell = 1; + SPE_81mm_M1_M57_SmokeShell = 1; + }; + + class SPE_1Rnd_81mm_FA_Mle_1932_HE { + SPE_8Rnd_81mm_FA_Mle_1932_HE = 1; + SPE_1Rnd_81mm_FA_Mle_1932_HE = 1; + }; + class SPE_81mm_FA_Mle_1932_Smoke { + SPE_8Rnd_81mm_FA_Mle_1932_Smoke = 1; + SPE_81mm_FA_Mle_1932_Smoke = 1; + }; + class SPE_81mm_FA_Mle_1932_Illu { + SPE_8Rnd_81mm_FA_Mle_1932_Illu = 1; + SPE_81mm_FA_Mle_1932_Illu = 1; + }; +}; diff --git a/addons/compat_spe/compat_spe_csw/CfgMagazines.hpp b/addons/compat_spe/compat_spe_csw/CfgMagazines.hpp new file mode 100644 index 00000000000..9c255c28008 --- /dev/null +++ b/addons/compat_spe/compat_spe_csw/CfgMagazines.hpp @@ -0,0 +1,26 @@ +// In SPE 1.1.1, the tracer magazines don't have proper names +class CfgMagazines { + class SPE_50Rnd_762x63; + class SPE_50Rnd_762x63_Tracer: SPE_50Rnd_762x63 { + displayName = SUBCSTRING(50Rnd_762x63_Tracer); + displayNameShort = "$STR_A3_tracer_dns"; + }; + + class SPE_100Rnd_762x63; + class SPE_100Rnd_762x63_Tracer: SPE_100Rnd_762x63 { + displayName = SUBCSTRING(100Rnd_762x63_Tracer); + displayNameShort = "$STR_A3_tracer_dns"; + }; + + class SPE_50Rnd_792x57; + class SPE_50Rnd_792x57_Tracer: SPE_50Rnd_792x57 { + displayName = SUBCSTRING(50Rnd_792x57_Tracer); + displayNameShort = "$STR_A3_tracer_dns"; + }; + + class SPE_100Rnd_792x57; + class SPE_100Rnd_792x57_Tracer: SPE_100Rnd_792x57 { + displayName = SUBCSTRING(100Rnd_792x57_Tracer); + displayNameShort = "$STR_A3_tracer_dns"; + }; +}; diff --git a/addons/compat_spe/compat_spe_csw/CfgVehicles.hpp b/addons/compat_spe/compat_spe_csw/CfgVehicles.hpp index e0a38aa341c..30d39301f38 100644 --- a/addons/compat_spe/compat_spe_csw/CfgVehicles.hpp +++ b/addons/compat_spe/compat_spe_csw/CfgVehicles.hpp @@ -9,90 +9,267 @@ class CfgVehicles { class ACE_Actions { class ACE_MainActions; }; - class Turrets { - class MainTurret; + }; + + // --- Gun Turrets ------------------------------------------------------------- + class StaticMGWeapon: StaticWeapon {}; + class SPE_StaticMGWeapon_base: StaticMGWeapon {}; + class SPE_M2_M3: SPE_StaticMGWeapon_base { + class ACE_Actions: ACE_Actions { + class ACE_MainActions: ACE_MainActions { + position = ""; + selection = "zamerny"; + }; + }; + class ace_csw { + enabled = 1; + proxyWeapon = QGVAR(M2_proxy); + magazineLocation = ""; + disassembleWeapon = "SPE_M2_50"; + disassembleTurret = QGVAR(m3Tripod); + ammoLoadTime = 10; + ammoUnloadTime = 8; + desiredAmmo = 100; + }; + }; + class SPE_M2_M3_Trench: SPE_M2_M3 { + class ace_csw: ace_csw { + disassembleWeapon = ""; + disassembleTurret = ""; }; - class UserActions; }; - // --- Mortars ----------------------------------------------------------------- - class StaticMortar: StaticWeapon { - class Turrets: Turrets { - class MainTurret: MainTurret {}; + + class SPE_M1919_M2: SPE_StaticMGWeapon_base { + class ace_csw { + enabled = 1; + proxyWeapon = QGVAR(M1919A4_proxy); + magazineLocation = "_target selectionPosition ['magazine', 'FireGeometry', 'AveragePoint']"; + disassembleWeapon = "SPE_M1919A4"; + disassembleTurret = QGVAR(m2Tripod); + ammoLoadTime = 8; + ammoUnloadTime = 6; + desiredAmmo = 100; }; }; - class SPE_StaticMortar_base: StaticMortar { - class Turrets: Turrets { - class MainTurret: MainTurret {}; + class SPE_M1919_M2_Trench_Deployed: SPE_M1919_M2 { + class ace_csw: ace_csw { + disassembleWeapon = ""; + disassembleTurret = ""; }; - class EventHandlers: EventHandlers { - class SPE_StaticWeaponsHandler { - init = ""; + }; + + + class SPE_MG42_Lafette: SPE_StaticMGWeapon_base { + class ACE_Actions: ACE_Actions { + class ACE_MainActions: ACE_MainActions { + class GVAR(alterHeight) { + condition = "getText (configOf _target >> 'SPE_AltHeight_Tripod_Name') != '' && {[_target, true] call SPE_WEAPONS_STATIC_fnc_can_alter_height}"; + displayName = "$STR_SPE_DN_ASSETS_VEHICLES_ADJUST_TRIPOD_HEIGHT"; + statement = "[_target, getText (configOf _target >> 'SPE_AltHeight_Tripod_Name'), true] call SPE_Weapons_Static_fnc_alter_height"; + icon = "\A3\Ui_f\data\IGUI\Cfg\Actions\repair_ca.paa"; + modifierFunction = "(_this select 3) set [1, format [localize 'STR_SPE_DN_ASSETS_VEHICLES_ADJUST_TRIPOD_HEIGHT', getText (configOf _target >> 'displayName')]]"; + }; }; }; }; + class SPE_MG42_Lafette_Deployed: SPE_MG42_Lafette { + class ace_csw { + enabled = 1; + proxyWeapon = QGVAR(MG42_proxy); + magazineLocation = ""; + disassembleWeapon = "SPE_MG42"; + disassembleTurret = QGVAR(LafetteTripod); + ammoLoadTime = 7; + ammoUnloadTime = 5; + desiredAmmo = 100; + }; + }; + class SPE_MG34_Lafette_Deployed: SPE_MG42_Lafette { + class ace_csw { + enabled = 1; + proxyWeapon = QGVAR(MG34_proxy); + magazineLocation = ""; + disassembleWeapon = "SPE_MG34"; + disassembleTurret = QGVAR(LafetteTripod); + ammoLoadTime = 7; + ammoUnloadTime = 5; + desiredAmmo = 100; + }; + }; - class SPE_US_Mortar_base: SPE_StaticMortar_base {}; - class SPE_M1_81: SPE_US_Mortar_base { - class Turrets: Turrets { - class MainTurret: MainTurret { - magazines[] = {}; + class SPE_MG42_Lafette_low; + class SPE_MG42_Lafette_low_Deployed: SPE_MG42_Lafette_low { + class ace_csw { + enabled = 1; + proxyWeapon = QGVAR(MG42_proxy); + magazineLocation = ""; + disassembleWeapon = "SPE_MG42"; + disassembleTurret = QGVAR(LafetteTripodLow); + ammoLoadTime = 7; + ammoUnloadTime = 5; + desiredAmmo = 100; + }; + }; + class SPE_MG42_Lafette_trench_Deployed: SPE_MG42_Lafette_low_Deployed { + class ace_csw: ace_csw { + disassembleWeapon = ""; + disassembleTurret = ""; + }; + }; + + class SPE_MG34_Lafette_low_Deployed: SPE_MG42_Lafette_low { + class ace_csw { + enabled = 1; + proxyWeapon = QGVAR(MG34_proxy); + magazineLocation = ""; + disassembleWeapon = "SPE_MG34"; + disassembleTurret = QGVAR(LafetteTripodLow); + ammoLoadTime = 7; + ammoUnloadTime = 5; + desiredAmmo = 100; + }; + }; + class SPE_MG34_Lafette_Trench_Deployed: SPE_MG34_Lafette_low_Deployed { + class ace_csw: ace_csw { + disassembleWeapon = ""; + disassembleTurret = ""; + }; + }; + + + class SPE_MG_Bipod_base; + class SPE_M1919A6_Bipod: SPE_MG_Bipod_base { + class ace_csw { + enabled = 1; + proxyWeapon = QGVAR(M1919A6_proxy); + magazineLocation = ""; + disassembleWeapon = ""; + disassembleTurret = ""; + ammoLoadTime = 8; + ammoUnloadTime = 6; + desiredAmmo = 100; + }; + }; + + + class SPE_MG42_Bipod: SPE_MG_Bipod_base { + class ace_csw { + enabled = 1; + proxyWeapon = QGVAR(MG42_proxy); + magazineLocation = ""; + disassembleWeapon = ""; + disassembleTurret = ""; + ammoLoadTime = 7; + ammoUnloadTime = 5; + desiredAmmo = 100; + }; + }; + class SPE_MG34_Bipod: SPE_MG_Bipod_base { + class ace_csw { + enabled = 1; + proxyWeapon = QGVAR(MG34_proxy); + magazineLocation = ""; + disassembleWeapon = ""; + disassembleTurret = ""; + ammoLoadTime = 7; + ammoUnloadTime = 5; + desiredAmmo = 100; + }; + }; + + + class ThingX; + class EGVAR(csw,baseTripod): ThingX { + class ACE_Actions { + class ACE_MainActions; + }; + }; + class GVAR(m3Tripod): EGVAR(csw,baseTripod) { + scope = 2; + displayName = "$STR_DN_SPE_M3_Tripod"; + model = "\WW2\SPE_Assets_m\Vehicles\StaticWeapons_U1_m\SPE_M3_Tripod.p3d"; + picture = "\WW2\SPE_Assets_t\Weapons\Equipment_U1_t\Weapons\Launchers\Gear_M3_Tripod_X_ca.paa"; + class ace_csw { + disassembleTo = "SPE_M3_Tripod"; + }; + }; + + class GVAR(m2Tripod): EGVAR(csw,baseTripod) { + scope = 2; + displayName = "$STR_DN_SPE_M2_Tripod"; + model = "\WW2\SPE_Assets_m\Vehicles\StaticWeapons_m\SPE_M2_Tripod_Low.p3d"; + picture = "\WW2\SPE_Assets_t\Weapons\Equipment_t\Weapons\Launchers\Gear_M2_Tripod_X_ca.paa"; + class ace_csw { + disassembleTo = "SPE_M2_Tripod"; + }; + }; + + class GVAR(LafetteTripodLow): EGVAR(csw,baseTripod) { + class ACE_Actions: ACE_Actions { + class ACE_MainActions: ACE_MainActions { + class GVAR(alterHeight) { + condition = "getText (configOf _target >> 'SPE_AltHeight_Tripod_Name') != '' && {[_target, true] call SPE_WEAPONS_STATIC_fnc_can_alter_height}"; + displayName = "$STR_SPE_DN_ASSETS_VEHICLES_ADJUST_TRIPOD_HEIGHT"; + statement = "[_target, getText (configOf _target >> 'SPE_AltHeight_Tripod_Name'), true] call SPE_Weapons_Static_fnc_alter_height"; + icon = "\A3\Ui_f\data\IGUI\Cfg\Actions\repair_ca.paa"; + modifierFunction = "(_this select 3) set [1, format [localize 'STR_SPE_DN_ASSETS_VEHICLES_ADJUST_TRIPOD_HEIGHT', getText (configOf _target >> 'displayName')]]"; + }; }; }; + scope = 2; + displayName = "$STR_DN_SPE_Lafette_Tripod"; + model = "\WW2\SPE_Assets_m\Vehicles\StaticWeapons_m\SPE_Lafette_Tripod_Low.p3d"; + picture = "\WW2\SPE_Assets_t\Weapons\Equipment_t\Weapons\Launchers\Gear_Lafette_Tripod_X_ca.paa"; + SPE_AltHeight_Tripod_Name = QGVAR(LafetteTripod); + class ace_csw { + disassembleTo = "SPE_Lafette_Tripod"; + }; + }; + + class GVAR(LafetteTripod): GVAR(LafetteTripodLow) { + model = "\WW2\SPE_Assets_m\Vehicles\StaticWeapons_m\SPE_Lafette_Tripod_High.p3d"; + SPE_AltHeight_Tripod_Name = QGVAR(LafetteTripodLow); + class ace_csw { + disassembleTo = "SPE_Lafette_Tripod"; + }; + }; + + // --- Mortars ----------------------------------------------------------------- + class StaticMortar: StaticWeapon {}; + class SPE_StaticMortar_base: StaticMortar {}; + class SPE_US_Mortar_base: SPE_StaticMortar_base {}; + class SPE_M1_81: SPE_US_Mortar_base { class ACE_Actions: ACE_Actions { class ACE_MainActions: ACE_MainActions { position = ""; selection = "zamerny"; }; }; - class UserActions { - delete Prepare_WP_Selected; - delete Prepare_WP; - delete Prepare_Smoke_Selected; - delete Prepare_Smoke; - delete Prepare_HE_Selected; - delete Prepare_HE; - delete Reload; - delete Unload; - }; - class ACE_CSW { + class ace_csw { enabled = 1; - proxyWeapon = "SPE_M1_81_proxy"; + proxyWeapon = QGVAR(M1_proxy); magazineLocation = "_target selectionPosition 'usti hlavne'"; disassembleWeapon = "SPE_M1_81_Barrel"; - disassembleTurret = QGVAR(M1_81_baseplate); + disassembleTurret = QGVAR(m1Baseplate); ammoLoadTime = 3; ammoUnloadTime = 3; desiredAmmo = 1; }; }; + class SPE_FR_Mortar_base: SPE_StaticMortar_base {}; class SPE_MLE_27_31: SPE_FR_Mortar_base { - class Turrets: Turrets { - class MainTurret: MainTurret { - magazines[] = {}; - }; - }; class ACE_Actions: ACE_Actions { class ACE_MainActions: ACE_MainActions { position = ""; selection = "zamerny"; }; }; - class UserActions { - delete Prepare_Illu_Selected; - delete Prepare_Illu; - delete Prepare_Smoke_Selected; - delete Prepare_Smoke; - delete Prepare_HE_Selected; - delete Prepare_HE; - delete Reload; - delete Unload; - }; - class ACE_CSW { + class ace_csw { enabled = 1; - proxyWeapon = "SPE_MLE_27_31_proxy"; + proxyWeapon = QGVAR(MLE_27_31_proxy); magazineLocation = "_target selectionPosition 'usti hlavne'"; disassembleWeapon = "SPE_MLE_27_31_Barrel"; disassembleTurret = QGVAR(MLE_27_31_baseplate); @@ -103,30 +280,9 @@ class CfgVehicles { }; class SPE_GrW278_1: SPE_MLE_27_31 { - class Turrets: Turrets { - class MainTurret: MainTurret { - magazines[] = {}; - }; - }; - class ACE_Actions: ACE_Actions { - class ACE_MainActions: ACE_MainActions { - position = ""; - selection = "zamerny"; - }; - }; - class UserActions { - delete Prepare_Illu_Selected; - delete Prepare_Illu; - delete Prepare_Smoke_Selected; - delete Prepare_Smoke; - delete Prepare_HE_Selected; - delete Prepare_HE; - delete Reload; - delete Unload; - }; - class ACE_CSW { + class ace_csw { enabled = 1; - proxyWeapon = "SPE_GrW278_1_proxy"; + proxyWeapon = QGVAR(GrW278_1_proxy); magazineLocation = "_target selectionPosition 'usti hlavne'"; disassembleWeapon = "SPE_GrW278_1_Barrel"; disassembleTurret = QGVAR(GrW278_baseplate); @@ -137,7 +293,15 @@ class CfgVehicles { }; - class EGVAR(csw,baseTripod); + class GVAR(m1Baseplate): EGVAR(csw,baseTripod) { + scope = 2; + displayName = "$STR_DN_SPE_M1_81_STAND"; + model = "\WW2\SPE_Assets_m\Weapons\Mortars_m\SPE_M1_Mortar_Stand_Deployed.p3d"; + picture = "\WW2\SPE_Assets_t\Weapons\Equipment_t\Weapons\Launchers\Gear_M1_81_Stand_X_ca.paa"; + class ace_csw { + disassembleTo = "SPE_M1_81_Stand"; + }; + }; class GVAR(MLE_27_31_baseplate): EGVAR(csw,baseTripod) { scope = 2; @@ -146,7 +310,7 @@ class CfgVehicles { picture = "\WW2\SPE_Assets_t\Weapons\Equipment_t\Weapons\Launchers\Gear_MLE_27_31_Stand_X_ca.paa"; hiddenSelections[] = {"camo_0","camo_1"}; hiddenSelectionsTextures[] = {"ww2\spe_assets_t\weapons\mortars_t\m1_mortar\Brandt_81mm_Mortar_French_co.paa","WW2\SPE_Assets_t\Weapons\Mortars_t\M1_Mortar\Brandt_81mm_Sight_French_co.paa"}; - class ACE_CSW { + class ace_csw { disassembleTo = "SPE_MLE_27_31_Stand"; }; }; @@ -158,83 +322,8 @@ class CfgVehicles { picture = "\WW2\SPE_Assets_t\Weapons\Equipment_t\Weapons\Launchers\Gear_GrW278_1_Stand_X_ca.paa"; hiddenSelections[] = {"camo_0"}; hiddenSelectionsTextures[] = {"ww2\spe_assets_t\weapons\mortars_t\m1_mortar\Brandt_81mm_Mortar_Gelb_co.paa"}; - class ACE_CSW { + class ace_csw { disassembleTo = "SPE_GrW278_1_Stand"; }; }; - - class GVAR(M1_81_baseplate): EGVAR(csw,baseTripod) { - scope = 2; - displayName = "$STR_DN_SPE_M1_81_STAND"; - model = "\WW2\SPE_Assets_m\Weapons\Mortars_m\SPE_M1_Mortar_Stand_Deployed.p3d"; - picture = "\WW2\SPE_Assets_t\Weapons\Equipment_t\Weapons\Launchers\Gear_M1_81_Stand_X_ca.paa"; - class ACE_CSW { - disassembleTo = "SPE_M1_81_Stand"; - }; - }; - - - class ACE_SPE_M1_81_Stand_Deployed: EGVAR(csw,baseTripod) { - author = "SPE"; - scope = 2; - displayName = "$STR_DN_SPE_M1_81_STAND"; - model = "\WW2\SPE_Assets_m\Weapons\Mortars_m\SPE_M1_Mortar_Stand_Deployed.p3d"; - picture = "\WW2\SPE_Assets_t\Weapons\Equipment_t\Weapons\Launchers\Gear_M1_81_Stand_X_ca.paa"; - class assembleInfo { - base = ""; - primary = 0; - displayName = ""; - assembleTo = ""; - class SPE_M1_81_Barrel { - deployTime = 0; - assembleTo = ""; - }; - }; - class ACE_CSW { - disassembleTo = "SPE_M1_81_Stand"; - }; - }; - class ACE_SPE_GrW278_1_Stand_Deployed: EGVAR(csw,baseTripod) { - author = "SPE"; - scope = 2; - displayName = "$STR_DN_SPE_GrW278_1_STAND"; - model = "\WW2\SPE_Assets_m\Weapons\Mortars_m\SPE_M1_Mortar_Stand_Deployed.p3d"; - picture = "\WW2\SPE_Assets_t\Weapons\Equipment_t\Weapons\Launchers\Gear_GrW278_1_Stand_X_ca.paa"; - hiddenSelectionsTextures[] = {"ww2\spe_assets_t\weapons\mortars_t\m1_mortar\Brandt_81mm_Mortar_Gelb_co.paa","WW2\SPE_Assets_t\Weapons\Mortars_t\M1_Mortar\Brandt_81mm_Sight_Gelb_co.paa"}; - class assembleInfo { - base = ""; - primary = 0; - displayName = ""; - assembleTo = ""; - class SPE_GrW278_1_Barrel { - deployTime = 0; - assembleTo = ""; - }; - }; - class ACE_CSW { - disassembleTo = "SPE_GrW278_1_Stand"; - }; - }; - class ACE_SPE_MLE_27_31_Stand_Deployed: EGVAR(csw,baseTripod) { - author = "SPE"; - scope = 2; - displayName = "$STR_DN_SPE_MLE_27_31_STAND"; - model = "\WW2\SPE_Assets_m\Weapons\Mortars_m\SPE_M1_Mortar_Stand_Deployed.p3d"; - picture = "\WW2\SPE_Assets_t\Weapons\Equipment_t\Weapons\Launchers\Gear_MLE_27_31_Stand_X_ca.paa"; - hiddenSelections[] = {"camo_0","camo_1"}; - hiddenSelectionsTextures[] = {"ww2\spe_assets_t\weapons\mortars_t\m1_mortar\Brandt_81mm_Mortar_French_co.paa","WW2\SPE_Assets_t\Weapons\Mortars_t\M1_Mortar\Brandt_81mm_Sight_French_co.paa"}; - class assembleInfo { - base = ""; - primary = 0; - displayName = ""; - assembleTo = ""; - class SPE_MLE_27_31_Barrel { - deployTime = 0; - assembleTo = ""; - }; - }; - class ACE_CSW { - disassembleTo = "SPE_MLE_27_31_Stand"; - }; - }; }; diff --git a/addons/compat_spe/compat_spe_csw/CfgWeapons.hpp b/addons/compat_spe/compat_spe_csw/CfgWeapons.hpp index db090c77080..b6e71dcb6a9 100644 --- a/addons/compat_spe/compat_spe_csw/CfgWeapons.hpp +++ b/addons/compat_spe/compat_spe_csw/CfgWeapons.hpp @@ -1,43 +1,162 @@ class CfgWeapons { - class Launcher; - class Launcher_Base_F: Launcher { - class WeaponSlotsInfo; + class Launcher_Base_F; + class SPE_Slung_Static_Weapon_Base: Launcher_Base_F {}; + + // --- Vanilla Compat ------------------------------------------------------------- + class EGVAR(csw,staticHMGCarry): Launcher_Base_F { + class ace_csw { + class assembleTo { + GVAR(m3Tripod) = "B_HMG_01_F"; + }; + }; + }; + class EGVAR(csw,staticM2ShieldCarry): EGVAR(csw,staticHMGCarry) { + class ace_csw: ace_csw { + class assembleTo { + GVAR(m3Tripod) = "B_HMG_02_F"; + }; + }; }; - class SPE_Slung_Static_Weapon_Base: Launcher_Base_F {}; + class EGVAR(csw,staticGMGCarry): Launcher_Base_F { + class ace_csw { + class assembleTo { + GVAR(m3Tripod) = "B_GMG_01_F"; + }; + }; + }; + + // --- Gun Turrets ------------------------------------------------------------- + class SPE_M2_M3_Tripod; + class GVAR(M2_proxy): SPE_M2_M3_Tripod { + magazineReloadTime = 0.5; + }; + class SPE_M3_Tripod: SPE_Slung_Static_Weapon_Base { + class ace_csw { + type = "mount"; + deployTime = 4; + pickupTime = 4; + deploy = QGVAR(m3Tripod); + }; + }; + class SPE_M2_50: SPE_Slung_Static_Weapon_Base { + class ace_csw { + type = "weapon"; + deployTime = 4; + pickupTime = 4; + class assembleTo { + GVAR(m3Tripod) = "SPE_M2_M3"; + EGVAR(csw,m3TripodLow) = "SPE_M2_M3"; + }; + }; + }; + + class SPE_M1919A4_tripod; + class GVAR(M1919A4_proxy): SPE_M1919A4_tripod { + magazineReloadTime = 0.5; + }; + + class SPE_M2_Tripod: SPE_Slung_Static_Weapon_Base { + class ace_csw { + type = "mount"; + deployTime = 4; + pickupTime = 4; + deploy = QGVAR(m2Tripod); + }; + }; + + class SPE_LMG; + class SPE_M1919A4: SPE_LMG { + class ace_csw { + type = "weapon"; + deployTime = 4; + pickupTime = 4; + class assembleTo { + GVAR(m2Tripod) = "SPE_M1919_M2"; + }; + }; + }; + + class SPE_M1919A6_StaticBipod; + class GVAR(M1919A6_proxy): SPE_M1919A6_StaticBipod { + magazineReloadTime = 0.5; + }; + + class SPE_MG42_Tripod; + class GVAR(MG42_proxy): SPE_MG42_Tripod { + magazineReloadTime = 0.5; + }; + + class SPE_MG34_Tripod; + class GVAR(MG34_proxy): SPE_MG34_Tripod { + magazineReloadTime = 0.5; + }; + + class SPE_Lafette_Tripod: SPE_Slung_Static_Weapon_Base { + class ace_csw { + type = "mount"; + deployTime = 4; + pickupTime = 4; + deploy = QGVAR(LafetteTripodLow); + }; + }; + class SPE_MG42: SPE_LMG { + class ace_csw { + type = "weapon"; + deployTime = 4; + pickupTime = 4; + class assembleTo { + GVAR(LafetteTripodLow) = "SPE_MG42_Lafette_low_Deployed"; + GVAR(LafetteTripod) = "SPE_MG42_Lafette_Deployed"; + }; + }; + }; + class SPE_MG34: SPE_LMG { + class ace_csw { + type = "weapon"; + deployTime = 4; + pickupTime = 4; + class assembleTo { + GVAR(LafetteTripodLow) = "SPE_MG34_Lafette_low_Deployed"; + GVAR(LafetteTripod) = "SPE_MG34_Lafette_Deployed"; + }; + }; + }; + + // --- Mortars ----------------------------------------------------------------- class SPE_M1_81; - class SPE_M1_81_proxy: SPE_M1_81 { + class GVAR(M1_proxy): SPE_M1_81 { magazineReloadTime = 0.5; }; class SPE_M1_81_Stand: SPE_Slung_Static_Weapon_Base { - class ACE_CSW { + class ace_csw { type = "mount"; deployTime = 4; pickupTime = 4; - deploy = QGVAR(M1_81_baseplate); + deploy = QGVAR(m1Baseplate); }; }; class SPE_M1_81_Barrel: SPE_Slung_Static_Weapon_Base { - class ACE_CSW { + class ace_csw { type = "weapon"; - deployTime = 4; - pickupTime = 4; + deployTime = 20; + pickupTime = 25; class assembleTo { - GVAR(M1_81_baseplate) = "SPE_M1_81"; + GVAR(m1Baseplate) = "SPE_M1_81"; EGVAR(csw,mortarBaseplate) = "SPE_M1_81"; }; }; }; class SPE_MLE_27_31; - class SPE_MLE_27_31_proxy: SPE_MLE_27_31 { + class GVAR(MLE_27_31_proxy): SPE_MLE_27_31 { magazineReloadTime = 0.5; }; class SPE_MLE_27_31_Stand: SPE_Slung_Static_Weapon_Base { - class ACE_CSW { + class ace_csw { type = "mount"; deployTime = 4; pickupTime = 4; @@ -45,7 +164,7 @@ class CfgWeapons { }; }; class SPE_MLE_27_31_Barrel: SPE_Slung_Static_Weapon_Base { - class ACE_CSW { + class ace_csw { type = "weapon"; deployTime = 20; pickupTime = 25; @@ -57,21 +176,20 @@ class CfgWeapons { }; class SPE_GrW278_1; - class SPE_GrW278_1_proxy: SPE_GrW278_1 { + class GVAR(GrW278_1_proxy): SPE_GrW278_1 { magazineReloadTime = 0.5; }; class SPE_GrW278_1_Stand: SPE_MLE_27_31_Stand { - class ACE_CSW { + class ace_csw { type = "mount"; deployTime = 4; pickupTime = 4; deploy = QGVAR(GrW278_baseplate); }; }; - class SPE_GrW278_1_Barrel: SPE_MLE_27_31_Barrel { - class ACE_CSW { + class ace_csw { type = "weapon"; deployTime = 20; pickupTime = 25; diff --git a/addons/compat_spe/compat_spe_csw/config.cpp b/addons/compat_spe/compat_spe_csw/config.cpp index 6ff669629bf..05627a8f6db 100644 --- a/addons/compat_spe/compat_spe_csw/config.cpp +++ b/addons/compat_spe/compat_spe_csw/config.cpp @@ -23,7 +23,22 @@ class CfgPatches { }; }; -#include "ACE_CSW_Groups.hpp" -// Todo: https://github.com/acemod/ACE3/pull/9292#discussion_r1327738181 -// #include "CfgVehicles.hpp" -// #include "CfgWeapons.hpp" +#include "CfgMagazines.hpp" +#include "CfgMagazineGroups.hpp" +#include "CfgVehicles.hpp" +#include "CfgWeapons.hpp" + +class CfgFunctions { + class SPE_WEAPONS_STATIC { + class SPE_Weapons_Static { + OVERWRITE_FUNC(alter_height); + OVERWRITE_FUNC(can_alter_height); + OVERWRITE_FUNC(can_assemble_weapon); + OVERWRITE_FUNC(can_disassemble_weapon); + OVERWRITE_FUNC(can_prepare_ammo); + OVERWRITE_FUNC(can_Reload); + OVERWRITE_FUNC(can_resupply_ammo); + OVERWRITE_FUNC(can_unload_ammo); + }; + }; +}; diff --git a/addons/compat_spe/compat_spe_csw/functions/fnc_alter_height.sqf b/addons/compat_spe/compat_spe_csw/functions/fnc_alter_height.sqf new file mode 100644 index 00000000000..927b754b7eb --- /dev/null +++ b/addons/compat_spe/compat_spe_csw/functions/fnc_alter_height.sqf @@ -0,0 +1,106 @@ +#include "..\script_component.hpp" +/* + * Author: Kerc (SPE), original by www.3commandobrigade.com, edited by johnb43 to be made CSW compatible + * Alters the static weapon's height. + * + * Arguments: + * 0: Static Weapon + * 1: New static weapon (i.e. the weapon to replace the current weapon) + * 2: Use ACE's progress bar (default: false) + * + * Return Value: + * None + * + * Example: + * cursorObject call SPE_Weapons_Static_fnc_can_alter_height + * + * Public: No + */ + +private _unit = call SPE_fnc_findPlayer; + +if !(alive _unit) exitWith {}; + +params ["_weaponPlatform", "_newStaticWeapon", ["_playProgressBar", false, [false]]]; + +if (_playProgressBar) exitWith { + [10 * EGVAR(csw,progressBarTimeCoefficent), [_weaponPlatform, _newStaticWeapon], { + (_this select 0) params ["_weaponPlatform", "_newStaticWeapon"]; + + [_weaponPlatform, _newStaticWeapon] call SPE_Weapons_Static_fnc_alter_height; + }, {}, LSUBLSTRING(alteringHeight), { + (_this select 0) params ["_weaponPlatform"]; + + _player distance _weaponPlatform <= 4 && {[_weaponPlatform, true] call SPE_Weapons_Static_fnc_can_alter_height} + }] call EFUNC(common,progressBar); +}; + +private _dir = vectorDir _weaponPlatform; +private _pos = (getPosATL _weaponPlatform) vectorAdd [0, 0, 0.1]; // 10 cm above terrain surface + +// Save state +private _magazines = magazinesAmmoFull _weaponPlatform; +private _assemblyModeIndex = _weaponPlatform getVariable QEGVAR(csw,assemblyMode); + +// Delete weapon and create new one +deleteVehicle _weaponPlatform; + +[{ + params ["_unit", "_newStaticWeapon", "_magazines", "_pos", "_dir", "_assemblyModeIndex"]; + + private _weaponPlatform = createVehicle [_newStaticWeapon, _pos, [], 0, "CAN_COLLIDE"]; + + if (!isNil "_assemblyModeIndex") then { + // Don't empty the weapon of its existing mags + _weaponPlatform setVariable [QEGVAR(csw,assemblyMode), 0, true]; + + if (_assemblyModeIndex == 0) exitWith {}; + + // Reset variable to original after initVehicle has run + [{ + (_this select 0) setVariable [QEGVAR(csw,assemblyMode), _this select 1, true]; + }, [_weaponPlatform, _assemblyModeIndex], 1.5] call CBA_fnc_waitAndExecute; + }; + + _weaponPlatform disableCollisionWith _unit; + _weaponPlatform setVectorDir _dir; + + [{ + _this remoteExecCall ["enableCollisionWith", _this]; + }, [_weaponPlatform, _unit], 0.5] call CBA_fnc_waitAndExecute; + + // Restore state + // First remove magazines that were spawned in with new weapon + { + _weaponPlatform removeMagazineTurret [_x, [0]]; + } forEach (_weaponPlatform magazinesTurret [0]); + + // Remove weapon temporarily and readd it to instantly load previous magazine + private _weapon = (_weaponPlatform weaponsTurret [0]) param [0, ""]; + + if (_weapon != "") then { + _weaponPlatform removeWeaponTurret [_weapon, [0]]; + }; + + if (_magazines isEqualTo []) exitWith {}; + + // Find loaded magazine + private _loadedIndex = _magazines findIf {_x select 2}; + + // If there was a loaded magazine, add that one first + if (_loadedIndex != -1) then { + (_magazines deleteAt _loadedIndex) params ["_magClass", "_ammoCount"]; + _weaponPlatform addMagazineTurret [_magClass, [0], _ammoCount]; + }; + + _weaponPlatform addWeaponTurret [_weapon, [0]]; + + { + _x params ["_magClass", "_ammoCount", "_loaded"]; + + // In some instances the loaded magazine is listed twice, so we skip it. + if (!_loaded) then { + _weaponPlatform addMagazineTurret [_magClass, [0], _ammoCount]; + }; + } forEach _magazines; +}, [_unit, _newStaticWeapon, _magazines, _pos, _dir, _assemblyModeIndex]] call CBA_fnc_execNextFrame; diff --git a/addons/compat_spe/compat_spe_csw/functions/fnc_can_Reload.sqf b/addons/compat_spe/compat_spe_csw/functions/fnc_can_Reload.sqf new file mode 100644 index 00000000000..c8a666753a1 --- /dev/null +++ b/addons/compat_spe/compat_spe_csw/functions/fnc_can_Reload.sqf @@ -0,0 +1,42 @@ +#include "..\script_component.hpp" +/* + * Author: Kerc (SPE), edited by johnb43 to be made CSW compatible + * Checks if the prepped magazine for the static weapon can be loaded. + * + * Arguments: + * 0: Static Weapon + * 1: Default magazine to load (unused) (default: "") + * + * Return Value: + * If the player can load the selected ammo for the static weapon's + * + * Example: + * cursorObject call SPE_Weapons_Static_fnc_can_Reload + * + * Public: No + */ + +params ["_weaponPlatform"]; + +private _unit = call SPE_fnc_findPlayer; + +alive _unit && +{alive _weaponPlatform} && +{vehicle _unit in [_unit, _weaponPlatform]} && +{(magazines _weaponPlatform) isEqualTo []} && +{ + private _selectedMagazine = _unit getVariable ["SPE_Static_Weapon_Magazine", ""]; + + if (_selectedMagazine == "") exitWith { + false + }; + + _selectedMagazine = _selectedMagazine call EFUNC(common,getConfigName); + + if (_selectedMagazine == "") exitWith { + false + }; + + _selectedMagazine in compatibleMagazines ((_weaponPlatform weaponsTurret [0]) select 0) +} && +{CONDITION_NO_CSW(_weaponPlatform)} // CSW check diff --git a/addons/compat_spe/compat_spe_csw/functions/fnc_can_alter_height.sqf b/addons/compat_spe/compat_spe_csw/functions/fnc_can_alter_height.sqf new file mode 100644 index 00000000000..7c3f8c1f84b --- /dev/null +++ b/addons/compat_spe/compat_spe_csw/functions/fnc_can_alter_height.sqf @@ -0,0 +1,31 @@ +#include "..\script_component.hpp" +/* + * Author: Kerc (SPE), original by www.3commandobrigade.com, edited by johnb43 to be made CSW compatible + * Checks if the static weapon's height can be adjusted. + * + * Arguments: + * 0: Static Weapon + * 1: Check for ACE CSW (default: false) + * + * Return Value: + * If the player can alter the static weapon's height + * + * Example: + * cursorObject call SPE_Weapons_Static_fnc_can_alter_height + * + * Public: No + */ + +params ["_weaponPlatform", ["_checkForCSW", false, [false]]]; + +private _unit = call SPE_fnc_findPlayer; + +alive _unit && +{alive _weaponPlatform} && +{isNull objectParent _unit} && +{crew _weaponPlatform isEqualTo []} && +{!(_weaponPlatform lockedTurret [0])} && { + // CSW check + (!_checkForCSW && {CONDITION_NO_CSW(_weaponPlatform)}) || + {_checkForCSW && {!(CONDITION_NO_CSW(_weaponPlatform))}} +} diff --git a/addons/compat_spe/compat_spe_csw/functions/fnc_can_assemble_weapon.sqf b/addons/compat_spe/compat_spe_csw/functions/fnc_can_assemble_weapon.sqf new file mode 100644 index 00000000000..60911d49fe1 --- /dev/null +++ b/addons/compat_spe/compat_spe_csw/functions/fnc_can_assemble_weapon.sqf @@ -0,0 +1,27 @@ +#include "..\script_component.hpp" +/* + * Author: Kerc (SPE), original by www.3commandobrigade.com, edited by johnb43 to be made CSW compatible + * Determines whether the player can assemble the static weapon. + * + * Arguments: + * 0: Tripod + * 1: Weapon + * + * Return Value: + * If the player can assemble the static weapon + * + * Example: + * cursorObject call SPE_Weapons_Static_fnc_can_assemble_weapon + * + * Public: No + */ + +params ["_tripod", "_weaponComponent"]; + +private _unit = call SPE_fnc_findPlayer; + +alive _unit && +{alive _tripod} && +{isNull objectParent _unit} && +{_weaponComponent in (weapons _unit)} && +{CONDITION_NO_CSW(_tripod)} // CSW check diff --git a/addons/compat_spe/compat_spe_csw/functions/fnc_can_disassemble_weapon.sqf b/addons/compat_spe/compat_spe_csw/functions/fnc_can_disassemble_weapon.sqf new file mode 100644 index 00000000000..66a54829537 --- /dev/null +++ b/addons/compat_spe/compat_spe_csw/functions/fnc_can_disassemble_weapon.sqf @@ -0,0 +1,29 @@ +#include "..\script_component.hpp" +/* + * Author: Kerc (SPE), original by www.3commandobrigade.com, edited by johnb43 to be made CSW compatible + * Checks if the static weapon can be disassembled. + * + * Arguments: + * 0: Static Weapon + * + * Return Value: + * If the player can disassemble the static weapon + * + * Example: + * cursorObject call SPE_Weapons_Static_fnc_can_Reload + * + * Public: No + */ + +params ["_weaponPlatform"]; + +private _unit = call SPE_fnc_findPlayer; + +alive _unit && +{alive _weaponPlatform} && +{isNull objectParent _unit} && +{crew _weaponPlatform isEqualTo []} && +{weaponDisassemblyEnabled _unit} && +{weaponDisassemblyEnabled _weaponPlatform} && +{!(_weaponPlatform lockedTurret [0])} && +{CONDITION_NO_CSW(_weaponPlatform)} // CSW check diff --git a/addons/compat_spe/compat_spe_csw/functions/fnc_can_prepare_ammo.sqf b/addons/compat_spe/compat_spe_csw/functions/fnc_can_prepare_ammo.sqf new file mode 100644 index 00000000000..e310b2a63cb --- /dev/null +++ b/addons/compat_spe/compat_spe_csw/functions/fnc_can_prepare_ammo.sqf @@ -0,0 +1,38 @@ +#include "..\script_component.hpp" +/* + * Author: ? (SPE), edited by johnb43 to be made CSW compatible + * Checks if the player can prepare the static weapon's ammo. + * + * Arguments: + * 0: Static Weapon + * 1: Magazine to load + * 2: If the magazine has been selected to be prepped for loading (default: false) + * + * Return Value: + * If the player can prepare the static weapon's ammo + * + * Example: + * cursorObject call SPE_Weapons_Static_fnc_can_prepare_ammo + * + * Public: No + */ + +params ["_weaponPlatform", "_ammo", ["_isSelected", false]]; + +private _unit = call SPE_fnc_findPlayer; + +alive _unit && +{alive _weaponPlatform} && +{vehicle _unit in [_unit, _weaponPlatform]} && +{ + private _defaultMags = getArray (configOf _weaponPlatform >> "Turrets" >> "MainTurret" >> "magazines"); + + if (({_x in _defaultMags} count (magazines _weaponPlatform)) > 1) exitWith { + false + }; + + private _selectedMagazine = _unit getVariable ["SPE_Static_Weapon_Magazine", ""]; + + _isSelected == (_selectedMagazine == _ammo) +} && +{CONDITION_NO_CSW(_weaponPlatform)} // CSW check diff --git a/addons/compat_spe/compat_spe_csw/functions/fnc_can_resupply_ammo.sqf b/addons/compat_spe/compat_spe_csw/functions/fnc_can_resupply_ammo.sqf new file mode 100644 index 00000000000..283c11d98d9 --- /dev/null +++ b/addons/compat_spe/compat_spe_csw/functions/fnc_can_resupply_ammo.sqf @@ -0,0 +1,27 @@ +#include "..\script_component.hpp" +/* + * Author: Kerc (SPE), original by www.3commandobrigade.com, edited by johnb43 to be made CSW compatible + * Checks if resupply of ammo to a static weapon is available. + * + * Arguments: + * 0: Static Weapon + * 1: Default magazine to load (unused) (default: "") + * + * Return Value: + * If the player can load the static weapon's ammo + * + * Example: + * cursorObject call SPE_Weapons_Static_fnc_can_resupply_ammo + * + * Public: No + */ + +params ["_weaponPlatform"]; + +private _unit = call SPE_fnc_findPlayer; + +alive _unit && +{alive _weaponPlatform} && +{vehicle _unit in [_unit, _weaponPlatform]} && +{(_weaponPlatform magazinesTurret [[0], false]) isEqualTo []} && // Limit the reload capacity of a static weapon to 1 magazines +{CONDITION_NO_CSW(_weaponPlatform)} // CSW check diff --git a/addons/compat_spe/compat_spe_csw/functions/fnc_can_unload_ammo.sqf b/addons/compat_spe/compat_spe_csw/functions/fnc_can_unload_ammo.sqf new file mode 100644 index 00000000000..23384d29733 --- /dev/null +++ b/addons/compat_spe/compat_spe_csw/functions/fnc_can_unload_ammo.sqf @@ -0,0 +1,27 @@ +#include "..\script_component.hpp" +/* + * Author: Kerc (SPE), original by www.3commandobrigade.com, edited by johnb43 to be made CSW compatible + * Checks if the player can unload a static weapon's magazines. + * + * Arguments: + * 0: Static Weapon + * + * Return Value: + * If the player can unload the static weapon's ammo + * + * Example: + * cursorObject call SPE_Weapons_Static_fnc_can_unload_ammo + * + * Public: No + */ + +params ["_weaponPlatform"]; + +private _unit = call SPE_fnc_findPlayer; + +alive _unit && +{alive _weaponPlatform} && +{_unit in _weaponPlatform || {isNull objectParent _unit && {(crew _weaponPlatform) isEqualTo []}}} && +{!(_weaponPlatform lockedTurret [0])} && +{(_weaponPlatform magazinesTurret [[0], false]) isNotEqualTo []} && +{CONDITION_NO_CSW(_weaponPlatform)} // CSW check diff --git a/addons/compat_spe/compat_spe_csw/script_component.hpp b/addons/compat_spe/compat_spe_csw/script_component.hpp index 1f7ace46a9e..8803d6fd261 100644 --- a/addons/compat_spe/compat_spe_csw/script_component.hpp +++ b/addons/compat_spe/compat_spe_csw/script_component.hpp @@ -1,3 +1,10 @@ #define SUBCOMPONENT csw #define SUBCOMPONENT_BEAUTIFIED Crew-Served Weapons #include "..\script_component.hpp" + +#define CONDITION_NO_CSW(var) (EGVAR(csw,ammoHandling) == 0) && {!([false, true, true, EGVAR(csw,defaultAssemblyMode)] select (var getVariable [ARR_2('EGVAR(csw,assemblyMode)',3)]))} + +#define OVERWRITE_FUNC(funcName)\ +class funcName {\ + file = QPATHTOF(DOUBLES(COMPONENT,SUBCOMPONENT)\functions\DOUBLES(fnc,funcName).sqf);\ +} diff --git a/addons/compat_spe/compat_spe_csw/stringtable.xml b/addons/compat_spe/compat_spe_csw/stringtable.xml new file mode 100644 index 00000000000..3368d4eb5e6 --- /dev/null +++ b/addons/compat_spe/compat_spe_csw/stringtable.xml @@ -0,0 +1,20 @@ + + + + + Altering Height... + + + .30-06 50Rnd Belt (M2/Tracer) + + + .30-06 100Rnd Belt (M2/Tracer) + + + 7.92x57 50Rnd Gurttrommel (L.S./Tracer) + + + 7.92x57 100Rnd Belt (L.S./Tracer) + + + diff --git a/tools/pDummies/WW2/SPE_Assets_m/Vehicles/StaticWeapons_U1_m/SPE_M3_Tripod.p3d b/tools/pDummies/WW2/SPE_Assets_m/Vehicles/StaticWeapons_U1_m/SPE_M3_Tripod.p3d new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tools/pDummies/WW2/SPE_Assets_m/Vehicles/StaticWeapons_m/SPE_Lafette_Tripod_High.p3d b/tools/pDummies/WW2/SPE_Assets_m/Vehicles/StaticWeapons_m/SPE_Lafette_Tripod_High.p3d new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tools/pDummies/WW2/SPE_Assets_m/Vehicles/StaticWeapons_m/SPE_Lafette_Tripod_Low.p3d b/tools/pDummies/WW2/SPE_Assets_m/Vehicles/StaticWeapons_m/SPE_Lafette_Tripod_Low.p3d new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tools/pDummies/WW2/SPE_Assets_m/Vehicles/StaticWeapons_m/SPE_M2_Tripod_Low.p3d b/tools/pDummies/WW2/SPE_Assets_m/Vehicles/StaticWeapons_m/SPE_M2_Tripod_Low.p3d new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tools/pDummies/WW2/SPE_Assets_t/Weapons/Equipment_U1_t/Weapons/Launchers/Gear_M3_Tripod_X_ca.paa b/tools/pDummies/WW2/SPE_Assets_t/Weapons/Equipment_U1_t/Weapons/Launchers/Gear_M3_Tripod_X_ca.paa new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tools/pDummies/WW2/SPE_Assets_t/Weapons/Equipment_t/Weapons/Launchers/Gear_Lafette_Tripod_X_ca.paa b/tools/pDummies/WW2/SPE_Assets_t/Weapons/Equipment_t/Weapons/Launchers/Gear_Lafette_Tripod_X_ca.paa new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tools/pDummies/WW2/SPE_Assets_t/Weapons/Equipment_t/Weapons/Launchers/Gear_M2_Tripod_X_ca.paa b/tools/pDummies/WW2/SPE_Assets_t/Weapons/Equipment_t/Weapons/Launchers/Gear_M2_Tripod_X_ca.paa new file mode 100644 index 00000000000..e69de29bb2d