optimize and fix recent group issue

This commit is contained in:
vbawol 2017-03-23 10:09:02 -05:00
parent 77b6ed4f18
commit ee2cf61d83

View File

@ -13,7 +13,7 @@
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_player/EPOCH_server_loadPlayer.sqf https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_player/EPOCH_server_loadPlayer.sqf
*/ */
//[[[cog import generate_private_arrays ]]] //[[[cog import generate_private_arrays ]]]
private ["_alreadyDead","_apperance","_arr","_attachments","_backpack","_canBeRevived","_class","_currWeap","_deadPlayer","_dir","_equipped","_found","_goggles","_group","_headgear","_hitpoints","_instanceID","_itemsInContainers","_jammer","_jammers","_linkedItems","_location","_medical","_newLocation","_newPlyr","_normalMagazines","_playerGroup","_playerGroupArray","_playerNetID","_playerUID","_prevInstance","_reject","_response","_serverSettingsConfig","_server_vars","_type","_uniform","_vars","_vest","_wMags","_wMagsArray","_weapon","_weaponsAndItems","_weaponsInContainers","_worldspace"]; private ["_alreadyDead","_attachments","_backpack","_canBeRevived","_class","_currWeap","_deadPlayer","_dir","_equipped","_found","_goggles","_group","_headgear","_hitpoints","_instanceID","_itemsInContainers","_jammer","_jammers","_linkedItems","_location","_newLocation","_newPlyr","_normalMagazines","_playerData","_playerGroup","_playerGroupArray","_playerNetID","_playerUID","_reject","_serverSettingsConfig","_type","_uniform","_vars","_vest","_wMags","_wMagsArray","_weapon","_weaponsAndItems","_weaponsInContainers"];
//[[[end]]] //[[[end]]]
_reject = true; _reject = true;
@ -30,14 +30,18 @@ if (!isNull _player) then {
_playerNetID = owner _player; _playerNetID = owner _player;
_playerUID = getPlayerUID _player; _playerUID = getPlayerUID _player;
if (_playerUID != "") then { if (_playerUID != "") then {
// Make Hive call // Make Hive call
_response = ["Player", _playerUID] call EPOCH_fnc_server_hiveGETRANGE; _playerData = [];
_arr = []; (["Player", _playerUID] call EPOCH_fnc_server_hiveGETRANGE) params [
if ((_response select 0) == 1 && (_response select 1) isEqualType []) then { ["_status", 0 ],
_arr = (_response select 1); ["_playerDataTmp", [] ]
}; ];
if (_status == 1 && _playerDataTmp isEqualType []) then {
_playerData = _playerDataTmp;
};
// Apperance defaults // Apperance defaults
_uniform = [_serverSettingsConfig, "defaultUniformFemale", "U_Test_uniform"] call EPOCH_fnc_returnConfigEntry; _uniform = [_serverSettingsConfig, "defaultUniformFemale", "U_Test_uniform"] call EPOCH_fnc_returnConfigEntry;
@ -61,25 +65,21 @@ if (!isNull _player) then {
// todo make dynamic // todo make dynamic
if (count _arr < 11) then { // invaild format attempt to override if (count _playerData < 11) then { // invaild format attempt to override
_arr = [[0, [], _instanceID], [0, 0, 1, 0, []], [_goggles, _headgear, _vest, _backpack, _uniform, _class], [], call EPOCH_defaultVars_SEPXVar, _weaponsAndItems, _linkedItems, _normalMagazines, _itemsInContainers, _weaponsInContainers, "", true]; _playerData = [[0, [], _instanceID], [0, 0, 1, 0, []], [_goggles, _headgear, _vest, _backpack, _uniform, _class], [], call EPOCH_defaultVars_SEPXVar, _weaponsAndItems, _linkedItems, _normalMagazines, _itemsInContainers, _weaponsInContainers, "", true];
}; };
_worldspace = _arr select 0; _playerData params ["_worldspace","_medical","","_server_vars","_vars","","","","","","_playerGroup","_canBeRevived"];
_dir = _worldspace select 0;
_location = _worldspace select 1; // Load world space and previous instance id
_worldspace params ["_dir","_location","_prevInstance"];
if (count _location == 2) then{ if (count _location == 2) then{
_location = (_location select 0) vectorAdd (_location select 1); _location = (_location select 0) vectorAdd (_location select 1);
}; };
_prevInstance = _worldspace select 2;
_medical = _arr select 1;
_server_vars = _arr select 3;
_vars = _arr select 4;
// Get player group // Get player group
_playerGroup = _arr select 10; _playerGroupArray = [];
// check players group // check players group
if (_playerGroup != "") then { if (_playerGroup != "") then {
_found = false; _found = false;
@ -103,8 +103,6 @@ if (!isNull _player) then {
diag_log format["DEBUG (Load Player) Set Group: %1", _playerGroup]; diag_log format["DEBUG (Load Player) Set Group: %1", _playerGroup];
}; };
_canBeRevived = _arr select 11;
_hitpoints = _vars select 11; _hitpoints = _vars select 11;
_deadPlayer = ["PlayerStats", _playerUID, 0] call EPOCH_fnc_server_hiveGETBIT; _deadPlayer = ["PlayerStats", _playerUID, 0] call EPOCH_fnc_server_hiveGETBIT;
@ -181,25 +179,15 @@ if (!isNull _player) then {
if (!_alreadyDead) then { if (!_alreadyDead) then {
// Medical // Medical
_newPlyr setBleedingRemaining(_medical select 0); _medical params ["_bleedingRemaining","_fatigue","_oxygenRemaining","_damage"];
// _newPlyr setFatigue (_medical select 1); _newPlyr setBleedingRemaining _bleedingRemaining;
_newPlyr setOxygenRemaining(_medical select 2); // _newPlyr setFatigue _fatigue;
_newPlyr setDamage(_medical select 3); _newPlyr setOxygenRemaining _oxygenRemaining;
_newPlyr setDamage _damage;
// Apperance // Apperance + Weapons
_apperance = _arr select 2; _playerData params ["","","_apperance","","","_weaponsAndItems","_linkedItems","_normalMagazines","_itemsInContainers","_weaponsInContainers"];
_goggles = _apperance select 0; // load Apperance
_headgear = _apperance select 1; _apperance params ["_goggles","_headgear","_vest","_backpack","_uniform"];
_vest = _apperance select 2;
_backpack = _apperance select 3;
_uniform = _apperance select 4;
// Weapons
_weaponsAndItems = _arr select 5;
_linkedItems = _arr select 6;
_normalMagazines = _arr select 7;
_itemsInContainers = _arr select 8;
_weaponsInContainers = _arr select 9;
}; };
// Load Apperance START // Load Apperance START
@ -222,7 +210,7 @@ if (!isNull _player) then {
// Load inventory + defaults START // Load inventory + defaults START
if (count _weaponsAndItems >= 3) then { if (count _weaponsAndItems >= 3) then {
_equipped = _weaponsAndItems select 2; _weaponsAndItems params ["_currWeap","_weaponsAndItemsArray","_equipped"];
{ {
_weapon = _x deleteAt 0; _weapon = _x deleteAt 0;
_type = getNumber(configfile >> "cfgweapons" >> _weapon >> "type"); _type = getNumber(configfile >> "cfgweapons" >> _weapon >> "type");
@ -275,8 +263,7 @@ if (!isNull _player) then {
_newPlyr addItem _x; _newPlyr addItem _x;
} forEach _attachments; } forEach _attachments;
}; };
} forEach(_weaponsAndItems select 1); } forEach _weaponsAndItemsArray;
_currWeap = _weaponsAndItems select 0;
}; };
// Linked items // Linked items
{ {