mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
finalized. works for weapons/mags/items. Optional container also works.
This commit is contained in:
@ -6,8 +6,7 @@
|
|||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit (OBJECT)
|
* 0: Unit (OBJECT)
|
||||||
* 1: Classname (String)
|
* 1: Classname (String)
|
||||||
* 2: Type (String)
|
* 2: Container (String, Optional) uniform, vest, backpack
|
||||||
* 3: Container (String, Optional)
|
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Array:
|
* Array:
|
||||||
@ -16,22 +15,26 @@
|
|||||||
*
|
*
|
||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
|
//#define DEBUG_MODE_FULL
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
EXPLODE_3_PVT(_this,_unit,_classname,_type);
|
EXPLODE_2_PVT(_this,_unit,_classname);
|
||||||
private "_addedToPlayer";
|
private "_addedToPlayer";
|
||||||
private "_container";
|
private "_container";
|
||||||
private "_canAdd";
|
private "_canAdd";
|
||||||
|
private "_type";
|
||||||
|
|
||||||
_canAdd = false;
|
_canAdd = false;
|
||||||
_addedToPlayer = true;
|
_addedToPlayer = true;
|
||||||
|
|
||||||
if((count _this) > 3) then {
|
if((count _this) > 2) then {
|
||||||
_container = _this select 3;
|
_container = _this select 2;
|
||||||
} else {
|
} else {
|
||||||
_container = nil;
|
_container = nil;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_type = [_classname] call EFUNC(common,getItemType);
|
||||||
|
|
||||||
if(!isNil "_container") then {
|
if(!isNil "_container") then {
|
||||||
switch (_container) do {
|
switch (_container) do {
|
||||||
case "vest": { _canAdd = _unit canAddItemToVest _classname; };
|
case "vest": { _canAdd = _unit canAddItemToVest _classname; };
|
||||||
@ -43,9 +46,8 @@ if(!isNil "_container") then {
|
|||||||
_canAdd = _unit canAdd _classname;
|
_canAdd = _unit canAdd _classname;
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (_type) do {
|
switch ((_type select 0)) do {
|
||||||
case "weapon": {
|
case "weapon": {
|
||||||
if (!isClass(ConfigFile >> "CfgWeapons" >> _classname)) exitWith {};
|
|
||||||
if (_canAdd) then {
|
if (_canAdd) then {
|
||||||
switch (_container) do {
|
switch (_container) do {
|
||||||
case "vest": { (vestContainer _unit) addWeaponCargoGlobal [_classname, 1]; };
|
case "vest": { (vestContainer _unit) addWeaponCargoGlobal [_classname, 1]; };
|
||||||
@ -62,7 +64,6 @@ switch (_type) do {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
case "magazine": {
|
case "magazine": {
|
||||||
if (!isClass(ConfigFile >> "CfgMagazines" >> _classname)) exitWith {};
|
|
||||||
if (_canAdd) then {
|
if (_canAdd) then {
|
||||||
switch (_container) do {
|
switch (_container) do {
|
||||||
case "vest": { (vestContainer _unit) addMagazineCargoGlobal [_classname, 1]; };
|
case "vest": { (vestContainer _unit) addMagazineCargoGlobal [_classname, 1]; };
|
||||||
@ -79,7 +80,6 @@ switch (_type) do {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
case "item": {
|
case "item": {
|
||||||
if (!isClass(ConfigFile >> "CfgWeapons" >> _classname)) exitWith {};
|
|
||||||
if (_canAdd) then {
|
if (_canAdd) then {
|
||||||
switch (_container) do {
|
switch (_container) do {
|
||||||
case "vest": { _unit addItemToVest _classname; };
|
case "vest": { _unit addItemToVest _classname; };
|
||||||
|
Reference in New Issue
Block a user