Skip to content

Commit

Permalink
Tweak overheating (#4969)
Browse files Browse the repository at this point in the history
* Tweak overheating

* Add define for constant magic num
  • Loading branch information
PabstMirror authored Apr 11, 2017
1 parent f0c8d5a commit fb73286
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion addons/common/functions/fnc_interpolateFromArray.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ params ["_array", "_value"];
private _min = _array select floor _value;
private _max = _array select ceil _value;

_min + (_max - _min) * (_value % 1) // return
linearConversion [0, 1, _value % 1, _min, _max] // return
2 changes: 1 addition & 1 deletion addons/overheating/functions/fnc_firedEH.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ if (GVAR(showParticleEffects) && {(CBA_missionTime > ((_unit getVariable [QGVAR(
// Only compute jamming for the local player
if (_unit != ACE_player) exitWith {END_COUNTER(firedEH);};

_jamChance = _jamChance * ([[0.5, 1.5, 15, 150], 3 * _scaledTemperature] call EFUNC(common,interpolateFromArray));
_jamChance = _jamChance * ([[0.5, 1, 2, 8, 20, 150], 5 * _scaledTemperature] call EFUNC(common,interpolateFromArray));

// increase jam chance on dusty grounds if prone (and at ground level)
if ((stance _unit == "PRONE") && {((getPosATL _unit) select 2) < 1}) then {
Expand Down
2 changes: 1 addition & 1 deletion addons/overheating/functions/fnc_swapBarrelCallback.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if (_assistant isEqualTo _gunner) then {
[localize LSTRING(SwappedBarrel), QPATHTOF(UI\spare_barrel_ca.paa)] call EFUNC(common,displayTextPicture);

private _temp = _gunner getVariable [format [QGVAR(%1_temp), _weapon], 0];
private _barrelMass = 0.50 * (getNumber (configFile >> "CfgWeapons" >> _weapon >> "WeaponSlotsInfo" >> "mass") / 22.0) max 1.0;
private _barrelMass = METAL_MASS_RATIO * (getNumber (configFile >> "CfgWeapons" >> _weapon >> "WeaponSlotsInfo" >> "mass") / 22.0) max 1.0;

// Instruct the server to load the coolest spare barrel into the weapon and
// store the removed barrel with the former weapon temperature. The server
Expand Down
2 changes: 1 addition & 1 deletion addons/overheating/functions/fnc_updateTemperature.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ private _timeVarName = format [QGVAR(%1_time), _weapon];
private _temperature = _unit getVariable [_tempVarName, 0];
private _lastTime = _unit getVariable [_timeVarName, 0];

private _barrelMass = 0.50 * (getNumber (configFile >> "CfgWeapons" >> _weapon >> "WeaponSlotsInfo" >> "mass") / 22.0) max 1.0;
private _barrelMass = METAL_MASS_RATIO * (getNumber (configFile >> "CfgWeapons" >> _weapon >> "WeaponSlotsInfo" >> "mass") / 22.0) max 1.0;

// Calculate cooling
_temperature = [_temperature, _barrelMass, CBA_missionTime - _lastTime] call FUNC(calculateCooling);
Expand Down
1 change: 1 addition & 0 deletions addons/overheating/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "\z\ace\addons\main\script_macros.hpp"

#define TEMP_TOLERANCE 50
#define METAL_MASS_RATIO 0.55

#ifdef DEBUG_MODE_FULL
#define TRACE_PROJECTILE_INFO(BULLET) _vdir = vectorNormalized velocity BULLET; _dir = (_vdir select 0) atan2 (_vdir select 1); _up = asin (_vdir select 2); _mv = vectorMagnitude velocity BULLET; TRACE_3("adjusted projectile",_dir,_up,_mv);
Expand Down

0 comments on commit fb73286

Please sign in to comment.