Skip to content

Commit

Permalink
Merge branch 'master' into gradual-ammo-cookoff
Browse files Browse the repository at this point in the history
  • Loading branch information
johnb432 committed Nov 3, 2024
2 parents 540ed27 + b153310 commit db4a1d0
Show file tree
Hide file tree
Showing 41 changed files with 656 additions and 292 deletions.
6 changes: 6 additions & 0 deletions addons/arsenal/CfgWeapons.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ class CfgWeapons {
class ToolKit: ItemCore {
ACE_isTool = 1; // sort in Tools Tab
};

class ChemicalDetector_01_base_F: ItemCore {
ACE_asItem = 1;
ACE_isTool = 1; // sort in Tools Tab
};

class DetectorCore;
class MineDetector: DetectorCore {
ACE_isTool = 1; // sort in Tools Tab
Expand Down
1 change: 1 addition & 0 deletions addons/arsenal/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ PREP(handleSearchInputChanged);
PREP(handleSearchModeToggle);
PREP(handleStats);
PREP(initBox);
PREP(isMiscItem);
PREP(itemInfo);
PREP(loadoutsChangeTab);
PREP(message);
Expand Down
1 change: 1 addition & 0 deletions addons/arsenal/XEH_preStart.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ uiNamespace setVariable [QGVAR(baseWeaponNameCache), createHashMap];
uiNamespace setVariable [QGVAR(addListBoxItemCache), createHashMap];
uiNamespace setVariable [QGVAR(rightPanelCache), createHashMap];
uiNamespace setVariable [QGVAR(sortCache), createHashMap];
uiNamespace setVariable [QGVAR(isMiscItemCache), createHashMap];

call FUNC(scanConfig);
17 changes: 3 additions & 14 deletions addons/arsenal/functions/fnc_addRightPanelButton.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,9 @@ if (!isNil "_currentButtonInPosition") then {
};

// If spot found, add items and return position
private _cfgWeapons = configFile >> "CfgWeapons";
private _cfgMagazines = configFile >> "CfgMagazines";
private _configItemInfo = "";
// Sanitize to configCase and drop anything that's not a misc item
_items = _items apply {_x call EFUNC(common,getConfigName)} select {_x call FUNC(isMiscItem)};

_items = _items select {
_configItemInfo = _cfgWeapons >> _x >> "ItemInfo";

_x isKindOf ["CBA_MiscItem", _cfgWeapons] && {getNumber (_configItemInfo >> "type") in [TYPE_MUZZLE, TYPE_OPTICS, TYPE_FLASHLIGHT, TYPE_BIPOD]} ||
{getNumber (_configItemInfo >> "type") in [TYPE_FIRST_AID_KIT, TYPE_MEDIKIT, TYPE_TOOLKIT]} ||
{getText (_cfgWeapons >> _x >> "simulation") == "ItemMineDetector"} ||
{getNumber (_cfgMagazines >> _x >> "ACE_isUnique") == 1} ||
{getNumber (_cfgMagazines >> _x >> "ACE_asItem") == 1}
};

GVAR(customRightPanelButtons) set [_position, [_items apply {_x call EFUNC(common,getConfigName)}, _picture, _tooltip, _moveOnOverwrite]];
GVAR(customRightPanelButtons) set [_position, [_items, _picture, _tooltip, _moveOnOverwrite]];

_position
54 changes: 54 additions & 0 deletions addons/arsenal/functions/fnc_isMiscItem.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#include "..\script_component.hpp"
/*
* Author: DartRuffian, LinkIsGrim
* Determines if a class is a miscellaneous item or not.
*
* Arguments:
* 0: Item or magazine <STRING>
* 1: Item config <CONFIG> (default: nil)
* 2: Whether item is a magazine <BOOL> (default: false)
* 3: Skip setting false keys in the cache, mostly used for building it during preStart <BOOL> (default: false)
*
* Return Value:
* True if class is a misc item, otherwise false <BOOL>
*
* Example:
* "ACE_CableTie" call ace_arsenal_fnc_isMiscItem
*
* Public: No
*/

params ["_item", "_config", ["_isMag", false], ["_skipFalseKeys", false]];
TRACE_4("",_item,_config,_isMag,_skipFalseKeys);

private _cache = uiNamespace getVariable QGVAR(isMiscItemCache);
private _return = _cache get _item;

// Don't replace with getOrDefaultCall, we want the key to only be set if return is true or _skipFalseKeys is false
if (isNil "_return") then {
private _fnc_hasProperty = {getNumber (_config >> "ACE_asItem") == 1 || {getNumber (_config >> "ACE_isUnique") == 1}};

_return = switch (true) do {
case (_item isKindOf ["CBA_MiscItem", configFile >> "CfgWeapons"]): {true}; // CBA misc item, easy

if (isNil "_config") then {
_config = _item call CBA_fnc_getItemConfig;
};

case (_isMag): _fnc_hasProperty; // Magazine misc item, also easy

private _itemType = getNumber (_config >> "ItemInfo" >> "type");

case (_itemType in [TYPE_FIRST_AID_KIT, TYPE_MEDIKIT, TYPE_TOOLKIT]): {true}; // Special items: Med/Toolkits
case (_itemType in [TYPE_MUZZLE, TYPE_OPTICS, TYPE_FLASHLIGHT, TYPE_BIPOD]): _fnc_hasProperty; // "Forced" misc items
case ((getText (configFile >> "CfgWeapons" >> _item >> "simulation")) == "ItemMineDetector"): {true}; // Special items: mine detectors

default {false}
};

if (_return || !_skipFalseKeys) then {
_cache set [_item, _return];
};
};

_return
16 changes: 7 additions & 9 deletions addons/arsenal/functions/fnc_scanConfig.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private _isTool = false;
_configItemInfo = _x >> "ItemInfo";
_hasItemInfo = isClass (_configItemInfo);
_itemInfoType = if (_hasItemInfo) then {getNumber (_configItemInfo >> "type")} else {0};
_isMiscItem = _className isKindOf ["CBA_MiscItem", _cfgWeapons];
_isMiscItem = [_className, _x, false, true] call FUNC(isMiscItem);
_isTool = getNumber (_x >> "ACE_isTool") isEqualTo 1;

switch (true) do {
Expand Down Expand Up @@ -127,13 +127,7 @@ private _isTool = false;
};
};
// Misc. items
case (
_hasItemInfo &&
{_isMiscItem &&
{_itemInfoType in [TYPE_OPTICS, TYPE_FLASHLIGHT, TYPE_MUZZLE, TYPE_BIPOD]}} ||
{_itemInfoType in [TYPE_FIRST_AID_KIT, TYPE_MEDIKIT, TYPE_TOOLKIT]} ||
{_simulationType == "ItemMineDetector"}
): {
case (_hasItemInfo && _isMiscItem): {
(_configItems get IDX_VIRT_MISC_ITEMS) set [_className, nil];
if (_isTool) then {_toolList set [_className, nil]};
};
Expand All @@ -160,7 +154,11 @@ private _magazineMiscItems = createHashMap;

{
_magazineMiscItems set [configName _x, nil];
} forEach ((toString {getNumber (_x >> "ACE_isUnique") == 1 || getNumber (_x >> "ACE_asItem") == 1}) configClasses _cfgMagazines);
} forEach ((toString {
with uiNamespace do { // configClasses runs in missionNamespace even if we're in preStart apparently
[configName _x, _x, true, true] call FUNC(isMiscItem);
};
}) configClasses _cfgMagazines);

// Remove invalid/non-existent entries
_grenadeList deleteAt "";
Expand Down
9 changes: 2 additions & 7 deletions addons/arsenal/functions/fnc_updateUniqueItemsList.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ private _attachments = GVAR(virtualItems) get IDX_VIRT_ATTACHMENTS;
_configItemInfo = _config >> "ItemInfo";
_hasItemInfo = isClass (_configItemInfo);
_itemInfoType = if (_hasItemInfo) then {getNumber (_configItemInfo >> "type")} else {0};
_isMiscItem = _x isKindOf ["CBA_MiscItem", _cfgWeapons];
_isMiscItem = _x call FUNC(isMiscItem);

_baseWeapon = if (!_isMiscItem) then {
_x call FUNC(baseWeapon)
Expand Down Expand Up @@ -263,12 +263,7 @@ private _attachments = GVAR(virtualItems) get IDX_VIRT_ATTACHMENTS;
// Misc. items
case (
!(_x in (GVAR(virtualItems) get IDX_VIRT_MISC_ITEMS)) && // misc. items don't use 'baseWeapon'
{_x in (_configItems get IDX_VIRT_MISC_ITEMS) ||
{_hasItemInfo &&
{_isMiscItem &&
{_itemInfoType in [TYPE_OPTICS, TYPE_FLASHLIGHT, TYPE_MUZZLE, TYPE_BIPOD]}} ||
{_itemInfoType in [TYPE_FIRST_AID_KIT, TYPE_MEDIKIT, TYPE_TOOLKIT]} ||
{_simulationType == "ItemMineDetector"}}}
{_x in (_configItems get IDX_VIRT_MISC_ITEMS) || {_hasItemInfo && _isMiscItem}}
): {
(GVAR(virtualItems) get IDX_VIRT_UNIQUE_MISC_ITEMS) set [_x, nil];
};
Expand Down
1 change: 1 addition & 0 deletions addons/cargo/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@
<Korean>화물 크기 확인</Korean>
<Japanese>貨物としての大きさを確認</Japanese>
<Russian>Проверить размер груза</Russian>
<French>Vérifier la taille de la cargaison</French>
</Key>
<Key ID="STR_ACE_Cargo_SizeMenu">
<English>Cargo Size: %1</English>
Expand Down
35 changes: 32 additions & 3 deletions addons/common/functions/fnc_checkVersionNumber.sqf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "..\script_component.hpp"
/*
* Author: commy2, johnb43
* Author: commy2, johnb43, Timi007
* Compares version numbers from loaded addons.
*
* Arguments:
Expand Down Expand Up @@ -32,8 +32,37 @@ private _cfgPatches = configFile >> "CfgPatches";
private _versions = [];

{
(getText (_cfgPatches >> _x >> "version") splitString ".") params [["_major", "0"], ["_minor", "0"]];
private _version = parseNumber _major + parseNumber _minor / 100;
// Determine the version of the addon. Parse it into a floating point number for comparison. Only major and minor are used.
// If no version is found or a parsing error occurs, the version is zero.
private _addonCfgPatches = _cfgPatches >> _x;
private _versionCfg = _addonCfgPatches >> "version";
private _version = switch (true) do {
// Normal case. Version is defined as a floating point number -> MAJOR.MINOR
case (isNumber _versionCfg): {
getNumber _versionCfg
};
// Addon Builder converts the version into a string if it is an invalid float -> "MAJOR.MINOR.PATCH"
case (isText _versionCfg): {
(getText _versionCfg splitString ".") params [["_major", "0"], ["_minor", "0"]];

parseNumber _major + parseNumber _minor / 100
};
// Fallback 1 (maybe versionAr is defined)
case (isArray (_addonCfgPatches >> "versionAr")): {
(getArray (_addonCfgPatches >> "versionAr")) params [["_major", 0], ["_minor", 0]];

_major + _minor / 100
};
// Fallback 2 (maybe versionStr is defined)
case (isText (_addonCfgPatches >> "versionStr")): {
(getText (_addonCfgPatches >> "versionStr") splitString ".") params [["_major", "0"], ["_minor", "0"]];

parseNumber _major + parseNumber _minor / 100
};
// No version found
default { 0 };
};

_versions pushBack _version;
} forEach _files;

Expand Down
6 changes: 5 additions & 1 deletion addons/dragging/functions/fnc_canCarry.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ params ["_unit", "_target"];
private _alive = alive _target;
private _isPerson = _target isKindOf "CAManBase";

if !((_alive || _isPerson) && {_target getVariable [QGVAR(canCarry), false]} && {isNull objectParent _target}) exitWith {false};
if !(
(_alive || _isPerson)
&& {_target getVariable [QGVAR(canCarry), false]}
&& {isNull objectParent _target || {!isNull getCorpse _target}}
) exitWith {false};

if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false};

Expand Down
132 changes: 69 additions & 63 deletions addons/fastroping/CfgVehicles.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,68 @@
#define MACRO_FRIES_SELFACTIONS \
class ACE_SelfActions { \
class ACE_prepareFRIES { \
displayName = CSTRING(Interaction_prepareFRIES); \
condition = QUOTE([_target] call FUNC(canPrepareFRIES)); \
statement = QUOTE([_target] call FUNC(prepareFRIES)); \
}; \
class ACE_stowFRIES { \
displayName = CSTRING(Interaction_stowFRIES); \
condition = QUOTE([_target] call FUNC(canStowFRIES)); \
statement = QUOTE([_target] call FUNC(stowFRIES)); \
}; \
class ACE_deployRopes3 { \
displayName = CSTRING(Interaction_deployRopes3); \
condition = QUOTE([ARR_3(_target,_player,'ACE_rope3')] call FUNC(canDeployRopes)); \
statement = QUOTE([ARR_2(QQGVAR(deployRopes),[ARR_3(_target,_player,'ACE_rope3')])] call CBA_fnc_serverEvent); \
}; \
class ACE_deployRopes6 { \
displayName = CSTRING(Interaction_deployRopes6); \
condition = QUOTE([ARR_3(_target,_player,'ACE_rope6')] call FUNC(canDeployRopes)); \
statement = QUOTE([ARR_2(QQGVAR(deployRopes),[ARR_3(_target,_player,'ACE_rope6')])] call CBA_fnc_serverEvent); \
}; \
class ACE_deployRopes12 { \
displayName = CSTRING(Interaction_deployRopes12); \
condition = QUOTE([ARR_3(_target,_player,'ACE_rope12')] call FUNC(canDeployRopes)); \
statement = QUOTE([ARR_2(QQGVAR(deployRopes),[ARR_3(_target,_player,'ACE_rope12')])] call CBA_fnc_serverEvent); \
}; \
class ACE_deployRopes15 { \
displayName = CSTRING(Interaction_deployRopes15); \
condition = QUOTE([ARR_3(_target,_player,'ACE_rope15')] call FUNC(canDeployRopes)); \
statement = QUOTE([ARR_2(QQGVAR(deployRopes),[ARR_3(_target,_player,'ACE_rope15')])] call CBA_fnc_serverEvent); \
}; \
class ACE_deployRopes18 { \
displayName = CSTRING(Interaction_deployRopes18); \
condition = QUOTE([ARR_3(_target,_player,'ACE_rope18')] call FUNC(canDeployRopes)); \
statement = QUOTE([ARR_2(QQGVAR(deployRopes),[ARR_3(_target,_player,'ACE_rope18')])] call CBA_fnc_serverEvent); \
}; \
class ACE_deployRopes27 { \
displayName = CSTRING(Interaction_deployRopes27); \
condition = QUOTE([ARR_3(_target,_player,'ACE_rope27')] call FUNC(canDeployRopes)); \
statement = QUOTE([ARR_2(QQGVAR(deployRopes),[ARR_3(_target,_player,'ACE_rope27')])] call CBA_fnc_serverEvent); \
}; \
class ACE_deployRopes36 { \
displayName = CSTRING(Interaction_deployRopes36); \
condition = QUOTE([ARR_4(_target,_player,'ACE_rope36',true)] call FUNC(canDeployRopes)); \
statement = QUOTE([ARR_2(QQGVAR(deployRopes),[ARR_3(_target,_player,'ACE_rope36')])] call CBA_fnc_serverEvent); \
}; \
class ACE_cutRopes { \
displayName = CSTRING(Interaction_cutRopes); \
condition = QUOTE([_target] call FUNC(canCutRopes)); \
statement = QUOTE(true); \
class confirmCutRopes { \
displayName = ECSTRING(common,confirm); \
condition = QUOTE([_target] call FUNC(canCutRopes)); \
statement = QUOTE([_target] call FUNC(cutRopes)); \
}; \
}; \
class ACE_fastRope { \
displayName = CSTRING(Interaction_fastRope); \
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canFastRope)); \
statement = QUOTE([ARR_2(_player,_target)] call FUNC(fastRope)); \
}; \
}


class CfgVehicles {
class Logic;
class Module_F: Logic {
Expand All @@ -24,69 +89,10 @@ class CfgVehicles {

class Air;
class Helicopter: Air {
class ACE_SelfActions {
class ACE_prepareFRIES {
displayName = CSTRING(Interaction_prepareFRIES);
condition = QUOTE([_target] call FUNC(canPrepareFRIES));
statement = QUOTE([_target] call FUNC(prepareFRIES));
};
class ACE_stowFRIES {
displayName = CSTRING(Interaction_stowFRIES);
condition = QUOTE([_target] call FUNC(canStowFRIES));
statement = QUOTE([_target] call FUNC(stowFRIES));
};
class ACE_deployRopes3 {
displayName = CSTRING(Interaction_deployRopes3);
condition = QUOTE([ARR_3(_target,_player,'ACE_rope3')] call FUNC(canDeployRopes));
statement = QUOTE([ARR_2(QQGVAR(deployRopes),[ARR_3(_target,_player,'ACE_rope3')])] call CBA_fnc_serverEvent);
};
class ACE_deployRopes6 {
displayName = CSTRING(Interaction_deployRopes6);
condition = QUOTE([ARR_3(_target,_player,'ACE_rope6')] call FUNC(canDeployRopes));
statement = QUOTE([ARR_2(QQGVAR(deployRopes),[ARR_3(_target,_player,'ACE_rope6')])] call CBA_fnc_serverEvent);
};
class ACE_deployRopes12 {
displayName = CSTRING(Interaction_deployRopes12);
condition = QUOTE([ARR_3(_target,_player,'ACE_rope12')] call FUNC(canDeployRopes));
statement = QUOTE([ARR_2(QQGVAR(deployRopes),[ARR_3(_target,_player,'ACE_rope12')])] call CBA_fnc_serverEvent);
};
class ACE_deployRopes15 {
displayName = CSTRING(Interaction_deployRopes15);
condition = QUOTE([ARR_3(_target,_player,'ACE_rope15')] call FUNC(canDeployRopes));
statement = QUOTE([ARR_2(QQGVAR(deployRopes),[ARR_3(_target,_player,'ACE_rope15')])] call CBA_fnc_serverEvent);
};
class ACE_deployRopes18 {
displayName = CSTRING(Interaction_deployRopes18);
condition = QUOTE([ARR_3(_target,_player,'ACE_rope18')] call FUNC(canDeployRopes));
statement = QUOTE([ARR_2(QQGVAR(deployRopes),[ARR_3(_target,_player,'ACE_rope18')])] call CBA_fnc_serverEvent);
};
class ACE_deployRopes27 {
displayName = CSTRING(Interaction_deployRopes27);
condition = QUOTE([ARR_3(_target,_player,'ACE_rope27')] call FUNC(canDeployRopes));
statement = QUOTE([ARR_2(QQGVAR(deployRopes),[ARR_3(_target,_player,'ACE_rope27')])] call CBA_fnc_serverEvent);
};
class ACE_deployRopes36 {
displayName = CSTRING(Interaction_deployRopes36);
condition = QUOTE([ARR_4(_target,_player,'ACE_rope36',true)] call FUNC(canDeployRopes));
statement = QUOTE([ARR_2(QQGVAR(deployRopes),[ARR_3(_target,_player,'ACE_rope36')])] call CBA_fnc_serverEvent);
};
class ACE_cutRopes {
displayName = CSTRING(Interaction_cutRopes);
condition = QUOTE([_target] call FUNC(canCutRopes));
// should not be empty to work with EGVAR(interact_menu,consolidateSingleChild) setting
statement = QUOTE(true);
class confirmCutRopes {
displayName = ECSTRING(common,confirm);
condition = QUOTE([_target] call FUNC(canCutRopes));
statement = QUOTE([_target] call FUNC(cutRopes));
};
};
class ACE_fastRope {
displayName = CSTRING(Interaction_fastRope);
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canFastRope));
statement = QUOTE([ARR_2(_player,_target)] call FUNC(fastRope));
};
};
MACRO_FRIES_SELFACTIONS;
};
class Plane: Air {
MACRO_FRIES_SELFACTIONS;
};

class Helicopter_Base_F;
Expand Down
4 changes: 2 additions & 2 deletions addons/fastroping/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@


if (isServer) then {
["Helicopter", "init", {
["Air", "init", {
if (!GVAR(autoAddFRIES)) exitWith {};
params ["_vehicle"];
if (isNumber (configOf _vehicle >> QGVAR(enabled)) && {isNil {_vehicle getVariable [QGVAR(FRIES), nil]}}) then {
Expand All @@ -51,7 +51,7 @@ if (isServer) then {

#ifdef DRAW_FASTROPE_INFO
addMissionEventHandler ["Draw3D", {
if !(cursorObject isKindOf "Helicopter") exitWith {};
if !(cursorObject isKindOf "Air") exitWith {};
private _config = configOf cursorObject;
private _enabled = getNumber (_config >> QGVAR(enabled));
drawIcon3D ["", [.5,.5,1,1], (ASLToAGL getPosASL cursorObject), 0.5, 0.5, 0, format ["%1 = %2", typeOf cursorObject, _enabled], 0.5, 0.025, "TahomaB"];
Expand Down
Loading

0 comments on commit db4a1d0

Please sign in to comment.