mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
updates to login system and hitpoints
- No longer track hitpoints from client side, now saved server side only and pushed to clients on login. https://community.bistudio.com/wiki/getAllHitPointsDamage - Changed use set / getUnitLoadout and should still have legacy player data support that will upgrade automatically on first save. - Default loadout can be controlled via new variables in epochconfig.hpp - Made data validation check dynamic using isEqualTypeParams as it does type checking and still fails if input is shorter than the default. https://community.bistudio.com/wiki/isEqualTypeParams - Added back server side damage protection for the new player body. If the new unit dies before the player switch it could cause login issues and should not cause issues with scripted setdamage or hitpoints as first thought. https://community.bistudio.com/wiki/allowDamage
This commit is contained in:
parent
7cbcb2c530
commit
1a211407b9
@ -30,7 +30,8 @@ antagonistChanceLoot = 0.09; //9% chance when player click "SEARCH" on a loot ob
|
||||
// Player Related
|
||||
cloneCost = 100; // debt incurred on player death
|
||||
MaxBankDebitforTrade = -50000; // If Player has less money on Bank, Crypto from Trade goes directly to Bank instead to Player
|
||||
// Start Leadout
|
||||
|
||||
// Default Loadout
|
||||
defaultUniformFemale = "U_Test_uniform";
|
||||
defaultVestFemale = "V_F41_EPOCH";
|
||||
defaultUniformMale = "U_Test1_uniform";
|
||||
@ -38,47 +39,14 @@ defaultVestMale = "V_41_EPOCH";
|
||||
defaultGoggles = "";
|
||||
defaultHeadgear = "";
|
||||
defaultBackpack = "";
|
||||
linkedItems[] = {"ItemMap","EpochRadio0"}; // {"Item1","Item2",...}; These Items will be linked to the Players Inventory
|
||||
itemsInContainers[] = {}; // {"Item1","Item2",...}; These Items will be put in the Players Cargo(s)
|
||||
weaponsInContainers[] = {}; // {"Weapon1","Weapon2",...}; These Weapons will be put in the Players Cargo(s)
|
||||
normalMagazines[] = {}; // {{"Magazine1",Ammocount1},{"Magazine2",Ammocount2},...};
|
||||
weaponsAndItems[] = {
|
||||
/*
|
||||
"srifle_EBR_F", // Active Weapon (in hand)
|
||||
{ // Full equipped Weapons (put here equipped Weapons that should be in the Weapons Slots)
|
||||
{
|
||||
"srifle_EBR_F", // Weapon 1
|
||||
"muzzle_snds_B", // Suppressor 1
|
||||
"acc_pointer_IR", // Laser 1
|
||||
"optic_DMS", // Optics 1
|
||||
{"20Rnd_762x51_Mag",20}, // Magtype + ammo count 1
|
||||
{}, // 2nd Magtype + ammo count 1 (Only needed for GL-Mags)
|
||||
"bipod_02_F_blk" // Bipod 1
|
||||
},
|
||||
{
|
||||
"Plunger", // Weapon 2
|
||||
"", // Suppressor 2
|
||||
"", // Laser 2
|
||||
"", // Optics 2
|
||||
{"stick_swing",1000}, // Magtype + ammo count 2
|
||||
""
|
||||
},
|
||||
{
|
||||
"ruger_pistol_epoch",
|
||||
"", // Suppressor 3
|
||||
"", // Laser 3
|
||||
"", // Optics 3
|
||||
{"10rnd_22X44_magazine",10}, // Magtype + ammo count 3
|
||||
"" // Bipod 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"srifle_EBR_F", // Primary Weapon
|
||||
"Plunger", // Secondary Weapon
|
||||
"ruger_pistol_epoch" // Handgun Weapon
|
||||
}
|
||||
*/
|
||||
};
|
||||
defaultprimaryWeapon[] = {}; // {"arifle_MX_pointer_F","","acc_pointer_IR","",{"30Rnd_65x39_caseless_mag",29},{},""};
|
||||
defaultsecondaryWeapon[] = {}; // {"launch_NLAW_F","","","",{"NLAW_F",1},{},""};
|
||||
defaulthandgunWeapon[] = {}; // {"hgun_P07_F","","","",{"16Rnd_9x21_Mag",16},{},""};
|
||||
defaultuniformItems[] = {}; // {{"FirstAidKit",1},{"30Rnd_65x39_caseless_mag",2,30},{"Chemlight_green",1,1}};
|
||||
defaultvestItems[] = {}; // {{"30Rnd_65x39_caseless_mag",3,30},{"16Rnd_9x21_Mag",2,16},{"SmokeShell",1,1},{"SmokeShellGreen",1,1},{"SmokeShellBlue",1,1},{"SmokeShellOrange",1,1},{"Chemlight_green",1,1}};
|
||||
defaultbackpackItems[] = {}; // {{"Medikit",1},{"FirstAidKit",10},{{"hgun_P07_F","","","",{"16Rnd_9x21_Mag",16},{},""},1}};
|
||||
defaultassignedItems[] = {}; // {"Rangefinder","","","",{},{},""}
|
||||
defaultlinkedItems[] = {"ItemMap","","EpochRadio0","","",""}; // {"ItemMap","ItemGPS","ItemRadio","ItemCompass","ItemWatch","NVGoggles"};
|
||||
|
||||
// vehicles - Max vehicle slots is calculated from per vehicle limits below. Warning! Higher the number lower the performance.
|
||||
disableAutoRefuel = "true"; // Removes auto refuel from all buildings at server startup.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*%FSM<COMPILE "C:\Program Files (x86)\Steam\steamapps\common\Arma 3 Tools\FSMEditor\scriptedFSM.cfg, Epoch Login">*/
|
||||
/*%FSM<COMPILE "F:\Program Files (x86)\Steam\steamapps\common\Arma 3 Tools\FSMEditor\scriptedFSM.cfg, Epoch Login">*/
|
||||
/*%FSM<HEAD>*/
|
||||
/*
|
||||
item0[] = {"INIT",0,250,-25.000000,-375.000000,75.000000,-325.000000,0.000000,"INIT"};
|
||||
item0[] = {"INIT",0,4346,-25.000000,-375.000000,75.000000,-325.000000,0.000000,"INIT"};
|
||||
item1[] = {"FINISH",1,250,-149.463196,1518.792480,-49.463196,1568.792480,0.000000,"FINISH"};
|
||||
item2[] = {"true",8,218,-150.000000,-125.000000,-50.000000,-75.000000,0.000000,"true"};
|
||||
item3[] = {"Version_Check",2,250,-25.000000,-75.000000,75.000000,-25.000000,0.000000,"Version Check"};
|
||||
@ -18,7 +18,7 @@ item13[] = {"ERROR_PlayerUID",2,250,275.000000,125.000000,375.000000,175.000000,
|
||||
item14[] = {"",7,210,471.000061,145.999908,478.999939,154.000092,0.000000,""};
|
||||
item15[] = {"Timeout_No_Respo",4,218,125.000000,875.000000,225.000000,925.000000,0.000000,"Timeout" \n "No Response"};
|
||||
item16[] = {"Response",4,218,-150.000000,825.000000,-50.000000,875.000000,0.000000,"Response"};
|
||||
item17[] = {"Setup_Player_Var",2,4346,-25.000000,1075.000000,75.000000,1125.000000,0.000000,"Setup Player" \n "Variables"};
|
||||
item17[] = {"Setup_Player_Var",2,250,-25.000000,1075.000000,75.000000,1125.000000,0.000000,"Setup Player" \n "Variables"};
|
||||
item18[] = {"Request_Hive",2,250,-25.000000,575.000000,75.000000,625.000000,0.000000,"Request Hive"};
|
||||
item19[] = {"Timeout_No_Respo",4,218,125.000000,575.000000,225.000000,625.000000,0.000000,"Timeout" \n "No Response"};
|
||||
item20[] = {"ERROR_Server_not",2,250,275.000000,875.000000,375.000000,925.000000,0.000000,"ERROR" \n "Server not" \n "Response"};
|
||||
@ -183,8 +183,8 @@ link93[] = {82,76};
|
||||
link94[] = {83,16};
|
||||
link95[] = {83,22};
|
||||
link96[] = {84,31};
|
||||
globals[] = {0.000000,0,0,0,0,640,480,1,247,6316128,1,-374.618774,303.072205,1651.411377,653.207275,573,844,1};
|
||||
window[] = {2,-1,-1,-1,-1,863,96,1080,96,3,595};
|
||||
globals[] = {0.000000,0,0,0,0,640,480,1,247,6316128,1,-406.572662,335.025604,359.874329,-776.300476,577,884,1};
|
||||
window[] = {2,-1,-1,-32000,-32000,871,104,1088,104,3,595};
|
||||
*//*%FSM</HEAD>*/
|
||||
class FSM
|
||||
{
|
||||
@ -209,7 +209,10 @@ class FSM
|
||||
"EPOCH_loginFSM = _thisFSM;" \n
|
||||
"EPOCH_playerLoginInit = {" \n
|
||||
" EPOCH_loginFSM setFSMVariable [_this select 0, _this select 1];" \n
|
||||
"};"/*%FSM</STATEINIT""">*/;
|
||||
"};" \n
|
||||
"" \n
|
||||
"// init vars " \n
|
||||
"_hitpoints = [];"/*%FSM</STATEINIT""">*/;
|
||||
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
|
||||
class Links
|
||||
{
|
||||
@ -893,11 +896,10 @@ class FSM
|
||||
" player addEventHandler [_x,([""CfgEpochClient"", _x, """"] call EPOCH_fnc_returnConfigEntryV2)];" \n
|
||||
"} forEach ([""CfgEpochClient"", ""addEventHandler"", []] call EPOCH_fnc_returnConfigEntryV2);" \n
|
||||
"" \n
|
||||
"if (count EPOCH_playerHitPoints isEqualTo count ((getAllHitPointsDamage player) param [0,[]])) then {" \n
|
||||
"// set inital hitpoints" \n
|
||||
"{" \n
|
||||
" player setHitIndex [_forEachIndex, _x];" \n
|
||||
" }forEach EPOCH_playerHitPoints;" \n
|
||||
"};" \n
|
||||
"}forEach _hitpoints;" \n
|
||||
"" \n
|
||||
"true call EPOCH_fnc_Weather;" \n
|
||||
"[5,100] spawn EPOCH_niteLight;" \n
|
||||
@ -1400,6 +1402,7 @@ class FSM
|
||||
"Epoch_personalToken = _C_SET deleteAt 0;" \n
|
||||
"Epoch_my_Group = _C_SET deleteAt 0;" \n
|
||||
"_communityStats = _C_SET deleteAt 0;" \n
|
||||
"_hitpoints = _C_SET deleteAt 0;" \n
|
||||
"" \n
|
||||
"_extraPayload = _C_SET deleteAt 0;" \n
|
||||
"" \n
|
||||
|
@ -27,7 +27,6 @@ private ["_customVars","_lastSave","_time"];
|
||||
_time = if (_this) then [{15},{80}];
|
||||
_lastSave = missionNamespace getVariable["EPOCH_lastSave", diag_tickTime];
|
||||
if ((diag_tickTime - _lastSave) >= _time) then {
|
||||
EPOCH_playerHitPoints = ((getAllHitPointsDamage player) param [2,[]]);
|
||||
_customVars = [];
|
||||
{
|
||||
_customVars pushBack (missionNamespace getVariable format["EPOCH_player%1",_x]);
|
||||
|
@ -60,7 +60,6 @@ EPOCH_customVarsDefaults = [
|
||||
["Toxicity",0,[100,0]],
|
||||
["Stamina",100,["EPOCH_playerStaminaMax",0]],
|
||||
["Crypto",0,[250000,0]],
|
||||
["HitPoints",[0,0,0,0],[1,1,1,1]],
|
||||
["BloodP",100,[190,0]],
|
||||
["SpawnArray",[],[]],
|
||||
["Karma",0,[50000,-50000]],
|
||||
|
@ -56,7 +56,7 @@ class CfgEpochClient
|
||||
niteLight[] = {1,1.88,22}; //Set ambient lighting at night: {Brightness of light,Height of light}. Default (Low Ambient): {1.88,22} | Twilight: {7.2,88} | Distant: {12.8,142}
|
||||
ryanZombiesEnabled = "true";
|
||||
antagonistSpawnIndex[] = {{"Epoch_Cloak_F",1},{"GreatWhite_F",2},{"Epoch_Sapper_F",2},{"Epoch_SapperG_F",1},{"Epoch_SapperB_F",1},{"I_UAV_01_F",2},{"PHANTOM",1},{"B_Heli_Transport_01_F",1},{"EPOCH_RyanZombie_1",12},{"I_Soldier_EPOCH",1}}; // {"type", limit}
|
||||
customVarsDefaults[] = {{"Temp",98.6,{106.7,95,102,105,96,95}},{"Hunger",1500,{5000,0,5001,5001,1250,0}},{"Thirst",750,{2500,0,2501,2501,625,0}},{"AliveTime",0,{-2,0}},{"Energy",0,{2500,0}},{"Wet",0,{100,0,35,55,-1,-1}},{"Soiled",0,{100,0,35,55,-1,-1}},{"Immunity",0,{100,0}},{"Toxicity",0,{100,0,35,55,-1,-1}},{"Stamina",100,{"EPOCH_playerStaminaMax",0}},{"Crypto",0,{250000,0}},{"HitPoints",{0,0,0,0},{1,0,0.5,1,-1,-1}},{"BloodP",100,{190,0,120,140,70,50}},{"SpawnArray",{},{}},{"Karma",0,{50000,-50000}},{"Alcohol",0,{100,0,35,55,-1,-1}},{"Radiation",0,{100,0,35,55,-1,-1}},{"Nuisance",0,{100,0}},{"MissionArray",{},{}}}; // EPOCH_player + varName, default value, {max,min,high-warn,high-critical,low-warn,low-critical}
|
||||
customVarsDefaults[] = {{"Temp",98.6,{106.7,95,102,105,96,95}},{"Hunger",1500,{5000,0,5001,5001,1250,0}},{"Thirst",750,{2500,0,2501,2501,625,0}},{"AliveTime",0,{-2,0}},{"Energy",0,{2500,0}},{"Wet",0,{100,0,35,55,-1,-1}},{"Soiled",0,{100,0,35,55,-1,-1}},{"Immunity",0,{100,0}},{"Toxicity",0,{100,0,35,55,-1,-1}},{"Stamina",100,{"EPOCH_playerStaminaMax",0}},{"Crypto",0,{250000,0}},{"BloodP",100,{190,0,120,140,70,50}},{"SpawnArray",{},{}},{"Karma",0,{50000,-50000}},{"Alcohol",0,{100,0,35,55,-1,-1}},{"Radiation",0,{100,0,35,55,-1,-1}},{"Nuisance",0,{100,0}},{"MissionArray",{},{}}}; // EPOCH_player + varName, default value, {max,min,high-warn,high-critical,low-warn,low-critical}
|
||||
// add any stats and their starting number here for better community integration and neat stats tracking too!
|
||||
defineCommunityStats[] = {{"Murders",0},{"Deaths",0},{"Suicides",0},{"Revives",0},{"TraderMissions",0},{"AIKills",0},{"AntagonistKills",0},{"ZombieKills",0}};
|
||||
hudConfigs[] = {{{"BloodP","","",{"getPlayerDamage",">=",0.7}},"topRight","x\addons\a3_epoch_code\Data\UI\bleeding_ca.paa",{"forceUpdate"}},{{"Oxygen","getPlayerOxygenRemaining","",{},{1,0,2,2,1,0.55}},"topRight","x\addons\a3_epoch_code\Data\UI\oxygen_ca.paa"},{"Hunger","topRight","x\addons\a3_epoch_code\Data\UI\hunger_ca.paa",{"forceBloodRise"}},{"Thirst","topRight","x\addons\a3_epoch_code\Data\UI\thirst_ca.paa",{"forceBloodRise"}},{"Temp","topRight",{"x\addons\a3_epoch_code\Data\UI\hot_ca.paa","x\addons\a3_epoch_code\Data\UI\cold_ca.paa"},{"forceFatigue"}},{"Toxicity","topRight","x\addons\a3_epoch_code\Data\UI\hazzard_ca.paa"},{"Alcohol","topRight","x\addons\a3_epoch_code\Data\UI\drunk_ca.paa"},{"Soiled","topRight","x\addons\a3_epoch_code\Data\UI\soiled_ca.paa"},{"Radiation","topRight","x\addons\a3_epoch_code\Data\UI\rads_ca.paa"},{{"HitPoints","getPlayerHitPointDamage","HitLegs"},"topRight","x\addons\a3_epoch_code\Data\UI\broken_ca.paa"}};
|
||||
|
@ -13,7 +13,7 @@
|
||||
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_player/EPOCH_server_checkPlayer.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_apperance","_arr","_class","_dead","_deadPlayer","_hitpoints","_isMale","_medical","_playerUID","_response","_vars","_communityStatsArray"];
|
||||
private ["_apperance","_arr","_class","_communityStatsArray","_dead","_deadPlayer","_defaultData","_instanceID","_isMale","_medical","_playerUID","_response","_return","_vars"];
|
||||
//[[[end]]]
|
||||
params [["_playerObj",objNull]];
|
||||
if (_playerObj isEqualType objNull) then {
|
||||
@ -26,12 +26,19 @@ if (_playerObj isEqualType objNull) then {
|
||||
_dead = false;
|
||||
_isMale = true;
|
||||
|
||||
_instanceID = call EPOCH_fn_InstanceID;
|
||||
_class = "Epoch_Female_F";
|
||||
|
||||
_arr = [];
|
||||
if ((_response select 0) == 1 && (_response select 1) isEqualType []) then {
|
||||
_arr = (_response select 1);
|
||||
};
|
||||
|
||||
if (count _arr < 11) then {
|
||||
// empty default data format, if "Player" data format is changed update this array!
|
||||
_defaultData = [[], [], [], [], [], [], [], [], [], [], "", true];
|
||||
|
||||
// If data does not validate against default or is too short, assume player is new or already dead.
|
||||
if !(_arr isEqualTypeParams _defaultData) then {
|
||||
_dead = true;
|
||||
} else {
|
||||
_medical = _arr select 1;
|
||||
@ -40,13 +47,11 @@ if (_playerObj isEqualType objNull) then {
|
||||
if (_class == "Epoch_Female_F") then {
|
||||
_isMale = false;
|
||||
};
|
||||
|
||||
_vars = _arr select 4;
|
||||
_hitpoints = _vars select 11;
|
||||
|
||||
_medical params ["","","","_damage",["_hitpoints",[0,0,0,0,0,0,0,0,0,0,0]] ];
|
||||
_deadPlayer = ["PlayerStats", _playerUID, 0] call EPOCH_fnc_server_hiveGETBIT;
|
||||
|
||||
if (_deadPlayer || (_medical select 3 == 1) || (_hitpoints select 2 == 1) || (_hitpoints select 3 == 1) || (_vars select 12 >= 180)) then {
|
||||
// check if player is already dead or was critically hit HitHead = 2 or HitBody = 7 and if blood pressure too high.
|
||||
if (_deadPlayer || (_damage == 1) || (_hitpoints select 2 == 1) || (_hitpoints select 7 == 1) || (_vars select 12 >= 180)) then {
|
||||
_dead = true;
|
||||
};
|
||||
};
|
||||
|
@ -13,7 +13,7 @@
|
||||
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_player/EPOCH_server_loadPlayer.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_CheckLocation","_allGroupMembers","_alreadyDead","_attachments","_backpack","_canBeRevived","_class","_currWeap","_deadPlayer","_defaultData","_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","_communityStatsArray","_communityStats"];
|
||||
private ["_CheckLocation","_allGroupMembers","_alreadyDead","_assignedItems","_attachments","_backpack","_backpackItems","_canBeRevived","_class","_communityStats","_communityStatsArray","_currWeap","_deadPlayer","_defaultData","_dir","_equipped","_found","_goggles","_group","_handgunWeapon","_headgear","_instanceID","_jammer","_jammers","_linkedItems","_loadout","_location","_newLocation","_newPlyr","_playerData","_playerGroup","_playerGroupArray","_playerNetID","_playerUID","_primaryWeapon","_reject","_secondaryWeapon","_serverSettingsConfig","_type","_uniform","_uniformItems","_vars","_vest","_vestItems","_wMags","_wMagsArray","_weapon"];
|
||||
//[[[end]]]
|
||||
_reject = true;
|
||||
|
||||
@ -54,24 +54,41 @@ if (!isNull _player) then {
|
||||
_backpack = [_serverSettingsConfig, "defaultBackpack", ""] call EPOCH_fnc_returnConfigEntry;
|
||||
|
||||
// Inventory defaults
|
||||
_linkedItems = [_serverSettingsConfig, "linkedItems", ["ItemMap","EpochRadio0"]] call EPOCH_fnc_returnConfigEntry;
|
||||
_itemsInContainers = [_serverSettingsConfig, "itemsInContainers", []] call EPOCH_fnc_returnConfigEntry;
|
||||
_weaponsInContainers = [_serverSettingsConfig, "weaponsInContainers", []] call EPOCH_fnc_returnConfigEntry;
|
||||
_normalMagazines = [_serverSettingsConfig, "normalMagazines", []] call EPOCH_fnc_returnConfigEntry;
|
||||
_weaponsAndItems = [_serverSettingsConfig, "weaponsAndItems", ["", []] ] call EPOCH_fnc_returnConfigEntry;
|
||||
_primaryWeapon = [_serverSettingsConfig, "defaultprimaryWeapon", []] call EPOCH_fnc_returnConfigEntry; // ["arifle_MX_pointer_F","","acc_pointer_IR","",["30Rnd_65x39_caseless_mag",29],[],""];
|
||||
_secondaryWeapon = [_serverSettingsConfig, "defaultsecondaryWeapon", []] call EPOCH_fnc_returnConfigEntry; // ["launch_NLAW_F","","","",["NLAW_F",1],[],""];
|
||||
_handgunWeapon = [_serverSettingsConfig, "defaulthandgunWeapon", []] call EPOCH_fnc_returnConfigEntry; // ["hgun_P07_F","","","",["16Rnd_9x21_Mag",16],[],""];
|
||||
_uniformItems = [_serverSettingsConfig, "defaultuniformItems", []] call EPOCH_fnc_returnConfigEntry; // [["FirstAidKit",1],["30Rnd_65x39_caseless_mag",2,30],["Chemlight_green",1,1]];
|
||||
_vestItems = [_serverSettingsConfig, "defaultvestItems", []] call EPOCH_fnc_returnConfigEntry; // [["30Rnd_65x39_caseless_mag",3,30],["16Rnd_9x21_Mag",2,16],["SmokeShell",1,1],["SmokeShellGreen",1,1],["SmokeShellBlue",1,1],["SmokeShellOrange",1,1],["Chemlight_green",1,1]];
|
||||
_backpackItems = [_serverSettingsConfig, "defaultbackpackItems", []] call EPOCH_fnc_returnConfigEntry; // [["Medikit",1],["FirstAidKit",10],[["hgun_P07_F","","","",["16Rnd_9x21_Mag",16],[],""],1]];
|
||||
_assignedItems = [_serverSettingsConfig, "defaultassignedItems", ["","","","",[],[],""]] call EPOCH_fnc_returnConfigEntry; // ["Rangefinder","","","",[],[],""]
|
||||
_linkedItems = [_serverSettingsConfig, "defaultlinkedItems", ["ItemMap","","EpochRadio0","","",""]] call EPOCH_fnc_returnConfigEntry; // ["ItemMap","ItemGPS","ItemRadio","ItemCompass","ItemWatch","NVGoggles"]
|
||||
|
||||
// default data
|
||||
_defaultData = [[0, [], _instanceID], [0, 0, 1, 0, []], [_goggles, _headgear, _vest, _backpack, _uniform, _class], [], call EPOCH_defaultVars_SEPXVar, _weaponsAndItems, _linkedItems, _normalMagazines, _itemsInContainers, _weaponsInContainers, "", true];
|
||||
_loadout = [
|
||||
_primaryWeapon,
|
||||
_secondaryWeapon,
|
||||
_handgunWeapon,
|
||||
[_uniform,_uniformItems],
|
||||
[_vest,_vestItems],
|
||||
[_backpack,_backpackItems],
|
||||
_headgear,
|
||||
_goggles,
|
||||
_assignedItems,
|
||||
_linkedItems
|
||||
];
|
||||
|
||||
// todo make dynamic
|
||||
if (count _playerData < 11) then { // invaild format attempt to override
|
||||
// default data, if "Player" data format is changed update this array!
|
||||
_defaultData = [[0, [], _instanceID, 1.0], [0, 0, 1, 0, [0,0,0,0,0,0,0,0,0,0,0]], ["", "", "", "", "", _class], [], call EPOCH_defaultVars_SEPXVar, _loadout, [], [], [], [], "", true];
|
||||
|
||||
// If data does not validate against default or is too short, override with default data.
|
||||
if !(_playerData isEqualTypeParams _defaultData) then {
|
||||
diag_log format["DEBUG: Invaild player data %1, defaults used instead.", _playerData];
|
||||
_playerData = _defaultData;
|
||||
};
|
||||
|
||||
_playerData params ["_worldspace","_medical","","_server_vars","_vars","","","","","","_playerGroup","_canBeRevived"];
|
||||
|
||||
// Load world space and previous instance id
|
||||
_worldspace params ["_dir","_location","_prevInstance"];
|
||||
_worldspace params ["_dir","_location","_prevInstance",["_schemaVersion",0.5]];
|
||||
|
||||
if (count _location == 2) then{
|
||||
_location = (_location select 0) vectorAdd (_location select 1);
|
||||
@ -103,11 +120,12 @@ if (!isNull _player) then {
|
||||
// diag_log format["DEBUG (Load Player) Set Group: %1", _playerGroup];
|
||||
};
|
||||
|
||||
_hitpoints = _vars select 11;
|
||||
_medical params ["_bleedingRemaining","_fatigue","_oxygenRemaining","_damage",["_hitpoints",[0,0,0,0,0,0,0,0,0,0,0]] ];
|
||||
|
||||
_deadPlayer = ["PlayerStats", _playerUID, 0] call EPOCH_fnc_server_hiveGETBIT;
|
||||
_alreadyDead = (_deadPlayer || (_medical select 3 == 1) || (_hitpoints select 2 == 1) || (_hitpoints select 3 == 1) || (_vars select 12 >= 180));
|
||||
|
||||
// check if player is already dead or was critically hit HitHead = 2 or HitBody = 7 and if blood pressure too high.
|
||||
_alreadyDead = (_deadPlayer || (_damage == 1) || (_hitpoints select 2 == 1) || (_hitpoints select 7 == 1) || (_vars select 12 >= 180));
|
||||
|
||||
if (_alreadyDead || _prevInstance != _instanceID || (count _location) < 3 || !(_location isEqualType [])) then {
|
||||
_dir = random 360;
|
||||
@ -160,6 +178,9 @@ if (!isNull _player) then {
|
||||
|
||||
_newPlyr = _group createUnit[_class, _location, [], 0, "CAN_COLLIDE"];
|
||||
if !(isNull _newPlyr) then {
|
||||
// disable damage server side
|
||||
_newPlyr allowDamage false;
|
||||
// add to cleanup
|
||||
addToRemainsCollector[_newPlyr];
|
||||
{
|
||||
_newPlyr disableAI _x;
|
||||
@ -170,7 +191,6 @@ if (!isNull _player) then {
|
||||
|
||||
if (!_alreadyDead) then {
|
||||
// Medical
|
||||
_medical params ["_bleedingRemaining","_fatigue","_oxygenRemaining","_damage"];
|
||||
_newPlyr setBleedingRemaining _bleedingRemaining;
|
||||
// _newPlyr setFatigue _fatigue;
|
||||
_newPlyr setOxygenRemaining _oxygenRemaining;
|
||||
@ -180,11 +200,20 @@ if (!isNull _player) then {
|
||||
_playerData = _defaultData;
|
||||
};
|
||||
|
||||
// set player loadout
|
||||
if (_schemaVersion >= 1.0) then {
|
||||
_playerData params ["","","","","","_loadout"];
|
||||
_newPlyr setUnitLoadout [_loadout, false];
|
||||
diag_log format["DEBUG: loaded player %1 with new schema Version %2", _newPlyr, _schemaVersion];
|
||||
|
||||
} else {
|
||||
// Legacy code start
|
||||
// Apperance + Weapons
|
||||
_playerData params ["","","_apperance","","","_weaponsAndItems","_linkedItems","_normalMagazines","_itemsInContainers","_weaponsInContainers"];
|
||||
// load Apperance
|
||||
_apperance params ["_goggles","_headgear","_vest","_backpack","_uniform"];
|
||||
|
||||
// old data format for 0.5 and prior.
|
||||
// Load Apperance START
|
||||
if (_uniform != "") then {
|
||||
_newPlyr addUniform _uniform;
|
||||
@ -202,7 +231,6 @@ if (!isNull _player) then {
|
||||
_newPlyr addVest _vest;
|
||||
};
|
||||
// Load Apperance END
|
||||
|
||||
_currWeap = "";
|
||||
// Load inventory + defaults START
|
||||
if (count _weaponsAndItems >= 3) then {
|
||||
@ -262,6 +290,7 @@ if (!isNull _player) then {
|
||||
};
|
||||
} forEach _weaponsAndItemsArray;
|
||||
};
|
||||
|
||||
// Linked items
|
||||
{
|
||||
if (_x in["Binocular", "Rangefinder","Laserdesignator","Laserdesignator_02","Laserdesignator_03","Laserdesignator_01_khk_F","Laserdesignator_02_ghex_F"]) then {
|
||||
@ -280,6 +309,8 @@ if (!isNull _player) then {
|
||||
// Add magazines
|
||||
{_newPlyr addMagazine _x} forEach _normalMagazines;
|
||||
// Load inventory + defaults END
|
||||
// Legacy code stop
|
||||
};
|
||||
|
||||
// Final Push
|
||||
if (isNull _player) then {
|
||||
@ -311,19 +342,19 @@ if (!isNull _player) then {
|
||||
_communityStats = ((_communityStatsArray select 1) select 0);
|
||||
_newPlyr setVariable["COMMUNITY_STATS", _communityStats];
|
||||
|
||||
[_playerNetID, _playerUID, [_newPlyr, _vars, _currWeap, loadAbs _newPlyr, _playerGroup, _canBeRevived, _newPlyr call EPOCH_server_setPToken,_playerGroupArray, _communityStats]] call EPOCH_server_pushPlayer;
|
||||
//diag_log format["DEBUG (Load Player) Sent Group: %1 %2", _playerGroup, _playerGroupArray];
|
||||
// re enable damage server side
|
||||
_newPlyr allowDamage true;
|
||||
|
||||
// Flag new body as ready for use.
|
||||
_newPlyr setVariable["SETUP", true, true];
|
||||
|
||||
// revive
|
||||
// Send message to player so they can take over the new body.
|
||||
[_playerNetID, _playerUID, [_newPlyr, _vars, _currWeap, loadAbs _newPlyr, _playerGroup, _canBeRevived, _newPlyr call EPOCH_server_setPToken,_playerGroupArray, _communityStats, _hitpoints]] call EPOCH_server_pushPlayer;
|
||||
|
||||
// revive test
|
||||
_newPlyr setVariable ['#rev_enabled', true, true];
|
||||
|
||||
// [] remoteExec ["bis_fnc_reviveInit",_player];
|
||||
|
||||
// This is a test to see setUnitLoadout can force propagation of unit loadout.
|
||||
_newPlyr setUnitLoadout (getUnitLoadout _newPlyr); // if this works, possibly replace all inventory code with with get|setUnitLoadout
|
||||
|
||||
// new Dynamicsimulation
|
||||
if(["CfgDynamicSimulation", "playerDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntryV2)then
|
||||
{
|
||||
|
@ -12,7 +12,9 @@
|
||||
Github:
|
||||
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_player/EPOCH_server_savePlayer.sqf
|
||||
*/
|
||||
private["_return", "_return2", "_pos", "_medical", "_playerUID", "_weapons", "_itemsplayer", "_weaponsplayer", "_appearance", "_dmg", "_allowSave", "_cIndex", "_Svars", "_current_crypto", "_group", "_revive", "_vehiclePlyr","_server_vars","_stats"];
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_Svars","_allowSave","_appearance","_cIndex","_dmg","_group","_hitpoints","_itemsplayer","_loadout","_medical","_playerUID","_pos","_return","_return2","_revive","_schemaVersion","_server_vars","_stats","_vehiclePlyr","_weapons","_weaponsplayer"];
|
||||
//[[[end]]]
|
||||
params [["_player",objNull], ["_vars",[]] ];
|
||||
|
||||
if (isNull _player) exitWith {
|
||||
@ -79,14 +81,26 @@ if (_allowSave) then{
|
||||
};
|
||||
|
||||
_dmg = damage _player;
|
||||
_medical = [getBleedingRemaining _player, 0, getOxygenRemaining _player, _dmg];
|
||||
_hitpoints = (getAllHitPointsDamage _player) param [2,[]];
|
||||
_medical = [getBleedingRemaining _player, 0, getOxygenRemaining _player, _dmg, _hitpoints];
|
||||
// appearance now handled with getUnitLoadout, typeof is still need to determine players class.
|
||||
_appearance = ["", "", "", "", "", typeOf _player];
|
||||
|
||||
/* Old unused method
|
||||
_appearance = [goggles _player, headgear _player, vest _player, backpack _player, uniform _player, typeOf _player];
|
||||
_itemsplayer = [getItemCargo(uniformContainer _player), getItemCargo(vestContainer _player), getItemCargo(backpackContainer _player)];
|
||||
_weaponsplayer = [getWeaponCargo(uniformContainer _player), getWeaponCargo(vestContainer _player), getWeaponCargo(backpackContainer _player)];
|
||||
_weapons = [currentWeapon _player, weaponsItems _player, [primaryWeapon _player, secondaryWeapon _player, handgunWeapon _player]];
|
||||
*/
|
||||
|
||||
// new save format
|
||||
_loadout = getUnitLoadout _player;
|
||||
|
||||
// change this if needed
|
||||
_schemaVersion = 1.0;
|
||||
|
||||
// save player
|
||||
_return = ["Player", _playerUID, EPOCH_expiresPlayer, [[getDir _player, _pos, (call EPOCH_fn_InstanceID)], _medical, _appearance, _server_vars, _vars, _weapons, assignedItems _player, magazinesAmmo _player, _itemsplayer, _weaponsplayer, _group, _revive]] call EPOCH_fnc_server_hiveSETEX;
|
||||
_return = ["Player", _playerUID, EPOCH_expiresPlayer, [[getDir _player, _pos, (call EPOCH_fn_InstanceID), _schemaVersion], _medical, _appearance, _server_vars, _vars, _loadout, [], [], [], [], _group, _revive]] call EPOCH_fnc_server_hiveSETEX;
|
||||
|
||||
// save community stats
|
||||
_stats = _player getVariable["COMMUNITY_STATS", EPOCH_defaultStatVars];
|
||||
|
Loading…
Reference in New Issue
Block a user