test fix issue with joining a dead players groups

optimize reduce number of allPlayer calls
This commit is contained in:
vbawol 2017-03-05 11:04:43 -06:00
parent c477b9bf58
commit 7714c62e96
7 changed files with 47 additions and 59 deletions

View File

@ -30,12 +30,8 @@ _modOrMemberRevert = if (_this select 3) then [{4},{3}];
_response = ["Group", _groupID] call EPOCH_fnc_server_hiveGETRANGE;
if ((_response select 0) == 1 && (_response select 1) isEqualType []) then {
_contentArray = _response select 1;
//_groupName = _contentArray select 0;
//_leaderName = _contentArray select 1;
//_groupSize = _contentArray select 2;
_modArray = _contentArray select 3;
_memberArray = _contentArray select 4;
_contentArray params ["_groupName","_leaderName","_groupSize","_modArray","_memberArray"];
_allPlayers = allPlayers select {alive _x};
if (_addOrRemove) then { //Add
_selectedPlayerName = "Dead Player";
@ -49,14 +45,14 @@ if ((_response select 0) == 1 && (_response select 1) isEqualType []) then {
if ((_x getVariable["GROUP",""]) == _groupID) exitWith {
_group = group _x;
};
}count allPlayers;
} forEach _allPlayers;
if (isNull _group) then {
_group = createGroup west;
};
[_x] joinSilent _group;
};
} forEach (allPlayers select {getPlayerUID _x == _selectedPlayerUID});
} forEach (_allPlayers select {getPlayerUID _x == _selectedPlayerUID});
// find player name from DB
if (_selectedPlayerName == "Dead Player") then {
@ -91,7 +87,7 @@ if ((_response select 0) == 1 && (_response select 1) isEqualType []) then {
_x setVariable ["GROUP", nil];
[_x] joinSilent (createGroup west);
[["resetGroup", true], _x] call EPOCH_sendRemoteExecClient;
} forEach (allPlayers select {getPlayerUID _x == _selectedPlayerUID});
} forEach (_allPlayers select {getPlayerUID _x == _selectedPlayerUID});
{
if (_x select 0 == _selectedPlayerUID) exitWith {
@ -119,7 +115,7 @@ if ((_response select 0) == 1 && (_response select 1) isEqualType []) then {
{
[["groupUpdate", _contentArray], _x] call EPOCH_sendRemoteExecClient;
} forEach (allPlayers select {(_x getVariable["GROUP", ""]) == _groupID});
} forEach (_allPlayers select {(_x getVariable["GROUP", ""]) == _groupID});
// Save Group Data
["Group", _groupID, _contentArray] call EPOCH_fnc_server_hiveSET;

View File

@ -153,7 +153,7 @@ if (!isNull _player) then {
if ((_x getVariable["GROUP", ""]) == _playerGroup) exitWith{
_group = group _x;
};
} forEach allPlayers;
} forEach (allPlayers select {alive _x});
};
if (isNull _group) then {

View File

@ -107,7 +107,7 @@ if (!local _player) then {
if ((_x getVariable["GROUP",""]) == _playerGroup) exitWith {
_group = group _x;
};
}forEach allPlayers;
}forEach (allPlayers select {alive _x});
if (isNull _group) then {
_group = createGroup west;

View File

@ -1268,12 +1268,10 @@ _skn_admincode = compileFinal ("
if ("+_skn_tg_map_player+") then {
_size = (0.5/ctrlMapScale _display) max 20;
{
if (isPlayer _x) then {
_display drawIcon [
getText (configFile >> 'CfgVehicles' >> typeOf _x >> 'Icon'), _x call _getDmgColor, visiblePosition _x, _size, _size, getDir _x, name _x
];
};
}forEach allPlayers;
_display drawIcon [
getText (configFile >> 'CfgVehicles' >> typeOf _x >> 'Icon'), _x call _getDmgColor, visiblePosition _x, _size, _size, getDir _x, name _x
];
}forEach (allPlayers select {alive _x});
};
if ("+_skn_tg_map_corpse+") then {
_size = (1/ctrlMapScale _display) max 20;
@ -1284,7 +1282,7 @@ _skn_admincode = compileFinal ("
getText (configFile >> 'CfgVehicles' >> typeOf _x >> 'Icon'), _color, visiblePosition _x, _size, _size, getDir _x, typeOf _x
];
};
}forEach allDeadMen;
}forEach (allPlayers select {!alive _x});
};
if ("+_skn_tg_map_loot+") then {
{

View File

@ -5,11 +5,11 @@ item0[] = {"Init",0,250,600.000000,-575.000000,700.000000,-525.000000,0.000000,"
item1[] = {"_",8,218,600.000000,-500.000000,700.000000,-450.000000,0.000000,""};
item2[] = {"Process",2,250,600.000000,-350.000000,700.000000,-300.000000,0.000000,"Process"};
item3[] = {"De_simulate_Vehicle",4,218,750.000000,-225.000000,850.000000,-175.000000,2.000000,"De-simulate" \n "Vehicle Check"};
item4[] = {"Simulate_Vehicle",4,4314,750.000000,-300.000000,850.000000,-250.000000,1.000000,"Simulate" \n "Vehicle Check"};
item4[] = {"Simulate_Vehicle",4,218,750.000000,-300.000000,850.000000,-250.000000,1.000000,"Simulate" \n "Vehicle Check"};
item5[] = {"CMD_queue",4,218,450.000000,-450.000000,550.000000,-400.000000,10.000000,"CMD queue"};
item6[] = {"Save_Players",4,218,450.000000,-375.000000,550.000000,-325.000000,3.000000,"Save" \n "Players"};
item7[] = {"Cleanup",4,218,750.000000,-375.000000,850.000000,-325.000000,8.000000,"Cleanup"};
item8[] = {"Events",4,218,450.000000,-225.000000,550.000000,-175.000000,0.000000,"Events"};
item8[] = {"Events",4,4314,450.000000,-225.000000,550.000000,-175.000000,0.000000,"Events"};
item9[] = {"Save_Vehicles",4,218,450.000000,-300.000000,550.000000,-250.000000,4.000000,"Save" \n "Vehicles"};
item10[] = {"Cleanup_Handler",4,218,750.000000,-450.000000,850.000000,-400.000000,8.000000,"Cleanup" \n "Handler"};
item11[] = {"Server_FPS",4,218,600.000000,-225.000000,700.000000,-175.000000,0.000000,"Server FPS"};
@ -33,8 +33,8 @@ link16[] = {8,2};
link17[] = {9,2};
link18[] = {10,2};
link19[] = {11,2};
globals[] = {0.000000,0,0,0,0,640,480,1,3,6316128,1,275.180084,1161.319580,208.497711,-659.879456,898,854,1};
window[] = {2,-1,-1,-1,-1,786,-1654,-362,26,3,916};
globals[] = {0.000000,0,0,0,0,640,480,1,3,6316128,1,275.180084,1161.319580,208.497711,-659.879456,898,884,1};
window[] = {2,-1,-1,-1,-1,968,208,1500,208,3,916};
*//*%FSM</HEAD>*/
class FSM
{
@ -318,39 +318,36 @@ class FSM
action=/*%FSM<ACTION""">*/"_delayTimeSim = diag_tickTime;" \n
"_playersTemp = [];" \n
"{ " \n
" if (isPlayer _x) then {" \n
"" \n
" {" \n
" if !(typeOf _x in _safeVehicles) then {" \n
" if (_x call EPOCH_server_getVToken) then {" \n
" if (_simulationHandler && !(simulationEnabled _x)) then {" \n
" _x enableSimulationGlobal true;" \n
" _activeVehicles pushBack _x;" \n
" };" \n
" } else {" \n
" if ((objectCurators _x) isEqualTo []) then {" \n
" diag_log format[""DEBUG: Invalid Vehicle Token, deleted %1"",_x];" \n
" deleteVehicle _x;" \n
" };" \n
" };" \n
" {" \n
" if !(typeOf _x in _safeVehicles) then {" \n
" if (_x call EPOCH_server_getVToken) then {" \n
" if (_simulationHandler && !(simulationEnabled _x)) then {" \n
" _x enableSimulationGlobal true;" \n
" _activeVehicles pushBack _x;" \n
" };" \n
" } else {" \n
" if ((objectCurators _x) isEqualTo []) then {" \n
" diag_log format[""DEBUG: Invalid Vehicle Token, deleted %1"",_x];" \n
" deleteVehicle _x;" \n
" };" \n
" }forEach (_x nearEntities[[""LandVehicle"", ""Ship"", ""Air"", ""Tank""], 300]);" \n
"" \n
"" \n
" _pUID = getPlayerUID _x;" \n
"" \n
" if !(_x call EPOCH_server_isPAdmin) then {" \n
" if (isObjectHidden _x) then {" \n
" _x hideObjectGlobal false;" \n
" };" \n
" if (_pUID != """") then {" \n
" _playersTemp pushBack _pUID;" \n
" [_pUID, _x] call _checkAuth;" \n
" };" \n
" } else {" \n
" if (_pUID != """") then { _playersTemp pushBack _pUID; };" \n
" };" \n
" }forEach (_x nearEntities[[""LandVehicle"", ""Ship"", ""Air"", ""Tank""], 300]);" \n
"" \n
" _pUID = getPlayerUID _x;" \n
"" \n
" if !(_x call EPOCH_server_isPAdmin) then {" \n
" if (isObjectHidden _x) then {" \n
" _x hideObjectGlobal false;" \n
" };" \n
" if (_pUID != """") then {" \n
" _playersTemp pushBack _pUID;" \n
" [_pUID, _x] call _checkAuth;" \n
" };" \n
" } else {" \n
" if (_pUID != """") then { _playersTemp pushBack _pUID; };" \n
" };" \n
"" \n
"}forEach allPlayers;" \n
"_players = _playersTemp;"/*%FSM</ACTION""">*/;
};
@ -460,4 +457,4 @@ class FSM
{
};
};
/*%FSM</COMPILE>*/
/*%FSM</COMPILE>*/

View File

@ -10,10 +10,7 @@ _chance = 50;
if (random 100 < _chance) then {
// get all alive players
_players = [];
{
if (alive _x) then {_players pushBack _x};
} forEach allPlayers;
_players = allPlayers select {alive _x};
// continue if players found alive
if !(_players isEqualTo []) then {

View File

@ -1,9 +1,9 @@
/*
Give everyone on the server 100 Crypto.
Give everyone alive on the server 100 Crypto.
by Aaron Clark - EpochMod.com
Improvements and or bugfixes and other contributions are welcome via the github:
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server_settings/EpochEvents/PaydayEvent.sqf
*/
{[_x,100] call EPOCH_server_effectCrypto;} forEach allPlayers;
{[_x,100] call EPOCH_server_effectCrypto;} forEach (allPlayers select {alive _x});