better way to handle login fsm variables

CfgEpochClient "debug" variable to control extra debug and is currently
used in login fsm.
This commit is contained in:
vbawol 2017-08-26 09:57:59 -05:00
parent 8e7419ec31
commit ff5d56af46
5 changed files with 25 additions and 29 deletions

View File

@ -1,8 +1,8 @@
/*%FSM<COMPILE "F:\Program Files (x86)\Steam\steamapps\common\Arma 3 Tools\FSMEditor\scriptedFSM.cfg, Epoch Login">*/
/*%FSM<HEAD>*/
/*
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"};
item0[] = {"INIT",0,250,-25.000000,-375.000000,75.000000,-325.000000,0.000000,"INIT"};
item1[] = {"FINISH",1,4346,-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"};
item4[] = {"Player_Object_Re",4,218,-150.000000,75.000000,-50.000000,125.000000,0.000000,"Player" \n "Object Ready"};
@ -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,-406.572662,335.025604,359.874329,-776.300476,577,884,1};
window[] = {2,-1,-1,-32000,-32000,871,104,1088,104,3,595};
globals[] = {0.000000,0,0,0,0,640,480,1,247,6316128,1,-346.821808,275.273865,1776.441162,823.351685,577,884,1};
window[] = {2,-1,-1,-1,-1,923,156,1140,156,3,595};
*//*%FSM</HEAD>*/
class FSM
{
@ -198,19 +198,15 @@ class FSM
itemno = 0;
init = /*%FSM<STATEINIT""">*/"titleCut ["""", ""BLACK FADED"", 1337];" \n
"0 fadeSound 0;" \n
"//player enableSimulation false;" \n
"" \n
"_debug = true;" \n
"// use config to control extra debug" \n
"_debug = [""CfgEpochClient"", ""debug"", false] call EPOCH_fnc_returnConfigEntryV2;" \n
"" \n
"_myTime = diag_tickTime;" \n
"if (_debug) then {" \n
" diag_log ""EPOCH-LOGIN: Init"";" \n
"};" \n
"" \n
"EPOCH_loginFSM = _thisFSM;" \n
"EPOCH_playerLoginInit = {" \n
" EPOCH_loginFSM setFSMVariable [_this select 0, _this select 1];" \n
"};" \n
"" \n
"// init vars " \n
"_hitpoints = [];"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
@ -236,9 +232,6 @@ class FSM
name = "FINISH";
itemno = 1;
init = /*%FSM<STATEINIT""">*/"[] spawn EPOCH_masterLoop;" \n
"" \n
"EPOCH_loginFSM = nil;" \n
"EPOCH_playerLoginInit = nil;" \n
"" \n
"// fade in sound and screen" \n
"3 fadeSound 1;" \n
@ -497,7 +490,7 @@ class FSM
itemno = 18;
init = /*%FSM<STATEINIT""">*/"_myTime = diag_tickTime;" \n
"" \n
"[player] remoteExec [""EPOCH_server_checkPlayer"",2];" \n
"[player,_thisFSM] remoteExec [""EPOCH_server_checkPlayer"",2];" \n
"" \n
"""Loading Player Data... Please wait!"" call Epoch_updateLoadingScreen;" \n
"progressLoadingScreen 0.5;" \n
@ -1345,7 +1338,7 @@ class FSM
init = /*%FSM<STATEINIT""">*/"startLoadingScreen ["""",""EpochLoadingScreen""];" \n
"""Gender Selected... Please wait!"" call Epoch_updateLoadingScreen;" \n
"" \n
"[player,EPOCH_PlayerIsMale] remoteExec [""EPOCH_server_loadPlayer"",2];" \n
"[player,EPOCH_PlayerIsMale,_thisFSM] remoteExec [""EPOCH_server_loadPlayer"",2];" \n
"EPOCH_PlayerIsMale = nil;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links

View File

@ -16,6 +16,8 @@ class CfgEpochClient
{
epochVersion = "1.0.0";
ArmAVersion = 168;
debug = "false"; // true = enable extra rpt debug lines, false to disable
sapperRngChance = 100; // increase number to reduce chances and reduce to increase. Default 100
droneRngChance = 100; // increase number to reduce chances and reduce to increase. Default 100
zombieRngChance = 50; // increase number to reduce chances and reduce to increase. Default 50

View File

@ -15,7 +15,7 @@
//[[[cog import generate_private_arrays ]]]
private ["_apperance","_arr","_class","_communityStatsArray","_dead","_deadPlayer","_defaultData","_instanceID","_isMale","_medical","_playerUID","_response","_return","_vars"];
//[[[end]]]
params [["_playerObj",objNull]];
params [["_playerObj",objNull],["_fsmHandle",0]];
if (_playerObj isEqualType objNull) then {
if (!isNull _playerObj) then {
_playerUID = getPlayerUID _playerObj;
@ -58,10 +58,10 @@ if (_playerObj isEqualType objNull) then {
/* true => New Char
false => load old Char */
['_checkPlayer_PVC', _dead] remoteExec ['EPOCH_playerLoginInit',_playerObj];
[_fsmHandle,['_checkPlayer_PVC', _dead]] remoteExecCall ['setFSMVariable', _playerObj];
if (!_dead) then { //Load old Char
[_playerObj, _isMale] call EPOCH_server_loadPlayer;
[_playerObj, _isMale, _fsmHandle] call EPOCH_server_loadPlayer;
};
};
};

View File

@ -17,7 +17,7 @@ private ["_CheckLocation","_allGroupMembers","_alreadyDead","_assignedItems","_a
//[[[end]]]
_reject = true;
params [["_player",objNull,[objNull]],["_isMale",true]];
params [["_player",objNull,[objNull]],["_isMale",true],["_fsmHandle",0]];
if (!isNull _player) then {
@ -358,7 +358,7 @@ if (!isNull _player) then {
_newPlyr setVariable["SETUP", true, true];
// Send message to player so they can take over the new body.
[_playerNetID, _playerUID, [_newPlyr, _vars, _currentWeapon, loadAbs _newPlyr, _playerGroup, _canBeRevived, _newPlyr call EPOCH_server_setPToken,_playerGroupArray, _communityStats, _hitpoints]] call EPOCH_server_pushPlayer;
[_playerNetID, _playerUID, [_newPlyr, _vars, _currentWeapon, loadAbs _newPlyr, _playerGroup, _canBeRevived, _newPlyr call EPOCH_server_setPToken,_playerGroupArray, _communityStats, _hitpoints], _fsmHandle] call EPOCH_server_pushPlayer;
// revive test
_newPlyr setVariable ['#rev_enabled', true, true];

View File

@ -140,9 +140,10 @@ EPOCH_server_setPToken = compileFinal ("private '_var';_var = 'epochserver' call
if (!_skn_enableAntihack) exitWith {
EPOCH_server_pushPlayer = compileFinal ("
_C_SET = _this select 2;
params ['_playerNetID','_playerUID','_C_SET','_fsmHandle'];
_C_SET pushBack '';
['_C_SET', _C_SET] remoteExec ['EPOCH_playerLoginInit',(_this select 0)];");
[_fsmHandle,['_C_SET', _C_SET]] remoteExecCall ['setFSMVariable', _playerNetID];
");
EPOCH_server_isPAdmin = compileFinal ("false");
EPOCH_server_Authed = compileFinal ("true");
EPOCH_server_disconnect = compileFinal("true");
@ -515,16 +516,16 @@ if (_skn_PVSPrefix == "") then {
};
EPOCH_server_pushPlayer = compileFinal ("
_C_SET = _this select 2;
if (_this select 1 in "+ str _skn_adminUIDArray+") then {
(_this select 0) publicVariableClient '"+_skn_Admin_Code+"';
(_this select 0) publicVariableClient '"+_skn_pv_adminLog+"';
(_this select 0) publicVariableClient '"+_skn_pv_hackerLog+"';
params ['_playerNetID','_playerUID','_C_SET','_fsmHandle'];
if (_playerUID in "+ str _skn_adminUIDArray+") then {
_playerNetID publicVariableClient '"+_skn_Admin_Code+"';
_playerNetID publicVariableClient '"+_skn_pv_adminLog+"';
_playerNetID publicVariableClient '"+_skn_pv_hackerLog+"';
_C_SET pushBack '[] spawn "+_skn_Admin_Init+"';
} else {
_C_SET pushBack '[] spawn "+_skn_AH_Init+"';
};
['_C_SET', _C_SET] remoteExec ['EPOCH_playerLoginInit',(_this select 0)];
[_fsmHandle,['_C_SET', _C_SET]] remoteExecCall ['setFSMVariable', _playerNetID];
true
");
EPOCH_server_isPAdmin = compileFinal ("if (isNull _this) then {false} else {getPlayerUID _this in "+str _skn_adminUIDArray+"}");