From e587a6e6e3716f053d87423259029c6130a71775 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Tue, 15 Dec 2015 01:09:26 -0600 Subject: [PATCH] Modernize code --- addons/overheating/ACE_Settings.hpp | 17 +- addons/overheating/CfgEventHandlers.hpp | 2 +- addons/overheating/CfgWeapons.hpp | 140 +------------ addons/overheating/XEH_postInit.sqf | 36 ++-- addons/overheating/XEH_preInit.sqf | 1 + addons/overheating/config.cpp | 14 +- .../functions/fnc_checkTemperature.sqf | 17 +- addons/overheating/functions/fnc_clearJam.sqf | 66 +++--- addons/overheating/functions/fnc_cooldown.sqf | 48 ----- .../functions/fnc_displayTemperature.sqf | 29 ++- addons/overheating/functions/fnc_firedEH.sqf | 188 +++++++----------- .../functions/fnc_handleTakeEH.sqf | 28 +++ .../overheating/functions/fnc_jamWeapon.sqf | 70 +++---- addons/overheating/functions/fnc_overheat.sqf | 30 +-- .../overheating/functions/fnc_swapBarrel.sqf | 10 +- .../functions/fnc_swapBarrelCallback.sqf | 8 +- .../functions/fnc_updateTemperature.sqf | 49 ++--- .../functions/script_component.hpp | 1 + addons/overheating/script_component.hpp | 3 + addons/overheating/stringtable.xml | 16 +- 20 files changed, 303 insertions(+), 470 deletions(-) delete mode 100644 addons/overheating/functions/fnc_cooldown.sqf create mode 100644 addons/overheating/functions/fnc_handleTakeEH.sqf create mode 100644 addons/overheating/functions/script_component.hpp diff --git a/addons/overheating/ACE_Settings.hpp b/addons/overheating/ACE_Settings.hpp index 2d63614a40..18936bb37f 100644 --- a/addons/overheating/ACE_Settings.hpp +++ b/addons/overheating/ACE_Settings.hpp @@ -3,7 +3,20 @@ class ACE_Settings { typeName = "BOOL"; isClientSettable = 1; value = 1; - displayName = CSTRING(SettingDisplayTextName); - description = CSTRING(SettingDisplayTextDesc); + displayName = CSTRING(DisplayTextOnJam_displayName); + description = CSTRING(DisplayTextOnJam_description); + }; + class GVAR(showParticleEffects) { + typeName = "BOOL"; + isClientSettable = 1; + value = 0; + displayName = CSTRING(showParticleEffects_displayName); + description = CSTRING(showParticleEffects_description); + }; + class GVAR(overheatingDispersion) { + typeName = "BOOL"; + value = 1; + displayName = CSTRING(overheatingDispersion_displayName); + description = CSTRING(overheatingDispersion_description); }; }; diff --git a/addons/overheating/CfgEventHandlers.hpp b/addons/overheating/CfgEventHandlers.hpp index f419ff8d06..8ee734d16f 100644 --- a/addons/overheating/CfgEventHandlers.hpp +++ b/addons/overheating/CfgEventHandlers.hpp @@ -21,7 +21,7 @@ class Extended_FiredBIS_EventHandlers { 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_3(_vehicle, currentWeapon _vehicle, true)] call FUNC(clearJam)}; ); + clientTake = QUOTE( _this call FUNC(handleTakeEH) ); }; }; }; diff --git a/addons/overheating/CfgWeapons.hpp b/addons/overheating/CfgWeapons.hpp index 9582c42373..6dca5ff70d 100644 --- a/addons/overheating/CfgWeapons.hpp +++ b/addons/overheating/CfgWeapons.hpp @@ -13,137 +13,15 @@ class CfgWeapons { }; }; - class Rifle; - class Rifle_Base_F : Rifle { - ACE_MRBS = 3000; - ACE_Dispersion = 0; + class RifleCore; + class Rifle: RifleCore { + //Mean Rounds Between Stoppages (this will be scaled based on the barrel temp) + ACE_MRBS = 3000; + + //Dispersion Factor (this will be scaled based on the barrel temp) + ACE_Dispersion = 1; + + //Slowdown Factor (this will be scaled based on the barrel temp) ACE_SlowdownFactor = 1; - - // 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 MMG_02_base_F: Rifle_Long_Base_F { - ACE_Overheating_allowSwapBarrel = 1; - ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.004}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class MMG_01_base_F: Rifle_Long_Base_F { - ACE_Overheating_allowSwapBarrel = 1; - ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 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}; }; }; diff --git a/addons/overheating/XEH_postInit.sqf b/addons/overheating/XEH_postInit.sqf index cf7005e385..d1a651610e 100644 --- a/addons/overheating/XEH_postInit.sqf +++ b/addons/overheating/XEH_postInit.sqf @@ -1,8 +1,8 @@ -// by CAA-Picard +// by esteldunedain #include "script_component.hpp" -GVAR(pseudoRandomList) = []; if (isServer) then { + GVAR(pseudoRandomList) = []; // Construct a list of pseudo random 2D vectors for "_i" from 0 to 30 do { GVAR(pseudoRandomList) pushBack [-1 + random 2, -1 + random 2]; @@ -14,22 +14,18 @@ if (isServer) then { if !(hasInterface) exitWith {}; // Add keybinds -["ACE3", - localize "STR_ACE_Overheating_UnjamWeapon", - { - // Conditions: canInteract - _exceptions = []; - if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; - // Conditions: specific - if !([ACE_player] call EFUNC(common,canUseWeapon) && - {currentWeapon ACE_player in (ACE_player getVariable [QGVAR(jammedWeapons), []])} - ) exitWith {false}; +["ACE3 Weapons", QGVAR(unjamWeapon), localize LSTRING(UnjamWeapon), +{ + // Conditions: canInteract + if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; + // Conditions: specific + if !([ACE_player] call EFUNC(common,canUseWeapon) && + {currentWeapon ACE_player in (ACE_player getVariable [QGVAR(jammedWeapons), []])} + ) exitWith {false}; - // Statement - [ACE_player, currentMuzzle ACE_player, false] call FUNC(clearJam); - true - }, - [19, [true, false, false]], - false, - "keydown" -] call cba_fnc_registerKeybind; + // Statement + [ACE_player, currentMuzzle ACE_player, false] call FUNC(clearJam); + true +}, +{false}, +[19, [true, false, false]], false] call CBA_fnc_addKeybind; //SHIFT + R Key diff --git a/addons/overheating/XEH_preInit.sqf b/addons/overheating/XEH_preInit.sqf index 5144e8a288..ec841eeac6 100644 --- a/addons/overheating/XEH_preInit.sqf +++ b/addons/overheating/XEH_preInit.sqf @@ -6,6 +6,7 @@ PREP(checkTemperature); PREP(clearJam); PREP(displayTemperature); PREP(firedEH); +PREP(handleTakeEH); PREP(jamWeapon); PREP(overheat); PREP(swapBarrel); diff --git a/addons/overheating/config.cpp b/addons/overheating/config.cpp index 489c1ebd41..0e899e1b25 100644 --- a/addons/overheating/config.cpp +++ b/addons/overheating/config.cpp @@ -20,17 +20,5 @@ class CfgPatches { #include "CfgWeapons.hpp" -class ACE_Settings { - class GVAR(DisplayTextOnJam) { - typeName = "BOOL"; - isClientSettable = 1; - value = 1; - displayName = "$STR_ACE_overheating_SettingDisplayTextName"; - description = "$STR_ACE_overheating_SettingDisplayTextDesc"; - }; - class GVAR(enableRefractEffect) { - typeName = "BOOL"; - value = 0; - }; -}; +#include "ACE_Settings.hpp" diff --git a/addons/overheating/functions/fnc_checkTemperature.sqf b/addons/overheating/functions/fnc_checkTemperature.sqf index 0d65601327..f720665620 100644 --- a/addons/overheating/functions/fnc_checkTemperature.sqf +++ b/addons/overheating/functions/fnc_checkTemperature.sqf @@ -10,24 +10,23 @@ * None * * Example: - * None + * [player, currentWeapon player] call ace_overheating_fnc_checkTemperature * * Public: No */ -#include "\z\ace\addons\overheating\script_component.hpp" +#include "script_component.hpp" -EXPLODE_2_PVT(_this,_player,_weapon); - -private ["_action"]; +params ["_player", "_weapon"]; +TRACE_2("params",_player,_weapon); // Play animation and report temperature -_action = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_checkTemperatureAction"); +private _action = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_checkTemperatureAction"); if (_action == "") then { - _action = "Gear"; + _action = "Gear"; }; _player playActionNow _action; -// Launch a PFH that waits a sec before displaying the temperature -[FUNC(displayTemperature), [_player, _weapon], 1.0, 0] call EFUNC(common,waitAndExecute); +// Waits a sec before displaying the temperature +[FUNC(displayTemperature), [_player, _weapon], 1.0] call EFUNC(common,waitAndExecute); diff --git a/addons/overheating/functions/fnc_clearJam.sqf b/addons/overheating/functions/fnc_clearJam.sqf index 1c7e959a98..33039328e4 100644 --- a/addons/overheating/functions/fnc_clearJam.sqf +++ b/addons/overheating/functions/fnc_clearJam.sqf @@ -10,48 +10,48 @@ * Return Value: * None * + * Example: + * [player, currentWeapon player, false] call ace_overheating_fnc_clearJam + * * Public: No */ -#include "\z\ace\addons\overheating\script_component.hpp" +#include "script_component.hpp" -EXPLODE_3_PVT(_this,_unit,_weapon,_skipAnim); +params ["_unit", "_weapon", "_skipAnim"]; +TRACE_3("params",_unit,_weapon,_skipAnim); -private ["_jammedWeapons"]; -_jammedWeapons = _unit getVariable [QGVAR(jammedWeapons), []]; +private _jammedWeapons = _unit getVariable [QGVAR(jammedWeapons), []]; if (_weapon in _jammedWeapons) then { - _jammedWeapons = _jammedWeapons - [_weapon]; + _jammedWeapons = _jammedWeapons - [_weapon]; - _unit setVariable [QGVAR(jammedWeapons), _jammedWeapons]; + _unit setVariable [QGVAR(jammedWeapons), _jammedWeapons]; - if (count _jammedWeapons == 0) then { - private "_id"; - - _id = _unit getVariable [QGVAR(JammingActionID), -1]; - [_unit, "DefaultAction", _id] call EFUNC(common,removeActionEventHandler); - _unit setVariable [QGVAR(JammingActionID), -1]; - }; - - if !(_skipAnim) then { - private "_clearJamAction"; - - _clearJamAction = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_clearJamAction"); - - if (_clearJamAction == "") then { - _clearJamAction = getText (configFile >> "CfgWeapons" >> _weapon >> "reloadAction"); + if (_jammedWeapons isEqualTo []) then { + private _id = _unit getVariable [QGVAR(JammingActionID), -1]; + [_unit, "DefaultAction", _id] call EFUNC(common,removeActionEventHandler); + _unit setVariable [QGVAR(JammingActionID), -1]; }; - _unit playActionNow _clearJamAction; - if (_weapon == primaryWeapon _unit) then { - playSound QGVAR(fixing_rifle); - } else { - if (_weapon == secondaryWeapon _unit) then { - playSound QGVAR(fixing_pistol); - }; - }; - }; + if !(_skipAnim) then { - if (GVAR(DisplayTextOnJam)) then { - [localize LSTRING(WeaponUnjammed)] call EFUNC(common,displayTextStructured); - }; + private _clearJamAction = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_clearJamAction"); + + if (_clearJamAction == "") then { + _clearJamAction = getText (configFile >> "CfgWeapons" >> _weapon >> "reloadAction"); + }; + + _unit playActionNow _clearJamAction; + if (_weapon == primaryWeapon _unit) then { + playSound QGVAR(fixing_rifle); + } else { + if (_weapon == secondaryWeapon _unit) then { + playSound QGVAR(fixing_pistol); + }; + }; + }; + + if (GVAR(DisplayTextOnJam)) then { + [localize LSTRING(WeaponUnjammed)] call EFUNC(common,displayTextStructured); + }; }; diff --git a/addons/overheating/functions/fnc_cooldown.sqf b/addons/overheating/functions/fnc_cooldown.sqf deleted file mode 100644 index 52052c7251..0000000000 --- a/addons/overheating/functions/fnc_cooldown.sqf +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: esteldunedain - * Calculate cooling down of the weapon. - * - * Argument: - * 0: Last temperature - * 1: Barrel mass - * 2: Time - * - * Return value: - * New temperature - * - * Public: No - */ -#include "\z\ace\addons\overheating\script_component.hpp" - -EXPLODE_3_PVT(_this,_temperature,_barrelMass,_totalTime); - -// If a long time passed since the last shot, there's no need to calculate anything; the weapon should be cool -if (_totalTime > 1800) exitWith {0}; - -private ["_barrelSurface", "_time", "_deltaTime"]; -_barrelSurface = _barrelMass / 7850 / 0.003; - -_time = 0; -while {true} do { - _deltaTime = (_totalTime - _time) min 20; - - _temperature = _temperature - ( - // Convective cooling - 25 * _barrelSurface * _temperature - // Radiative cooling - + 0.4 * 5.67e-8 * _barrelSurface * - ( (_temperature + 273.15)*(_temperature + 273.15) - * (_temperature + 273.15)*(_temperature + 273.15) - - 273.15 * 273.15 * 273.15 *273.15 ) - ) * _deltaTime / (_barrelMass * 466); - - if (_temperature < 1) exitWith {0}; - - if (isNil "_temperature") exitWith { - ACE_LOGERROR_3("_totalTime = %1; _time = %2; _deltaTime = %3;",_totalTime,_time,_deltaTime); - 0 - }; - - _time = _time + _deltaTime; - if (_time >= _totalTime) exitWith { _temperature max 0 }; -}; diff --git a/addons/overheating/functions/fnc_displayTemperature.sqf b/addons/overheating/functions/fnc_displayTemperature.sqf index 11eb13ca75..b2b8d2b4c0 100644 --- a/addons/overheating/functions/fnc_displayTemperature.sqf +++ b/addons/overheating/functions/fnc_displayTemperature.sqf @@ -9,41 +9,40 @@ * Return Values: * None * + * Example: + * [player, currentWeapon player] call ace_overheating_fnc_displayTemperature + * * Public: No */ -#include "\z\ace\addons\overheating\script_component.hpp" +#include "script_component.hpp" -EXPLODE_2_PVT(_this,_player,_weapon); - -private ["_temperature", "_scaledTemperature", "_color", "_count", "_string", "_text", "_picture"]; +params ["_player", "_weapon"]; +TRACE_2("params",_player,_weapon); // Calculate cool down of weapon since last shot -_temperature = [_player, _weapon, 0] call FUNC(updateTemperature); -_scaledTemperature = (_temperature / 1000) min 1; +private _temperature = [_player, _weapon, 0] call FUNC(updateTemperature); +private _scaledTemperature = (_temperature / 1000) min 1; -_color = [ +private _color = [ 2 * (_scaledTemperature * 2 min 1) min 1, 2 * (1 - (_scaledTemperature * 2 min 1)) min 1, 00 ]; -_count = round (12 * _scaledTemperature); -_string = ""; +private _count = round (12 * _scaledTemperature); +private _string = ""; for "_a" from 1 to _count do { _string = _string + "|"; }; -_text = [_string, _color] call EFUNC(common,stringToColoredText); +private _text = [_string, _color] call EFUNC(common,stringToColoredText); _string = ""; for "_a" from (_count + 1) to 12 do { _string = _string + "|"; }; -_text = composeText [ - _text, - [_string, [0.5, 0.5, 0.5]] call EFUNC(common,stringToColoredText) -]; +_text = composeText [_text, [_string, [0.5, 0.5, 0.5]] call EFUNC(common,stringToColoredText)]; -_picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture"); +private _picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture"); [_text, _picture] call EFUNC(common,displayTextPicture); diff --git a/addons/overheating/functions/fnc_firedEH.sqf b/addons/overheating/functions/fnc_firedEH.sqf index 4f5e0b7119..fc30a56e38 100644 --- a/addons/overheating/functions/fnc_firedEH.sqf +++ b/addons/overheating/functions/fnc_firedEH.sqf @@ -3,29 +3,32 @@ * Handle weapon fire * * Argument: - * 0: Unit - * 1: Weapon - * 3: Muzzle - * 4: Ammo - * 5: Magazine - * 6: Projectile + * 0: unit - Object the event handler is assigned to + * 1: weapon - Fired weapon + * 2: muzzle - Muzzle that was used + * 3: mode - Current mode of the fired weapon + * 4: ammo - Ammo used + * 5: magazine - magazine name which was used + * 6: projectile - Object of the projectile that was shot * * Return value: * None * * Public: No */ -#include "\z\ace\addons\overheating\script_component.hpp" +#include "script_component.hpp" -private ["_unit", "_weapon", "_ammo", "_projectile"]; +BEGIN_COUNTER(firedEH); -_unit = _this select 0; -_weapon = _this select 1; -_ammo = _this select 4; -_projectile = _this select 6; +params ["_unit", "_weapon", "_muzzle", "", "_ammo", "", "_projectile"]; +TRACE_5("params",_unit,_weapon,_muzzle,_ammo,_projectile); -// Exit if the unit isn't a player -if !([_unit] call EFUNC(common,isPlayer)) exitWith {}; +if (((!GVAR(overheatingDispersion)) && {_unit != ACE_player}) //If no dispersion, only run when local + || {!([_unit] call EFUNC(common,isPlayer))} //Ignore AI + || {(_unit distance ACE_player) > 3000} //Ignore far away shots + || {(_muzzle != (primaryWeapon _unit)) && {_muzzle != (handgunWeapon _unit)}}) exitWith { // Only rifle or pistol muzzles (ignore grenades / GLs) + END_COUNTER(firedEH); +}; // Compute new temperature if the unit is the local player if (_unit == ACE_player) then { @@ -33,118 +36,81 @@ if (_unit == ACE_player) then { }; // Get current temperature from the unit variable -_variableName = format [QGVAR(%1), _weapon]; -_scaledTemperature = (((_unit getVariable [_variableName, [0,0]]) select 0) / 1000) min 1 max 0; - -systemChat str(_scaledTemperature); - -if (time > (_unit getVariable [QGVAR(lastDrop), -1000]) + 0.40 && _scaledTemperature > 0.1) then { - _unit setVariable [QGVAR(lastDrop), time]; - - private ["_position", "_direction","_intensity"]; - - _direction = (_unit weaponDirection _weapon) vectorMultiply 0.25; - _position = (position _projectile) vectorAdd (_direction vectorMultiply (4*(random 0.30))); - - if (GVAR(enableRefractEffect)) then { - // Refract SFX, beginning at temp 100º and maxs out at 500º - _intensity = (_scaledTemperature - 0.10) / 0.40 min 1; - drop [ - "\A3\data_f\ParticleEffects\Universal\Refract", - "", - "Billboard", - 10, - 2, - _position, - _direction, - 0, - 1.2, - 1.0, - 0.1, - [0.10,0.25], - [[0.6,0.6,0.6,0.3*_intensity],[0.2,0.2,0.2,0.05*_intensity]], - [0,1], - 0.1, - 0.05, - "", - "", - "" - ]; - }; - - // Smoke SFX, beginning at temp 150º - _intensity = (_scaledTemperature - 0.15) / 0.85; - if (_intensity > 0) then { - drop [ - ["\A3\data_f\ParticleEffects\Universal\Universal", 16, 12, 1, 16], - "", - "Billboard", - 10, - 1.2, - _position, - [0,0,0.15], - 100 + random 80, - 1.275, - 1, - 0.025, - [0.15,0.43], - [[0.6,0.6,0.6,0.5*_intensity],[0.2,0.2,0.2,0.15*_intensity]], - [0,1], - 1, - 0.04, - "", - "", - "" - ]; - }; -}; +private _variableName = format [QGVAR(%1), _weapon]; +(_unit getVariable [_variableName, [0, 0]]) params ["_temperature"]; +private _scaledTemperature = linearConversion [0, 1000, _temperature, 0, 1, true]; +TRACE_3("",_variableName,_temperature,_scaledTemperature); // Dispersion and bullet slow down -private ["_dispersion", "_slowdownFactor", "_count"]; +if (GVAR(overheatingDispersion)) then { + private _dispersion = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_Dispersion"); + _dispersion = (_dispersion * ([[0,1,2,4], 3 * _scaledTemperature] call EFUNC(common,interpolateFromArray))) max 0; -_dispersion = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_Dispersion"); + private _slowdownFactor = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_SlowdownFactor"); + if (_slowdownFactor == 0) then {_slowdownFactor = 1}; + _slowdownFactor = _slowdownFactor * linearConversion [0.666, 1, _scaledTemperature, 0, -0.1, true]; -_dispersion = ([[0*_dispersion,1*_dispersion,2*_dispersion,4*_dispersion], 3 * _scaledTemperature] call EFUNC(common,interpolateFromArray)) max 0; + // Exit if GVAR(pseudoRandomList) isn't synced yet + if (isNil QGVAR(pseudoRandomList)) exitWith {ACE_LOGERROR("No pseudoRandomList sync");}; -_slowdownFactor = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_SlowdownFactor"); + // Get the pseudo random values for dispersion from the remaining ammo count + (GVAR(pseudoRandomList) select ((_unit ammo _weapon) mod (count GVAR(pseudoRandomList)))) params ["_dispersionX", "_dispersionY"]; -if (_slowdownFactor == 0) then {_slowdownFactor = 1}; + TRACE_4("change",_dispersion,_slowdownFactor,_dispersionX,_dispersionY); -_slowdownFactor = ([[1*_slowdownFactor,1*_slowdownFactor,1*_slowdownFactor,0.9*_slowdownFactor], 3 * _scaledTemperature] call EFUNC(common,interpolateFromArray)) max 0; + [_projectile, _dispersionX * _dispersion, _dispersionY * _dispersion, _slowdownFactor * vectorMagnitude (velocity _projectile)] call EFUNC(common,changeProjectileDirection); +}; +// ------ LOCAL PLAYER ONLY ------------ +// Only compute jamming and show Visual Effects for the local player +if (_unit != ACE_player) exitWith {END_COUNTER(firedEH);}; -// Exit if GVAR(pseudoRandomList) isn't synced yet -if (count GVAR(pseudoRandomList) == 0) exitWith {}; +private _jamChance = if (isNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_MRBS")) then { + 1 / getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_MRBS"); +} else { + 1 / 3000; +}; +_jamChance = _jamChance * ([[0.5, 1.5, 7.5, 37.5], 3 * _scaledTemperature] call EFUNC(common,interpolateFromArray)); -// Get the pseudo random values for dispersion from the remaining ammo count -private "_pseudoRandomPair"; -_pseudoRandomPair = GVAR(pseudoRandomList) select ((_unit ammo _weapon) mod count GVAR(pseudoRandomList)); - -[_projectile, (_pseudoRandomPair select 0) * _dispersion, (_pseudoRandomPair select 1) * _dispersion, (_slowdownFactor - 1) * vectorMagnitude (velocity _projectile)] call EFUNC(common,changeProjectileDirection); - - - -// Only compute jamming for the local player -if (_unit != ACE_player) exitWith {}; - -private "_jamChance"; -_jamChance = 1 / getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_MRBS"); // arma handles division by 0 - -_jamChance = [[0.5*_jamChance,1.5*_jamChance,7.5*_jamChance,37.5*_jamChance], 3 * _scaledTemperature] call EFUNC(common,interpolateFromArray); - -// increase jam chance on dusty grounds if prone -if (stance _unit == "PRONE") then { - private "_surface"; - _surface = toArray (surfaceType getPosASL _unit); - _surface deleteAt 0; - - _surface = configFile >> "CfgSurfaces" >> toString _surface; +// increase jam chance on dusty grounds if prone (and at ground level) +if ((stance _unit == "PRONE") && {((getPosATL _unit) select 2) < 1}) then { + private _surface = configFile >> "CfgSurfaces" >> ((surfaceType getPosASL _unit) select [1]); if (isClass _surface) then { + TRACE_1("dust",getNumber (_surface >> "dust")); _jamChance = _jamChance + (getNumber (_surface >> "dust")) * _jamChance; }; }; -if (random 1 < _jamChance) then { +TRACE_3("check for random jam",_unit,_weapon,_jamChance); +if ((random 1) < _jamChance) then { [_unit, _weapon] call FUNC(jamWeapon); }; + +//Particle Effects: +if (GVAR(showParticleEffects) && {(ACE_time > ((_unit getVariable [QGVAR(lastDrop), -1000]) + 0.40)) && {_scaledTemperature > 0.1}}) then { + _unit setVariable [QGVAR(lastDrop), ACE_time]; + + private _direction = (_unit weaponDirection _weapon) vectorMultiply 0.25; + private _position = (position _projectile) vectorAdd (_direction vectorMultiply (4*(random 0.30))); + + // Refract SFX, beginning at temp 100º and maxs out at 500º + private _intensity = linearConversion [0.1, 0.5, _scaledTemperature, 0, 1, true]; + TRACE_3("refract",_direction,_position,_intensity); + if (_intensity > 0) then { + drop [ + "\A3\data_f\ParticleEffects\Universal\Refract", "", "Billboard", 10, 2, _position, _direction, 0, 1.2, 1.0, + 0.1, [0.10,0.25], [[0.6,0.6,0.6,0.3*_intensity],[0.2,0.2,0.2,0.05*_intensity]], [0,1], 0.1, 0.05, "", "", ""]; + }; + // Smoke SFX, beginning at temp 150º + private _intensity = linearConversion [0.15, 1, _scaledTemperature, 0, 1, true]; + TRACE_3("smoke",_direction,_position,_intensity); + if (_intensity > 0) then { + drop [ + ["\A3\data_f\ParticleEffects\Universal\Universal", 16, 12, 1, 16], "", "Billboard", 10, 1.2, _position, + [0,0,0.15], 100 + random 80, 1.275, 1, 0.025, [0.15,0.43], [[0.6,0.6,0.6,0.5*_intensity],[0.2,0.2,0.2,0.15*_intensity]], + [0,1], 1, 0.04, "", "", ""]; + }; +}; + +END_COUNTER(firedEH); diff --git a/addons/overheating/functions/fnc_handleTakeEH.sqf b/addons/overheating/functions/fnc_handleTakeEH.sqf new file mode 100644 index 0000000000..df5a416e10 --- /dev/null +++ b/addons/overheating/functions/fnc_handleTakeEH.sqf @@ -0,0 +1,28 @@ +/* + * Author: ??? probably CAA-Picard / Commy2 + * Handle "take" event + * I think it fixs jams when manually dragging a new magazine in from player's inventory + * + * Argument: + * 0: unit - Object the event handler is assigned to + * 1: container + * 2: item + * + * Return value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_container", "_item"]; +TRACE_3("params",_unit,_container,_item); + +if ((_unit == ACE_player) + && {_container in [uniformContainer _unit, vestContainer _unit, backpackContainer _unit]} + && {_item == currentMagazine _unit}) then { //Todo: should this be any valid magazine for any jammed gun? + + TRACE_1("clearing jam",currentWeapon _unit); + [_unit, currentWeapon _unit, true] call FUNC(clearJam) + +}; diff --git a/addons/overheating/functions/fnc_jamWeapon.sqf b/addons/overheating/functions/fnc_jamWeapon.sqf index 000cd44021..1580ac240e 100644 --- a/addons/overheating/functions/fnc_jamWeapon.sqf +++ b/addons/overheating/functions/fnc_jamWeapon.sqf @@ -9,74 +9,58 @@ * Return value: * None * + * Example: + * [player, currentWeapon player] call ace_overheating_fnc_jamWeapon + * * Public: No */ -#include "\z\ace\addons\overheating\script_component.hpp" +#include "script_component.hpp" -EXPLODE_2_PVT(_this,_unit,_weapon); +params ["_unit", "_weapon"]; +TRACE_2("params",_unit,_weapon); // don't jam a weapon with no rounds left -if (_unit ammo _weapon == 0) exitWith {}; +private _ammo = _unit ammo _weapon; +if (_ammo == 0) exitWith {}; -private ["_jammedWeapons"]; -_jammedWeapons = _unit getVariable [QGVAR(jammedWeapons), []]; +private _jammedWeapons = _unit getVariable [QGVAR(jammedWeapons), []]; _jammedWeapons pushBack _weapon; _unit setVariable [QGVAR(jammedWeapons), _jammedWeapons]; -// this is to re-activate the 'DefaultAction', so you can jam a weapon while full auto shooting -_fnc_stopCurrentBurst = { - EXPLODE_2_PVT(_this,_params,_pfhId); - EXPLODE_4_PVT(_params,_unit,_weapon,_ammo,_startFrame); - - // Skip the first execution of the PFH - if (diag_frameno == _startFrame) exitWith {}; - - // Remove the PFH on the second execution - [_pfhId] call CBA_fnc_removePerFrameHandler; - - _unit setAmmo [_weapon, _ammo]; -}; // Stop current burst -_ammo = _unit ammo _weapon; if (_ammo > 0) then { _unit setAmmo [_weapon, 0]; - [_fnc_stopCurrentBurst, 0, [_unit, _weapon, _ammo, diag_frameno]] call CBA_fnc_addPerFrameHandler; + // this is to re-activate the 'DefaultAction', so you can jam a weapon while full auto shootin + [{ + params ["_unit", "_weapon", "_ammo"]; + _unit setAmmo [_weapon, _ammo]; + }, [_unit, _weapon, _ammo]] call EFUNC(common,execNextFrame); }; // only display the hint once, after you try to shoot an already jammed weapon GVAR(knowAboutJam) = false; if (_unit getVariable [QGVAR(JammingActionID), -1] == -1) then { - private ["_condition", "_statement", "_condition2", "_statement2", "_id"]; - _condition = { - [_this select 1] call EFUNC(common,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 [QGVAR(knowAboutJam), false]) && {(_this select 1) ammo currentWeapon (_this select 1) > 0} && {GVAR(DisplayTextOnJam)}) then { - [localize LSTRING(WeaponJammed)] call EFUNC(common,displayTextStructured); - GVAR(knowAboutJam) = true; + private _condition = { + [_this select 1] call EFUNC(common,canUseWeapon) + && {currentMuzzle (_this select 1) in ((_this select 1) getVariable [QGVAR(jammedWeapons), []])} + && {!(currentMuzzle (_this select 1) in ((_this select 1) getVariable [QEGVAR(safemode,safedWeapons), []]))} }; - }; - _condition2 = { - currentWeapon (_this select 1) in ((_this select 1) getVariable [QGVAR(jammedWeapons), []]) - }; + private _statement = { + playSound3D ["a3\sounds_f\weapons\Other\dry9.wss", _this select 0]; - _statement2 = { - [_this select 1, currentWeapon (_this select 1), false] call FUNC(clearJam); - }; + if (!(missionNamespace getVariable [QGVAR(knowAboutJam), false]) && {(_this select 1) ammo currentWeapon (_this select 1) > 0} && {GVAR(DisplayTextOnJam)}) then { + [localize LSTRING(WeaponJammed)] call EFUNC(common,displayTextStructured); + GVAR(knowAboutJam) = true; + }; + }; - //_id = [_unit, format ["%1", localize LSTRING(UnjamWeapon)], "DefaultAction", _condition, _statement, _condition2, _statement2, 10] call EFUNC(common,addActionMenuEventHandler); - _id = [_unit, "DefaultAction", _condition, _statement] call EFUNC(common,addActionEventHandler); + private _id = [_unit, "DefaultAction", _condition, _statement] call EFUNC(common,addActionEventHandler); - _unit setVariable [QGVAR(JammingActionID), _id]; + _unit setVariable [QGVAR(JammingActionID), _id]; }; diff --git a/addons/overheating/functions/fnc_overheat.sqf b/addons/overheating/functions/fnc_overheat.sqf index 70e69a95ab..469d3eeee5 100644 --- a/addons/overheating/functions/fnc_overheat.sqf +++ b/addons/overheating/functions/fnc_overheat.sqf @@ -1,5 +1,5 @@ /* - * Author: Commy2 and CAA-Picard + * Author: Commy2 and esteldunedain * Handle weapon fire, heat up the weapon * * Argument: @@ -15,22 +15,26 @@ * * Public: No */ -#include "\z\ace\addons\overheating\script_component.hpp" +#include "script_component.hpp" -private ["_unit", "_weapon", "_ammo", "_projectile"]; -_unit = _this select 0; -_weapon = _this select 1; -_ammo = _this select 4; -_projectile = _this select 6; +params ["_unit", "_weapon", "", "", "_ammo", "", "_projectile"]; +TRACE_4("params",_unit,_weapon,_ammo,_projectile); -private ["_bulletMass","_energyIncrement"]; +//Only do heat calculations every 3 bullets +if (((_unit ammo _weapon) % 3) != 0) exitWith {}; + +BEGIN_COUNTER(overheat); // Get physical parameters -_bulletMass = getNumber (configFile >> "CfgAmmo" >> _ammo >> "ACE_BulletMass"); +private _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")); + // If the bullet mass is not configured, estimate it + _bulletMass = 3.4334 + 0.5171 * (getNumber (configFile >> "CfgAmmo" >> _ammo >> "hit") + getNumber (configFile >> "CfgAmmo" >> _ammo >> "caliber")); }; -_energyIncrement = 0.75 * 0.0005 * _bulletMass * (vectorMagnitudeSqr velocity _projectile); +private _energyIncrement = 3 * 0.000375 * _bulletMass * (vectorMagnitudeSqr velocity _projectile); -[_unit, _weapon, _energyIncrement] call FUNC(updateTemperature) +TRACE_2("heat",_bulletMass,_energyIncrement); + +[_unit, _weapon, _energyIncrement] call FUNC(updateTemperature); + +END_COUNTER(overheat); diff --git a/addons/overheating/functions/fnc_swapBarrel.sqf b/addons/overheating/functions/fnc_swapBarrel.sqf index 4bd0f734b9..62b1029180 100644 --- a/addons/overheating/functions/fnc_swapBarrel.sqf +++ b/addons/overheating/functions/fnc_swapBarrel.sqf @@ -9,14 +9,18 @@ * Return value: * None * + * Example: + * [player, currentWeapon player] call ace_overheating_fnc_swapBarrel + * * Public: No */ -#include "\z\ace\addons\overheating\script_component.hpp" +#include "script_component.hpp" -EXPLODE_2_PVT(_this,_player,_weapon); +params ["_player", "_weapon"]; +TRACE_2("params",_player,_weapon); if (stance _player != "PRONE") then { - [_player, "amovpknlmstpsraswrfldnon", 1] call EFUNC(common,doAnimation); + [_player, "amovpknlmstpsraswrfldnon", 1] call EFUNC(common,doAnimation); }; _player playActionNow "GestureDismountMuzzle"; _player playAction "GestureMountMuzzle"; diff --git a/addons/overheating/functions/fnc_swapBarrelCallback.sqf b/addons/overheating/functions/fnc_swapBarrelCallback.sqf index 5947e381c7..1f6fdb8b59 100644 --- a/addons/overheating/functions/fnc_swapBarrelCallback.sqf +++ b/addons/overheating/functions/fnc_swapBarrelCallback.sqf @@ -9,11 +9,15 @@ * Return value: * None * + * Example: + * [player, currentWeapon player] call ace_overheating_fnc_swapBarrelCallback + * * Public: No */ -#include "\z\ace\addons\overheating\script_component.hpp" +#include "script_component.hpp" -EXPLODE_2_PVT(_this,_player,_weapon); +params ["_player", "_weapon"]; +TRACE_2("params",_player,_weapon); // don't consume the barrel, but rotate through them. [localize LSTRING(SwappedBarrel), QUOTE(PATHTOF(UI\spare_barrel_ca.paa))] call EFUNC(common,displayTextPicture); diff --git a/addons/overheating/functions/fnc_updateTemperature.sqf b/addons/overheating/functions/fnc_updateTemperature.sqf index 19fa94e472..ee3d4039e9 100644 --- a/addons/overheating/functions/fnc_updateTemperature.sqf +++ b/addons/overheating/functions/fnc_updateTemperature.sqf @@ -10,46 +10,46 @@ * Return value: * Current temperature * + * Example: + * [player, currentWeapon player, 2000] call ace_overheating_fnc_updateTemperature + * * Public: No */ -#include "\z\ace\addons\overheating\script_component.hpp" +#include "script_component.hpp" -EXPLODE_3_PVT(_this,_unit,_weapon,_heatIncrement); - -private ["_variableName", "_oldHeat", "_temperature", "_time", "_barrelMass"]; +params ["_unit", "_weapon", "_heatIncrement"]; +TRACE_3("params",_unit,_weapon,_heatIncrement); // each weapon has it's own variable. Can't store the temperature in the weapon since they are not objects unfortunately. -_variableName = format [QGVAR(%1), _weapon]; +private _variableName = format [QGVAR(%1), _weapon]; // get old values -_oldHeat = _unit getVariable [_variableName, [0, 0]]; -_temperature = _oldHeat select 0; -_time = _oldHeat select 1; +(_unit getVariable [_variableName, [0, 0]]) params ["_temperature", "_time"]; -_barrelMass = 0.50 * (getNumber (configFile >> "CfgWeapons" >> _weapon >> "WeaponSlotsInfo" >> "mass") / 22.0) max 1.0; +private _barrelMass = 0.50 * (getNumber (configFile >> "CfgWeapons" >> _weapon >> "WeaponSlotsInfo" >> "mass") / 22.0) max 1.0; _fnc_cooling = { - EXPLODE_3_PVT(_this,_temperature,_barrelMass,_totalTime); + params ["_temperature", "_barrelMass", "_totalTime"]; + TRACE_3("cooling",_temperature,_barrelMass,_totalTime); // If a long time passed since the last shot, there's no need to calculate anything; the weapon should be cool if (_totalTime > 1800) exitWith {0}; - private ["_barrelSurface", "_time", "_deltaTime"]; - _barrelSurface = _barrelMass / 7850 / 0.003; + private _barrelSurface = _barrelMass / 7850 / 0.003; - _time = 0; + private _time = 0; while {true} do { - _deltaTime = (_totalTime - _time) min 20; + private _deltaTime = (_totalTime - _time) min 20; _temperature = _temperature - ( - // Convective cooling - 25 * _barrelSurface * _temperature - // Radiative cooling - + 0.4 * 5.67e-8 * _barrelSurface * - ( (_temperature + 273.15)*(_temperature + 273.15) - * (_temperature + 273.15)*(_temperature + 273.15) - - 273.15 * 273.15 * 273.15 *273.15 ) - ) * _deltaTime / (_barrelMass * 466); + // Convective cooling + 25 * _barrelSurface * _temperature + // Radiative cooling + + 0.4 * 5.67e-8 * _barrelSurface * + ( (_temperature + 273.15)*(_temperature + 273.15) + * (_temperature + 273.15)*(_temperature + 273.15) + - 273.15 * 273.15 * 273.15 *273.15 ) + ) * _deltaTime / (_barrelMass * 466); if (_temperature < 1) exitWith {0}; @@ -64,12 +64,13 @@ _fnc_cooling = { }; // Calculate cooling -_temperature = [_temperature, _barrelMass, time - _time] call _fnc_cooling; +_temperature = [_temperature, _barrelMass, ACE_time - _time] call _fnc_cooling; +TRACE_1("cooledTo",_temperature); // Calculate heating // Steel Heat Capacity = 466 J/(Kg.K) _temperature = _temperature + _heatIncrement / (_barrelMass * 466); // Publish the variable -[_unit, _variableName, [_temperature, time], 2.0] call EFUNC(common,setVariablePublic); +[_unit, _variableName, [_temperature, ACE_time], 2.0] call EFUNC(common,setVariablePublic); _temperature diff --git a/addons/overheating/functions/script_component.hpp b/addons/overheating/functions/script_component.hpp new file mode 100644 index 0000000000..a8668e5b4f --- /dev/null +++ b/addons/overheating/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\overheating\script_component.hpp" \ No newline at end of file diff --git a/addons/overheating/script_component.hpp b/addons/overheating/script_component.hpp index ff124851ad..abae557ebd 100644 --- a/addons/overheating/script_component.hpp +++ b/addons/overheating/script_component.hpp @@ -1,6 +1,9 @@ #define COMPONENT overheating #include "\z\ace\addons\main\script_mod.hpp" +// #define ENABLE_PERFORMANCE_COUNTERS +// #define DEBUG_MODE_FULL + #ifdef DEBUG_ENABLED_OVERHEATING #define DEBUG_MODE_FULL #endif diff --git a/addons/overheating/stringtable.xml b/addons/overheating/stringtable.xml index 28dc8b95c7..75ac666aae 100644 --- a/addons/overheating/stringtable.xml +++ b/addons/overheating/stringtable.xml @@ -1,7 +1,7 @@  - + Display text on jam Zeige Text bei Ladehemmung Mostrar texto al encasquillarse @@ -13,7 +13,7 @@ Mostrar texto quando trava acontecer Visualizza testo in caso di inceppamento - + Display a notification whenever your weapon gets jammed Zeige einen Hinweis, wenn die Waffe eine Ladehemmung hat. Mostrar notificación cada vez que el arma se encasquille @@ -25,6 +25,18 @@ Mostra uma notificação quando sua arma sofre um travamento. Visualizza una notifica in caso la tua arma si inceppasse + + Overheating Particle Effects + + + Show particle effects when weapon overheats + + + Overheating Dispersion + + + Overheated weapons will be less accurate and have decreased muzzle velocity. Applys for all players. + Spare barrel Ersatzlauf