Some Fav-Bar Tweaks

- Moved configs to cfgepochclient
- Changed Keydown-Check from EPOCH_Buildmode to EPOCH_Target
- Replaced "resetonLogin" to only remove "forbidden items"
This commit is contained in:
He-Man 2017-08-03 18:18:18 +02:00
parent 97cf50183e
commit ff4b401b5f
9 changed files with 59 additions and 53 deletions

View File

@ -38,12 +38,19 @@ if (_handled) exitWith{ true };
if !(alive player) exitWith{ false };
EPOCH_doRotate = false;
EPOCH_modKeys = [_shift,_ctrl,_alt];
call epoch_favBar_modifier;
if !(EPOCH_modKeys isequalto [_shift,_ctrl,_alt]) then {
EPOCH_modKeys = [_shift,_ctrl,_alt];
call epoch_favBar_modifier;
};
//Favorites bar
if (_dikCode in [EPOCH_keysfav1,EPOCH_keysfav2,EPOCH_keysfav3,EPOCH_keysfav4,EPOCH_keysfav5]) then {
_this call epoch_favBar_action;
if (isnull EPOCH_Target) then {
_this call epoch_favBar_action;
} else {
"Can't use while in building mode!" call epoch_message;
};
};
// increase vol

View File

@ -34,8 +34,10 @@ _handled = false;
_this call Epoch_custom_EH_KeyUp;
if (_handled) exitWith{ true };
EPOCH_modKeys = [_shift,_ctrl,_alt];
call epoch_favBar_modifier;
if !(EPOCH_modKeys isequalto [_shift,_ctrl,_alt]) then {
EPOCH_modKeys = [_shift,_ctrl,_alt];
call epoch_favBar_modifier;
};
//Main actions
if (_dikCode == EPOCH_keysAction) then {

View File

@ -369,7 +369,7 @@ _fnc_dropEquipAccessories = {
};
player selectWeapon ((_loadout select _slot) select 0);
if (!EPOCH_fav_FastWeaponSwitching) then {
if !(["CfgEpochClient", "Fav_FastWeaponSwitching", false] call EPOCH_fnc_returnConfigEntryV2) then {
player playAction "reloadMagazine";
};
_return

View File

@ -13,7 +13,7 @@
Usage: none
*/
private ["_item","_slot","_dsp","_kee","_tileIdx","_itemHasInteraction","_force","_errorCode","_curSlot"];
private ["_item","_slot","_dsp","_kee","_tileIdx","_itemHasInteraction","_force","_errorCode","_curSlot","_Fav_DropIfOverflow","_Fav_FastWeaponSwitching"];
params ["_dsp","_kee"];
_tileIdx = switch (_kee) do {
@ -27,28 +27,26 @@ _tileIdx = switch (_kee) do {
_item = rmx_var_favBar_current select _tileIdx;
_itemHasInteraction = str(missionConfigFile >> "CfgItemInteractions" >> _item) != "";
if (EPOCH_buildMode == 0) then {
if (_itemHasInteraction) then {
EPOCH_InteractedItem = ["",_item,""];
[] call EPOCH_consumeItem;
EPOCH_favBar_itemConsumed = true;
} else {
_slot = _item call epoch_itemTypeSlot;
_force = if (_slot in [3,4,5,7,8,10,11,16]) then {true} else {false}; //see how it works with other items, definitely keep true for weapons
_errorCode = [_item,EPOCH_fav_DropIfOverflow,_force] call epoch_equip;
player selectWeapon _item;
if (_slot in [3,4,5]) then {
_curSlot = _item call epoch_itemTypeSlot;
if (_curSlot == _slot && !EPOCH_fav_FastWeaponSwitching && _errorCode in [1,2]) then {player playAction "reloadMagazine";};
};
if (_errorCode isEqualTo 2) then {"Not enough space, item dropped on the ground!" call epoch_message;};
if (_errorCode isEqualTo 4 && _item != (currentWeapon player)) then {"Not enough space!" call epoch_message;};
if (_errorCode isEqualTo 3) then {"Item not found!" call epoch_message;};
if (_errorCode isEqualTo 5) then {"No compatible weapon found!" call epoch_message;};
};
if (_itemHasInteraction) then {
EPOCH_InteractedItem = ["",_item,""];
[] call EPOCH_consumeItem;
EPOCH_favBar_itemConsumed = true;
} else {
"Can't use while in building mode!" call epoch_message;
_Fav_DropIfOverflow = ["CfgEpochClient", "Fav_DropIfOverflow", false] call EPOCH_fnc_returnConfigEntryV2;
_slot = _item call epoch_itemTypeSlot;
_force = if (_slot in [3,4,5,7,8,10,11,16]) then {true} else {false}; //see how it works with other items, definitely keep true for weapons
_errorCode = [_item,_Fav_DropIfOverflow,_force] call epoch_equip;
player selectWeapon _item;
if (_slot in [3,4,5]) then {
_curSlot = _item call epoch_itemTypeSlot;
_Fav_FastWeaponSwitching = ["CfgEpochClient", "Fav_FastWeaponSwitching", false] call EPOCH_fnc_returnConfigEntryV2;
if (_curSlot == _slot && !_Fav_FastWeaponSwitching && _errorCode in [1,2]) then {player playAction "reloadMagazine";};
};
if (_errorCode isEqualTo 2) then {"Not enough space, item dropped on the ground!" call epoch_message;};
if (_errorCode isEqualTo 4 && _item != (currentWeapon player)) then {"Not enough space!" call epoch_message;};
if (_errorCode isEqualTo 3) then {"Item not found!" call epoch_message;};
if (_errorCode isEqualTo 5) then {"No compatible weapon found!" call epoch_message;};
};
true

View File

@ -14,23 +14,27 @@
Usage: none
*/
disableSerialization;
private ["_action","_idx","_bidx","_mod"];
private ["_action","_idx","_bidx","_mod","_baritems","_Fav_BannedItems"];
params ["_action","_idx","_bidx","_mod"];
_Fav_BannedItems = ["CfgEpochClient", "Fav_BannedItems", []] call EPOCH_fnc_returnConfigEntryV2;
switch _action do {
case "load":
{
private ["_tmp","_c","_p"];
if (EPOCH_fav_resetOnLogin) then {
profileNamespace setVariable ["rmx_var_favBar_MNone",nil];
profileNamespace setVariable ["rmx_var_favBar_MCtrl",nil];
profileNamespace setVariable ["rmx_var_favBar_MShift",nil];
profileNamespace setVariable ["rmx_var_favBar_MAlt",nil];
};
rmx_var_favBar_MNone = profileNamespace getVariable ["rmx_var_favBar_MNone",["","","","",""]];
rmx_var_favBar_MCtrl = profileNamespace getVariable ["rmx_var_favBar_MCtrl",["","","","",""]];
rmx_var_favBar_MShift = profileNamespace getVariable ["rmx_var_favBar_MShift",["","","","",""]];
rmx_var_favBar_MAlt = profileNamespace getVariable ["rmx_var_favBar_MAlt",["","","","",""]];
{
_baritems = _x;
{
if (_x in _Fav_BannedItems) then {
_baritems set [_foreachindex,""];
};
} foreach _x;
} foreach [rmx_var_favBar_MNone,rmx_var_favBar_MCtrl,rmx_var_favBar_MShift,rmx_var_favBar_MAlt];
rmx_var_favBar_current = rmx_var_favBar_MNone;
waitUntil {uiSleep 0.1; ctrlShown (["fav_equipped", 1] call epoch_getHUDCtrl)};
@ -53,8 +57,7 @@ switch _action do {
case "add":
{
private ["_type","_isBanned","_isAmmo","_isChemlight","_itemIsWeapon","_itemHasInteraction","_c"];
if (rmx_var_favBar_Item in EPOCH_fav_BannedItems) exitWith {"Item is not allowed in favorites!" call epoch_message; false};
if (rmx_var_favBar_Item in _Fav_BannedItems) exitWith {"Item is not allowed in favorites!" call epoch_message; false};
if (rmx_var_favBar_Item in rmx_var_favBar_current) exitWith {"Item already exists in favorites!" call epoch_message; false}; //if duplicate
_type = (rmx_var_favBar_Item call BIS_fnc_itemType) select 1;

View File

@ -26,7 +26,7 @@
*/
private ["_display","_c","_gIdx","_g"];
if !(EPOCH_fav_enableFavoriteBar) exitWith {false};
if !(["CfgEpochClient", "Fav_enableFavoriteBar", true] call EPOCH_fnc_returnConfigEntryV2) exitWith {false};
disableSerialization;
waitUntil {!isNull findDisplay 602};

View File

@ -14,7 +14,7 @@
Usage: none
*/
if !(EPOCH_fav_enableFavoriteBar) exitWith {false};
if !(["CfgEpochClient", "Fav_enableFavoriteBar", true] call EPOCH_fnc_returnConfigEntryV2) exitWith {false};
private ["_playerItems","_equipped","_mod","_txt"];
_playerItems = itemsWithMagazines player;

View File

@ -66,17 +66,6 @@ EPOCH_favBar_itemConsumed = false;
rmx_var_favBar_Item = "";
EPOCH_modKeys = [false,false,false];
//If disabled, players will not be able to use favorite bar
EPOCH_fav_enableFavoriteBar = true;
//If enabled, same slot weapons from favorites bar are equipped instantly, otherwise reload action is played (recommended for immersion)
EPOCH_fav_FastWeaponSwitching = false;
//If enabled and inventory full, equipped weapon will be dropped on ground in favor for the new selected weapon, otherwise action will fail with message and weapon will not be equipped
EPOCH_fav_DropIfOverflow = false;
//Items that users are not allowed to pin
EPOCH_fav_BannedItems = ["FAK"]; //add items that can be abused here
//Reset all favorite items on every login (players will be required to re-add everything again).
EPOCH_fav_resetOnLogin = true;
["EPOCH_onEachFrame", "onEachFrame", EPOCH_onEachFrame] call BIS_fnc_addStackedEventHandler;
// Custom Keys

View File

@ -91,9 +91,16 @@ class CfgEpochClient
playerRevengeMinAliveTime = 900;
bankTransferTime[] = {0.0006,1.2,0.06};
// Favorite Bar
Fav_enableFavoriteBar = "true"; // If disabled, players will not be able to use favorite bar
Fav_DropIfOverflow = "false"; // If enabled and inventory full, equipped weapon will be dropped on ground in favor for the new selected weapon, otherwise action will fail with message and weapon will not be equipped
Fav_FastWeaponSwitching = "false"; // If enabled, same slot weapons from favorites bar are equipped instantly, otherwise reload action is played (recommended for immersion)
Fav_BannedItems[] = {"FAK"}; // Items that users are not allowed to pin
// Advanced Vehicle Repair
UseAdvancedVehicleRepair = "true"; // Switch On / Off Advanced Vehicle Repair (Does not effect SuppressedCraftingItems !)
SuppressedCraftingItems[] = {"VehicleRepair","VehicleRepairLg"}; // Suppresed for usage of "Advanced Vehicle Repair"
UseAdvancedVehicleRepair = "true";
VehicleRepairs[] = {
VehicleRepairs[] = { // {Hitpoint, dmg to repair, dmg to replace, mat to repair, mat to replace}
{"HitHull",0.33,0.66,"ItemScraps","ItemCorrugated"},
{"HitBody",0.33,1,"ItemScraps","ItemCorrugated"},
{"HitLFWheel",0.33,1,"VehicleRepair","SpareTire"},