Overheating - Increase cooling for open bolt guns and spare barrels (#9827)

* open bolt and spare barrel cooling boost

* change magic number to macro
This commit is contained in:
Drofseh 2024-03-06 09:45:41 -08:00 committed by GitHub
parent 78334e2be4
commit 6ea0312770
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 16 additions and 10 deletions

View File

@ -7,6 +7,7 @@
* 0: Initial temperature <NUMBER> * 0: Initial temperature <NUMBER>
* 1: Barrel mass <NUMBER> * 1: Barrel mass <NUMBER>
* 2: Time interval <NUMBER> * 2: Time interval <NUMBER>
* 3: Bolt type <NUMBER>
* *
* Return Value: * Return Value:
* Final temperature <NUMBER> * Final temperature <NUMBER>
@ -17,7 +18,7 @@
* Public: No * Public: No
*/ */
params ["_temperature", "_barrelMass", "_totalTime"]; params ["_temperature", "_barrelMass", "_totalTime", "_boltType"];
// The lowest temperature a weapon can reach is the ambient air temperature. // The lowest temperature a weapon can reach is the ambient air temperature.
private _ambientTemperature = ambientTemperature select 0; private _ambientTemperature = ambientTemperature select 0;
@ -43,6 +44,9 @@ if (ACE_player call EFUNC(common,isSwimming)) then {
_convectionRate = _convectionRate * ((linearConversion [0,1,rain,1,5,true] + (5 min (vectorMagnitude wind / 10))) / 2); _convectionRate = _convectionRate * ((linearConversion [0,1,rain,1,5,true] + (5 min (vectorMagnitude wind / 10))) / 2);
}; };
//Increase convection cooling for open bolt type guns
if (_boltType == 0) then {_convectionRate = _convectionRate * OPEN_BOLT_ADDITIONAL_CONVECTION};
TRACE_4("cooling",_temperature,_totalTime,_barrelMass,_barrelSurface); TRACE_4("cooling",_temperature,_totalTime,_barrelMass,_barrelSurface);
private _time = 0; private _time = 0;

View File

@ -61,8 +61,8 @@ private _fnc_onSuccess = {
}; };
// cool the weapon // cool the weapon
private _barrelMass = ([_weapon] call FUNC(getWeaponData)) select 7; private _weaponData = [_weapon] call FUNC(getWeaponData);
_temperature = [_temperature, _barrelMass, _liquidAmount * 10] call FUNC(calculateCooling); _temperature = [_temperature, _weaponData select 7, _liquidAmount * 10, _weaponData select 6] call FUNC(calculateCooling);
[_target, _tempVarName, _temperature, TEMP_TOLERANCE] call EFUNC(common,setApproximateVariablePublic); [_target, _tempVarName, _temperature, TEMP_TOLERANCE] call EFUNC(common,setApproximateVariablePublic);
}; };

View File

@ -59,8 +59,8 @@ private _fnc_condition = {
}; };
//Cool the weapon down //Cool the weapon down
private _barrelMass = ([_weapon] call FUNC(getWeaponData)) select 7; private _weaponData = [_weapon] call FUNC(getWeaponData);
_temperature = [_temperature, _barrelMass, 20] call FUNC(calculateCooling); _temperature = [_temperature, _weaponData select 7, 20, _weaponData select 6] call FUNC(calculateCooling);
[_player, _tempVarName, _temperature, TEMP_TOLERANCE] call EFUNC(common,setApproximateVariablePublic); [_player, _tempVarName, _temperature, TEMP_TOLERANCE] call EFUNC(common,setApproximateVariablePublic);
/* // to be added when licence compatible audio can be found or recorded /* // to be added when licence compatible audio can be found or recorded

View File

@ -20,10 +20,10 @@ TRACE_1("updateSpareBarrelsTemperaturesThread1",GVAR(storedSpareBarrels));
_y params ["_initialTemp","_initialTime", "_barrelMass"]; _y params ["_initialTemp","_initialTime", "_barrelMass"];
// Calculate cooling // Calculate cooling
private _finalTemp = [_initialTemp, _barrelMass, CBA_missionTime - _initialTime] call FUNC(calculateCooling); private _finalTemp = [_initialTemp, _barrelMass, CBA_missionTime - _initialTime, 0] call FUNC(calculateCooling); //the zero is to indicate an open bolt gun. Barrel is outside of a gun here, so always open.
TRACE_4("updateSpareBarrelsTemperaturesThread2",_barrelMagazineID,_initialTemp,_finalTemp,_barrelMass); TRACE_4("updateSpareBarrelsTemperaturesThread2",_barrelMagazineID,_initialTemp,_finalTemp,_barrelMass);
if (_finalTemp < 5) then { if (_finalTemp <= (ambientTemperature select 0)) then {
// The barrel is cool enough to keep calculating. Remove it from the hash // The barrel is cool enough to finish calculating. Remove it from the hash
GVAR(storedSpareBarrels) deleteAt _x; GVAR(storedSpareBarrels) deleteAt _x;
} else { } else {
// Store the new temp // Store the new temp

View File

@ -33,8 +33,9 @@ _trackedWeapons pushBackUnique _tempVarName;
_unit setVariable [QGVAR(trackedWeapons), _trackedWeapons]; _unit setVariable [QGVAR(trackedWeapons), _trackedWeapons];
// Calculate cooling // Calculate cooling
private _barrelMass = ([_weapon] call FUNC(getWeaponData)) select 7; private _weaponData = [_weapon] call FUNC(getWeaponData);
_temperature = [_temperature, _barrelMass, CBA_missionTime - _lastTime] call FUNC(calculateCooling); private _barrelMass = _weaponData select 7;
_temperature = [_temperature, _barrelMass, CBA_missionTime - _lastTime, _weaponData select 6] call FUNC(calculateCooling);
TRACE_1("cooledTo",_temperature); TRACE_1("cooledTo",_temperature);
// Calculate heating // Calculate heating

View File

@ -19,6 +19,7 @@
#define TEMP_TOLERANCE 50 #define TEMP_TOLERANCE 50
#define METAL_MASS_RATIO 0.55 #define METAL_MASS_RATIO 0.55
#define GUNPOWDER_IGNITION_TEMP 180 #define GUNPOWDER_IGNITION_TEMP 180
#define OPEN_BOLT_ADDITIONAL_CONVECTION 1.1
#ifdef DEBUG_MODE_FULL #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); #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);