mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-13 19:52:38 +03:00
Update player_spawn_2.sqf
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
private ["_hunger","_thirst","_timeOut","_result","_randomSpot","_distance","_mylastPos","_lastTemp","_rnd","_messTimer","_PlayerNearby","_ZedsNearby","_saveTime"];
|
||||
private ["_isOK", "_startcombattimer", "_myPos", "_wpnType", "_ismelee","_radsound", "_bloodloss","_NutritionLoss", "_Nutrition","_outsideMap","_lastUpdate","_tempPos","_lowBlood","_start", "_refObj", "_size", "_vel", "_speed","_isPZombie", "_radTimer", "_timer", "_timer30", "_timer150", "_timerMonitor","_hunger","_thirst","_result","_randomSpot","_distance","_mylastPos","_lastTemp","_rnd","_messTimer","_saveTime"];
|
||||
disableSerialization;
|
||||
_timeOut = 0;
|
||||
|
||||
_messTimer = 0;
|
||||
_lastTemp = dayz_temperatur;
|
||||
_isPZombie = player isKindOf "PZombie_VB";
|
||||
@@ -14,7 +14,7 @@ _timerMonitor = diag_ticktime;
|
||||
player setVariable ["temperature",dayz_temperatur,true];
|
||||
player setVariable["friendlies",DZE_Friends,true];
|
||||
|
||||
[0,0] call player_humanityChange;
|
||||
//[0,0] call player_humanityChange;
|
||||
|
||||
//player addMagazine "Hatchet_swing";
|
||||
//player addWeapon "MeleeHatchet";
|
||||
@@ -59,18 +59,6 @@ while {1 == 1} do {
|
||||
|
||||
dayz_areaAffect = _size;
|
||||
|
||||
if (_speed > 0.1) then {
|
||||
_timeOut = _timeOut + 1;
|
||||
};
|
||||
|
||||
if (_timeOut > 150) then {
|
||||
_humanity = player getVariable ["humanity",0];
|
||||
if (_humanity < 1) then {
|
||||
[round(_timeOut / 10),0] call player_humanityChange;
|
||||
};
|
||||
_timeOut = 0;
|
||||
};
|
||||
|
||||
//reset OpenTarget variable if the timer has run out.
|
||||
if (OpenTarget_Time > 0 && {diag_tickTime - OpenTarget_Time >= dayz_OpenTarget_TimerTicks}) then
|
||||
{
|
||||
@@ -91,6 +79,8 @@ while {1 == 1} do {
|
||||
//Every 30 seconds force the client to update the server of all medical Values
|
||||
if ((diag_tickTime - _timer30) > 30) then {
|
||||
[] spawn {
|
||||
private "_medical";
|
||||
|
||||
_medical = player call player_sumMedical;
|
||||
|
||||
PVDZ_playerMedicalSync = [player,_medical];
|
||||
@@ -111,9 +101,9 @@ while {1 == 1} do {
|
||||
// Check for radiation
|
||||
DZE_InRadiationZone = false;
|
||||
|
||||
_outsideMap = ((dayz_myPosition select 0) < dayz_minpos || (dayz_myPosition select 1) < dayz_minpos || (dayz_myPosition select 0) > dayz_maxpos || (dayz_myPosition select 1) > dayz_maxpos);
|
||||
_outsideMap = ((dayz_myPosition select 0) < dayz_minpos || {(dayz_myPosition select 1) < dayz_minpos} || {(dayz_myPosition select 0) > dayz_maxpos} || {(dayz_myPosition select 1) > dayz_maxpos});
|
||||
|
||||
if ((_outsideMap || DZE_Quarantine) && {!r_player_dead} && {!isNull (findDisplay 46)} && {player distance (getMarkerPos "respawn_west") > 15}) then {
|
||||
if ((_outsideMap || {DZE_Quarantine}) && {!r_player_dead} && {!isNull (findDisplay 46)} && {player distance (getMarkerPos "respawn_west") > 15}) then {
|
||||
DZE_InRadiationZone = true;
|
||||
};
|
||||
player setVariable["posForceUpdate",true,true];
|
||||
@@ -153,7 +143,7 @@ while {1 == 1} do {
|
||||
|
||||
//Temperatur
|
||||
2 call player_temp_calculation; //2 = sleep time of this loop //TeeChange
|
||||
if ((_lastTemp - dayz_temperatur) > 0.75 or (_lastTemp - dayz_temperatur) < -0.75 ) then {
|
||||
if ((_lastTemp - dayz_temperatur) > 0.75 || {(_lastTemp - dayz_temperatur) < -0.75}) then {
|
||||
player setVariable ["temperature",dayz_temperatur,false];
|
||||
|
||||
PVDZ_serverStoreVar = [player,"temperature",dayz_temperatur];
|
||||
@@ -164,7 +154,7 @@ while {1 == 1} do {
|
||||
dayz_temperatur = (dayz_temperatur min dayz_temperaturmax) max dayz_temperaturmin;
|
||||
|
||||
//can get nearby infection
|
||||
if (!r_player_infected && !_isPZombie) then {
|
||||
if (!r_player_infected && {!_isPZombie}) then {
|
||||
// Infectionriskstart
|
||||
if (dayz_temperatur < ((80 / 100) * (dayz_temperaturnormal - dayz_temperaturmin) + dayz_temperaturmin)) then { //TeeChange
|
||||
{
|
||||
@@ -230,21 +220,17 @@ while {1 == 1} do {
|
||||
|
||||
// Regen some blood if player is well fed and resting
|
||||
// Attention: regen _result must not trigger the "up" arrow of the blood icon
|
||||
if (r_player_blood < r_player_bloodTotal and dayz_hunger < SleepFood
|
||||
and dayz_thirst < SleepWater and !r_player_injured
|
||||
and !r_player_infected and !(r_player_Sepsis select 0)
|
||||
and !r_player_unconscious) then {
|
||||
if (r_player_blood < r_player_bloodTotal && {dayz_hunger < SleepFood} && {dayz_thirst < SleepWater} && {!r_player_injured} && {!r_player_infected} && {!(r_player_Sepsis select 0)} && {!r_player_unconscious}) then {
|
||||
_result = (1-(dayz_hunger + dayz_thirst)/(SleepWater + SleepFood));
|
||||
switch (1==1) do {
|
||||
case (_result < 0.25) : {}; // not well fed
|
||||
case ((toArray(animationState player) select 5) == 112) : { // prone
|
||||
|
||||
call {
|
||||
if (_result < 0.25) exitWith {}; // not well fed
|
||||
if ((toArray(animationState player) select 5) == 112) exitWith { // prone
|
||||
_result = _result * (1 + 10 * (r_player_bloodTotal - r_player_blood) / r_player_bloodTotal);
|
||||
};
|
||||
case (speed player < 1) : { // still
|
||||
if (speed player < 1) exitWith { // still
|
||||
_result = _result * (1 + 4 * sqrt((r_player_bloodTotal - r_player_blood) / r_player_bloodTotal));
|
||||
};
|
||||
default { // moving
|
||||
};
|
||||
};
|
||||
r_player_bloodregen = r_player_bloodregen + _result;
|
||||
};
|
||||
@@ -260,7 +246,7 @@ while {1 == 1} do {
|
||||
player setVariable ["USEC_lowBlood",true,true];
|
||||
};
|
||||
} else {
|
||||
if (_lowBlood && !r_player_injured) then {
|
||||
if (_lowBlood && {!r_player_injured}) then {
|
||||
player setVariable ["USEC_lowBlood",false,true];
|
||||
r_player_lowblood = false;
|
||||
};
|
||||
@@ -277,7 +263,7 @@ while {1 == 1} do {
|
||||
};
|
||||
|
||||
//Save Checker
|
||||
if (dayz_unsaved or ((diag_ticktime - dayz_lastSave) > 300)) then {
|
||||
if (dayz_unsaved || {(diag_ticktime - dayz_lastSave) > 300}) then {
|
||||
if ((diag_ticktime - dayz_lastSave) > _saveTime) then {
|
||||
|
||||
PVDZ_plr_Save = [player,nil,false,dayz_playerAchievements];
|
||||
@@ -293,10 +279,10 @@ while {1 == 1} do {
|
||||
};
|
||||
|
||||
// sort out pickup actions
|
||||
_isOK = (pickupInit and !canPickup) or (!pickupInit and canPickup);
|
||||
_isOK = (pickupInit && {!canPickup}) || {!pickupInit && {canPickup}};
|
||||
|
||||
if (_isOK) then {
|
||||
if (pickupInit and !canPickup) then {
|
||||
if (pickupInit && {!canPickup}) then {
|
||||
canPickup = true;
|
||||
pickupInit = false;
|
||||
};
|
||||
@@ -306,26 +292,12 @@ while {1 == 1} do {
|
||||
pickupInit = true;
|
||||
};
|
||||
|
||||
_PlayerNearby = false;
|
||||
_ZedsNearby = false;
|
||||
if ({isPlayer _x} count (player nearEntities ["AllVehicles", 5]) > 1) then {
|
||||
_PlayerNearby = true;
|
||||
};
|
||||
if (count (player nearEntities ["zZombie_Base", 10]) > 0) then {
|
||||
_ZedsNearby = true;
|
||||
};
|
||||
|
||||
_startcombattimer = player getVariable["startcombattimer", 0];
|
||||
if (_startcombattimer == 1) then { //Do not use _PlayerNearby it makes building impossible, this is handled in player_onPause.sqf just fine
|
||||
player setVariable["combattimeout", diag_tickTime + 30, false];
|
||||
if !(player getVariable["inCombat",false]) then {player setVariable["inCombat",true,true];};
|
||||
player setVariable["startcombattimer", 0, false];
|
||||
}; /* else {
|
||||
if (_ZedsNearby && !_isPZombie) then { //this makes building a nightmare, this is handled in player_onPause.sqf just fine
|
||||
player setVariable["combattimeout", diag_tickTime + 10, false];
|
||||
player setVariable["startcombattimer", 0, false];
|
||||
};
|
||||
}; */
|
||||
|
||||
uiSleep 2;
|
||||
|
||||
@@ -336,7 +308,7 @@ while {1 == 1} do {
|
||||
};
|
||||
|
||||
//Melee Weapons ammo fix
|
||||
if(isNil {login_ammochecked}) then {
|
||||
if(isNil "login_ammochecked") then {
|
||||
login_ammochecked = true;
|
||||
_wpnType = primaryWeapon player;
|
||||
_ismelee = (getNumber (configFile >> "CfgWeapons" >> _wpnType >> "melee") == 1);
|
||||
@@ -358,8 +330,10 @@ while {1 == 1} do {
|
||||
|
||||
//Crowbar ammo fix
|
||||
//"MeleeCrowbar" call dayz_meleeMagazineCheck;
|
||||
_stop = diag_tickTime;
|
||||
|
||||
/*
|
||||
_stop = diag_tickTime;
|
||||
|
||||
if ((diag_tickTime - _timerMonitor) > 60) then {
|
||||
diag_log format ["Loop Monitor - Spawn2: %1, DA: %2, SA: %3",(_stop - _start),(diag_tickTime - (player getVariable "damageActions")),(diag_tickTime - (player getVariable "selfActions"))];
|
||||
_timerMonitor = diag_ticktime;
|
||||
|
||||
Reference in New Issue
Block a user