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

View File

@ -18,36 +18,59 @@
Parameter(s): Parameter(s):
_this select 0: OBJECT - player object _this select 0: OBJECT - player object
_this select 1: STRING - personal token _this select 1: STRING - personal token
_this select 2: NUMBER - loadABS
Returns: Returns:
NOTHING NOTHING
*/ */
//[[[cog import generate_private_arrays ]]] //[[[cog import generate_private_arrays ]]]
private ["_group","_playerObject","_ply"]; private ["_prevPlayerObject"];
//[[[end]]] //[[[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 { if !(alive player && alive _playerObject && !isPlayer _playerObject) then {
_ply = player;
_group = group player;
selectPlayer _playerObject;
deleteVehicle _ply;
Epoch_canBeRevived = false; // reveal new player object (to hopefully propigate info faster).
Epoch_personalToken = _this select 1; player reveal _playerObject;
[] spawn EPOCH_masterLoop; // spawn a thread to wait for loadAbs to sync before using selectPlayer
[5, 100] call EPOCH_niteLight; [_playerObject,_personalToken,_loadAbs] spawn {
params ["_playerObject","_personalToken","_loadAbs"];
closeDialog 0; // get current player object
("BIS_fnc_respawnCounter" call BIS_fnc_rscLayer) cutText ["","PLAIN"]; _prevPlayerObjectect = player;
{ // wait for loadAbs to sync
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 // switch to new playerObject
EPOCH_playerBloodP = 120; 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 { } else {
deleteVehicle _playerObject; deleteVehicle _playerObject;
}; };

View File

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