Merge pull request #3758 from acemod/overheatingSetting2

Overheating - Add Master Enabled Setting (barrelPR)
This commit is contained in:
Nicolás Badano 2016-05-04 20:07:45 -03:00
commit 153c6583b5
7 changed files with 77 additions and 64 deletions

View File

@ -38,4 +38,10 @@ class ACE_Settings {
displayName = CSTRING(unJamFailChance_displayName);
description = CSTRING(unJamFailChance_description);
};
class GVAR(enabled) {
typeName = "BOOL";
value = 1;
displayName = CSTRING(enabled_displayName);
description = CSTRING(enabled_description);
};
};

View File

@ -16,11 +16,3 @@ class Extended_PostInit_EventHandlers {
init = QUOTE( call COMPILE_FILE(XEH_postInit) );
};
};
class Extended_Take_EventHandlers {
class CAManBase {
class GVAR(UnjamReload) {
clientTake = QUOTE( _this call FUNC(handleTakeEH) );
};
};
};

View File

@ -6,7 +6,7 @@ class CfgVehicles {
class ACE_Equipment {
class GVAR(UnJam) {
displayName = CSTRING(UnjamWeapon);
condition = QUOTE( [_player] call FUNC(canUnjam) );
condition = QUOTE( GVAR(enabled) && {[_player] call FUNC(canUnjam)} );
exceptions[] = {"isNotInside", "isNotSitting"};
statement = QUOTE( [ARR_2(_player, currentMuzzle _player)] call FUNC(clearJam); );
showDisabled = 0;
@ -15,7 +15,7 @@ class CfgVehicles {
};
class GVAR(SwapBarrel) {
displayName = CSTRING(SwapBarrel);
condition = QUOTE( 'ACE_SpareBarrel' in magazines _player && {getNumber (configFile >> 'CfgWeapons' >> currentWeapon _player >> 'ACE_Overheating_allowSwapBarrel') == 1} );
condition = QUOTE( GVAR(enabled) && {'ACE_SpareBarrel' in magazines _player} && {getNumber (configFile >> 'CfgWeapons' >> currentWeapon _player >> 'ACE_Overheating_allowSwapBarrel') == 1} );
statement = QUOTE( [ARR_3(_player, _player, currentWeapon _player)] call FUNC(swapBarrel); );
showDisabled = 0;
priority = 3;
@ -23,7 +23,7 @@ class CfgVehicles {
};
class GVAR(CheckTemperature) {
displayName = CSTRING(CheckTemperatureShort);
condition = "switch (currentWeapon _player) do {case (''): {false}; case (primaryWeapon _player); case (handgunWeapon _player): {true}; default {false}}";
condition = "ace_overheating_enabled && {switch (currentWeapon _player) do {case (''): {false}; case (primaryWeapon _player); case (handgunWeapon _player): {true}; default {false}}}";
exceptions[] = {"isNotInside", "isNotSitting"};
statement = QUOTE( [ARR_3(_player, _player, currentWeapon _player)] call FUNC(checkTemperature); );
showDisabled = 0;
@ -32,7 +32,7 @@ class CfgVehicles {
};
class GVAR(CheckTemperatureSpareBarrels) {
displayName = CSTRING(CheckTemperatureSpareBarrelsShort);
condition = QUOTE( 'ACE_SpareBarrel' in magazines _player);
condition = QUOTE( GVAR(enabled) && {'ACE_SpareBarrel' in magazines _player});
exceptions[] = {"isNotInside", "isNotSitting"};
statement = QUOTE( [_player] call FUNC(checkSpareBarrelsTemperatures); );
showDisabled = 0;
@ -46,13 +46,13 @@ class CfgVehicles {
class ACE_Weapon {
class GVAR(SwapBarrel) {
displayName = CSTRING(SwapBarrel);
condition = QUOTE( 'ACE_SpareBarrel' in magazines _player && {getNumber (configFile >> 'CfgWeapons' >> currentWeapon _target >> 'ACE_Overheating_allowSwapBarrel') == 1} );
condition = QUOTE( GVAR(enabled) && {'ACE_SpareBarrel' in magazines _player} && {getNumber (configFile >> 'CfgWeapons' >> currentWeapon _target >> 'ACE_Overheating_allowSwapBarrel') == 1} );
statement = QUOTE([ARR_3(_player, _target, currentWeapon _target)] call FUNC(swapBarrelAssistant););
icon = QUOTE(PATHTOF(UI\spare_barrel_ca.paa));
};
class GVAR(CheckTemperature) {
displayName = CSTRING(CheckTemperatureShort);
condition = "switch (currentWeapon _target) do {case (''): {false}; case (primaryWeapon _target); case (handgunWeapon _target): {true}; default {false}}";
condition = "ace_overheating_enabled && {switch (currentWeapon _target) do {case (''): {false}; case (primaryWeapon _target); case (handgunWeapon _target): {true}; default {false}}}";
exceptions[] = {"isNotInside", "isNotSitting"};
statement = QUOTE( [ARR_3(_player, _target, currentWeapon _target)] call FUNC(checkTemperature); );
icon = QUOTE(PATHTOF(UI\temp_ca.paa));

View File

@ -1,62 +1,69 @@
// by esteldunedain
#include "script_component.hpp"
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];
};
publicVariable QGVAR(pseudoRandomList);
if (hasInterface) then {
// Add keybinds
["ACE3 Weapons", QGVAR(unjamWeapon), localize LSTRING(UnjamWeapon),
{
// Conditions: canInteract
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
// Keep track of the temperature of stored spare barrels
GVAR(storedSpareBarrels) = [] call CBA_fnc_hashCreate;
if !(GVAR(enabled) && {[ACE_player] call FUNC(canUnjam)}) exitWith {false};
// Install event handlers for spare barrels
["spareBarrelsSendTemperatureHint", FUNC(sendSpareBarrelsTemperaturesHint)] call EFUNC(common,addEventHandler);
["spareBarrelsLoadCoolest", FUNC(loadCoolestSpareBarrel)] call EFUNC(common,addEventHandler);
// Schedule cool down calculation of stored spare barrels
[] call FUNC(updateSpareBarrelsTemperaturesThread);
// Statement
[ACE_player, currentMuzzle ACE_player, false] call FUNC(clearJam);
true
},
{false},
[19, [true, false, false]], false] call CBA_fnc_addKeybind; //SHIFT + R Key
};
if !(hasInterface) exitWith {};
GVAR(cacheWeaponData) = call CBA_fnc_createNamespace;
GVAR(cacheAmmoData) = call CBA_fnc_createNamespace;
GVAR(cacheSilencerData) = call CBA_fnc_createNamespace;
// Add keybinds
["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 FUNC(canUnjam)) exitWith {false};
// Statement
[ACE_player, currentMuzzle ACE_player, false] call FUNC(clearJam);
true
},
{false},
[19, [true, false, false]], false] call CBA_fnc_addKeybind; //SHIFT + R Key
// Schedule cool down calculation of player weapons at (infrequent) regular intervals
[] call FUNC(updateTemperatureThread);
["SettingsInitialized", {
TRACE_1("SettingsInitialized eh", GVAR(enabled));
if (!GVAR(enabled)) exitWith {};
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];
};
publicVariable QGVAR(pseudoRandomList);
// Keep track of the temperature of stored spare barrels
GVAR(storedSpareBarrels) = [] call CBA_fnc_hashCreate;
// Install event handlers for spare barrels
["spareBarrelsSendTemperatureHint", FUNC(sendSpareBarrelsTemperaturesHint)] call EFUNC(common,addEventHandler);
["spareBarrelsLoadCoolest", FUNC(loadCoolestSpareBarrel)] call EFUNC(common,addEventHandler);
// Schedule cool down calculation of stored spare barrels
[] call FUNC(updateSpareBarrelsTemperaturesThread);
};
if !(hasInterface) exitWith {};
GVAR(cacheWeaponData) = call CBA_fnc_createNamespace;
GVAR(cacheAmmoData) = call CBA_fnc_createNamespace;
GVAR(cacheSilencerData) = call CBA_fnc_createNamespace;
//Add Take EH (for reload)
["CAManBase", "Take", {_this call FUNC(handleTakeEH);}] call CBA_fnc_addClassEventHandler;
// Register fire event handler
["firedPlayer", DFUNC(firedEH)] call EFUNC(common,addEventHandler);
// Only add eh to non local players if dispersion is enabled
if (GVAR(overheatingDispersion)) then {
["firedPlayerNonLocal", DFUNC(firedEH)] call EFUNC(common,addEventHandler);
};
}] call EFUNC(common,addEventHandler);
// Install event handler to display temp when a barrel was swapped
["showWeaponTemperature", DFUNC(displayTemperature)] call EFUNC(common,addEventHandler);
// Install event handler to initiate an assisted barrel swap
["initiateSwapBarrelAssisted", DFUNC(swapBarrel)] call EFUNC(common,addEventHandler);
// Schedule cool down calculation of player weapons at (infrequent) regular intervals
[] call FUNC(updateTemperatureThread);
// Install event handler to display temp when a barrel was swapped
["showWeaponTemperature", DFUNC(displayTemperature)] call EFUNC(common,addEventHandler);
// Install event handler to initiate an assisted barrel swap
["initiateSwapBarrelAssisted", DFUNC(swapBarrel)] call EFUNC(common,addEventHandler);
}] call EFUNC(common,addEventHandler);

View File

@ -15,7 +15,7 @@
*
* Public: No
*/
#define DEBUG_MODE_FULL
// #define DEBUG_MODE_FULL
#include "script_component.hpp"
params ["_assistant", "_gunner", "_weapon"];

View File

@ -13,7 +13,7 @@
*
* Public: No
*/
#define DEBUG_MODE_FULL
// #define DEBUG_MODE_FULL
#include "script_component.hpp"
private _pairs = [];

View File

@ -282,7 +282,15 @@
<English>Very Hot Spare Barrel/s</English>
</Key>
<Key ID="STR_ACE_Overheating_BarrelExtremelyHot">
<English>Extremele Hot Spare Barrel/s</English>
<English>Extremely Hot Spare Barrel/s</English>
</Key>
<Key ID="STR_ACE_Overheating_enabled_displayName">
<English>Overheating Enabled</English>
<German>Überhitzen Aktiviert</German>
<Spanish>Activada Sobrecalentamiento</Spanish>
</Key>
<Key ID="STR_ACE_Overheating_enabled_description">
<English>Master enable for the overheating/jamming module</English>
</Key>
</Package>
</Project>