mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge remote-tracking branch 'origin/master' into AddItemToInventory
This commit is contained in:
commit
5d6495dafe
@ -58,6 +58,8 @@ PREP(getAllGear);
|
||||
PREP(getCaptivityStatus);
|
||||
PREP(getConfigCommander);
|
||||
PREP(getConfigGunner);
|
||||
PREP(getConfigType);
|
||||
PREP(getConfigTypeObject);
|
||||
PREP(getDeathAnim);
|
||||
PREP(getDefaultAnim);
|
||||
PREP(getDefinedVariable);
|
||||
@ -71,6 +73,8 @@ PREP(getGunner);
|
||||
PREP(getHitPoints);
|
||||
PREP(getHitPointsWithSelections);
|
||||
PREP(getInPosition);
|
||||
PREP(getItemType);
|
||||
PREP(getItemTypeWeapon);
|
||||
PREP(getMarkerType);
|
||||
PREP(getName);
|
||||
PREP(getNumberFromMissionSQM);
|
||||
|
24
addons/common/functions/fnc_getConfigType.sqf
Normal file
24
addons/common/functions/fnc_getConfigType.sqf
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* What kind of Cfg is the item. Works for CfgMagaines, CfgWeapons and CfgGlasses
|
||||
*
|
||||
* Argument:
|
||||
* 0: A item's classname. (String)
|
||||
*
|
||||
* Return value:
|
||||
* CfgWhatever (String)
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_item";
|
||||
|
||||
_item = _this select 0;
|
||||
|
||||
if (isClass (configFile >> "CfgWeapons" >> _item)) exitWith {"CfgWeapons"};
|
||||
|
||||
if (isClass (configFile >> "CfgMagazines" >> _item)) exitWith {"CfgMagazines"};
|
||||
|
||||
if (isClass (configFile >> "CfgGlasses" >> _item)) exitWith {"CfgGlasses"};
|
||||
|
||||
""
|
22
addons/common/functions/fnc_getConfigTypeObject.sqf
Normal file
22
addons/common/functions/fnc_getConfigTypeObject.sqf
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* What kind of Cfg is the object. Works for CfgVehicles and CfgAmmo
|
||||
*
|
||||
* Argument:
|
||||
* 0: An object's classname. (String)
|
||||
*
|
||||
* Return value:
|
||||
* CfgWhatever (String)
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_object";
|
||||
|
||||
_object = _this select 0;
|
||||
|
||||
if (isClass (configFile >> "CfgVehicles" >> _object)) exitWith {"CfgVehicles"};
|
||||
|
||||
if (isClass (configFile >> "CfgAmmo" >> _object)) exitWith {"CfgAmmo"};
|
||||
|
||||
""
|
29
addons/common/functions/fnc_getItemType.sqf
Normal file
29
addons/common/functions/fnc_getItemType.sqf
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* What kind of item is given classname
|
||||
*
|
||||
* Argument:
|
||||
* 0: Classname of a item. (String)
|
||||
*
|
||||
* Return value:
|
||||
* Item type. (Array)
|
||||
* 0: "weapon", "item", "magazine", "unknown" or "" (String)
|
||||
* 1: A description of the item (e.g. "primary" for a weapon or "vest" for a vest item)
|
||||
*
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_item";
|
||||
|
||||
_item = _this select 0;
|
||||
|
||||
_cfgType = [_item] call FUNC(getConfigType);
|
||||
|
||||
if (_cfgType == "CfgGlasses") exitWith {["item","glasses"]};
|
||||
|
||||
if (_cfgType == "CfgMagazines") exitWith { ["magazine", [_item] call FUNC(getItemTypeWeapon) select 1] };
|
||||
|
||||
if (_cfgType == "CfgWeapons") exitWith { [_item] call FUNC(getItemTypeWeapon) };
|
||||
|
||||
["",""]
|
74
addons/common/functions/fnc_getItemTypeWeapon.sqf
Normal file
74
addons/common/functions/fnc_getItemTypeWeapon.sqf
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* What kind of item is given classname. Has to be a CfgWeapons. Undefined behavior for CfgMagazine.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Classname of a CfgWeapon. (String)
|
||||
*
|
||||
* Return value:
|
||||
* See ace_common_fnc_getItemType
|
||||
*
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_item";
|
||||
|
||||
_item = _this select 0;
|
||||
|
||||
private "_config";
|
||||
_config = configFile >> [_item] call FUNC(getConfigType) >> _item;
|
||||
|
||||
if (!isClass _config) exitWith {["",""]};
|
||||
|
||||
private "_type";
|
||||
_type = getNumber (_config >> "type");
|
||||
|
||||
if (isNumber (_config >> "ItemInfo" >> "type")) then {
|
||||
_type = getNumber (_config >> "ItemInfo" >> "type");
|
||||
};
|
||||
|
||||
switch (true) do {
|
||||
case (_type == 0): {["unknown","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 == 768): {["magazine","secondary"]}; // NLAW
|
||||
case (_type == 1536): {["magazine","secondary"]}; // titan
|
||||
|
||||
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 == 2^12): {
|
||||
switch (toLower getText (_config >> "simulation")) do {
|
||||
case ("binocular"): {["weapon","binocular"]};
|
||||
case ("nvgoggles"): {["item","nvgoggles"]};
|
||||
case ("itemminedetector"): {["item","minedetector"]};
|
||||
default {["weapon","unknown"]};
|
||||
};
|
||||
};
|
||||
|
||||
case (_type == 2^16): {["weapon","vehicle"]};
|
||||
case (_type == 2^17): {["item","unknown"]}; // ???
|
||||
default {["item","unknown"]};
|
||||
};
|
Loading…
Reference in New Issue
Block a user