Tweaked blacklisting of uav backpacks

This commit is contained in:
Christian 2017-11-22 15:55:06 +01:00
parent 3a79923537
commit 0f50b2e865
5 changed files with 70 additions and 99 deletions

View File

@ -1,5 +1,3 @@
private [ "_loadouts_data", "_saved_loadouts", "_counter", "_loadplayers", "_playerselected", "_namestr", "_nextplayer", "_playerItems", "_text", "_badItems" ];
load_loadout = 0;
edit_loadout = 0;
respawn_loadout = 0;
@ -7,9 +5,11 @@ load_from_player = -1;
exit_on_load = 0;
createDialog "liberation_arsenal";
_saved_loadouts = profileNamespace getVariable "bis_fnc_saveInventory_data";
_loadouts_data = [];
_counter = 0;
private _saved_loadouts = profileNamespace getVariable "bis_fnc_saveInventory_data";
private _loadouts_data = [];
private _counter = 0;
private _backpack = backpack player;
if ( !isNil "_saved_loadouts" ) then {
{
if ( _counter % 2 == 0 ) then {
@ -36,7 +36,7 @@ if ( count _loadouts_data > 0 ) then {
ctrlEnable [ 202, false ];
};
_loadplayers = [];
private _loadplayers = [];
{
if ( !(name _x in [ "HC1", "HC2", "HC3" ]) ) then {
_loadplayers pushback [ name _x, _x ];
@ -46,8 +46,8 @@ _loadplayers = [];
if ( count _loadplayers > 0 ) then {
{
_nextplayer = _x select 1;
_namestr = "";
private _nextplayer = _x select 1;
private _namestr = "";
if(count (squadParams _nextplayer) != 0) then {
_namestr = "[" + ((squadParams _nextplayer select 0) select 0) + "] ";
};
@ -72,35 +72,7 @@ while { dialog && (alive player) && edit_loadout == 0 } do {
[ player ] call F_correctLaserBatteries;
if (KP_liberation_arsenalUsePreset) then {
_playerItems = [];
if ((headgear player) != "") then {_playerItems pushback (headgear player);};
if ((goggles player) != "") then {_playerItems pushback (goggles player);};
if ((uniform player) != "") then {_playerItems pushback (uniform player);};
if ((vest player) != "") then {_playerItems pushback (vest player);};
if ((backpack player) != "") then {_playerItems pushback (backpack player);};
{if ((_x != "") && !(_x in _playerItems)) then {_playerItems pushback _x;};} forEach (assignedItems player);
{if ((_x != "") && !(_x in _playerItems)) then {_playerItems pushback _x;};} forEach (uniformItems player);
{if ((_x != "") && !(_x in _playerItems)) then {_playerItems pushback _x;};} forEach (vestItems player);
{if ((_x != "") && !(_x in _playerItems)) then {_playerItems pushback _x;};} forEach (weapons player);
{if ((_x != "") && !(_x in _playerItems)) then {_playerItems pushback _x;};} forEach (primaryWeaponItems player);
{if ((_x != "") && !(_x in _playerItems)) then {_playerItems pushback _x;};} forEach (secondaryWeaponItems player);
{if ((_x != "") && !(_x in _playerItems)) then {_playerItems pushback _x;};} forEach (handgunItems player);
if (({(_x in KP_liberation_allowed_items) || ((_x find "ACRE") != -1) || ((_x find "tf_") != -1) || ((_x find "TFAR_") != -1)} count _playerItems) != count _playerItems) then {
_text = format ["[KP LIBERATION] [BLACKLIST] Found %1 at Player %2", (_playerItems - KP_liberation_allowed_items), name player];
_text remoteExec ["diag_log",2];
_badItems = "";
{if (((_x find "ACRE") == -1) && ((_x find "tf_") == -1) && ((_x find "TFAR_") == -1)) then {_badItems = _badItems + _x + "\n";};} forEach (_playerItems - KP_liberation_allowed_items);
hint format [localize "STR_BLACKLISTED_ITEM_FOUND", _badItems];
removeAllWeapons player;
removeAllItems player;
removeAllAssignedItems player;
removeUniform player;
removeVest player;
removeBackpack player;
removeHeadgear player;
removeGoggles player;
} else {
if ([_backpack] call F_checkGear) then {
hint format [ localize "STR_HINT_LOADOUT_LOADED", _loaded_loadout];
};
} else {
@ -120,7 +92,7 @@ while { dialog && (alive player) && edit_loadout == 0 } do {
};
if ( load_from_player >= 0 ) then {
_playerselected = ( _loadplayers select load_from_player ) select 1;
private _playerselected = ( _loadplayers select load_from_player ) select 1;
if ( alive _playerselected ) then {
[ player, [ _playerselected, ["repetitive"] ] call F_getLoadout ] call F_setLoadout;
hint format [ localize "STR_LOAD_PLAYER_LOADOUT_HINT", name _playerselected ];
@ -139,36 +111,6 @@ if ( edit_loadout > 0 ) then {
if (KP_liberation_arsenalUsePreset) then {
uiSleep 5;
waitUntil {sleep 1; isNull (uinamespace getvariable "RSCDisplayArsenal")};
_playerItems = [];
if ((headgear player) != "") then {_playerItems pushback (headgear player);};
if ((goggles player) != "") then {_playerItems pushback (goggles player);};
if ((uniform player) != "") then {_playerItems pushback (uniform player);};
if ((vest player) != "") then {_playerItems pushback (vest player);};
if ((backpack player) != "") then {_playerItems pushback (backpack player);};
{if ((_x != "") && !(_x in _playerItems)) then {_playerItems pushback _x;};} forEach (assignedItems player);
{if ((_x != "") && !(_x in _playerItems)) then {_playerItems pushback _x;};} forEach (uniformItems player);
{if ((_x != "") && !(_x in _playerItems)) then {_playerItems pushback _x;};} forEach (vestItems player);
{if ((_x != "") && !(_x in _playerItems)) then {_playerItems pushback _x;};} forEach (backpackItems player);
{if ((_x != "") && !(_x in _playerItems)) then {_playerItems pushback _x;};} forEach (weapons player);
{if ((_x != "") && !(_x in _playerItems)) then {_playerItems pushback _x;};} forEach (primaryWeaponItems player);
{if ((_x != "") && !(_x in _playerItems)) then {_playerItems pushback _x;};} forEach (secondaryWeaponItems player);
{if ((_x != "") && !(_x in _playerItems)) then {_playerItems pushback _x;};} forEach (handgunItems player);
if (({(_x in KP_liberation_allowed_items) || ((_x find "ACRE") != -1) || ((_x find "tf_") != -1) || ((_x find "TFAR_") != -1)} count _playerItems) != count _playerItems) then {
_text = format ["[KP LIBERATION] [BLACKLIST] Found %1 at Player %2", (_playerItems - KP_liberation_allowed_items), name player];
_text remoteExec ["diag_log",2];
_badItems = "";
{if (((_x find "ACRE") == -1) && ((_x find "tf_") == -1) && ((_x find "TFAR_") == -1)) then {_badItems = _badItems + _x + "\n";};} forEach (_playerItems - KP_liberation_allowed_items);
hint format [localize "STR_BLACKLISTED_ITEM_FOUND", _badItems];
removeAllWeapons player;
removeAllItems player;
removeAllAssignedItems player;
removeUniform player;
removeVest player;
removeBackpack player;
removeHeadgear player;
removeGoggles player;
};
[_backpack] call F_checkGear;
};
};

View File

@ -29,6 +29,8 @@ while {true} do {
(GRLIB_force_redeploy || (player distance (getmarkerpos GRLIB_respawn_marker) < 50)) && vehicle player == player && alive player && !dialog && howtoplay == 0
};
private _backpack = backpack player;
fullmap = 0;
_old_fullmap = 0;
@ -184,36 +186,7 @@ while {true} do {
};
if (KP_liberation_arsenalUsePreset) then {
_playerItems = [];
if ((headgear player) != "") then {_playerItems pushback (headgear player);};
if ((goggles player) != "") then {_playerItems pushback (goggles player);};
if ((uniform player) != "") then {_playerItems pushback (uniform player);};
if ((vest player) != "") then {_playerItems pushback (vest player);};
if ((backpack player) != "") then {_playerItems pushback (backpack player);};
{if ((_x != "") && !(_x in _playerItems)) then {_playerItems pushback _x;};} forEach (assignedItems player);
{if ((_x != "") && !(_x in _playerItems)) then {_playerItems pushback _x;};} forEach (uniformItems player);
{if ((_x != "") && !(_x in _playerItems)) then {_playerItems pushback _x;};} forEach (vestItems player);
{if ((_x != "") && !(_x in _playerItems)) then {_playerItems pushback _x;};} forEach (backpackItems player);
{if ((_x != "") && !(_x in _playerItems)) then {_playerItems pushback _x;};} forEach (weapons player);
{if ((_x != "") && !(_x in _playerItems)) then {_playerItems pushback _x;};} forEach (primaryWeaponItems player);
{if ((_x != "") && !(_x in _playerItems)) then {_playerItems pushback _x;};} forEach (secondaryWeaponItems player);
{if ((_x != "") && !(_x in _playerItems)) then {_playerItems pushback _x;};} forEach (handgunItems player);
if (({(_x in KP_liberation_allowed_items) || ((_x find "ACRE") != -1) || ((_x find "tf_") != -1) || ((_x find "TFAR_") != -1)} count _playerItems) != count _playerItems) then {
_text = format ["[KP LIBERATION] [BLACKLIST] Found %1 at Player %2", (_playerItems - KP_liberation_allowed_items), name player];
_text remoteExec ["diag_log",2];
_badItems = "";
{if (((_x find "ACRE") == -1) && ((_x find "tf_") == -1) && ((_x find "TFAR_") == -1)) then {_badItems = _badItems + _x + "\n";};} forEach (_playerItems - KP_liberation_allowed_items);
hint format [localize "STR_BLACKLISTED_ITEM_FOUND", _badItems];
removeAllWeapons player;
removeAllItems player;
removeAllAssignedItems player;
removeUniform player;
removeVest player;
removeBackpack player;
removeHeadgear player;
removeGoggles player;
};
[_backpack] call F_checkGear;
};
if (KP_liberation_mobilerespawn && (KP_liberation_respawn_time > time)) then {

View File

@ -0,0 +1,54 @@
/*
F_checkGear
File: F_kp_checkGear.sqf
Author: Wyqer - https://github.com/Wyqer
Date: 2017-11-22
Last Update: 2017-11-22
Description:
Checks the players gear for blacklisted items and report these items. Also returns if the player check was fine (true) or if he had bad items (false).
Parameter(s):
0: STRING - Backpack classname of the players backpack as he entered the arsenal / load a loadout. (Default "")
Returns:
BOOL
*/
params [["_backpack", ""]];
private _return = true;
private _playerItems = [];
if ((headgear player) != "") then {_playerItems pushBack (headgear player);};
if ((goggles player) != "") then {_playerItems pushBack (goggles player);};
if ((uniform player) != "") then {_playerItems pushBack (uniform player);};
if ((vest player) != "") then {_playerItems pushBack (vest player);};
if (((backpack player) != "") && ((backpack player) != _backpack)) then {_playerItems pushBack (backpack player);};
{_playerItems pushBackUnique _x;} forEach (assignedItems player);
{_playerItems pushBackUnique _x;} forEach (uniformItems player);
{_playerItems pushBackUnique _x;} forEach (vestItems player);
{_playerItems pushBackUnique _x;} forEach (backpackItems player);
{_playerItems pushBackUnique _x;} forEach (weapons player);
{_playerItems pushBackUnique _x;} forEach (primaryWeaponItems player);
{_playerItems pushBackUnique _x;} forEach (secondaryWeaponItems player);
{_playerItems pushBackUnique _x;} forEach (handgunItems player);
if (({(_x in KP_liberation_allowed_items) || ((_x find "ACRE") != -1) || ((_x find "tf_") != -1) || ((_x find "TFAR_") != -1)} count _playerItems) != count _playerItems) then {
private _text = format ["[KP LIBERATION] [BLACKLIST] Found %1 at Player %2", (_playerItems - KP_liberation_allowed_items), name player];
_text remoteExec ["diag_log",2];
private _badItems = "";
{if (((_x find "ACRE") == -1) && ((_x find "tf_") == -1) && ((_x find "TFAR_") == -1)) then {_badItems = _badItems + _x + "\n";};} forEach (_playerItems - KP_liberation_allowed_items);
hint format [localize "STR_BLACKLISTED_ITEM_FOUND", _badItems];
removeAllWeapons player;
removeAllItems player;
removeAllAssignedItems player;
removeUniform player;
removeVest player;
removeBackpack player;
removeHeadgear player;
removeGoggles player;
_return = false;
};
_return

View File

@ -57,3 +57,4 @@ F_getResistanceTier = compileFinal preprocessFileLineNumbers "scripts\shared\fun
F_spawnGuerillaGroup = compileFinal preprocessFileLineNumbers "scripts\shared\functions\F_kp_spawnGuerillaGroup.sqf";
F_createCrate = compileFinal preprocessFileLineNumbers "scripts\shared\functions\F_kp_createCrate.sqf";
F_isClassUAV = compileFinal preprocessFileLineNumbers "scripts\shared\functions\F_kp_isClassUAV.sqf";
F_checkGear = compileFinal preprocessFileLineNumbers "scripts\shared\functions\F_kp_checkGear.sqf";

View File

@ -165,6 +165,7 @@ class Missions
* Tweaked: Extended allowed items extension list with some bwmod classnames. Thanks to [madpat3](https://github.com/madpat3)
* Tweaked: Detection of UAVs. Thanks to [veteran29](https://github.com/veteran29)
* Tweaked: Enemy vehicle crew spawning. Ensure that they'll be on the right side (important for red vs blue). Thanks to [veteran29](https://github.com/veteran29)
* Tweaked: If you enter the arsenal with a packed weapon or UAV backpack, it won't be identified as blacklisted anymore.
* Fixed: Wounded civilian animation in dedicated server environment. Thanks to [veteran29](https://github.com/veteran29)
### 0.961 (6th November 2017)