test making player revive work similar to load #693

on revive, use reveal against new player object.
send loadABS value from server and wait client side for a match before
using selectPlayer.
Note: may need some form of code lock to prevent duplicate calls
Todo: Look into changing revive system to A3's own.
This commit is contained in:
vbawol 2017-01-01 12:33:04 -06:00
parent de95260a3e
commit 468deeb252
3 changed files with 44 additions and 21 deletions

View File

@ -207,7 +207,7 @@ class FSM
"};" \n
"" \n
"_finalPlayerObjectCheck = {" \n
" (_mass == (loadAbs _playerObject))" \n
" (_mass isEqualTo (loadAbs _playerObject))" \n
"};" \n
"" \n
"EPOCH_loginFSM = _thisFSM;" \n
@ -1423,4 +1423,4 @@ class FSM
"Reject_without_B",
};
};
/*%FSM</COMPILE>*/
/*%FSM</COMPILE>*/

View File

@ -18,36 +18,59 @@
Parameter(s):
_this select 0: OBJECT - player object
_this select 1: STRING - personal token
_this select 2: NUMBER - loadABS
Returns:
NOTHING
*/
//[[[cog import generate_private_arrays ]]]
private ["_group","_playerObject","_ply"];
private ["_prevPlayerObject"];
//[[[end]]]
_playerObject = _this select 0;
params [
["_playerObject",objNull,[objNull]],
["_personalToken","",[""]],
["_loadAbs",0,[0]]
];
if (isNull _playerObject) exitWith { diag_log "EPOCH-DEBUG: New Player Object was Null cannot revive." };
if !(alive player && alive _playerObject && !isPlayer _playerObject) then {
_ply = player;
_group = group player;
selectPlayer _playerObject;
deleteVehicle _ply;
Epoch_canBeRevived = false;
Epoch_personalToken = _this select 1;
// reveal new player object (to hopefully propigate info faster).
player reveal _playerObject;
[] spawn EPOCH_masterLoop;
[5, 100] call EPOCH_niteLight;
// spawn a thread to wait for loadAbs to sync before using selectPlayer
[_playerObject,_personalToken,_loadAbs] spawn {
params ["_playerObject","_personalToken","_loadAbs"];
closeDialog 0;
("BIS_fnc_respawnCounter" call BIS_fnc_rscLayer) cutText ["","PLAIN"];
// get current player object
_prevPlayerObjectect = player;
{
player removeEventHandler [_x, 0];
player addEventHandler [_x,(["CfgEpochClient", _x, ""] call EPOCH_fnc_returnConfigEntryV2)];
} forEach (["CfgEpochClient", "addEventHandler", []] call EPOCH_fnc_returnConfigEntryV2);
// wait for loadAbs to sync
// reset blood Pressure to warning level
EPOCH_playerBloodP = 120;
// switch to new playerObject
selectPlayer _playerObject;
// delete previous player object
deleteVehicle _prevPlayerObject;
// set token and can revive to false
Epoch_canBeRevived = false;
Epoch_personalToken = _personalToken;
// restart masterloop
[] spawn EPOCH_masterLoop;
[5, 100] call EPOCH_niteLight;
closeDialog 0;
("BIS_fnc_respawnCounter" call BIS_fnc_rscLayer) cutText ["","PLAIN"];
{
player removeEventHandler [_x, 0];
player addEventHandler [_x,(["CfgEpochClient", _x, ""] call EPOCH_fnc_returnConfigEntryV2)];
} forEach (["CfgEpochClient", "addEventHandler", []] call EPOCH_fnc_returnConfigEntryV2);
// reset blood Pressure to warning level
EPOCH_playerBloodP = 120;
};
} else {
deleteVehicle _playerObject;
};

View File

@ -265,7 +265,7 @@ if (!local _player) then {
};
// send to player
[_newPlyr, _token] remoteExec ['EPOCH_clientRevive',_player];
[_newPlyr, _token, loadAbs _newPlyr] remoteExec ['EPOCH_clientRevive',_player];
};
};
};