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_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.
// 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,30 +18,30 @@ EXPLODE_2_PVT(_this,_player,_weapon);
private ["_temperature", "_scaledTemperature", "_color", "_count", "_string", "_text", "_picture"];
// 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;
_color = [
2 * _scaledTemperature min 1,
2 * (1 - _scaledTemperature) min 1,
00
2 * _scaledTemperature min 1,
2 * (1 - _scaledTemperature) min 1,
00
];
_count = 2 + round (10 * _scaledTemperature);
_count = round (12 * _scaledTemperature);
_string = "";
for "_a" from 1 to _count do {
_string = _string + "|";
_string = _string + "|";
};
_text = [_string, _color] call EFUNC(common,stringToColoredText);
_string = "";
for "_a" from (_count + 1) to 12 do {
_string = _string + "|";
_string = _string + "|";
};
_text = composeText [
_text,
[_string, [0.5, 0.5, 0.5]] call EFUNC(common,stringToColoredTex)t
_text,
[_string, [0.5, 0.5, 0.5]] call EFUNC(common,stringToColoredText)
];
_picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture");

View File

@ -27,92 +27,89 @@ _weapon = _this select 1;
// Compute new temperature if the unit is the local player
if (_unit == ACE_player) then {
_this call FUNC(overheat);
_this call FUNC(overheat);
};
// 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;
//////////////////////////////// FIX
systemChat format ["%1", _scaledTemperature];
_scaledTemperature = random 1;
//////////////////////////////// FIX
// Smoke SFX, beginning at TEMP 0.15
private "_intensity";
_intensity = (_scaledTemperature - 0.2) * 1.25;
if (_intensity > 0) then {
private ["_position", "_direction"];
private ["_position", "_direction"];
_position = position _projectile;
_direction = (_unit weaponDirection _weapon) vectorMultiply 0.25;
_position = position _projectile;
_direction = (_unit weaponDirection _weapon) vectorMultiply 0.25;
drop [
"\A3\data_f\ParticleEffects\Universal\Refract",
"",
"Billboard",
1.1,
2,
_position,
_direction,
1,
1.2,
1.0,
0.1,
[0.1,0.15],
[[0.06,0.06,0.06,0.32*_scaledTemperature], [0.3,0.3,0.3,0.28*_scaledTemperature], [0.3,0.3,0.3,0.25*_scaledTemperature], [0.3,0.3,0.3,0.22*_scaledTemperature], [0.3,0.3,0.3,0.1*_scaledTemperature]],
[1,0],
0.1,
0.05,
"",
"",
""
];
_intensity = (_scaledTemperature - 0.5) * 2;
if (_intensity > 0) then {
drop [
["\A3\data_f\ParticleEffects\Universal\Universal", 16, 12, 1, 16],
"",
"Billboard",
1,
1.2,
_position,
[0,0,0.25],
0,
1.275,
1,
0.025,
[0.28,0.33,0.37],
[[0.6,0.6,0.6,0.3*_intensity]],
[0.2],
1,
0.04,
"",
"",
""
"\A3\data_f\ParticleEffects\Universal\Refract",
"",
"Billboard",
1.1,
2,
_position,
_direction,
1,
1.2,
1.0,
0.1,
[0.1,0.15],
[[0.06,0.06,0.06,0.32*_scaledTemperature], [0.3,0.3,0.3,0.28*_scaledTemperature], [0.3,0.3,0.3,0.25*_scaledTemperature], [0.3,0.3,0.3,0.22*_scaledTemperature], [0.3,0.3,0.3,0.1*_scaledTemperature]],
[1,0],
0.1,
0.05,
"",
"",
""
];
};
_intensity = (_scaledTemperature - 0.5) * 2;
if (_intensity > 0) then {
drop [
["\A3\data_f\ParticleEffects\Universal\Universal", 16, 12, 1, 16],
"",
"Billboard",
1,
1.2,
_position,
[0,0,0.25],
0,
1.275,
1,
0.025,
[0.28,0.33,0.37],
[[0.6,0.6,0.6,0.3*_intensity]],
[0.2],
1,
0.04,
"",
"",
""
];
};
};
// Dispersion and bullet slow down
private ["_dispersion", "_slowdownFactor", "_count"];
_dispersion = getArray (configFile >> "CfgWeapons" >> _weapon >> "ACE_Overheating_Dispersion");
_dispersion = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_Dispersion");
_count = count _dispersion;
if (_count > 0) then {
_dispersion = ([_dispersion, (_count - 1) * _scaledTemperature] call EFUNC(common,interpolateFromArray)) max 0;
} else {
_dispersion = 0;
};
_dispersion = ([[0*_dispersion,1*_dispersion,2*_dispersion,4*_dispersion], 3 * _scaledTemperature] call EFUNC(common,interpolateFromArray)) max 0;
_slowdownFactor = getArray (configFile >> "CfgWeapons" >> _weapon >> "ACE_Overheating_slowdownFactor");
_slowdownFactor = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_SlowdownFactor");
_count = count _slowdownFactor;
if (_count > 0) then {
_slowdownFactor = ([_slowdownFactor, (_count - 1) * _scaledTemperature] call EFUNC(common,interpolateFromArray)) max 0;
} else {
_slowdownFactor = 1;
};
if (_slowdownFactor == 0) then {_slowdownFactor = 1};
_slowdownFactor = ([[1*_slowdownFactor,1*_slowdownFactor,1*_slowdownFactor,0.9*_slowdownFactor], 3 * _scaledTemperature] call EFUNC(common,interpolateFromArray)) max 0;
// Exit if GVAR(pseudoRandomList) isn't synced yet
@ -130,34 +127,26 @@ _pseudoRandomPair = GVAR(pseudoRandomList) select ((_unit ammo _weapon) mod coun
if (_unit != ACE_player) exitWith {};
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;
if (_count == 0) then {
_jamChance = [0];
_count = 1;
};
_jamChance = [_jamChance, (_count - 1) * _scaledTemperature] call EFUNC(common,interpolateFromArray);
_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;
private "_surface";
_surface = toArray (surfaceType getPosASL _unit);
_surface deleteAt 0;
_surface = configFile >> "CfgSurfaces" >> toString _surface;
if (isClass _surface) then {
_jamChance = _jamChance + (getNumber (_surface >> "dust")) * _jamChance;
};
_surface = configFile >> "CfgSurfaces" >> toString _surface;
if (isClass _surface) then {
_jamChance = _jamChance + (getNumber (_surface >> "dust")) * _jamChance;
};
};
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 {
[_unit, _weapon] call FUNC(jamWeapon);
[_unit, _weapon] call FUNC(jamWeapon);
};