Overheating - Fix errors, improve documentation, change AceX references for integration (#8522)

* Fix jam script error, improve documentation

* formatting

* Update docs/wiki/feature/overheating.md

Co-authored-by: GhostIsSpooky <69561145+Salluci@users.noreply.github.com>

* Update docs/wiki/feature/overheating.md

Co-authored-by: GhostIsSpooky <69561145+Salluci@users.noreply.github.com>

* fix icon filepath for AceX integration

* Apply suggestions from code review

Co-authored-by: PabstMirror <pabstmirror@gmail.com>

* Update addons/overheating/XEH_postInit.sqf

Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com>

* move old AceX references to macros

* small whitespace formatting

Co-authored-by: GhostIsSpooky <69561145+Salluci@users.noreply.github.com>
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com>
This commit is contained in:
Drofseh 2021-10-17 15:00:16 -07:00 committed by GitHub
parent 37c16afe9c
commit eadbc60314
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 31 additions and 24 deletions

View File

@ -38,7 +38,7 @@ class CfgVehicles {
};
class GVAR(CoolWeaponWithItem) {
displayName = CSTRING(CoolWeaponWithItem);
condition = QUOTE(GVAR(enabled) && {isClass(configfile >> 'CfgPatches' >> 'acex_field_rations')});
condition = QUOTE(GVAR(enabled) && {isClass (configfile >> 'CfgPatches' >> 'acex_field_rations')});
exceptions[] = {"isNotInside", "isNotSwimming", "isNotSitting"};
statement = "true";
showDisabled = 0;
@ -66,7 +66,7 @@ class CfgVehicles {
};
class GVAR(CoolWeaponWithItem) {
displayName = CSTRING(CoolWeaponWithItem);
condition = QUOTE(GVAR(enabled) && {isClass(configfile >> 'CfgPatches' >> 'acex_field_rations')});
condition = QUOTE(GVAR(enabled) && {isClass (configfile >> 'CfgPatches' >> 'acex_field_rations')});
exceptions[] = {"isNotInside", "isNotSwimming", "isNotSitting"};
statement = "true";
showDisabled = 0;

View File

@ -82,27 +82,27 @@ if (hasInterface) then {
[QGVAR(initiateSwapBarrelAssisted), DFUNC(swapBarrel)] call CBA_fnc_addEventHandler;
// Add an action to allow hot weapons to be cooled off in AceX Field Rations water sources
if (isClass(configfile >> "CfgPatches" >> "acex_field_rations")) then {
if (isClass (configfile >> "CfgPatches" >> "acex_field_rations")) then {
[
{acex_field_rations_enabled || CBA_missionTime > 1},
{EXGVAR(field_rations,enabled) || CBA_missionTime > 1},
{
if (!acex_field_rations_enabled) exitWith {};
if (!EXGVAR(field_rations,enabled)) exitWith {};
_CoolWeaponWithWaterSourceAction = [
QGVAR(CoolWeaponWithWaterSource),
LLSTRING(CoolWeaponWithWaterSource),
"\z\acex\addons\field_rations\ui\icon_water_tap.paa",
QPATHTOEF(field_rations,ui\icon_water_tap.paa),
{
private _waterSource = _target getVariable ["acex_field_rations_waterSource", objNull];
private _waterSource = _target getVariable [QEXGVAR(field_rations,waterSource), objNull];
[_player, _waterSource] call FUNC(coolWeaponWithWaterSource);
},
{
private _waterSource = _target getVariable ["acex_field_rations_waterSource", objNull];
private _waterSource = _target getVariable [QEXGVAR(field_rations,waterSource), objNull];
[_player, _waterSource] call acex_field_rations_fnc_canDrinkFromSource;
}
] call EFUNC(interact_menu,createAction);
["acex_field_rations_helper", 0, ["acex_field_rations_waterSource"], _CoolWeaponWithWaterSourceAction] call EFUNC(interact_menu,addActionToClass);
[QEGVAR(field_rations,helper), 0, [QGVAR(field_rations,waterSource)], _CoolWeaponWithWaterSourceAction] call EFUNC(interact_menu,addActionToClass);
},
[]
] call CBA_fnc_waitUntilAndExecute;

View File

@ -25,8 +25,8 @@ private _config = configFile >> "CfgWeapons" >> _item;
private _weapon = currentWeapon _target;
private _tempVarName = format [QGVAR(%1_temp), _weapon];
private _temperature = _target getVariable [_tempVarName, 0];
private _replacementItem = getText (_config >> "acex_field_rations_replacementItem");
private _liquidAmount = getNumber (_config >> "acex_field_rations_thirstQuenched");
private _replacementItem = getText (_config >> QEXGVAR(field_rations,replacementItem));
private _liquidAmount = getNumber (_config >> QEXGVAR(field_rations,thirstQuenched));
private _consumeText = format [LLSTRING(CoolingWeaponWithItem), getText (configFile >> "CfgWeapons" >> _weapon >> "displayName"), getText (_config >> "displayName")];
/* // to be added when licence compatible audio can be found or recorded

View File

@ -28,7 +28,7 @@ private _fnc_onFinish = {
params ["_args"];
_args params ["_player", "_target", "_weapon", "_tempVarName"];
private _water = _target call acex_field_rations_fnc_getRemainingWater;
private _water = _target call EFUNC(field_rations,getRemainingWater);
if (_water <= 0 && {_water != -10}) exitWith {
[
@ -46,7 +46,7 @@ private _fnc_condition = {
_args params ["_player", "_target", "_weapon", "_tempVarName"];
private _temperature = _player getVariable [_tempVarName, 0];
private _water = _target call acex_field_rations_fnc_getRemainingWater;
private _water = _target EFUNC(field_rations,getRemainingWater);
if (_water <= 0 && {_water != -10}) exitWith {false};
@ -55,7 +55,7 @@ private _fnc_condition = {
//Remove water from the source, unless it's unlimited
if (_water != -10) then {
[_target, _water - 1] call acex_field_rations_fnc_setRemainingWater;
[_target, _water - 1] call EFUNC(field_rations,setRemainingWater);
};
//Cool the weapon down

View File

@ -25,7 +25,7 @@ private _fnc_getActions = {
{
private _config = _cfgWeapons >> _x;
if (getNumber (_config >> "acex_field_rations_thirstQuenched") > 0) then {
if (getNumber (_config >> QEXGVAR(field_rations,thirstQuenched)) > 0) then {
private _displayName = getText (_config >> "displayName");
private _picture = getText (_config >> "picture");

View File

@ -32,9 +32,9 @@ _unit setVariable [QGVAR(jammedWeapons), _jammedWeapons];
// Cookoffs only happen on Fire and Dud, dud rounds are lost on jam clear.
// Reduce chance of duds as temp increases (functionally increasing the chance of the others but with fewer commands)
private _temp = 1 max (_unit getVariable [format [QGVAR(%1_temp), _weapon], 0]);
private _jamTypesAllowed = getArray (configFile >> 'CfgWeapons' >> currentWeapon _player >> QGVAR(jamTypesAllowed));
private _jamTypesAllowed = getArray (configFile >> 'CfgWeapons' >> currentWeapon _unit >> QGVAR(jamTypesAllowed));
if (_jamTypesAllowed == []) then {
if (_jamTypesAllowed isEqualTo []) then {
_jamTypesAllowed = ["Eject", 1, "Extract", 1, "Feed", 1, "Fire", 1, "Dud", (5 / (_temp / 5))];
} else {
for "_i" from count _jamTypesAllowed to 1 step -1 do {

View File

@ -16,7 +16,7 @@ version:
### 1.1 Weapon Jamming
Adds a probability to jam a weapon when firing. Jams can be cleared by reloading, using the clear jam-key, or using the self interaction menu.
Adds a probability to jam a weapon when firing. The hotter a weapon gets, the more likely a jam is to occur.
### 1.2 Temperature simulation
@ -28,13 +28,17 @@ Hot weapons can also cause chambered ammunition to spontaneously ignite. The hig
### 1.4 Spare barrels
Adds the ability to changes barrels on machine guns to compensate for those effects. Changing the barrel can also unjam the gun.
Adds the ability to change barrels on machine guns to compensate for those effects. When a barrel is changed, the coolest barrel available is always selected.
## 2. Usage
### 2.1 Clearing a jammed weapon
- To clear a jammed weapon, press <kbd>SHIFT</kbd> + <kbd>R</kbd> (ACE3 default key bind `Clear jam`).
Jams can be cleared in the following ways:
- Press <kbd>SHIFT</kbd> + <kbd>R</kbd> (ACE3 default key bind `Clear jam`).
- Press self interaction <kbd>Ctrl</kbd> + <kbd>&nbsp;Win</kbd> (ACE3 default key bind `Self Interaction Key`), select `Equipment`, select 'Clear Jam'
- Reload (setting dependant)
- Swap barrels (setting dependant)
### 2.2 Swapping barrels

View File

@ -18,11 +18,13 @@ version:
```cpp
class CfgWeapons {
class MyMG {
class Rifle_Long_Base_F ;
class MyMG : Rifle_Long_Base_F {
ace_overheating_mrbs = 3000; //Mean Rounds Between Stoppages (this will be scaled based on the barrel temp)
ace_overheating_slowdownFactor = 1; //Slowdown Factor (this will be scaled based on the barrel temp)
ace_overheating_slowdownFactor = 1; //Slowdown Factor, reduces the velocity of the projectile (this will be scaled based on the barrel temp)
ace_overheating_allowSwapBarrel = 1; // 1 to enable barrel swap. 0 to disable. Meant for machine guns where you can easily swap the barrel without dismantling the whole weapon.
ace_overheating_dispersion = 0.75; //Dispersion Factor (this will be scaled based on the barrel temp)
ace_overheating_dispersion = 0.75; //Dispersion Factor, increases the dispersion of the projectile (this will be scaled based on the barrel temp)
};
};
```
@ -33,8 +35,9 @@ class CfgWeapons {
class CfgWeapons {
class Pistol_Base_F;
class MyRevolver: Pistol_Base_F {
ace_overheating_jamTypesAllowed = ["Fire","Dud"]; //Allowed and default values are ["Eject", "Extract", "Feed", "Fire", "Dud"]. In the example here a revolver does not eject, extract, or feed on each shot to those values are removed.
ace_overheating_jamTypesAllowed = ["Fire","Dud"]; //Allowed and default values are ["Eject", "Extract", "Feed", "Fire", "Dud"]. In the example here a revolver does not eject, extract, or feed on each shot so those values are removed.
};
};
```
### 1.3 Custom jam clearing animation