Skip to content

Commit

Permalink
Common - Make FUNC(isModLoaded) case-insensitive (#9704)
Browse files Browse the repository at this point in the history
* Update fnc_isModLoaded.sqf

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

* Update fnc_isModLoaded.sqf

---------

Co-authored-by: LinkIsGrim <salluci.lovi@gmail.com>
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
  • Loading branch information
3 people committed Jan 1, 2024
1 parent f063c44 commit 8ca5263
Show file tree
Hide file tree
Showing 15 changed files with 21 additions and 28 deletions.
4 changes: 2 additions & 2 deletions addons/advanced_fatigue/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ if (!hasInterface) exitWith {};
}, true] call CBA_fnc_addPlayerEventHandler;

// - Duty factors -------------------------------------------------------------
if (["ACE_Medical"] call EFUNC(common,isModLoaded)) then {
if (["ace_medical"] call EFUNC(common,isModLoaded)) then {
[QEGVAR(medical,pain), { // 0->1.0, 0.5->1.05, 1->1.1
linearConversion [0, 1, (_this getVariable [QEGVAR(medical,pain), 0]), 1, 1.1, true];
}] call FUNC(addDutyFactor);
[QEGVAR(medical,bloodVolume), { // 6->1.0, 5->1.167, 4->1.33
linearConversion [6, 0, (_this getVariable [QEGVAR(medical,bloodVolume), 6]), 1, 2, true];
}] call FUNC(addDutyFactor);
};
if (["ACE_Dragging"] call EFUNC(common,isModLoaded)) then {
if (["ace_dragging"] call EFUNC(common,isModLoaded)) then {
[QEGVAR(dragging,isCarrying), {
[1, 3] select (_this getVariable [QEGVAR(dragging,isCarrying), false]);
}] call FUNC(addDutyFactor);
Expand Down
15 changes: 4 additions & 11 deletions addons/common/functions/fnc_isModLoaded.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,17 @@
* Check in CfgPatches if modification is loaded
*
* Arguments:
* 0: Mod Name or Classname of the mod in CfgPatches <STRING>
* 0: Classname of the mod in CfgPatches <STRING>
*
* Return Value:
* if modification is loaded <BOOL>
* If modification is loaded <BOOL>
*
* Example:
* ["class"] call ace_common_fnc_isModLoaded
* "class" call ace_common_fnc_isModLoaded
*
* Public: Yes
*/

params [["_modName", "", [""]]];

private _return = GVAR(isModLoadedCache) get _modName;

if (isNil "_return") then {
_return = isClass (configFile >> "CfgPatches" >> _modName);
GVAR(isModLoadedCache) set [_modName, _return];
};

_return
GVAR(isModLoadedCache) getOrDefaultCall [toLowerANSI _modName, {isClass (configFile >> "CfgPatches" >> _modName)}, true]
2 changes: 1 addition & 1 deletion addons/compat_sog/functions/fnc_handlePunjiTrapTrigger.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* Public: No
*/
params ["_trap"];
if (!(["ACE_Medical"] call EFUNC(common,isModLoaded))) exitWith {};
if (!(["ace_medical"] call EFUNC(common,isModLoaded))) exitWith {};

private _radius = getNumber (configOf _trap >> "indirectHitRange");
private _affectedUnits = _trap nearEntities ["CAManBase", _radius];
Expand Down
2 changes: 1 addition & 1 deletion addons/csw/functions/fnc_assemble_deployTripod.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
[_player, "PutDown"] call EFUNC(common,doGesture);

// drag after deploying
if ((missionNamespace getVariable [QGVAR(dragAfterDeploy), false]) && {["ACE_dragging"] call EFUNC(common,isModLoaded)}) then {
if ((missionNamespace getVariable [QGVAR(dragAfterDeploy), false]) && {["ace_dragging"] call EFUNC(common,isModLoaded)}) then {
if ([_player, _cswTripod] call EFUNC(dragging,canCarry)) then {
TRACE_1("starting carry",_cswTripod);
[_player, _cswTripod] call EFUNC(dragging,startCarry);
Expand Down
2 changes: 1 addition & 1 deletion addons/csw/functions/fnc_staticWeaponInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ if (hasInterface && {!(_typeOf in GVAR(initializedStaticTypes))}) then {
_ammoActionPath = [_typeOf, 0, ["ACE_MainActions"], _ammoAction] call EFUNC(interact_menu,addActionToClass);
};

if (["ACE_reload"] call EFUNC(common,isModLoaded)) then {
if (["ace_reload"] call EFUNC(common,isModLoaded)) then {
// move reload's check ammo action to the ammo handling point (remove and re-add)
[_typeOf, 0, ["ACE_MainActions", QEGVAR(reload,CheckAmmo)]] call EFUNC(interact_menu,removeActionFromClass);
private _checkAmmoAction = [QGVAR(checkAmmo), localize ELSTRING(reload,checkAmmo), "", EFUNC(reload,checkAmmo), EFUNC(reload,canCheckAmmo)] call EFUNC(interact_menu,createAction);
Expand Down
4 changes: 2 additions & 2 deletions addons/dogtags/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// Add actions and event handlers only if ace_medical is loaded
// - Adding actions via config would create a dependency
if (["ACE_Medical"] call EFUNC(common,isModLoaded)) then {
if (["ace_medical"] call EFUNC(common,isModLoaded)) then {
if (hasInterface) then {
private _checkTagAction = [
"ACE_CheckDogtag",
Expand Down Expand Up @@ -47,7 +47,7 @@ if (["ACE_Medical"] call EFUNC(common,isModLoaded)) then {
};

// If the arsenal is loaded, show the custom names for dog tags when in the arsenal
if (["ACE_Arsenal"] call EFUNC(common,isModLoaded)) then {
if (["ace_arsenal"] call EFUNC(common,isModLoaded)) then {
[QEGVAR(arsenal,rightPanelFilled), {
params ["_display", "_leftPanelIDC", "_rightPanelIDC"];

Expand Down
2 changes: 1 addition & 1 deletion addons/gforces/functions/fnc_pfhUpdateGForces.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private _suitCoef = if ((uniform ACE_player) != "") then {
private _gBlackOut = MAXVIRTUALG / _classCoef + MAXVIRTUALG / _suitCoef - MAXVIRTUALG;

// Unconsciousness
if ((_average > _gBlackOut) && {["ACE_Medical"] call EFUNC(common,isModLoaded) && {!(ACE_player getVariable ["ACE_isUnconscious", false])}}) then {
if ((_average > _gBlackOut) && {["ace_medical"] call EFUNC(common,isModLoaded) && {!(ACE_player getVariable ["ACE_isUnconscious", false])}}) then {
[ACE_player, true, (10 + floor(random 5)), true] call EFUNC(medical,setUnconscious);
};

Expand Down
4 changes: 2 additions & 2 deletions addons/grenades/functions/fnc_flashbangExplosionEH.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ if (hasInterface && {!isNull ACE_player} && {alive ACE_player}) then {
_strength = _strength * _losCoefficient;

// Add ace_hearing ear ringing sound effect
if (["ACE_Hearing"] call EFUNC(common,isModLoaded) && {_strength > 0 && {EGVAR(hearing,damageCoefficent) > 0.25}}) then {
if (["ace_hearing"] call EFUNC(common,isModLoaded) && {_strength > 0 && {EGVAR(hearing,damageCoefficent) > 0.25}}) then {
private _earringingStrength = 40 * _strength;
[_earringingStrength] call EFUNC(hearing,earRinging);
TRACE_1("Earringing Strength",_earringingStrength);
};

// add ace_medical pain effect:
if (["ACE_Medical"] call EFUNC(common,isModLoaded) && {_strength > 0.1}) then {
if (["ace_medical"] call EFUNC(common,isModLoaded) && {_strength > 0.1}) then {
[ACE_player, _strength / 2] call EFUNC(medical,adjustPainLevel);
};

Expand Down
2 changes: 1 addition & 1 deletion addons/killtracker/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
if ((getText (missionconfigfile >> "CfgDebriefingSections" >> QUOTE(XADDON) >> "variable")) != QXGVAR(outputText)) exitWith {
TRACE_1("no mission debriefing config",_this);
};
if (!(["ACE_Medical"] call EFUNC(common,isModLoaded))) exitWith {
if (!(["ace_medical"] call EFUNC(common,isModLoaded))) exitWith {
WARNING("No ACE-Medical");
XGVAR(outputText) = "No ACE-Medical";
};
Expand Down
2 changes: 1 addition & 1 deletion addons/overpressure/functions/fnc_firedEHBB.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ if (_distance < _backblastRange) then {

[_damage * 100] call BIS_fnc_bloodEffect;

if (["ACE_Medical"] call EFUNC(common,isModLoaded)) then {
if (["ace_medical"] call EFUNC(common,isModLoaded)) then {
[_unit, _damage, "body", "backblast", _unit] call EFUNC(medical,addDamageToUnit);
} else {
_unit setDamage (damage _unit + _damage);
Expand Down
2 changes: 1 addition & 1 deletion addons/overpressure/functions/fnc_overpressureDamage.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ TRACE_3("cache",_overpressureAngle,_overpressureRange,_overpressureDamage);
[_damage * 100] call BIS_fnc_bloodEffect;
};

if (["ACE_Medical"] call EFUNC(common,isModLoaded)) then {
if (["ace_medical"] call EFUNC(common,isModLoaded)) then {
[_x, _damage, "body", "backblast", _firer] call EFUNC(medical,addDamageToUnit);
} else {
_x setDamage (damage _x + _damage);
Expand Down
2 changes: 1 addition & 1 deletion addons/zeus/functions/fnc_bi_moduleArsenal.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if (_activated && local _logic) then {
};

if (_error == "") then {
if (["ACE_Arsenal"] call EFUNC(common,isModLoaded)) then {
if (["ace_arsenal"] call EFUNC(common,isModLoaded)) then {
if (!isPlayer _unit || {player == _unit}) then {

[{
Expand Down
2 changes: 1 addition & 1 deletion addons/zeus/functions/fnc_moduleSetMedic.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ params ["_logic"];

if !(local _logic) exitWith {};

if !(["ACE_Medical"] call EFUNC(common,isModLoaded)) then {
if !(["ace_medical"] call EFUNC(common,isModLoaded)) then {
[LSTRING(RequiresAddon)] call FUNC(showMessage);
} else {
private _mouseOver = GETMVAR(bis_fnc_curatorObjectPlaced_mouseOver,[""]);
Expand Down
2 changes: 1 addition & 1 deletion addons/zeus/functions/fnc_moduleSetMedicalFacility.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ params ["_logic"];

if !(local _logic) exitWith {};

if !(["ACE_Medical"] call EFUNC(common,isModLoaded)) then {
if !(["ace_medical"] call EFUNC(common,isModLoaded)) then {
[LSTRING(RequiresAddon)] call FUNC(showMessage);
} else {
private _mouseOver = GETMVAR(bis_fnc_curatorObjectPlaced_mouseOver,[""]);
Expand Down
2 changes: 1 addition & 1 deletion addons/zeus/functions/fnc_moduleSetMedicalVehicle.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ params ["_logic"];

if !(local _logic) exitWith {};

if !(["ACE_Medical"] call EFUNC(common,isModLoaded)) then {
if !(["ace_medical"] call EFUNC(common,isModLoaded)) then {
[LSTRING(RequiresAddon)] call FUNC(showMessage);
} else {
private _mouseOver = GETMVAR(bis_fnc_curatorObjectPlaced_mouseOver,[""]);
Expand Down

0 comments on commit 8ca5263

Please sign in to comment.