mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 12:12:34 +03:00
Move low blood check to scheduler
The old low blood check runs every frame until server restart. Having it in the scheduler does almost the same with much less performance impact.
This commit is contained in:
@@ -1144,7 +1144,7 @@ class FSM
|
||||
init = /*%FSM<STATEINIT""">*/"if (_debug == 1) then {diag_log [diag_tickTime,'Initialize'];};" \n
|
||||
"" \n
|
||||
"//Medical" \n
|
||||
"dayz_medicalH = [] execVM ""\z\addons\dayz_code\medical\init_medical.sqf""; //Medical Monitor Script (client only)" \n
|
||||
"//dayz_medicalH = [] execVM ""\z\addons\dayz_code\medical\init_medical.sqf""; //Medical Monitor Script (client only)" \n
|
||||
"[player] call fnc_usec_damageHandle;" \n
|
||||
"" \n
|
||||
"if (r_player_unconscious) then {" \n
|
||||
|
||||
@@ -18,7 +18,9 @@ sched_medical_slow = { // 10 seconds
|
||||
sched_medical_init = { [ []spawn{} ] };
|
||||
sched_medical = { // 1 second
|
||||
HIDE_FSM_VARS
|
||||
private "_unconHdlr";
|
||||
|
||||
private ["_unconHdlr","_lowBlood"];
|
||||
|
||||
_unconHdlr = _this select 0;
|
||||
|
||||
if (r_player_blood == r_player_bloodTotal) then {
|
||||
@@ -38,14 +40,29 @@ sched_medical = { // 1 second
|
||||
};
|
||||
};
|
||||
|
||||
if ((r_player_blood <= 3000) and !r_player_unconscious) then {
|
||||
if (random 100 > 99) then {
|
||||
if (!r_player_unconscious && {(r_player_blood/r_player_bloodTotal) < 0.35}) then {
|
||||
r_player_lowblood = true;
|
||||
playSound "heartbeat_1";
|
||||
addCamShake [2, 0.5, 25];
|
||||
if (r_player_lowblood) then {
|
||||
if (!dayz_soundMuted) then {
|
||||
// muted is 0.25, so this is always higher
|
||||
0 fadeSound ((r_player_blood/r_player_bloodTotal) + 0.5);
|
||||
};
|
||||
"dynamicBlur" ppEffectEnable true;"dynamicBlur" ppEffectAdjust [random 4]; "dynamicBlur" ppEffectCommit 0.2;
|
||||
};
|
||||
_lowBlood = player getVariable ["USEC_lowBlood", false];
|
||||
if ((r_player_blood < r_player_bloodTotal) and {!_lowBlood}) then {
|
||||
player setVariable["USEC_lowBlood",true,true];
|
||||
};
|
||||
|
||||
if (r_player_blood <= 3000 && {random 100 > 99}) then {
|
||||
[player, ((random 0.1) + 0.2)] call fnc_usec_damageUnconscious;
|
||||
};
|
||||
};
|
||||
|
||||
//Handle Unconscious player
|
||||
if ((r_player_unconscious) and (!r_player_unconsciousInProgress) and (scriptDone _unconHdlr)) then {
|
||||
if ((r_player_unconscious) and {!r_player_unconsciousInProgress} and {scriptDone _unconHdlr}) then {
|
||||
//localize "CLIENT: Start Unconscious Function";
|
||||
_unconHdlr = [] spawn fnc_usec_unconscious;
|
||||
};
|
||||
@@ -82,7 +99,8 @@ sched_medical_effects = {
|
||||
// change saturation, blur and vignetting according to blood level
|
||||
// Shivering if character temperature is near the minimum
|
||||
|
||||
private ["_hndCC", "_hndDB", "_tmp1", "_tmp2", "_tmp3"];
|
||||
private ["_hndCC", "_hndDB", "_tmp1", "_tmp2", "_tmp3","_hndRB"];
|
||||
|
||||
_hndCC = _this select 0;
|
||||
_hndDB = _this select 1;
|
||||
_hndRB = _this select 2;
|
||||
@@ -114,7 +132,7 @@ sched_medical_effects = {
|
||||
[_hndCC, _hndDB, _hndRB] ppEffectCommit 1.5;
|
||||
|
||||
//Add Shivering
|
||||
if (dayz_temperatur <= (0.125 * (dayz_temperaturmax - dayz_temperaturmin) + dayz_temperaturmin) and ((vehicle player == player and speed player < 5) or (vehicle player != player))) then {
|
||||
if (dayz_temperatur <= (0.125 * (dayz_temperaturmax - dayz_temperaturmin) + dayz_temperaturmin) and {(vehicle player == player and speed player < 5) or (vehicle player != player)}) then {
|
||||
addCamShake [0.6 * (dayz_temperaturmin / dayz_temperatur), 2, 30];
|
||||
};
|
||||
|
||||
@@ -125,7 +143,7 @@ sched_medical_effectsSlow = {
|
||||
// every 10 seconds
|
||||
HIDE_FSM_VARS
|
||||
|
||||
if (!r_player_unconscious && (r_player_infected or r_player_inpain)) then {
|
||||
if (!r_player_unconscious && {r_player_infected or r_player_inpain}) then {
|
||||
//Original pain shake was stronger [2, 1, 25]
|
||||
//Low blood still uses strong shake in init_medical.sqf
|
||||
addCamShake [1, 1, 20];
|
||||
@@ -133,7 +151,7 @@ sched_medical_effectsSlow = {
|
||||
if (!r_player_infected) then {
|
||||
playSound "breath_1"; //In pain
|
||||
} else {
|
||||
if (1 > random 2 && (speed player < 5 or {vehicle player != player})) then {
|
||||
if ((1 > random 2) && {speed player < 5 or {vehicle player != player}}) then {
|
||||
[player,"cough",1,false] call dayz_zombieSpeak;
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user