Epoch/Sources/epoch_code/compile/setup/EPOCH_clientRevive.sqf

87 lines
2.8 KiB
Plaintext
Raw Normal View History

2015-12-07 16:24:52 +00:00
/*
Author: Aaron Clark - EpochMod.com
Contributors:
Description:
Unisex check for vests, gives swing ammo and performs radio changed check
Licence:
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
Github:
2016-06-13 16:54:19 +00:00
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/setup/EPOCH_clientRevive.sqf
2015-12-07 16:24:52 +00:00
Example:
_data call EPOCH_clientRevive;
Parameter(s):
_this select 0: OBJECT - player object
_this select 1: STRING - personal token
_this select 2: NUMBER - loadABS
2015-12-07 16:24:52 +00:00
Returns:
NOTHING
*/
2016-09-01 00:29:08 +00:00
//[[[cog import generate_private_arrays ]]]
2017-09-27 02:20:41 +00:00
private ["_playerBloodPKeyFinal","_prevPlayerObject"];
2016-09-01 00:29:08 +00:00
//[[[end]]]
params [
["_playerObject",objNull,[objNull]],
["_personalToken","",[""]],
["_loadAbs",0,[0]]
];
if (isNull _playerObject) exitWith { diag_log "EPOCH-DEBUG: New Player Object was Null cannot revive." };
2015-09-14 20:55:36 +00:00
if !(alive player && alive _playerObject && !isPlayer _playerObject) then {
2017-01-02 23:28:07 +00:00
// reveal new player object (to hopefully propagate info faster).
player reveal _playerObject;
2015-09-14 20:55:36 +00:00
// spawn a thread to wait for loadAbs to sync before using selectPlayer
[_playerObject,_personalToken,_loadAbs] spawn {
params ["_playerObject","_personalToken","_loadAbs"];
2015-09-14 20:55:36 +00:00
// get current player object
2017-01-10 18:31:05 +00:00
_prevPlayerObject = player;
2015-09-14 20:55:36 +00:00
// wait for loadAbs to sync
2017-01-01 18:33:53 +00:00
waitUntil {_loadAbs isEqualTo (loadAbs _playerObject)};
2016-01-08 23:19:18 +00:00
// 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;
// reset blood Pressure to warning level
2017-09-27 02:20:41 +00:00
_playerBloodPKeyFinal = "EPOCH_playerBloodP";
2017-09-28 17:00:48 +00:00
if !(isNil "_playerBloodPKey") then {_playerBloodPKeyFinal = _playerBloodPKey};
2017-09-27 02:20:41 +00:00
missionNamespace setVariable [_playerBloodPKeyFinal, 120];
2017-10-07 19:23:54 +00:00
// Wait until _playerObject is local before adding Rating and EH's
waituntil {local _playerObject};
// restart masterloop
2017-12-10 17:25:16 +00:00
EPOCH_forceUpdateNow = nil; // Set to nil and wait later until Masterloop has redefined it
[] 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);
2017-12-10 17:25:16 +00:00
waituntil {uisleep 0.5; !isnil "EPOCH_forceUpdateNow"}; // Wait until Materloop is has set this Variable to false
EPOCH_forceUpdateNow = true;
};
2015-09-14 20:55:36 +00:00
} else {
deleteVehicle _playerObject;
};