From 1db298722bf56d7f989db44b30ab9a9df6576ea3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Tue, 13 Jan 2015 00:23:14 -0300 Subject: [PATCH] CBAfy AGM_Overheating --- addons/overheating/$PBOPREFIX$ | 1 + addons/overheating/CfgEventHandlers.hpp | 21 + addons/overheating/CfgSounds.hpp | 6 + addons/overheating/CfgVehicles.hpp | 124 ++++++ addons/overheating/CfgWeapons.hpp | 180 ++++++++ addons/overheating/XEH_preInit.sqf | 9 + addons/overheating/config.cpp | 388 ++---------------- .../overheating/functions/fn_swapBarrel.sqf | 15 - .../functions/fn_swapBarrelCallback.sqf | 13 - ...mperature.sqf => fnc_checkTemperature.sqf} | 15 +- .../{fn_clearJam.sqf => fnc_clearJam.sqf} | 17 +- .../{fn_cooldown.sqf => fnc_cooldown.sqf} | 3 +- .../{fn_jamWeapon.sqf => fnc_jamWeapon.sqf} | 33 +- .../{fn_overheat.sqf => fnc_overheat.sqf} | 27 +- .../overheating/functions/fnc_swapBarrel.sqf | 16 + .../functions/fnc_swapBarrelCallback.sqf | 14 + addons/overheating/script_component.hpp | 12 + addons/overheating/stringtable.xml | 26 +- 18 files changed, 472 insertions(+), 448 deletions(-) create mode 100644 addons/overheating/$PBOPREFIX$ create mode 100644 addons/overheating/CfgEventHandlers.hpp create mode 100644 addons/overheating/CfgSounds.hpp create mode 100644 addons/overheating/CfgVehicles.hpp create mode 100644 addons/overheating/CfgWeapons.hpp create mode 100644 addons/overheating/XEH_preInit.sqf delete mode 100644 addons/overheating/functions/fn_swapBarrel.sqf delete mode 100644 addons/overheating/functions/fn_swapBarrelCallback.sqf rename addons/overheating/functions/{fn_checkTemperature.sqf => fnc_checkTemperature.sqf} (80%) rename addons/overheating/functions/{fn_clearJam.sqf => fnc_clearJam.sqf} (52%) rename addons/overheating/functions/{fn_cooldown.sqf => fnc_cooldown.sqf} (93%) rename addons/overheating/functions/{fn_jamWeapon.sqf => fnc_jamWeapon.sqf} (53%) rename addons/overheating/functions/{fn_overheat.sqf => fnc_overheat.sqf} (84%) create mode 100644 addons/overheating/functions/fnc_swapBarrel.sqf create mode 100644 addons/overheating/functions/fnc_swapBarrelCallback.sqf create mode 100644 addons/overheating/script_component.hpp diff --git a/addons/overheating/$PBOPREFIX$ b/addons/overheating/$PBOPREFIX$ new file mode 100644 index 0000000000..8171cd28be --- /dev/null +++ b/addons/overheating/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\overheating \ No newline at end of file diff --git a/addons/overheating/CfgEventHandlers.hpp b/addons/overheating/CfgEventHandlers.hpp new file mode 100644 index 0000000000..839856a5db --- /dev/null +++ b/addons/overheating/CfgEventHandlers.hpp @@ -0,0 +1,21 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE( call COMPILE_FILE(XEH_preInit.sqf) ); + }; +}; + +class Extended_FiredBIS_EventHandlers { + class CAManBase { + class GVAR(Overheat) { + clientFiredBIS = QUOTE( if (_this select 0 == ACE_player) then {_this call FUNC(overheat)}; ); + }; + }; +}; + +class Extended_Take_EventHandlers { + class CAManBase { + class GVAR(UnjamReload) { + clientTake = QUOTE( if (_this select 0 == ACE_player && {(_this select 1) in [ARR_3(uniformContainer (_this select 0), vestContainer (_this select 0), backpackContainer (_this select 0))]} && {_this select 2 == currentMagazine (_this select 0)}) then {_vehicle = vehicle (_this select 0); [ARR_4(_vehicle, currentWeapon _vehicle, true)] call FUNC(clearJam)}; ); + }; + }; +}; diff --git a/addons/overheating/CfgSounds.hpp b/addons/overheating/CfgSounds.hpp new file mode 100644 index 0000000000..a3d593ec7a --- /dev/null +++ b/addons/overheating/CfgSounds.hpp @@ -0,0 +1,6 @@ +class CfgSounds { + class ACE_BarrelSwap { + sound[] = {QUOTE(PATHOF(sounds\barrelswap.ogg)),5,1,200}; + titles[] = {}; + }; +}; diff --git a/addons/overheating/CfgVehicles.hpp b/addons/overheating/CfgVehicles.hpp new file mode 100644 index 0000000000..a3c955dd12 --- /dev/null +++ b/addons/overheating/CfgVehicles.hpp @@ -0,0 +1,124 @@ +#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ + name = #ITEM; \ + count = COUNT; \ +}; + +class CfgVehicles { + class Man; + + class CAManBase: Man { + class ACE_SelfActions { + class ACE_Equipment { + class ACE_SwapBarrel { + displayName = "$STR_ACE_Overheating_SwapBarrel"; + condition = QUOTE( 'ACE_SpareBarrel' in items _player && {getNumber (configFile >> 'CfgWeapons' >> currentWeapon _player >> 'ACE_Overheating_allowSwapBarrel') == 1} ); + statement = QUOTE( [_player, currentWeapon _player] call FUNC(swapBarrel); ); + showDisabled = 0; + priority = 3; + icon = QUOTE(PATHOF(UI\spare_barrel_ca.paa)); + hotkey = "B"; + }; + }; + class ACE_CheckTemperature { + displayName = "$STR_ACE_Overheating_CheckTemperatureShort"; + condition = QUOTE( currentWeapon _player in [primaryWeapon _player, secondaryWeapon _player, handgunWeapon _player] ); + statement = QUOTE( [_player, currentWeapon _player] call FUNC(CheckTemperature); ); + showDisabled = 0; + priority = 3.1; + icon = QUOTE(PATHOF(UI\temp_ca.paa)); + hotkey = "P"; + }; + }; + }; + + class ReammoBox_F; + class NATO_Box_Base; + class EAST_Box_Base; + class IND_Box_Base; + class FIA_Box_Base_F; + + class Box_NATO_Support_F: NATO_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_SpareBarrel,2) + }; + }; + + class B_supplyCrate_F: ReammoBox_F { + class TransportItems { + MACRO_ADDITEM(ACE_SpareBarrel,2) + }; + }; + + class Box_East_Support_F: EAST_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_SpareBarrel,2) + }; + }; + + class O_supplyCrate_F: B_supplyCrate_F { + class TransportItems { + MACRO_ADDITEM(ACE_SpareBarrel,2) + }; + }; + + class Box_IND_Support_F: IND_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_SpareBarrel,2) + }; + }; + + class Box_FIA_Support_F: FIA_Box_Base_F { + class TransportItems { + MACRO_ADDITEM(ACE_SpareBarrel,2) + }; + }; + + class I_supplyCrate_F: B_supplyCrate_F { + class TransportItems { + MACRO_ADDITEM(ACE_SpareBarrel,2) + }; + }; + + class IG_supplyCrate_F: ReammoBox_F { + class TransportItems { + MACRO_ADDITEM(ACE_SpareBarrel,2) + }; + }; + + class C_supplyCrate_F: ReammoBox_F { + class TransportItems { + MACRO_ADDITEM(ACE_SpareBarrel,2) + }; + }; + + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportItems { + MACRO_ADDITEM(ACE_SpareBarrel,6) + }; + }; + + // Add ACE_SpareBarrel to every machine gunner. + #define MACRO_ADDSPAREBARREL \ + items[] = {"FirstAidKit", "ACE_SpareBarrel"}; \ + respawnitems[] = {"FirstAidKit", "ACE_SpareBarrel"}; + + // NATO + class B_Soldier_02_f; class B_soldier_AR_F:B_Soldier_02_f {MACRO_ADDSPAREBARREL}; + class B_Soldier_support_base_F; class B_soldier_AAR_F:B_Soldier_support_base_F {MACRO_ADDSPAREBARREL}; + class B_Soldier_base_F; class B_CTRG_soldier_AR_A_F:B_Soldier_base_F {MACRO_ADDSPAREBARREL}; + + // Guerrilla + class I_G_Soldier_base_F; class I_G_Soldier_AR_F:I_G_Soldier_base_F {MACRO_ADDSPAREBARREL}; + class B_G_Soldier_AR_F:I_G_Soldier_AR_F {MACRO_ADDSPAREBARREL}; + class O_G_Soldier_AR_F:I_G_Soldier_AR_F {MACRO_ADDSPAREBARREL}; + + // Iran + class O_Soldier_base_F; class O_Soldier_AR_F:O_Soldier_base_F {MACRO_ADDSPAREBARREL}; + class O_Soldier_support_base_F; class O_Soldier_AAR_F:O_Soldier_support_base_F {MACRO_ADDSPAREBARREL}; + class O_Soldier_Urban_base; class O_soldierU_AR_F:O_Soldier_Urban_base {MACRO_ADDSPAREBARREL}; + class O_soldierU_AAR_F:O_Soldier_Urban_base {MACRO_ADDSPAREBARREL}; + + // Czech + class I_Soldier_02_F; class I_Soldier_AR_F:I_Soldier_02_F {MACRO_ADDSPAREBARREL}; + class I_Soldier_support_base_F; class I_Soldier_AAR_F:I_Soldier_support_base_F {MACRO_ADDSPAREBARREL}; +}; \ No newline at end of file diff --git a/addons/overheating/CfgWeapons.hpp b/addons/overheating/CfgWeapons.hpp new file mode 100644 index 0000000000..fc379494f0 --- /dev/null +++ b/addons/overheating/CfgWeapons.hpp @@ -0,0 +1,180 @@ +class CfgWeapons { + class ACE_ItemCore; + class InventoryItem_Base_F; + + class ACE_SpareBarrel: ACE_ItemCore { + displayname = "$STR_ACE_Overheating_SpareBarrelName"; + descriptionshort = "$STR_ACE_Overheating_SpareBarrelDescription"; + //model = ""; + picture = QUOTE(PATHOF(UI\spare_barrel_ca.paa)); + scope = 2; + class ItemInfo: InventoryItem_Base_F { + mass = 50; + }; + }; + + class Rifle; + class Rifle_Base_F : Rifle { + // Dispersion, SlowdownFactor and JamChance arrays have 4 values for different temperatures, which are interpolated between. + // These values correspond to temperatures Converted to real life values: 0: 0°C, 1: 333°C, 2: 666°C, 3: 1000°C. + + // Dispersion in radians. First value is for temp. 0, second for temp. 1 and so on. Values inbetween get interpolated. Negative values get ignored and can be used to move the starting point to hotter temperatures. + ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; + // How much the projectile gets slowed down before leaving the barrel. 0.9 means the bullet will lose 10% velocity. Values inbetween get interpolated. Numbers greater 1 increase the velocity, smaller 1 decrease it. + ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; + // Chance to jam the weapon. 0.0003 means 3 malfunctions on 10,000 rounds fired at this temperature. Values inbetween get interpolated. Negative values get ignored and can be used to move the starting point to hotter temperatures. + // When no reliable data exists for temperature vs. jam chance except MRBS, the following uniform criteria was adopted: [0, 1/MRBS, 5/MRBS, 25/MRBS]. + ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + }; + + class Rifle_Long_Base_F : Rifle_Base_F { + ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; + ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; + ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + }; + + class arifle_MX_Base_F : Rifle_Base_F { + ACE_clearJamAction = "GestureReloadMX"; // Custom jam clearing action. Default uses reload animation. + ACE_checkTemperatureAction = "Gear"; // Custom check temperature action. Default uses gear animation. + ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; + ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; + ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + }; + + class arifle_MX_SW_F : arifle_MX_Base_F { + ACE_clearJamAction = ""; // Custom jam clearing action. Use empty string to undefine. + ACE_Overheating_allowSwapBarrel = 1; // 1 to enable barrel swap. 0 to disable. Meant for machine guns where you can easily swap the barrel without dismantling the whole weapon. + ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; + ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; + ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + }; + + class arifle_Katiba_Base_F : Rifle_Base_F { + ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; + ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; + ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + }; + + class mk20_base_F : Rifle_Base_F { + ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; + ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; + ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + }; + + class Tavor_base_F : Rifle_Base_F { + ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; + ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; + ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + }; + + class SDAR_base_F : Rifle_Base_F { + ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; + ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; + ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + }; + + class EBR_base_F : Rifle_Long_Base_F { + ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; + ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; + ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + }; + + class DMR_01_base_F : Rifle_Long_Base_F { + ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; + ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; + ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + }; + + class GM6_base_F : Rifle_Long_Base_F { + ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; + ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; + ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + }; + + class LRR_base_F : Rifle_Long_Base_F { + ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; + ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; + ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + }; + + class LMG_Mk200_F : Rifle_Long_Base_F { + ACE_Overheating_allowSwapBarrel = 1; + ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; + ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; + ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + }; + + class LMG_Zafir_F : Rifle_Long_Base_F { + ACE_Overheating_allowSwapBarrel = 1; + ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; + ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; + ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + }; + + class SMG_01_Base : Rifle_Base_F { + ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; + ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; + ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + }; + + class SMG_02_base_F : Rifle_Base_F { + ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; + ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; + ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + }; + + class pdw2000_base_F : Rifle_Base_F { + ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; + ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; + ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + }; +}; + +class CfgAmmo { + class BulletCore; + class BulletBase : BulletCore { + ACE_BulletMass = 0; // Bullet mass in grams + }; + + // Rifle and MG rounds + class B_556x45_Ball : BulletBase { + ACE_BulletMass = 4.1; // 5.56x45 NATO + }; + + class B_65x39_Caseless : BulletBase { + ACE_BulletMass = 8; // 6.5mm Grendel + }; + + class B_762x51_Ball : BulletBase { + ACE_BulletMass = 10; // 7.62x51 NATO + }; + class ACE_B_762x51_M118LR : B_762x51_Ball { + ACE_BulletMass = 11; // 7.62x51 NATO M118 + }; + + class B_127x99_Ball : BulletBase { + ACE_BulletMass = 42; // 12.7×99mm NATO (.50 BMG) + }; + + class B_127x108_Ball : BulletBase { + ACE_BulletMass = 48.3; // 12.7x108 + }; + + class B_408_Ball : BulletBase { + ACE_BulletMass = 27; // .408 Cheyenne Tactical + }; + + // Pistol Rounds + class B_9x21_Ball : BulletBase { + ACE_BulletMass = 7.45; // 9×21mm IMI + }; + class B_9x19_Ball : B_9x21_Ball { + ACE_BulletMass = 7.45; // 9×19mm Parabellum + }; + class B_127x33_Ball : BulletBase { + ACE_BulletMass = 21; // .50 AE + }; + class B_45ACP_Ball : BulletBase { + ACE_BulletMass = 12; // .45 ACP + }; +}; diff --git a/addons/overheating/XEH_preInit.sqf b/addons/overheating/XEH_preInit.sqf new file mode 100644 index 0000000000..5ed28f8a23 --- /dev/null +++ b/addons/overheating/XEH_preInit.sqf @@ -0,0 +1,9 @@ +#include "script_component.hpp" + +PREP(checkTemperature); +PREP(clearJam); +PREP(cooldown); +PREP(jamWeapon); +PREP(overheat); +PREP(swapBarrel); +PREP(swapBarrelCallback); diff --git a/addons/overheating/config.cpp b/addons/overheating/config.cpp index 2c3c0f35c7..b2db6117b8 100644 --- a/addons/overheating/config.cpp +++ b/addons/overheating/config.cpp @@ -1,369 +1,35 @@ +#include "script_component.hpp" + class CfgPatches { - class AGM_Overheating { - units[] = {}; - weapons[] = {"AGM_SpareBarrel"}; - requiredVersion = 0.60; - requiredAddons[] = {AGM_Core, AGM_Interaction}; - version = "0.95"; - versionStr = "0.95"; - versionAr[] = {0,95,0}; - author[] = {"commy2", "KoffeinFlummi", "CAA-Picard"}; - authorUrl = "https://github.com/commy2/"; - }; + class ADDON { + units[] = {}; + weapons[] = {"ACE_SpareBarrel"}; + requiredVersion = 0.60; + requiredAddons[] = {ACE_Core, ACE_Interaction}; + version = "0.95"; + versionStr = "0.95"; + versionAr[] = {0,95,0}; + author[] = {"commy2", "KoffeinFlummi", "CAA-Picard"}; + authorUrl = "https://github.com/commy2/"; + }; }; -class CfgFunctions { - class AGM_Overheating { - class AGM_Overheating { - file = "\AGM_Overheating\functions"; - class checkTemperature; - class clearJam; - class cooldown; - class jamWeapon; - class overheat; - class swapBarrel; - class swapBarrelCallback; +#include "CfgEventHandlers.hpp" + +class ACE_Core_Default_Keys { + class clearJam { + displayName = "$STR_ACE_Overheating_UnjamWeapon"; + condition = QUOTE( [_player] call EFUNC(core,canUseWeapon) && {currentWeapon _player in (_player getVariable [QUOTE(QGVAR(jammedWeapons)), []])} ); + statement = QUOTE( [_player, currentMuzzle _player, false] call FUNC(clearJam); ); + key = 19; + shift = 1; + control = 0; + alt = 0; }; - }; }; -class Extended_FiredBIS_EventHandlers { - class CAManBase { - class AGM_Overheating_Overheat { - clientFiredBIS = "if (_this select 0 == AGM_player) then {_this call AGM_Overheating_fnc_overheat};"; - }; - }; -}; +#include "CfgSounds.hpp" -class Extended_Take_EventHandlers { - class CAManBase { - class AGM_Overheating_UnjamReload { - clientTake = "if (_this select 0 == AGM_player && {(_this select 1) in [uniformContainer (_this select 0), vestContainer (_this select 0), backpackContainer (_this select 0)]} && {_this select 2 == currentMagazine (_this select 0)}) then {_vehicle = vehicle (_this select 0); [_vehicle, currentWeapon _vehicle, true] call AGM_Overheating_fnc_clearJam};"; - }; - }; -}; +#include "CfgVehicles.hpp" -class AGM_Core_Default_Keys { - class clearJam { - displayName = "$STR_AGM_Overheating_UnjamWeapon"; - condition = "[_player] call AGM_Core_fnc_canUseWeapon && {currentWeapon _player in (_player getVariable ['AGM_Overheating_jammedWeapons', []])}"; - statement = "[_player, currentMuzzle _player, false] call AGM_Overheating_fnc_clearJam;"; - key = 19; - shift = 1; - control = 0; - alt = 0; - }; -}; - -class CfgSounds { - class AGM_BarrelSwap { - sound[] = {"\AGM_Overheating\sounds\barrelswap.ogg",5,1,200}; - titles[] = {}; - }; -}; - -#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ - name = #ITEM; \ - count = COUNT; \ -}; - -class CfgVehicles { - class Man; - - class CAManBase: Man { - class AGM_SelfActions { - class AGM_Equipment { - class AGM_SwapBarrel { - displayName = "$STR_AGM_Overheating_SwapBarrel"; - condition = "'AGM_SpareBarrel' in items _player && {getNumber (configFile >> 'CfgWeapons' >> currentWeapon _player >> 'AGM_Overheating_allowSwapBarrel') == 1}"; - statement = "[_player, currentWeapon _player] call AGM_Overheating_fnc_swapBarrel;"; - showDisabled = 0; - priority = 3; - icon = "AGM_Overheating\UI\spare_barrel_ca.paa"; - hotkey = "B"; - }; - }; - class AGM_CheckTemperature { - displayName = "$STR_AGM_Overheating_CheckTemperatureShort"; - condition = "currentWeapon _player in [primaryWeapon _player, secondaryWeapon _player, handgunWeapon _player]"; - statement = "[_player, currentWeapon _player] call AGM_Overheating_fnc_CheckTemperature;"; - showDisabled = 0; - priority = 3.1; - icon = "AGM_Overheating\UI\temp_ca.paa"; - hotkey = "P"; - }; - }; - }; - - class ReammoBox_F; - class NATO_Box_Base; - class EAST_Box_Base; - class IND_Box_Base; - class FIA_Box_Base_F; - - class Box_NATO_Support_F: NATO_Box_Base { - class TransportItems { - MACRO_ADDITEM(AGM_SpareBarrel,2) - }; - }; - - class B_supplyCrate_F: ReammoBox_F { - class TransportItems { - MACRO_ADDITEM(AGM_SpareBarrel,2) - }; - }; - - class Box_East_Support_F: EAST_Box_Base { - class TransportItems { - MACRO_ADDITEM(AGM_SpareBarrel,2) - }; - }; - - class O_supplyCrate_F: B_supplyCrate_F { - class TransportItems { - MACRO_ADDITEM(AGM_SpareBarrel,2) - }; - }; - - class Box_IND_Support_F: IND_Box_Base { - class TransportItems { - MACRO_ADDITEM(AGM_SpareBarrel,2) - }; - }; - - class Box_FIA_Support_F: FIA_Box_Base_F { - class TransportItems { - MACRO_ADDITEM(AGM_SpareBarrel,2) - }; - }; - - class I_supplyCrate_F: B_supplyCrate_F { - class TransportItems { - MACRO_ADDITEM(AGM_SpareBarrel,2) - }; - }; - - class IG_supplyCrate_F: ReammoBox_F { - class TransportItems { - MACRO_ADDITEM(AGM_SpareBarrel,2) - }; - }; - - class C_supplyCrate_F: ReammoBox_F { - class TransportItems { - MACRO_ADDITEM(AGM_SpareBarrel,2) - }; - }; - - class AGM_Box_Misc: Box_NATO_Support_F { - class TransportItems { - MACRO_ADDITEM(AGM_SpareBarrel,6) - }; - }; - - // Add AGM_SpareBarrel to every machine gunner. - #define MACRO_ADDSPAREBARREL \ - items[] = {"FirstAidKit", "AGM_SpareBarrel"}; \ - respawnitems[] = {"FirstAidKit", "AGM_SpareBarrel"}; - - // NATO - class B_Soldier_02_f; class B_soldier_AR_F:B_Soldier_02_f {MACRO_ADDSPAREBARREL}; - class B_Soldier_support_base_F; class B_soldier_AAR_F:B_Soldier_support_base_F {MACRO_ADDSPAREBARREL}; - class B_Soldier_base_F; class B_CTRG_soldier_AR_A_F:B_Soldier_base_F {MACRO_ADDSPAREBARREL}; - - // Guerrilla - class I_G_Soldier_base_F; class I_G_Soldier_AR_F:I_G_Soldier_base_F {MACRO_ADDSPAREBARREL}; - class B_G_Soldier_AR_F:I_G_Soldier_AR_F {MACRO_ADDSPAREBARREL}; - class O_G_Soldier_AR_F:I_G_Soldier_AR_F {MACRO_ADDSPAREBARREL}; - - // Iran - class O_Soldier_base_F; class O_Soldier_AR_F:O_Soldier_base_F {MACRO_ADDSPAREBARREL}; - class O_Soldier_support_base_F; class O_Soldier_AAR_F:O_Soldier_support_base_F {MACRO_ADDSPAREBARREL}; - class O_Soldier_Urban_base; class O_soldierU_AR_F:O_Soldier_Urban_base {MACRO_ADDSPAREBARREL}; - class O_soldierU_AAR_F:O_Soldier_Urban_base {MACRO_ADDSPAREBARREL}; - - // Czech - class I_Soldier_02_F; class I_Soldier_AR_F:I_Soldier_02_F {MACRO_ADDSPAREBARREL}; - class I_Soldier_support_base_F; class I_Soldier_AAR_F:I_Soldier_support_base_F {MACRO_ADDSPAREBARREL}; -}; - -class CfgWeapons { - class AGM_ItemCore; - class InventoryItem_Base_F; - - class AGM_SpareBarrel: AGM_ItemCore { - displayname = "$STR_AGM_Overheating_SpareBarrelName"; - descriptionshort = "$STR_AGM_Overheating_SpareBarrelDescription"; - //model = ""; - picture = "\AGM_Overheating\UI\spare_barrel_ca.paa"; - scope = 2; - class ItemInfo: InventoryItem_Base_F { - mass = 50; - }; - }; - - class Rifle; - class Rifle_Base_F : Rifle { - // Dispersion, SlowdownFactor and JamChance arrays have 4 values for different temperatures, which are interpolated between. - // These values correspond to temperatures Converted to real life values: 0: 0°C, 1: 333°C, 2: 666°C, 3: 1000°C. - - // Dispersion in radians. First value is for temp. 0, second for temp. 1 and so on. Values inbetween get interpolated. Negative values get ignored and can be used to move the starting point to hotter temperatures. - AGM_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; - // How much the projectile gets slowed down before leaving the barrel. 0.9 means the bullet will lose 10% velocity. Values inbetween get interpolated. Numbers greater 1 increase the velocity, smaller 1 decrease it. - AGM_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - // Chance to jam the weapon. 0.0003 means 3 malfunctions on 10,000 rounds fired at this temperature. Values inbetween get interpolated. Negative values get ignored and can be used to move the starting point to hotter temperatures. - // When no reliable data exists for temperature vs. jam chance except MRBS, the following uniform criteria was adopted: [0, 1/MRBS, 5/MRBS, 25/MRBS]. - AGM_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class Rifle_Long_Base_F : Rifle_Base_F { - AGM_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; - AGM_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - AGM_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class arifle_MX_Base_F : Rifle_Base_F { - AGM_clearJamAction = "GestureReloadMX"; // Custom jam clearing action. Default uses reload animation. - AGM_checkTemperatureAction = "Gear"; // Custom check temperature action. Default uses gear animation. - AGM_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; - AGM_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - AGM_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class arifle_MX_SW_F : arifle_MX_Base_F { - AGM_clearJamAction = ""; // Custom jam clearing action. Use empty string to undefine. - AGM_Overheating_allowSwapBarrel = 1; // 1 to enable barrel swap. 0 to disable. Meant for machine guns where you can easily swap the barrel without dismantling the whole weapon. - AGM_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; - AGM_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - AGM_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class arifle_Katiba_Base_F : Rifle_Base_F { - AGM_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; - AGM_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - AGM_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class mk20_base_F : Rifle_Base_F { - AGM_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; - AGM_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - AGM_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class Tavor_base_F : Rifle_Base_F { - AGM_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; - AGM_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - AGM_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class SDAR_base_F : Rifle_Base_F { - AGM_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; - AGM_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - AGM_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class EBR_base_F : Rifle_Long_Base_F { - AGM_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; - AGM_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - AGM_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class DMR_01_base_F : Rifle_Long_Base_F { - AGM_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; - AGM_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - AGM_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class GM6_base_F : Rifle_Long_Base_F { - AGM_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; - AGM_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - AGM_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class LRR_base_F : Rifle_Long_Base_F { - AGM_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; - AGM_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - AGM_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class LMG_Mk200_F : Rifle_Long_Base_F { - AGM_Overheating_allowSwapBarrel = 1; - AGM_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; - AGM_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - AGM_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class LMG_Zafir_F : Rifle_Long_Base_F { - AGM_Overheating_allowSwapBarrel = 1; - AGM_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; - AGM_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - AGM_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class SMG_01_Base : Rifle_Base_F { - AGM_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; - AGM_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - AGM_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class SMG_02_base_F : Rifle_Base_F { - AGM_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; - AGM_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - AGM_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class pdw2000_base_F : Rifle_Base_F { - AGM_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; - AGM_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - AGM_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; -}; - -class CfgAmmo { - class BulletCore; - class BulletBase : BulletCore { - AGM_BulletMass = 0; // Bullet mass in grams - }; - - // Rifle and MG rounds - class B_556x45_Ball : BulletBase { - AGM_BulletMass = 4.1; // 5.56x45 NATO - }; - - class B_65x39_Caseless : BulletBase { - AGM_BulletMass = 8; // 6.5mm Grendel - }; - - class B_762x51_Ball : BulletBase { - AGM_BulletMass = 10; // 7.62x51 NATO - }; - class AGM_B_762x51_M118LR : B_762x51_Ball { - AGM_BulletMass = 11; // 7.62x51 NATO M118 - }; - - class B_127x99_Ball : BulletBase { - AGM_BulletMass = 42; // 12.7×99mm NATO (.50 BMG) - }; - - class B_127x108_Ball : BulletBase { - AGM_BulletMass = 48.3; // 12.7x108 - }; - - class B_408_Ball : BulletBase { - AGM_BulletMass = 27; // .408 Cheyenne Tactical - }; - - // Pistol Rounds - class B_9x21_Ball : BulletBase { - AGM_BulletMass = 7.45; // 9×21mm IMI - }; - class B_9x19_Ball : B_9x21_Ball { - AGM_BulletMass = 7.45; // 9×19mm Parabellum - }; - class B_127x33_Ball : BulletBase { - AGM_BulletMass = 21; // .50 AE - }; - class B_45ACP_Ball : BulletBase { - AGM_BulletMass = 12; // .45 ACP - }; -}; +#include "CfgWeapons.hpp" diff --git a/addons/overheating/functions/fn_swapBarrel.sqf b/addons/overheating/functions/fn_swapBarrel.sqf deleted file mode 100644 index fa6c0f64f2..0000000000 --- a/addons/overheating/functions/fn_swapBarrel.sqf +++ /dev/null @@ -1,15 +0,0 @@ -// by commy2 - -private ["_player", "_weapon"]; - -_player = _this select 0; -_weapon = _this select 1; - -if (stance _player != "PRONE") then { - [_player, "amovpknlmstpsraswrfldnon", 1] call AGM_Core_fnc_doAnimation; -}; -_player playActionNow "GestureDismountMuzzle"; -_player playAction "GestureMountMuzzle"; -playSound "AGM_BarrelSwap"; - -[10, [_player, _weapon], "AGM_Overheating_fnc_swapBarrelCallback", localize "STR_AGM_Overheating_SwappingBarrel"] call AGM_Core_fnc_progressBar; diff --git a/addons/overheating/functions/fn_swapBarrelCallback.sqf b/addons/overheating/functions/fn_swapBarrelCallback.sqf deleted file mode 100644 index d6fdf6ddc6..0000000000 --- a/addons/overheating/functions/fn_swapBarrelCallback.sqf +++ /dev/null @@ -1,13 +0,0 @@ -// by commy2 - -private ["_player", "_weapon"]; - -_player = _this select 0; -_weapon = _this select 1; - -// don't consume the barrel, but rotate through them. -//player removeItem "AGM_SpareBarrel"; - -[localize "STR_AGM_Overheating_SwappedBarrel", "\AGM_Overheating\UI\spare_barrel_ca.paa"] call AGM_Core_fnc_displayTextPicture; - -_player setVariable [format ["AGM_Overheating_%1", _weapon], [0, 0], false]; diff --git a/addons/overheating/functions/fn_checkTemperature.sqf b/addons/overheating/functions/fnc_checkTemperature.sqf similarity index 80% rename from addons/overheating/functions/fn_checkTemperature.sqf rename to addons/overheating/functions/fnc_checkTemperature.sqf index 8b93be59ce..97d0d70d73 100644 --- a/addons/overheating/functions/fn_checkTemperature.sqf +++ b/addons/overheating/functions/fnc_checkTemperature.sqf @@ -1,11 +1,12 @@ // by commy2 and CAA-Picard +#include "script_component.hpp" _this spawn { _player = _this select 0; _weapon = _this select 1; // Calculate cool down of weapon since last shot - _string = format ["AGM_Overheating_%1", _weapon]; + _string = format [GVAR(%1), _weapon]; _overheat = _player getVariable [_string, [0, 0]]; _temperature = _overheat select 0; _time = _overheat select 1; @@ -14,9 +15,9 @@ _this spawn { _barrelMass = 0.50 * (getNumber (configFile >> "CfgWeapons" >> _weapon >> "WeaponSlotsInfo" >> "mass") / 22.0) max 1.0; // Calculate cooling - _temperature = [_temperature, _barrelMass, time - _time] call AGM_Overheating_fnc_cooldown; + _temperature = [_temperature, _barrelMass, time - _time] call FUNC(cooldown); - ["Overheating", _temperature, {format ["Temperature: %1 °C", _this]}] call AGM_Debug_fnc_log; + ["Overheating", _temperature, {format ["Temperature: %1 °C", _this]}] call EFUNC(core,log); // Store new temperature _time = time; @@ -24,7 +25,7 @@ _this spawn { _scaledTemperature = (_temperature / 1000) min 1; // Play animation and report temperature - _action = getText (configFile >> "CfgWeapons" >> _weapon >> "AGM_checkTemperatureAction"); + _action = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_checkTemperatureAction"); if (_action == "") then { _action = "Gear"; @@ -45,7 +46,7 @@ _this spawn { for "_a" from 1 to _count do { _string = _string + "|"; }; - _text = [_string, _color] call AGM_Core_fnc_stringToColoredText; + _text = [_string, _color] call EFUNC(core,stringToColoredText); _string = ""; for "_a" from (_count + 1) to 12 do { @@ -54,10 +55,10 @@ _this spawn { _text = composeText [ _text, - [_string, [0.5, 0.5, 0.5]] call AGM_Core_fnc_stringToColoredText + [_string, [0.5, 0.5, 0.5]] call EFUNC(core,stringToColoredTex)t ]; _picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture"); - [_text, _picture] call AGM_Core_fnc_displayTextPicture; + [_text, _picture] call EFUNC(core,displayTextPicture); }; diff --git a/addons/overheating/functions/fn_clearJam.sqf b/addons/overheating/functions/fnc_clearJam.sqf similarity index 52% rename from addons/overheating/functions/fn_clearJam.sqf rename to addons/overheating/functions/fnc_clearJam.sqf index 2815836583..198e3ea135 100644 --- a/addons/overheating/functions/fn_clearJam.sqf +++ b/addons/overheating/functions/fnc_clearJam.sqf @@ -1,4 +1,5 @@ // by commy2 +#include "script_component.hpp" private ["_unit", "_weapon", "_skipAnim", "_jammedWeapons"]; @@ -6,27 +7,25 @@ _unit = _this select 0; _weapon = _this select 1; _skipAnim = _this select 2; -_jammedWeapons = _unit getVariable ["AGM_Overheating_jammedWeapons", []]; +_jammedWeapons = _unit getVariable [QGVAR(jammedWeapons), []]; if (_weapon in _jammedWeapons) then { _jammedWeapons = _jammedWeapons - [_weapon]; - _unit setVariable ["AGM_Overheating_jammedWeapons", _jammedWeapons]; + _unit setVariable [QGVAR(jammedWeapons), _jammedWeapons]; if (count _jammedWeapons == 0) then { private "_id"; - _id = _unit getVariable ["AGM_JammingActionID", -1]; - //_unit removeAction _id; - //[_unit, "DefaultAction", _id] call AGM_Core_fnc_removeActionMenuEventHandler; - [_unit, "DefaultAction", _id] call AGM_Core_fnc_removeActionEventHandler; - _unit setVariable ["AGM_JammingActionID", -1]; + _id = _unit getVariable [QGVAR(JammingActionID), -1]; + [_unit, "DefaultAction", _id] call EFUNC(core,removeActionEventHandler); + _unit setVariable [QGVAR(JammingActionID), -1]; }; if !(_skipAnim) then { private "_clearJamAction"; - _clearJamAction = getText (configFile >> "CfgWeapons" >> _weapon >> "AGM_clearJamAction"); + _clearJamAction = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_clearJamAction"); if (_clearJamAction == "") then { _clearJamAction = getText (configFile >> "CfgWeapons" >> _weapon >> "reloadAction"); @@ -35,5 +34,5 @@ if (_weapon in _jammedWeapons) then { _unit playActionNow _clearJamAction; }; - [localize "STR_AGM_Overheating_WeaponUnjammed"] call AGM_Core_fnc_displayTextStructured; + [localize "STR_ACE_Overheating_WeaponUnjammed"] call EFUNC(core,displayTextStructured); }; diff --git a/addons/overheating/functions/fn_cooldown.sqf b/addons/overheating/functions/fnc_cooldown.sqf similarity index 93% rename from addons/overheating/functions/fn_cooldown.sqf rename to addons/overheating/functions/fnc_cooldown.sqf index 7f556a21b0..701768793f 100644 --- a/addons/overheating/functions/fn_cooldown.sqf +++ b/addons/overheating/functions/fnc_cooldown.sqf @@ -11,6 +11,7 @@ * Return value: * New temperature (number) */ +#include "script_component.hpp" private ["_temperature", "_barrelMass", "_totalTime", "_barrelSurface", "_time", "_deltaTime"]; @@ -40,7 +41,7 @@ while {true} do { if (_temperature < 1) exitWith {0}; if (isNil "_temperature") exitWith { - diag_log text format ["[AGM] ERROR: _totalTime = %1; _time = %2; _deltaTime = %3;", _totalTime, _time, _deltaTime]; + diag_log text format ["[ACE] ERROR: _totalTime = %1; _time = %2; _deltaTime = %3;", _totalTime, _time, _deltaTime]; 0 }; diff --git a/addons/overheating/functions/fn_jamWeapon.sqf b/addons/overheating/functions/fnc_jamWeapon.sqf similarity index 53% rename from addons/overheating/functions/fn_jamWeapon.sqf rename to addons/overheating/functions/fnc_jamWeapon.sqf index bbdf3f86ef..1351742690 100644 --- a/addons/overheating/functions/fn_jamWeapon.sqf +++ b/addons/overheating/functions/fnc_jamWeapon.sqf @@ -1,4 +1,5 @@ // based on KK_fnc_playerWeaponMulfunction from KillzoneKid +#include "script_component.hpp" private ["_unit", "_weapon", "_jammedWeapons"]; @@ -8,10 +9,10 @@ _weapon = _this select 1; // don't jam a weapon with no rounds left if (_unit ammo _weapon == 0) exitWith {}; -_jammedWeapons = _unit getVariable ["AGM_Overheating_jammedWeapons", []]; +_jammedWeapons = _unit getVariable [QGVAR(jammedWeapons), []]; _jammedWeapons pushBack _weapon; -_unit setVariable ["AGM_Overheating_jammedWeapons", _jammedWeapons]; +_unit setVariable [QGVAR(jammedWeapons), _jammedWeapons]; // this is to re-activate the 'DefaultAction', so you can jam a weapon while full auto shooting [_unit, _weapon] spawn { @@ -28,41 +29,41 @@ _unit setVariable ["AGM_Overheating_jammedWeapons", _jammedWeapons]; waitUntil {_frame < diag_frameno}; _unit setAmmo [_weapon, _ammo]; - //[localize "STR_AGM_Overheating_WeaponJammed"] call AGM_Core_fnc_displayTextStructured; + //[localize "STR_ACE_Overheating_WeaponJammed"] call EFUNC(core,displayTextStructured); }; }; // only display the hint once, after you try to shoot an already jammed weapon -AGM_Overheating_knowAboutJam = false; +GVAR(knowAboutJam) = false; -if (_unit getVariable ["AGM_JammingActionID", -1] == -1) then { +if (_unit getVariable [QGVAR(JammingActionID), -1] == -1) then { private ["_condition", "_statement", "_condition2", "_statement2", "_id"]; _condition = { - [_this select 1] call AGM_Core_fnc_canUseWeapon - && {currentMuzzle (_this select 1) in ((_this select 1) getVariable ["AGM_Overheating_jammedWeapons", []])} - && {!(currentMuzzle (_this select 1) in ((_this select 1) getVariable ["AGM_SafeMode_safedWeapons", []]))} + [_this select 1] call EFUNC(core,canUseWeapon) + && {currentMuzzle (_this select 1) in ((_this select 1) getVariable [QGVAR(jammedWeapons), []])} + && {!(currentMuzzle (_this select 1) in ((_this select 1) getVariable [QEGVAR(safemode,safedWeapons), []]))} }; _statement = { playSound3D ["a3\sounds_f\weapons\Other\dry9.wss", _this select 0]; - if (!(missionNamespace getVariable ["AGM_Overheating_knowAboutJam", false]) && {(_this select 1) ammo currentWeapon (_this select 1) > 0}) then { - [localize "STR_AGM_Overheating_WeaponJammed"] call AGM_Core_fnc_displayTextStructured; - AGM_Overheating_knowAboutJam = true; + if (!(missionNamespace getVariable [QGVAR(knowAboutJam), false]) && {(_this select 1) ammo currentWeapon (_this select 1) > 0}) then { + [localize "STR_ACE_Overheating_WeaponJammed"] call EFUNC(core,displayTextStructured); + GVAR(knowAboutJam) = true; }; }; _condition2 = { - currentWeapon (_this select 1) in ((_this select 1) getVariable ["AGM_Overheating_jammedWeapons", []]) + currentWeapon (_this select 1) in ((_this select 1) getVariable [QGVAR(jammedWeapons), []]) }; _statement2 = { - [_this select 1, currentWeapon (_this select 1), false] call AGM_Overheating_fnc_clearJam; + [_this select 1, currentWeapon (_this select 1), false] call FUNC(clearJam); }; - //_id = [_unit, format ["%1", localize "STR_AGM_Overheating_UnjamWeapon"], "DefaultAction", _condition, _statement, _condition2, _statement2, 10] call AGM_Core_fnc_addActionMenuEventHandler; - _id = [_unit, "DefaultAction", _condition, _statement] call AGM_Core_fnc_addActionEventHandler; + //_id = [_unit, format ["%1", localize "STR_ACE_Overheating_UnjamWeapon"], "DefaultAction", _condition, _statement, _condition2, _statement2, 10] call EFUNC(core,addActionMenuEventHandler); + _id = [_unit, "DefaultAction", _condition, _statement] call EFUNC(core,addActionEventHandler); - _unit setVariable ["AGM_JammingActionID", _id]; + _unit setVariable [QGVAR(JammingActionID), _id]; }; diff --git a/addons/overheating/functions/fn_overheat.sqf b/addons/overheating/functions/fnc_overheat.sqf similarity index 84% rename from addons/overheating/functions/fn_overheat.sqf rename to addons/overheating/functions/fnc_overheat.sqf index 5b4912e471..084af39f2f 100644 --- a/addons/overheating/functions/fn_overheat.sqf +++ b/addons/overheating/functions/fnc_overheat.sqf @@ -1,4 +1,5 @@ // by commy2 and CAA-Picard +#include "script_component.hpp" private ["_unit", "_weapon", "_ammo", "_projectile", "_velocity", "_variableName", "_overheat", "_temperature", "_time", "_energyIncrement", "_barrelMass", "_scaledTemperature"]; @@ -9,7 +10,7 @@ _projectile = _this select 6; _velocity = velocity _projectile; // each weapon has it's own variable. Can't store the temperature in the weapon since they are not objects unfortunately. -_variableName = format ["AGM_Overheating_%1", _weapon]; +_variableName = format [QGVAR(%1), _weapon]; // get old values _overheat = _unit getVariable [_variableName, [0, 0]]; @@ -17,7 +18,7 @@ _temperature = _overheat select 0; _time = _overheat select 1; // Get physical parameters -_bulletMass = getNumber (configFile >> "CfgAmmo" >> _ammo >> "AGM_BulletMass"); +_bulletMass = getNumber (configFile >> "CfgAmmo" >> _ammo >> "ACE_BulletMass"); if (_bulletMass == 0) then { // If the bullet mass is not configured, estimate it _bulletMass = 3.4334 + 0.5171 * (getNumber (configFile >> "CfgAmmo" >> _ammo >> "hit") + getNumber (configFile >> "CfgAmmo" >> _ammo >> "caliber")); @@ -26,7 +27,7 @@ _energyIncrement = 0.75 * 0.0005 * _bulletMass * (vectorMagnitudeSqr _velocity); _barrelMass = 0.50 * (getNumber (configFile >> "CfgWeapons" >> _weapon >> "WeaponSlotsInfo" >> "mass") / 22.0) max 1.0; // Calculate cooling -_temperature = [_temperature, _barrelMass, time - _time] call AGM_Overheating_fnc_cooldown; +_temperature = [_temperature, _barrelMass, time - _time] call FUNC(cooldown); // Calculate heating _temperature = _temperature + _energyIncrement / (_barrelMass * 466); // Steel Heat Capacity = 466 J/(Kg.K) @@ -97,31 +98,31 @@ if (_intensity > 0) then { // dispersion and bullet slow down private ["_dispersion", "_slowdownFactor", "_count"]; -_dispersion = getArray (configFile >> "CfgWeapons" >> _weapon >> "AGM_Overheating_Dispersion"); +_dispersion = getArray (configFile >> "CfgWeapons" >> _weapon >> "ACE_Overheating_Dispersion"); _count = count _dispersion; if (_count > 0) then { - _dispersion = ([_dispersion, (_count - 1) * _scaledTemperature] call AGM_Core_fnc_interpolateFromArray) max 0; + _dispersion = ([_dispersion, (_count - 1) * _scaledTemperature] call EFUNC(core,interpolateFromArray)) max 0; } else { _dispersion = 0; }; -_slowdownFactor = getArray (configFile >> "CfgWeapons" >> _weapon >> "AGM_Overheating_slowdownFactor"); +_slowdownFactor = getArray (configFile >> "CfgWeapons" >> _weapon >> "ACE_Overheating_slowdownFactor"); _count = count _slowdownFactor; if (_count > 0) then { - _slowdownFactor = ([_slowdownFactor, (_count - 1) * _scaledTemperature] call AGM_Core_fnc_interpolateFromArray) max 0; + _slowdownFactor = ([_slowdownFactor, (_count - 1) * _scaledTemperature] call EFUNC(core,interpolateFromArray)) max 0; } else { _slowdownFactor = 1; }; -[_projectile, _dispersion - 2 * random _dispersion, _dispersion - 2 * random _dispersion, (_slowdownFactor - 1) * vectorMagnitude _velocity] call AGM_Core_fnc_changeProjectileDirection; +[_projectile, _dispersion - 2 * random _dispersion, _dispersion - 2 * random _dispersion, (_slowdownFactor - 1) * vectorMagnitude _velocity] call EFUNC(core,changeProjectileDirection); // jamming private "_jamChance"; -_jamChance = getArray (configFile >> "CfgWeapons" >> _weapon >> "AGM_Overheating_jamChance"); +_jamChance = getArray (configFile >> "CfgWeapons" >> _weapon >> "ACE_Overheating_jamChance"); _count = count _jamChance; if (_count == 0) then { @@ -129,7 +130,7 @@ if (_count == 0) then { _count = 1; }; -_jamChance = [_jamChance, (_count - 1) * _scaledTemperature] call AGM_Core_fnc_interpolateFromArray; +_jamChance = [_jamChance, (_count - 1) * _scaledTemperature] call EFUNC(core,interpolateFromArray); // increase jam chance on dusty grounds if prone if (stance _unit == "PRONE") then { @@ -143,12 +144,12 @@ if (stance _unit == "PRONE") then { }; }; -if ("Jam" in (missionNamespace getvariable ["AGM_Debug", []])) then { +if ("Jam" in (missionNamespace getvariable ["ACE_Debug", []])) then { _jamChance = 0.5; }; -["Overheating", [_temperature, _jamChance], {format ["Temperature: %1 - JamChance: %2", _this select 0, _this select 1]}] call AGM_Debug_fnc_log; +["Overheating", [_temperature, _jamChance], {format ["Temperature: %1 - JamChance: %2", _this select 0, _this select 1]}] call EFUNC(core,log); if (random 1 < _jamChance) then { - [_unit, _weapon] call AGM_Overheating_fnc_jamWeapon; + [_unit, _weapon] call FUNC(jamWeapon); }; diff --git a/addons/overheating/functions/fnc_swapBarrel.sqf b/addons/overheating/functions/fnc_swapBarrel.sqf new file mode 100644 index 0000000000..76abc6b68e --- /dev/null +++ b/addons/overheating/functions/fnc_swapBarrel.sqf @@ -0,0 +1,16 @@ +// by commy2 +#include "script_component.hpp" + +private ["_player", "_weapon"]; + +_player = _this select 0; +_weapon = _this select 1; + +if (stance _player != "PRONE") then { + [_player, "amovpknlmstpsraswrfldnon", 1] call EFUNC(core,doAnimation); +}; +_player playActionNow "GestureDismountMuzzle"; +_player playAction "GestureMountMuzzle"; +playSound "ACE_BarrelSwap"; + +[10, [_player, _weapon], QFUNC(swapBarrelCallback), localize "STR_ACE_Overheating_SwappingBarrel"] call EFUNC(core,progressBar); diff --git a/addons/overheating/functions/fnc_swapBarrelCallback.sqf b/addons/overheating/functions/fnc_swapBarrelCallback.sqf new file mode 100644 index 0000000000..b02de4bf32 --- /dev/null +++ b/addons/overheating/functions/fnc_swapBarrelCallback.sqf @@ -0,0 +1,14 @@ +// by commy2 +#include "script_component.hpp" + +private ["_player", "_weapon"]; + +_player = _this select 0; +_weapon = _this select 1; + +// don't consume the barrel, but rotate through them. +//player removeItem "ACE_SpareBarrel"; + +[localize "STR_ACE_Overheating_SwappedBarrel", QUOTE(PATHOF(UI\spare_barrel_ca.paa))] call EFUNC(core,displayTextPicture); + +_player setVariable [format [QGVAR(%1), _weapon], [0, 0], false]; diff --git a/addons/overheating/script_component.hpp b/addons/overheating/script_component.hpp new file mode 100644 index 0000000000..d7ce7d2d3b --- /dev/null +++ b/addons/overheating/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT overheating +#include "\z\ace\Addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_OVERHEATING + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_OVERHEATING + #define DEBUG_SETTINGS DEBUG_SETTINGS_OVERHEATING +#endif + +#include "\z\ace\Addons\main\script_macros.hpp" \ No newline at end of file diff --git a/addons/overheating/stringtable.xml b/addons/overheating/stringtable.xml index 8f68ebaf01..f8cea2ddb9 100644 --- a/addons/overheating/stringtable.xml +++ b/addons/overheating/stringtable.xml @@ -1,8 +1,8 @@  - + - + Spare barrel Ersatzlauf Cañón de repuesto @@ -14,7 +14,7 @@ Cano Reserva Canna di ricambio - + Use to swap barrel. Benutzen, um Lauf zu wechseln. Permite intercambiar el cañón @@ -26,7 +26,7 @@ Use para trocar o cano/estriamento. Usata per cambiare la canna. - + Weapon jammed! Ladehemmung! Arma encasquillada! @@ -38,7 +38,7 @@ Arma travada! Arma inceppata! - + Clear jam Ladehemmung beheben Desencasquillar el arma @@ -50,7 +50,7 @@ Destravar arma Ripulisci l'arma - + Jam cleared Ladehemmung behoben Arma desencasquillada @@ -62,7 +62,7 @@ Arma destravada Arma pronta al fuoco - + Swap barrel Lauf wechseln Cambiar el cañón @@ -74,7 +74,7 @@ Substituir cano Sostiuisci la canna - + Swapping barrel... Lauf wird gewechselt... Cambiando el cañón... @@ -86,7 +86,7 @@ Substituindo cano... Sto sostituendo la canna ... - + Swapped barrel Lauf gewechselt Cañón cambiado @@ -98,7 +98,7 @@ Cano substituído Canna sostituita - + Check weapons temperature Temperatur der Waffe prüfen Verificar temperatura del arma @@ -110,7 +110,7 @@ Controlla la temperatura della canna Проверить температуру оружия - + Check temperature Temperatur prüfen Verificar temperatura @@ -122,7 +122,7 @@ Controlla la temperatura Проверить температуру - + Checking temperature ... Prüfe Temperatur ... Verificando temperatura ... @@ -134,7 +134,7 @@ Sto controllando la temperatura ... Проверка температуры ... - + Temperature Temperatur Temperatura