CBAfy AGM_Overheating

This commit is contained in:
Nicolás Badano 2015-01-13 00:23:14 -03:00
parent c0df8b7f54
commit 1db298722b
18 changed files with 472 additions and 448 deletions

View File

@ -0,0 +1 @@
z\ace\addons\overheating

View File

@ -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)}; );
};
};
};

View File

@ -0,0 +1,6 @@
class CfgSounds {
class ACE_BarrelSwap {
sound[] = {QUOTE(PATHOF(sounds\barrelswap.ogg)),5,1,200};
titles[] = {};
};
};

View File

@ -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};
};

View File

@ -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
};
};

View File

@ -0,0 +1,9 @@
#include "script_component.hpp"
PREP(checkTemperature);
PREP(clearJam);
PREP(cooldown);
PREP(jamWeapon);
PREP(overheat);
PREP(swapBarrel);
PREP(swapBarrelCallback);

View File

@ -1,369 +1,35 @@
#include "script_component.hpp"
class CfgPatches { class CfgPatches {
class AGM_Overheating { class ADDON {
units[] = {}; units[] = {};
weapons[] = {"AGM_SpareBarrel"}; weapons[] = {"ACE_SpareBarrel"};
requiredVersion = 0.60; requiredVersion = 0.60;
requiredAddons[] = {AGM_Core, AGM_Interaction}; requiredAddons[] = {ACE_Core, ACE_Interaction};
version = "0.95"; version = "0.95";
versionStr = "0.95"; versionStr = "0.95";
versionAr[] = {0,95,0}; versionAr[] = {0,95,0};
author[] = {"commy2", "KoffeinFlummi", "CAA-Picard"}; author[] = {"commy2", "KoffeinFlummi", "CAA-Picard"};
authorUrl = "https://github.com/commy2/"; authorUrl = "https://github.com/commy2/";
}; };
}; };
class CfgFunctions { #include "CfgEventHandlers.hpp"
class AGM_Overheating {
class AGM_Overheating { class ACE_Core_Default_Keys {
file = "\AGM_Overheating\functions"; class clearJam {
class checkTemperature; displayName = "$STR_ACE_Overheating_UnjamWeapon";
class clearJam; condition = QUOTE( [_player] call EFUNC(core,canUseWeapon) && {currentWeapon _player in (_player getVariable [QUOTE(QGVAR(jammedWeapons)), []])} );
class cooldown; statement = QUOTE( [_player, currentMuzzle _player, false] call FUNC(clearJam); );
class jamWeapon; key = 19;
class overheat; shift = 1;
class swapBarrel; control = 0;
class swapBarrelCallback; alt = 0;
}; };
};
}; };
class Extended_FiredBIS_EventHandlers { #include "CfgSounds.hpp"
class CAManBase {
class AGM_Overheating_Overheat {
clientFiredBIS = "if (_this select 0 == AGM_player) then {_this call AGM_Overheating_fnc_overheat};";
};
};
};
class Extended_Take_EventHandlers { #include "CfgVehicles.hpp"
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};";
};
};
};
class AGM_Core_Default_Keys { #include "CfgWeapons.hpp"
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
};
};

View File

@ -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;

View File

@ -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];

View File

@ -1,11 +1,12 @@
// by commy2 and CAA-Picard // by commy2 and CAA-Picard
#include "script_component.hpp"
_this spawn { _this spawn {
_player = _this select 0; _player = _this select 0;
_weapon = _this select 1; _weapon = _this select 1;
// Calculate cool down of weapon since last shot // 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]]; _overheat = _player getVariable [_string, [0, 0]];
_temperature = _overheat select 0; _temperature = _overheat select 0;
_time = _overheat select 1; _time = _overheat select 1;
@ -14,9 +15,9 @@ _this spawn {
_barrelMass = 0.50 * (getNumber (configFile >> "CfgWeapons" >> _weapon >> "WeaponSlotsInfo" >> "mass") / 22.0) max 1.0; _barrelMass = 0.50 * (getNumber (configFile >> "CfgWeapons" >> _weapon >> "WeaponSlotsInfo" >> "mass") / 22.0) max 1.0;
// Calculate cooling // 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 // Store new temperature
_time = time; _time = time;
@ -24,7 +25,7 @@ _this spawn {
_scaledTemperature = (_temperature / 1000) min 1; _scaledTemperature = (_temperature / 1000) min 1;
// Play animation and report temperature // Play animation and report temperature
_action = getText (configFile >> "CfgWeapons" >> _weapon >> "AGM_checkTemperatureAction"); _action = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_checkTemperatureAction");
if (_action == "") then { if (_action == "") then {
_action = "Gear"; _action = "Gear";
@ -45,7 +46,7 @@ _this spawn {
for "_a" from 1 to _count do { for "_a" from 1 to _count do {
_string = _string + "|"; _string = _string + "|";
}; };
_text = [_string, _color] call AGM_Core_fnc_stringToColoredText; _text = [_string, _color] call EFUNC(core,stringToColoredText);
_string = ""; _string = "";
for "_a" from (_count + 1) to 12 do { for "_a" from (_count + 1) to 12 do {
@ -54,10 +55,10 @@ _this spawn {
_text = composeText [ _text = composeText [
_text, _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"); _picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture");
[_text, _picture] call AGM_Core_fnc_displayTextPicture; [_text, _picture] call EFUNC(core,displayTextPicture);
}; };

View File

@ -1,4 +1,5 @@
// by commy2 // by commy2
#include "script_component.hpp"
private ["_unit", "_weapon", "_skipAnim", "_jammedWeapons"]; private ["_unit", "_weapon", "_skipAnim", "_jammedWeapons"];
@ -6,27 +7,25 @@ _unit = _this select 0;
_weapon = _this select 1; _weapon = _this select 1;
_skipAnim = _this select 2; _skipAnim = _this select 2;
_jammedWeapons = _unit getVariable ["AGM_Overheating_jammedWeapons", []]; _jammedWeapons = _unit getVariable [QGVAR(jammedWeapons), []];
if (_weapon in _jammedWeapons) then { if (_weapon in _jammedWeapons) then {
_jammedWeapons = _jammedWeapons - [_weapon]; _jammedWeapons = _jammedWeapons - [_weapon];
_unit setVariable ["AGM_Overheating_jammedWeapons", _jammedWeapons]; _unit setVariable [QGVAR(jammedWeapons), _jammedWeapons];
if (count _jammedWeapons == 0) then { if (count _jammedWeapons == 0) then {
private "_id"; private "_id";
_id = _unit getVariable ["AGM_JammingActionID", -1]; _id = _unit getVariable [QGVAR(JammingActionID), -1];
//_unit removeAction _id; [_unit, "DefaultAction", _id] call EFUNC(core,removeActionEventHandler);
//[_unit, "DefaultAction", _id] call AGM_Core_fnc_removeActionMenuEventHandler; _unit setVariable [QGVAR(JammingActionID), -1];
[_unit, "DefaultAction", _id] call AGM_Core_fnc_removeActionEventHandler;
_unit setVariable ["AGM_JammingActionID", -1];
}; };
if !(_skipAnim) then { if !(_skipAnim) then {
private "_clearJamAction"; private "_clearJamAction";
_clearJamAction = getText (configFile >> "CfgWeapons" >> _weapon >> "AGM_clearJamAction"); _clearJamAction = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_clearJamAction");
if (_clearJamAction == "") then { if (_clearJamAction == "") then {
_clearJamAction = getText (configFile >> "CfgWeapons" >> _weapon >> "reloadAction"); _clearJamAction = getText (configFile >> "CfgWeapons" >> _weapon >> "reloadAction");
@ -35,5 +34,5 @@ if (_weapon in _jammedWeapons) then {
_unit playActionNow _clearJamAction; _unit playActionNow _clearJamAction;
}; };
[localize "STR_AGM_Overheating_WeaponUnjammed"] call AGM_Core_fnc_displayTextStructured; [localize "STR_ACE_Overheating_WeaponUnjammed"] call EFUNC(core,displayTextStructured);
}; };

View File

@ -11,6 +11,7 @@
* Return value: * Return value:
* New temperature (number) * New temperature (number)
*/ */
#include "script_component.hpp"
private ["_temperature", "_barrelMass", "_totalTime", "_barrelSurface", "_time", "_deltaTime"]; private ["_temperature", "_barrelMass", "_totalTime", "_barrelSurface", "_time", "_deltaTime"];
@ -40,7 +41,7 @@ while {true} do {
if (_temperature < 1) exitWith {0}; if (_temperature < 1) exitWith {0};
if (isNil "_temperature") exitWith { 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 0
}; };

View File

@ -1,4 +1,5 @@
// based on KK_fnc_playerWeaponMulfunction from KillzoneKid // based on KK_fnc_playerWeaponMulfunction from KillzoneKid
#include "script_component.hpp"
private ["_unit", "_weapon", "_jammedWeapons"]; private ["_unit", "_weapon", "_jammedWeapons"];
@ -8,10 +9,10 @@ _weapon = _this select 1;
// don't jam a weapon with no rounds left // don't jam a weapon with no rounds left
if (_unit ammo _weapon == 0) exitWith {}; if (_unit ammo _weapon == 0) exitWith {};
_jammedWeapons = _unit getVariable ["AGM_Overheating_jammedWeapons", []]; _jammedWeapons = _unit getVariable [QGVAR(jammedWeapons), []];
_jammedWeapons pushBack _weapon; _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 // this is to re-activate the 'DefaultAction', so you can jam a weapon while full auto shooting
[_unit, _weapon] spawn { [_unit, _weapon] spawn {
@ -28,41 +29,41 @@ _unit setVariable ["AGM_Overheating_jammedWeapons", _jammedWeapons];
waitUntil {_frame < diag_frameno}; waitUntil {_frame < diag_frameno};
_unit setAmmo [_weapon, _ammo]; _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 // 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"]; private ["_condition", "_statement", "_condition2", "_statement2", "_id"];
_condition = { _condition = {
[_this select 1] call AGM_Core_fnc_canUseWeapon [_this select 1] call EFUNC(core,canUseWeapon)
&& {currentMuzzle (_this select 1) in ((_this select 1) getVariable ["AGM_Overheating_jammedWeapons", []])} && {currentMuzzle (_this select 1) in ((_this select 1) getVariable [QGVAR(jammedWeapons), []])}
&& {!(currentMuzzle (_this select 1) in ((_this select 1) getVariable ["AGM_SafeMode_safedWeapons", []]))} && {!(currentMuzzle (_this select 1) in ((_this select 1) getVariable [QEGVAR(safemode,safedWeapons), []]))}
}; };
_statement = { _statement = {
playSound3D ["a3\sounds_f\weapons\Other\dry9.wss", _this select 0]; 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 { if (!(missionNamespace getVariable [QGVAR(knowAboutJam), false]) && {(_this select 1) ammo currentWeapon (_this select 1) > 0}) then {
[localize "STR_AGM_Overheating_WeaponJammed"] call AGM_Core_fnc_displayTextStructured; [localize "STR_ACE_Overheating_WeaponJammed"] call EFUNC(core,displayTextStructured);
AGM_Overheating_knowAboutJam = true; GVAR(knowAboutJam) = true;
}; };
}; };
_condition2 = { _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 = { _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 ["<t color=""#FFFF00"" >%1</t>", localize "STR_AGM_Overheating_UnjamWeapon"], "DefaultAction", _condition, _statement, _condition2, _statement2, 10] call AGM_Core_fnc_addActionMenuEventHandler; //_id = [_unit, format ["<t color=""#FFFF00"" >%1</t>", localize "STR_ACE_Overheating_UnjamWeapon"], "DefaultAction", _condition, _statement, _condition2, _statement2, 10] call EFUNC(core,addActionMenuEventHandler);
_id = [_unit, "DefaultAction", _condition, _statement] call AGM_Core_fnc_addActionEventHandler; _id = [_unit, "DefaultAction", _condition, _statement] call EFUNC(core,addActionEventHandler);
_unit setVariable ["AGM_JammingActionID", _id]; _unit setVariable [QGVAR(JammingActionID), _id];
}; };

View File

@ -1,4 +1,5 @@
// by commy2 and CAA-Picard // by commy2 and CAA-Picard
#include "script_component.hpp"
private ["_unit", "_weapon", "_ammo", "_projectile", "_velocity", "_variableName", "_overheat", "_temperature", "_time", "_energyIncrement", "_barrelMass", "_scaledTemperature"]; private ["_unit", "_weapon", "_ammo", "_projectile", "_velocity", "_variableName", "_overheat", "_temperature", "_time", "_energyIncrement", "_barrelMass", "_scaledTemperature"];
@ -9,7 +10,7 @@ _projectile = _this select 6;
_velocity = velocity _projectile; _velocity = velocity _projectile;
// each weapon has it's own variable. Can't store the temperature in the weapon since they are not objects unfortunately. // 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 // get old values
_overheat = _unit getVariable [_variableName, [0, 0]]; _overheat = _unit getVariable [_variableName, [0, 0]];
@ -17,7 +18,7 @@ _temperature = _overheat select 0;
_time = _overheat select 1; _time = _overheat select 1;
// Get physical parameters // Get physical parameters
_bulletMass = getNumber (configFile >> "CfgAmmo" >> _ammo >> "AGM_BulletMass"); _bulletMass = getNumber (configFile >> "CfgAmmo" >> _ammo >> "ACE_BulletMass");
if (_bulletMass == 0) then { if (_bulletMass == 0) then {
// If the bullet mass is not configured, estimate it // If the bullet mass is not configured, estimate it
_bulletMass = 3.4334 + 0.5171 * (getNumber (configFile >> "CfgAmmo" >> _ammo >> "hit") + getNumber (configFile >> "CfgAmmo" >> _ammo >> "caliber")); _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; _barrelMass = 0.50 * (getNumber (configFile >> "CfgWeapons" >> _weapon >> "WeaponSlotsInfo" >> "mass") / 22.0) max 1.0;
// Calculate cooling // Calculate cooling
_temperature = [_temperature, _barrelMass, time - _time] call AGM_Overheating_fnc_cooldown; _temperature = [_temperature, _barrelMass, time - _time] call FUNC(cooldown);
// Calculate heating // Calculate heating
_temperature = _temperature + _energyIncrement / (_barrelMass * 466); // Steel Heat Capacity = 466 J/(Kg.K) _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 // dispersion and bullet slow down
private ["_dispersion", "_slowdownFactor", "_count"]; private ["_dispersion", "_slowdownFactor", "_count"];
_dispersion = getArray (configFile >> "CfgWeapons" >> _weapon >> "AGM_Overheating_Dispersion"); _dispersion = getArray (configFile >> "CfgWeapons" >> _weapon >> "ACE_Overheating_Dispersion");
_count = count _dispersion; _count = count _dispersion;
if (_count > 0) then { 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 { } else {
_dispersion = 0; _dispersion = 0;
}; };
_slowdownFactor = getArray (configFile >> "CfgWeapons" >> _weapon >> "AGM_Overheating_slowdownFactor"); _slowdownFactor = getArray (configFile >> "CfgWeapons" >> _weapon >> "ACE_Overheating_slowdownFactor");
_count = count _slowdownFactor; _count = count _slowdownFactor;
if (_count > 0) then { 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 { } else {
_slowdownFactor = 1; _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 // jamming
private "_jamChance"; private "_jamChance";
_jamChance = getArray (configFile >> "CfgWeapons" >> _weapon >> "AGM_Overheating_jamChance"); _jamChance = getArray (configFile >> "CfgWeapons" >> _weapon >> "ACE_Overheating_jamChance");
_count = count _jamChance; _count = count _jamChance;
if (_count == 0) then { if (_count == 0) then {
@ -129,7 +130,7 @@ if (_count == 0) then {
_count = 1; _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 // increase jam chance on dusty grounds if prone
if (stance _unit == "PRONE") then { 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; _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 { if (random 1 < _jamChance) then {
[_unit, _weapon] call AGM_Overheating_fnc_jamWeapon; [_unit, _weapon] call FUNC(jamWeapon);
}; };

View File

@ -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);

View File

@ -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];

View File

@ -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"

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Edited with tabler - 2014-12-17 --> <!-- Edited with tabler - 2014-12-17 -->
<Project name="AGM"> <Project name="ACE">
<Package name="Overheating"> <Package name="Overheating">
<Key ID="STR_AGM_Overheating_SpareBarrelName"> <Key ID="STR_ACE_Overheating_SpareBarrelName">
<English>Spare barrel</English> <English>Spare barrel</English>
<German>Ersatzlauf</German> <German>Ersatzlauf</German>
<Spanish>Cañón de repuesto</Spanish> <Spanish>Cañón de repuesto</Spanish>
@ -14,7 +14,7 @@
<Portuguese>Cano Reserva</Portuguese> <Portuguese>Cano Reserva</Portuguese>
<Italian>Canna di ricambio</Italian> <Italian>Canna di ricambio</Italian>
</Key> </Key>
<Key ID="STR_AGM_Overheating_SpareBarrelDescription"> <Key ID="STR_ACE_Overheating_SpareBarrelDescription">
<English>Use to swap barrel.</English> <English>Use to swap barrel.</English>
<German>Benutzen, um Lauf zu wechseln.</German> <German>Benutzen, um Lauf zu wechseln.</German>
<Spanish>Permite intercambiar el cañón</Spanish> <Spanish>Permite intercambiar el cañón</Spanish>
@ -26,7 +26,7 @@
<Portuguese>Use para trocar o cano/estriamento.</Portuguese> <Portuguese>Use para trocar o cano/estriamento.</Portuguese>
<Italian>Usata per cambiare la canna.</Italian> <Italian>Usata per cambiare la canna.</Italian>
</Key> </Key>
<Key ID="STR_AGM_Overheating_WeaponJammed"> <Key ID="STR_ACE_Overheating_WeaponJammed">
<English>Weapon jammed!</English> <English>Weapon jammed!</English>
<German>Ladehemmung!</German> <German>Ladehemmung!</German>
<Spanish>Arma encasquillada!</Spanish> <Spanish>Arma encasquillada!</Spanish>
@ -38,7 +38,7 @@
<Portuguese>Arma travada!</Portuguese> <Portuguese>Arma travada!</Portuguese>
<Italian>Arma inceppata!</Italian> <Italian>Arma inceppata!</Italian>
</Key> </Key>
<Key ID="STR_AGM_Overheating_UnjamWeapon"> <Key ID="STR_ACE_Overheating_UnjamWeapon">
<English>Clear jam</English> <English>Clear jam</English>
<German>Ladehemmung beheben</German> <German>Ladehemmung beheben</German>
<Spanish>Desencasquillar el arma</Spanish> <Spanish>Desencasquillar el arma</Spanish>
@ -50,7 +50,7 @@
<Portuguese>Destravar arma</Portuguese> <Portuguese>Destravar arma</Portuguese>
<Italian>Ripulisci l'arma</Italian> <Italian>Ripulisci l'arma</Italian>
</Key> </Key>
<Key ID="STR_AGM_Overheating_WeaponUnjammed"> <Key ID="STR_ACE_Overheating_WeaponUnjammed">
<English>Jam cleared</English> <English>Jam cleared</English>
<German>Ladehemmung behoben</German> <German>Ladehemmung behoben</German>
<Spanish>Arma desencasquillada</Spanish> <Spanish>Arma desencasquillada</Spanish>
@ -62,7 +62,7 @@
<Portuguese>Arma destravada</Portuguese> <Portuguese>Arma destravada</Portuguese>
<Italian>Arma pronta al fuoco</Italian> <Italian>Arma pronta al fuoco</Italian>
</Key> </Key>
<Key ID="STR_AGM_Overheating_SwapBarrel"> <Key ID="STR_ACE_Overheating_SwapBarrel">
<English>Swap barrel</English> <English>Swap barrel</English>
<German>Lauf wechseln</German> <German>Lauf wechseln</German>
<Spanish>Cambiar el cañón</Spanish> <Spanish>Cambiar el cañón</Spanish>
@ -74,7 +74,7 @@
<Portuguese>Substituir cano</Portuguese> <Portuguese>Substituir cano</Portuguese>
<Italian>Sostiuisci la canna</Italian> <Italian>Sostiuisci la canna</Italian>
</Key> </Key>
<Key ID="STR_AGM_Overheating_SwappingBarrel"> <Key ID="STR_ACE_Overheating_SwappingBarrel">
<English>Swapping barrel...</English> <English>Swapping barrel...</English>
<German>Lauf wird gewechselt...</German> <German>Lauf wird gewechselt...</German>
<Spanish>Cambiando el cañón...</Spanish> <Spanish>Cambiando el cañón...</Spanish>
@ -86,7 +86,7 @@
<Portuguese>Substituindo cano...</Portuguese> <Portuguese>Substituindo cano...</Portuguese>
<Italian>Sto sostituendo la canna ...</Italian> <Italian>Sto sostituendo la canna ...</Italian>
</Key> </Key>
<Key ID="STR_AGM_Overheating_SwappedBarrel"> <Key ID="STR_ACE_Overheating_SwappedBarrel">
<English>Swapped barrel</English> <English>Swapped barrel</English>
<German>Lauf gewechselt</German> <German>Lauf gewechselt</German>
<Spanish>Cañón cambiado</Spanish> <Spanish>Cañón cambiado</Spanish>
@ -98,7 +98,7 @@
<Portuguese>Cano substituído</Portuguese> <Portuguese>Cano substituído</Portuguese>
<Italian>Canna sostituita</Italian> <Italian>Canna sostituita</Italian>
</Key> </Key>
<Key ID="STR_AGM_Overheating_CheckTemperature"> <Key ID="STR_ACE_Overheating_CheckTemperature">
<English>Check weapons temperature</English> <English>Check weapons temperature</English>
<German>Temperatur der Waffe prüfen</German> <German>Temperatur der Waffe prüfen</German>
<Spanish>Verificar temperatura del arma</Spanish> <Spanish>Verificar temperatura del arma</Spanish>
@ -110,7 +110,7 @@
<Italian>Controlla la temperatura della canna</Italian> <Italian>Controlla la temperatura della canna</Italian>
<Russian>Проверить температуру оружия</Russian> <Russian>Проверить температуру оружия</Russian>
</Key> </Key>
<Key ID="STR_AGM_Overheating_CheckTemperatureShort"> <Key ID="STR_ACE_Overheating_CheckTemperatureShort">
<English>Check temperature</English> <English>Check temperature</English>
<German>Temperatur prüfen</German> <German>Temperatur prüfen</German>
<Spanish>Verificar temperatura</Spanish> <Spanish>Verificar temperatura</Spanish>
@ -122,7 +122,7 @@
<Italian>Controlla la temperatura</Italian> <Italian>Controlla la temperatura</Italian>
<Russian>Проверить температуру</Russian> <Russian>Проверить температуру</Russian>
</Key> </Key>
<Key ID="STR_AGM_Overheating_CheckingTemperature"> <Key ID="STR_ACE_Overheating_CheckingTemperature">
<English>Checking temperature ...</English> <English>Checking temperature ...</English>
<German>Prüfe Temperatur ...</German> <German>Prüfe Temperatur ...</German>
<Spanish>Verificando temperatura ...</Spanish> <Spanish>Verificando temperatura ...</Spanish>
@ -134,7 +134,7 @@
<Italian>Sto controllando la temperatura ...</Italian> <Italian>Sto controllando la temperatura ...</Italian>
<Russian>Проверка температуры ...</Russian> <Russian>Проверка температуры ...</Russian>
</Key> </Key>
<Key ID="STR_AGM_Overheating_Temperature"> <Key ID="STR_ACE_Overheating_Temperature">
<English>Temperature</English> <English>Temperature</English>
<German>Temperatur</German> <German>Temperatur</German>
<Spanish>Temperatura</Spanish> <Spanish>Temperatura</Spanish>