mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Fix some item type magic numbers (#6487)
* Fix item type magic numbers * Add weapon and magazine macros
This commit is contained in:
parent
364f84d382
commit
0e980907fe
@ -33,9 +33,7 @@ for "_i" from 0 to (count _cfgWeapons)-1 do {
|
||||
if (isClass _weaponConfig) then {
|
||||
private _weapon = configName _weaponConfig;
|
||||
private _weaponType = getNumber (_weaponConfig >> "Type");
|
||||
if (_weaponType in [1, 2]) then {
|
||||
// The weapon is a primary weapon or a handgun weapon
|
||||
|
||||
if (_weaponType in [TYPE_WEAPON_PRIMARY, TYPE_WEAPON_HANDGUN]) then {
|
||||
private _weaponInitSpeed = getNumber (_weaponConfig >> "initSpeed");
|
||||
private _magazines = getArray (_weaponConfig >> "magazines");
|
||||
{
|
||||
|
@ -81,37 +81,37 @@ if (_items isEqualType true) then {
|
||||
/* Weapon acc */
|
||||
case (
|
||||
isClass (_configItemInfo) &&
|
||||
{(getNumber (_configItemInfo >> "type")) in [101, 201, 301, 302]} &&
|
||||
{(getNumber (_configItemInfo >> "type")) in [TYPE_MUZZLE, TYPE_OPTICS, TYPE_FLASHLIGHT, TYPE_BIPOD]} &&
|
||||
{!(_x isKindOf ["CBA_MiscItem", (_configCfgWeapons)])}
|
||||
): {
|
||||
switch (getNumber (_configItemInfo >> "type")) do {
|
||||
case 201: {
|
||||
case TYPE_OPTICS: {
|
||||
(_cargo select 1) select 0 pushBackUnique _x;
|
||||
};
|
||||
case 301: {
|
||||
case TYPE_FLASHLIGHT: {
|
||||
(_cargo select 1) select 1 pushBackUnique _x;
|
||||
};
|
||||
case 101: {
|
||||
case TYPE_MUZZLE: {
|
||||
(_cargo select 1) select 2 pushBackUnique _x;
|
||||
};
|
||||
case 302: {
|
||||
case TYPE_BIPOD: {
|
||||
(_cargo select 1) select 3 pushBackUnique _x;
|
||||
};
|
||||
};
|
||||
};
|
||||
/* Headgear */
|
||||
case (isClass (_configItemInfo) &&
|
||||
{getNumber (_configItemInfo >> "type") == 605}): {
|
||||
{getNumber (_configItemInfo >> "type") == TYPE_HEADGEAR}): {
|
||||
(_cargo select 3) pushBackUnique _x;
|
||||
};
|
||||
/* Uniform */
|
||||
case (isClass (_configItemInfo) &&
|
||||
{getNumber (_configItemInfo >> "type") == 801}): {
|
||||
{getNumber (_configItemInfo >> "type") == TYPE_UNIFORM}): {
|
||||
(_cargo select 4) pushBackUnique _x;
|
||||
};
|
||||
/* Vest */
|
||||
case (isClass (_configItemInfo) &&
|
||||
{getNumber (_configItemInfo >> "type") == 701}): {
|
||||
{getNumber (_configItemInfo >> "type") == TYPE_VEST}): {
|
||||
(_cargo select 5) pushBackUnique _x;
|
||||
};
|
||||
/* NVgs */
|
||||
@ -120,7 +120,7 @@ if (_items isEqualType true) then {
|
||||
};
|
||||
/* Binos */
|
||||
case (_simulationType == "Binocular" ||
|
||||
{(_simulationType == 'Weapon') && {(getNumber (_configCfgWeapons >> _x >> 'type') == 4096)}}): {
|
||||
{(_simulationType == 'Weapon') && {(getNumber (_configCfgWeapons >> _x >> 'type') == TYPE_BINOCULAR_AND_NVG)}}): {
|
||||
(_cargo select 9) pushBackUnique _x;
|
||||
};
|
||||
/* Map */
|
||||
@ -145,20 +145,20 @@ if (_items isEqualType true) then {
|
||||
};
|
||||
/* UAV terminals */
|
||||
case (isClass (_configItemInfo) &&
|
||||
{getNumber (_configItemInfo >> "type") == 621}): {
|
||||
{getNumber (_configItemInfo >> "type") == TYPE_UAV_TERMINAL}): {
|
||||
(_cargo select 14) pushBackUnique _x;
|
||||
};
|
||||
/* Weapon, at the bottom to avoid adding binos */
|
||||
case (isClass (_configCfgWeapons >> _x >> "WeaponSlotsInfo") &&
|
||||
{getNumber (_configCfgWeapons >> _x >> 'type') != 4096}): {
|
||||
{getNumber (_configCfgWeapons >> _x >> 'type') != TYPE_BINOCULAR_AND_NVG}): {
|
||||
switch (getNumber (_configCfgWeapons >> _x >> "type")) do {
|
||||
case 1: {
|
||||
case TYPE_WEAPON_PRIMARY: {
|
||||
(_cargo select 0) select 0 pushBackUnique ([_x] call bis_fnc_baseWeapon);
|
||||
};
|
||||
case 2: {
|
||||
case TYPE_WEAPON_HANDGUN: {
|
||||
(_cargo select 0) select 2 pushBackUnique ([_x] call bis_fnc_baseWeapon);
|
||||
};
|
||||
case 4: {
|
||||
case TYPE_WEAPON_SECONDARY: {
|
||||
(_cargo select 0) select 1 pushBackUnique ([_x] call bis_fnc_baseWeapon);
|
||||
};
|
||||
};
|
||||
@ -166,9 +166,9 @@ if (_items isEqualType true) then {
|
||||
/* Misc items */
|
||||
case (
|
||||
isClass (_configItemInfo) &&
|
||||
((getNumber (_configItemInfo >> "type")) in [101, 201, 301, 302] &&
|
||||
((getNumber (_configItemInfo >> "type")) in [TYPE_MUZZLE, TYPE_OPTICS, TYPE_FLASHLIGHT, TYPE_BIPOD] &&
|
||||
{(_x isKindOf ["CBA_MiscItem", (_configCfgWeapons)])}) ||
|
||||
{(getNumber (_configItemInfo >> "type")) in [401, 619, 620]} ||
|
||||
{(getNumber (_configItemInfo >> "type")) in [TYPE_FIRST_AID_KIT, TYPE_MEDIKIT, TYPE_TOOLKIT]} ||
|
||||
{(getText (_configCfgWeapons >> _x >> "simulation")) == "ItemMineDetector"}
|
||||
): {
|
||||
(_cargo select 17) pushBackUnique _x;
|
||||
@ -193,7 +193,7 @@ if (_items isEqualType true) then {
|
||||
switch true do {
|
||||
// Rifle, handgun, secondary weapons mags
|
||||
case (
|
||||
(getNumber (configFile >> "CfgMagazines" >> _x >> "type") in [256,512,1536,16]) &&
|
||||
(getNumber (configFile >> "CfgMagazines" >> _x >> "type") in [TYPE_MAGAZINE_PRIMARY_AND_THROW,TYPE_MAGAZINE_SECONDARY_AND_PUT,1536,TYPE_MAGAZINE_HANDGUN_AND_GL]) &&
|
||||
{!(_x in _grenadeList)} &&
|
||||
{!(_x in _putList)}
|
||||
): {
|
||||
|
@ -46,23 +46,23 @@ private _configCfgWeapons = configFile >> "CfgWeapons"; //Save this lookup in va
|
||||
/* Weapon acc */
|
||||
case (
|
||||
_hasItemInfo &&
|
||||
{_itemInfoType in [101, 201, 301, 302]} &&
|
||||
{_itemInfoType in [TYPE_MUZZLE, TYPE_OPTICS, TYPE_FLASHLIGHT, TYPE_BIPOD]} &&
|
||||
{!(configName _x isKindOf ["CBA_MiscItem", (_configCfgWeapons)])}
|
||||
): {
|
||||
|
||||
//Convert type to array index
|
||||
(_cargo select 1) select ([201,301,101,302] find _itemInfoType) pushBackUnique _className;
|
||||
(_cargo select 1) select ([TYPE_OPTICS,TYPE_FLASHLIGHT,TYPE_MUZZLE,TYPE_BIPOD] find _itemInfoType) pushBackUnique _className;
|
||||
};
|
||||
/* Headgear */
|
||||
case (_itemInfoType == 605): {
|
||||
case (_itemInfoType == TYPE_HEADGEAR): {
|
||||
(_cargo select 3) pushBackUnique _className;
|
||||
};
|
||||
/* Uniform */\
|
||||
case (_itemInfoType == 801): {
|
||||
case (_itemInfoType == TYPE_UNIFORM): {
|
||||
(_cargo select 4) pushBackUnique _className;
|
||||
};
|
||||
/* Vest */
|
||||
case (_itemInfoType == 701): {
|
||||
case (_itemInfoType == TYPE_VEST): {
|
||||
(_cargo select 5) pushBackUnique _className;
|
||||
};
|
||||
/* NVgs */
|
||||
@ -71,7 +71,7 @@ private _configCfgWeapons = configFile >> "CfgWeapons"; //Save this lookup in va
|
||||
};
|
||||
/* Binos */
|
||||
case (_simulationType == "Binocular" ||
|
||||
((_simulationType == 'Weapon') && {(getNumber (_x >> 'type') == 4096)})): {
|
||||
((_simulationType == 'Weapon') && {(getNumber (_x >> 'type') == TYPE_BINOCULAR_AND_NVG)})): {
|
||||
(_cargo select 9) pushBackUnique _className;
|
||||
};
|
||||
/* Map */
|
||||
@ -95,20 +95,20 @@ private _configCfgWeapons = configFile >> "CfgWeapons"; //Save this lookup in va
|
||||
(_cargo select 14) pushBackUnique _className;
|
||||
};
|
||||
/* UAV terminals */
|
||||
case (_itemInfoType == 621): {
|
||||
case (_itemInfoType == TYPE_UAV_TERMINAL): {
|
||||
(_cargo select 14) pushBackUnique _className;
|
||||
};
|
||||
/* Weapon, at the bottom to avoid adding binos */
|
||||
case (isClass (_x >> "WeaponSlotsInfo") &&
|
||||
{getNumber (_x >> 'type') != 4096}): {
|
||||
{getNumber (_x >> 'type') != TYPE_BINOCULAR_AND_NVG}): {
|
||||
switch (getNumber (_x >> "type")) do {
|
||||
case 1: {
|
||||
case TYPE_WEAPON_PRIMARY: {
|
||||
(_cargo select 0) select 0 pushBackUnique (_className call bis_fnc_baseWeapon);
|
||||
};
|
||||
case 2: {
|
||||
case TYPE_WEAPON_HANDGUN: {
|
||||
(_cargo select 0) select 2 pushBackUnique (_className call bis_fnc_baseWeapon);
|
||||
};
|
||||
case 4: {
|
||||
case TYPE_WEAPON_SECONDARY: {
|
||||
(_cargo select 0) select 1 pushBackUnique (_className call bis_fnc_baseWeapon);
|
||||
};
|
||||
};
|
||||
@ -116,9 +116,9 @@ private _configCfgWeapons = configFile >> "CfgWeapons"; //Save this lookup in va
|
||||
/* Misc items */
|
||||
case (
|
||||
_hasItemInfo &&
|
||||
(_itemInfoType in [101, 201, 301, 302] &&
|
||||
(_itemInfoType in [TYPE_MUZZLE, TYPE_OPTICS, TYPE_FLASHLIGHT, TYPE_BIPOD] &&
|
||||
{(_className isKindOf ["CBA_MiscItem", (_configCfgWeapons)])}) ||
|
||||
{_itemInfoType in [401, 619, 620]} ||
|
||||
{_itemInfoType in [TYPE_FIRST_AID_KIT, TYPE_MEDIKIT, TYPE_TOOLKIT]} ||
|
||||
{(getText ( _x >> "simulation")) == "ItemMineDetector"}
|
||||
): {
|
||||
(_cargo select 17) pushBackUnique _className;
|
||||
@ -142,7 +142,7 @@ private _putList = [];
|
||||
switch true do {
|
||||
// Rifle, handgun, secondary weapons mags
|
||||
case (
|
||||
(getNumber (_x >> "type") in [256,512,1536,16]) &&
|
||||
(getNumber (_x >> "type") in [TYPE_MAGAZINE_PRIMARY_AND_THROW,TYPE_MAGAZINE_SECONDARY_AND_PUT,1536,TYPE_MAGAZINE_HANDGUN_AND_GL]) &&
|
||||
{!(_className in _grenadeList)} &&
|
||||
{!(_className in _putList)}
|
||||
): {
|
||||
|
@ -38,35 +38,35 @@ private _default = ["item", "magazine"] select (_cfgType == "CfgMagazines");
|
||||
|
||||
switch (true) do {
|
||||
case (_type == 0): {[_default, "unknown"]};
|
||||
case (_type == 2^0): {["weapon", "primary"]};
|
||||
case (_type == 2^1): {["weapon", "handgun"]};
|
||||
case (_type == 2^2): {["weapon", "secondary"]};
|
||||
case (_type < 2^4): {["weapon", "unknown"]};
|
||||
case (_type == 2^4): {["magazine", "handgun"]}; // handgun
|
||||
case (_type == 2^8): {["magazine", "primary"]}; // rifle
|
||||
case (_type == 2^9): {["magazine", "secondary"]}; // rpg, mg, mines
|
||||
case (_type == TYPE_WEAPON_PRIMARY): {["weapon", "primary"]};
|
||||
case (_type == TYPE_WEAPON_HANDGUN): {["weapon", "handgun"]};
|
||||
case (_type == TYPE_WEAPON_SECONDARY): {["weapon", "secondary"]};
|
||||
case (_type < TYPE_MAGAZINE_HANDGUN_AND_GL): {["weapon", "unknown"]};
|
||||
case (_type == TYPE_MAGAZINE_HANDGUN_AND_GL): {["magazine", "handgun"]}; // handgun
|
||||
case (_type == TYPE_MAGAZINE_PRIMARY_AND_THROW): {["magazine", "primary"]}; // rifle
|
||||
case (_type == TYPE_MAGAZINE_SECONDARY_AND_PUT): {["magazine", "secondary"]}; // rpg, mg, mines
|
||||
//case (_type < 2^11): {["magazine", "unknown"]};
|
||||
|
||||
case (_type == 101): {["item", "muzzle"]};
|
||||
case (_type == 201): {["item", "optics"]};
|
||||
case (_type == 301): {["item", "flashlight"]};
|
||||
case (_type == 302): {["item", "under"]}; // czech for bipod item
|
||||
case (_type == 401): {["item", "first_aid_kit"]};
|
||||
case (_type == 501): {["item", "fins"]}; // not implemented
|
||||
case (_type == 601): {["item", "breathing_bomb"]}; // not implemented
|
||||
case (_type == 603): {["item", "goggles"]};
|
||||
case (_type == 604): {["item", "scuba"]}; // not implemented
|
||||
case (_type == 605): {["item", "headgear"]};
|
||||
case (_type == 611): {["item", "radio"]};
|
||||
case (_type == 616): {["item", "hmd"]};
|
||||
case (_type == 617): {["item", "binocular"]};
|
||||
case (_type == 619): {["item", "medikit"]};
|
||||
case (_type == 620): {["item", "toolkit"]};
|
||||
case (_type == 621): {["item", "uav_terminal"]};
|
||||
case (_type == 701): {["item", "vest"]};
|
||||
case (_type == 801): {["item", "uniform"]};
|
||||
case (_type == TYPE_MUZZLE): {["item", "muzzle"]};
|
||||
case (_type == TYPE_OPTICS): {["item", "optics"]};
|
||||
case (_type == TYPE_FLASHLIGHT): {["item", "flashlight"]};
|
||||
case (_type == TYPE_BIPOD): {["item", "under"]}; // czech for bipod item
|
||||
case (_type == TYPE_FIRST_AID_KIT): {["item", "first_aid_kit"]};
|
||||
case (_type == TYPE_FINS): {["item", "fins"]}; // not implemented
|
||||
case (_type == TYPE_BREATHING_BOMB): {["item", "breathing_bomb"]}; // not implemented
|
||||
case (_type == TYPE_GOGGLE): {["item", "goggles"]};
|
||||
case (_type == TYPE_SCUBA): {["item", "scuba"]}; // not implemented
|
||||
case (_type == TYPE_HEADGEAR): {["item", "headgear"]};
|
||||
case (_type == TYPE_RADIO): {["item", "radio"]};
|
||||
case (_type == TYPE_HMD): {["item", "hmd"]};
|
||||
case (_type == TYPE_BINOCULAR): {["item", "binocular"]};
|
||||
case (_type == TYPE_MEDIKIT): {["item", "medikit"]};
|
||||
case (_type == TYPE_TOOLKIT): {["item", "toolkit"]};
|
||||
case (_type == TYPE_UAV_TERMINAL): {["item", "uav_terminal"]};
|
||||
case (_type == TYPE_VEST): {["item", "vest"]};
|
||||
case (_type == TYPE_UNIFORM): {["item", "uniform"]};
|
||||
|
||||
case (_type == 2^12): {
|
||||
case (_type == TYPE_BINOCULAR_AND_NVG): {
|
||||
switch (toLower _simulation) do {
|
||||
case ("weapon"): {["weapon", "binocular"]};
|
||||
case ("binocular"): {["weapon", "binocular"]};
|
||||
@ -76,8 +76,8 @@ switch (true) do {
|
||||
};
|
||||
};
|
||||
|
||||
case (_type == 2^16): {["weapon", "vehicle"]};
|
||||
case (_type == 2^17): {
|
||||
case (_type == TYPE_WEAPON_VEHICLE): {["weapon", "vehicle"]};
|
||||
case (_type == TYPE_ITEM): {
|
||||
switch (toLower _simulation) do {
|
||||
case ("itemmap"): {["item", "map"]};
|
||||
case ("itemgps"): {["item", "gps"]};
|
||||
|
@ -12,7 +12,7 @@ class CfgWeapons {
|
||||
class CBA_MiscItem_ItemInfo;
|
||||
|
||||
class ACE_ExplosiveItem: CBA_MiscItem_ItemInfo {
|
||||
allowedSlots[] = {801,701,901};
|
||||
allowedSlots[] = {TYPE_UNIFORM,TYPE_VEST,TYPE_BACKPACK};
|
||||
//type = 201;
|
||||
};
|
||||
|
||||
|
@ -60,6 +60,18 @@
|
||||
count = COUNT; \
|
||||
}
|
||||
|
||||
// weapon types
|
||||
#define TYPE_WEAPON_PRIMARY 1
|
||||
#define TYPE_WEAPON_HANDGUN 2
|
||||
#define TYPE_WEAPON_SECONDARY 4
|
||||
// magazine types
|
||||
#define TYPE_MAGAZINE_HANDGUN_AND_GL 16 // mainly
|
||||
#define TYPE_MAGAZINE_PRIMARY_AND_THROW 256
|
||||
#define TYPE_MAGAZINE_SECONDARY_AND_PUT 512 // mainly
|
||||
// more types
|
||||
#define TYPE_BINOCULAR_AND_NVG 4096
|
||||
#define TYPE_WEAPON_VEHICLE 65536
|
||||
#define TYPE_ITEM 131072
|
||||
// item types
|
||||
#define TYPE_DEFAULT 0
|
||||
#define TYPE_MUZZLE 101
|
||||
|
Loading…
Reference in New Issue
Block a user