This commit is contained in:
commy2
2015-04-16 19:12:49 +02:00
committed by PabstMirror
parent 4264789631
commit f83206353d
3 changed files with 84 additions and 91 deletions

View File

@ -15,6 +15,10 @@ class CfgWeapons {
class Rifle; class Rifle;
class Rifle_Base_F : Rifle { class Rifle_Base_F : Rifle {
ACE_MRBS = 3000;
ACE_Dispersion = 0;
ACE_SlowdownFactor = 1;
// Dispersion, SlowdownFactor and JamChance arrays have 4 values for different temperatures, which are interpolated between. // 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. // These values correspond to temperatures Converted to real life values: 0: 0°C, 1: 333°C, 2: 666°C, 3: 1000°C.

View File

@ -18,7 +18,7 @@ EXPLODE_2_PVT(_this,_player,_weapon);
private ["_temperature", "_scaledTemperature", "_color", "_count", "_string", "_text", "_picture"]; private ["_temperature", "_scaledTemperature", "_color", "_count", "_string", "_text", "_picture"];
// Calculate cool down of weapon since last shot // Calculate cool down of weapon since last shot
_temperature = [_player, _weapon, 0] call FUNC(updateTemperature) _temperature = [_player, _weapon, 0] call FUNC(updateTemperature);
_scaledTemperature = (_temperature / 1000) min 1; _scaledTemperature = (_temperature / 1000) min 1;
_color = [ _color = [
@ -27,7 +27,7 @@ _color = [
00 00
]; ];
_count = 2 + round (10 * _scaledTemperature); _count = round (12 * _scaledTemperature);
_string = ""; _string = "";
for "_a" from 1 to _count do { for "_a" from 1 to _count do {
_string = _string + "|"; _string = _string + "|";
@ -41,7 +41,7 @@ for "_a" from (_count + 1) to 12 do {
_text = composeText [ _text = composeText [
_text, _text,
[_string, [0.5, 0.5, 0.5]] call EFUNC(common,stringToColoredTex)t [_string, [0.5, 0.5, 0.5]] call EFUNC(common,stringToColoredText)
]; ];
_picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture"); _picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture");

View File

@ -34,6 +34,11 @@ if (_unit == ACE_player) then {
_variableName = format [QGVAR(%1), _weapon]; _variableName = format [QGVAR(%1), _weapon];
_scaledTemperature = (((_unit getVariable [_variableName, [0,0]]) select 0) / 1000) min 1 max 0; _scaledTemperature = (((_unit getVariable [_variableName, [0,0]]) select 0) / 1000) min 1 max 0;
//////////////////////////////// FIX
systemChat format ["%1", _scaledTemperature];
_scaledTemperature = random 1;
//////////////////////////////// FIX
// Smoke SFX, beginning at TEMP 0.15 // Smoke SFX, beginning at TEMP 0.15
private "_intensity"; private "_intensity";
@ -96,23 +101,15 @@ 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 >> "ACE_Overheating_Dispersion"); _dispersion = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_Dispersion");
_count = count _dispersion; _dispersion = ([[0*_dispersion,1*_dispersion,2*_dispersion,4*_dispersion], 3 * _scaledTemperature] call EFUNC(common,interpolateFromArray)) max 0;
if (_count > 0) then {
_dispersion = ([_dispersion, (_count - 1) * _scaledTemperature] call EFUNC(common,interpolateFromArray)) max 0;
} else {
_dispersion = 0;
};
_slowdownFactor = getArray (configFile >> "CfgWeapons" >> _weapon >> "ACE_Overheating_slowdownFactor"); _slowdownFactor = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_SlowdownFactor");
_count = count _slowdownFactor; if (_slowdownFactor == 0) then {_slowdownFactor = 1};
if (_count > 0) then {
_slowdownFactor = ([_slowdownFactor, (_count - 1) * _scaledTemperature] call EFUNC(common,interpolateFromArray)) max 0; _slowdownFactor = ([[1*_slowdownFactor,1*_slowdownFactor,1*_slowdownFactor,0.9*_slowdownFactor], 3 * _scaledTemperature] call EFUNC(common,interpolateFromArray)) max 0;
} else {
_slowdownFactor = 1;
};
// Exit if GVAR(pseudoRandomList) isn't synced yet // Exit if GVAR(pseudoRandomList) isn't synced yet
@ -130,15 +127,9 @@ _pseudoRandomPair = GVAR(pseudoRandomList) select ((_unit ammo _weapon) mod coun
if (_unit != ACE_player) exitWith {}; if (_unit != ACE_player) exitWith {};
private "_jamChance"; private "_jamChance";
_jamChance = getArray (configFile >> "CfgWeapons" >> _weapon >> "ACE_Overheating_jamChance"); _jamChance = 1 / getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_MRBS"); // arma handles division by 0
_count = count _jamChance; _jamChance = [[0.5*_jamChance,1.5*_jamChance,7.5*_jamChance,37.5*_jamChance], 3 * _scaledTemperature] call EFUNC(common,interpolateFromArray);
if (_count == 0) then {
_jamChance = [0];
_count = 1;
};
_jamChance = [_jamChance, (_count - 1) * _scaledTemperature] call EFUNC(common,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 {
@ -152,11 +143,9 @@ if (stance _unit == "PRONE") 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 EFUNC(common,log); systemChat format ["Temperature: %1 - JamChance: %2", _scaledTemperature, _jamChance];
if (random 1 < _jamChance) then { if (random 1 < _jamChance) then {
[_unit, _weapon] call FUNC(jamWeapon); [_unit, _weapon] call FUNC(jamWeapon);