Split player_death into scheduled and unscheduled #1833

Death message was sometimes showing incorrectly due to spawn delay.

Also the sched_corpses two minute loop was occasionally deleting bodies
right away because bodyName setVariable was delayed by the time it took
PVDZ_plr_death to send (up to a few seconds). See #1825
This commit is contained in:
ebaydayz
2016-12-28 16:16:39 -05:00
parent b807648cc6
commit d509c15c82
12 changed files with 147 additions and 149 deletions

View File

@@ -18,7 +18,7 @@ sched_medical_slow = { // 10 seconds
sched_medical_init = { [ []spawn{} ] };
sched_medical = { // 1 second
HIDE_FSM_VARS
private ["_method","_unconHdlr"];
private "_unconHdlr";
_unconHdlr = _this select 0;
if (r_player_blood == 12000) then {
@@ -27,14 +27,8 @@ sched_medical = { // 1 second
//r_player_unconscious = getVariable ["NORRN_unconscious", true];
_method = switch (true) do {
case (dayz_lastDamageSource != "none" && diag_tickTime - dayz_lastDamageTime < 30): {dayz_lastDamageSource}; //Major event takes priority for cause of death
case (dayz_lastMedicalSource != "none" && diag_tickTime - dayz_lastMedicalTime < 10): {dayz_lastMedicalSource}; //Starve, Dehyd, Sick
default {"bled"}; //No other damage sources in last 30 seconds
};
if (r_player_blood <= 0) then {
[dayz_sourceBleeding, _method] spawn player_death;
[dayz_sourceBleeding,"find"] call player_death;
};
if (!canStand player) then { // be consistant with player_updateGui.sqf