favbar: cleanup + private declares

This commit is contained in:
Raymix 2017-08-02 19:33:53 +01:00
parent d2e7a433a3
commit 082036236a
7 changed files with 21 additions and 44 deletions

View File

@ -30,21 +30,21 @@
4 - not enough space 4 - not enough space
5 - accessory not compatible 5 - accessory not compatible
*/ */
private ["_item","_drop","_forceEquip"]; private ["_item","_drop","_forceEquip","_return","_loadout","_slot","_uniform","_vest","_bpack","_uniformItems","_vestItems","_bPackItems","_itemInInventory",
"_fnc_dropItem","_fnc_findItemInContainers","_fnc_moveWeaponFromContainer","_fnc_MoveWeaponToContainer","_fnc_canMoveToContainer","_fnc_dropEquipWeapon","_fnc_dropAssign",
"_fnc_MoveShellToContainer","_fnc_moveShellFromContainer","_fnc_dropEquipShells","_fnc_findAccessorySlot","_fnc_dropEquipAccessories"];
params [["_item","",[""]],["_drop",false,[false]],["_forceEquip",false,[false]]]; params [["_item","",[""]],["_drop",false,[false]],["_forceEquip",false,[false]]];
_return = 0; _return = 0;
if (_item == "") exitWith {_return}; if (_item == "") exitWith {_return};
_slot = _item call epoch_itemTypeSlot; _slot = _item call epoch_itemTypeSlot;
_loadout = getUnitLoadout player; _loadout = getUnitLoadout player;
_loadout params ["_pSlot","_sSlot","_hSlot","_uniform","_vest","_bpack","_helm","_goggles","_bino","_assigned"]; _uniform = _loadout param [3,[]];
_pSlot params ["_pWeapon","_pSilencer","_pLaser","_pOptic","_pMag","_pMag2","_pBipod"]; _vest = _loadout param [4,[]]
_sSlot params ["_sWeapon","_sSilencer","_sLaser","_sOptic","_sMag","_sBipod"]; _bpack = _loadout param [5,[]]
_hSlot params ["_hWeapon","_hSilencer","_hLaser","_hOptic","_hMag","_hBipod"];
_uniformItems = _uniform param [1,[]]; _uniformItems = _uniform param [1,[]];
_vestItems = _vest param [1,[]]; _vestItems = _vest param [1,[]];
_bPackItems = _bPack param [1,[]]; _bPackItems = _bPack param [1,[]];
_binoculars = _bino param [0,[]];
_itemInInventory = _item in ((magazines player) + (items player)); _itemInInventory = _item in ((magazines player) + (items player));
@ -73,7 +73,7 @@ _fnc_dropItem = {
}; };
_fnc_findItemInContainers = { _fnc_findItemInContainers = {
private "_item"; private ["_item","_container","_index","_found","_currItem"];
params ["_item"]; params ["_item"];
_container = 0; _container = 0;
@ -96,7 +96,7 @@ _fnc_findItemInContainers = {
if _found exitWith {}; if _found exitWith {};
} forEach [_uniformItems,_vestItems,_bPackItems]; } forEach [_uniformItems,_vestItems,_bPackItems];
[_container,_index,_found]; [_container,_index,_found]
}; };
_fnc_moveWeaponFromContainer = { _fnc_moveWeaponFromContainer = {
@ -292,7 +292,7 @@ _fnc_dropEquipShells = {
_fnc_findAccessorySlot = { _fnc_findAccessorySlot = {
_item = toLower _item; _item = toLower _item;
private ["_found","_slot","_accessory"]; private ["_found","_slot","_accessory","_compatibleMuzzles","_compatibleCows","_compatiblePointers","_compatibleBipods"];
_slot = 0; _slot = 0;
_accessory = 0; _accessory = 0;
_found = false; _found = false;
@ -322,7 +322,7 @@ _fnc_findAccessorySlot = {
if (_item in _compatibleBipods) exitWith {_found = true; _accessory = 6}; if (_item in _compatibleBipods) exitWith {_found = true; _accessory = 6};
} forEach [(primaryWeapon player),(secondaryWeapon player),(handgunWeapon player)]; } forEach [(primaryWeapon player),(secondaryWeapon player),(handgunWeapon player)];
[_found,_slot,_accessory]; [_found,_slot,_accessory]
}; };
_fnc_dropEquipAccessories = { _fnc_dropEquipAccessories = {
@ -339,7 +339,7 @@ _fnc_dropEquipAccessories = {
_item = toLower _item; _item = toLower _item;
_itemEquipped = _item in _itemsPlayer; _itemEquipped = _item in _itemsPlayer;
_equipped = (_loadout select _slot) select _accessory; _equipped = (_loadout select _slot) select _accessory;
systemChat str [_item,_equipped];
if (!_itemInInventory && !_itemEquipped) exitWith {_return = 3}; if (!_itemInInventory && !_itemEquipped) exitWith {_return = 3};
if (_equipped != "") then { if (_equipped != "") then {
_equipped = (_loadout select _slot) select _accessory; _equipped = (_loadout select _slot) select _accessory;
@ -452,6 +452,7 @@ switch _slot do {
}; };
case 12: //mines case 12: //mines
{ {
private ["_allMuzzles","_muzzle","_found","_mags"];
if (_itemInInventory) then { if (_itemInInventory) then {
_allMuzzles = getArray (configFile >> "CfgWeapons" >> "Put" >> "Muzzles"); _allMuzzles = getArray (configFile >> "CfgWeapons" >> "Put" >> "Muzzles");

View File

@ -34,7 +34,7 @@
17 - Grenades 17 - Grenades
17 - Unsure about these, modify script as required, but don't change existing structure 17 - Unsure about these, modify script as required, but don't change existing structure
*/ */
private ["_item"]; private ["_item","_cat","_type"];
params [["_item","",[""]]]; params [["_item","",[""]]];
if (_item == "") exitWith {false}; if (_item == "") exitWith {false};
@ -62,14 +62,3 @@ if (_type == "Grenade") exitWith {17};
if (_type in ["Magazine","Shotgun","FirstAidKit","LaserDesignator","Medikit","MineDetector","Toolkit","VehicleWeapon","Unknown","UnknownEquipment","UnknownWeapon"]) exitWith {18}; if (_type in ["Magazine","Shotgun","FirstAidKit","LaserDesignator","Medikit","MineDetector","Toolkit","VehicleWeapon","Unknown","UnknownEquipment","UnknownWeapon"]) exitWith {18};
0 0

View File

@ -13,7 +13,7 @@
Usage: none Usage: none
*/ */
private ["_item","_slot"]; private ["_item","_slot","_dsp","_kee","_tileIdx","_itemHasInteraction","_force","_errorCode","_curSlot"];
params ["_dsp","_kee"]; params ["_dsp","_kee"];
_tileIdx = switch (_kee) do { _tileIdx = switch (_kee) do {

View File

@ -15,6 +15,7 @@
RETURNS: classname for item in inventory RETURNS: classname for item in inventory
*/ */
private ["_return","_dispName","_idx","_className"];
(_this select 1 select 0) params ["_dispName","_idx","_className"]; (_this select 1 select 0) params ["_dispName","_idx","_className"];
_return = ""; _return = "";

View File

@ -14,7 +14,7 @@
Usage: none Usage: none
*/ */
private ["_item","_ammo","_cnt"];
//switch //switch
_item = switch (_this) do { _item = switch (_this) do {

View File

@ -24,7 +24,8 @@
Usage: none Usage: none
*/ */
//TODO: Maybe - spawn IDC cleanup thread, wait until display closes private ["_display","_c","_gIdx","_g"];
if !(EPOCH_fav_enableFavoriteBar) exitWith {false}; if !(EPOCH_fav_enableFavoriteBar) exitWith {false};
disableSerialization; disableSerialization;
waitUntil {!isNull findDisplay 602}; waitUntil {!isNull findDisplay 602};
@ -86,19 +87,3 @@ _c ctrlCommit 0;
//Listboxes? //Listboxes?
//6325,1241 //6325,1241
//619,638,633 //619,638,633

View File

@ -15,6 +15,7 @@
*/ */
if !(EPOCH_fav_enableFavoriteBar) exitWith {false}; if !(EPOCH_fav_enableFavoriteBar) exitWith {false};
private ["_playerItems","_equipped","_mod","_txt"];
_playerItems = itemsWithMagazines player; _playerItems = itemsWithMagazines player;
_equipped = [primaryWeapon player, secondaryWeapon player, handgunWeapon player, headgear player, goggles player, hmd player, binocular player]; _equipped = [primaryWeapon player, secondaryWeapon player, handgunWeapon player, headgear player, goggles player, hmd player, binocular player];