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";
|
||||
@@ -28,14 +28,14 @@ while {1 == 1} do {
|
||||
_vel = velocity player;
|
||||
_speed = round((_vel distance [0,0,0]) * 3.5);
|
||||
_saveTime = (playersNumber west * 2) + 10;
|
||||
|
||||
|
||||
//reset rating always
|
||||
if (((rating player) > 0) or ((rating player) < 0)) then {
|
||||
player setUnitRank "PRIVATE";
|
||||
};
|
||||
|
||||
dayz_myLoad = (((count dayz_myBackpackMags) * 0.2) + (count dayz_myBackpackWpns)) + (((count dayz_myMagazines) * 0.1) + (count dayz_myWeapons * 0.5));
|
||||
|
||||
|
||||
//reset position
|
||||
_randomSpot = true;
|
||||
_tempPos = getPosATL player;
|
||||
@@ -59,46 +59,36 @@ 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
|
||||
{
|
||||
player setVariable ["OpenTarget",false,true];
|
||||
};
|
||||
|
||||
|
||||
if ((diag_tickTime - _timer150) > 60) then {
|
||||
//Digest Food.
|
||||
if (r_player_foodstack > 0) then { r_player_foodstack = r_player_foodstack - 1; };
|
||||
|
||||
|
||||
_timer150 = diag_ticktime;
|
||||
};
|
||||
|
||||
if ((diag_tickTime - _timer) > 300) then {
|
||||
|
||||
if ((diag_tickTime - _timer) > 300) then {
|
||||
_timer = diag_tickTime;
|
||||
};
|
||||
|
||||
|
||||
//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];
|
||||
publicVariableServer "PVDZ_playerMedicalSync";
|
||||
};
|
||||
_timer30 = diag_tickTime;
|
||||
};
|
||||
|
||||
|
||||
//Record Check
|
||||
_lastUpdate = diag_ticktime - dayZ_lastPlayerUpdate;
|
||||
if (_lastUpdate > 8) then {
|
||||
@@ -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];
|
||||
@@ -121,14 +111,14 @@ while {1 == 1} do {
|
||||
dayZ_lastPlayerUpdate = diag_ticktime;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
_hunger = (abs((((r_player_bloodTotal - r_player_blood) / r_player_bloodTotal) * 5) + _speed + dayz_myLoad) * 3);
|
||||
if (diag_ticktime - dayz_panicCooldown < 120) then {
|
||||
_hunger = _hunger * 2;
|
||||
};
|
||||
dayz_hunger = dayz_hunger + (_hunger / 70); //60 Updated to 80
|
||||
dayz_hunger = (dayz_hunger min SleepFood) max 0;
|
||||
|
||||
|
||||
//Thirst
|
||||
_thirst = 2;
|
||||
if (_refObj == player) then {
|
||||
@@ -136,35 +126,35 @@ while {1 == 1} do {
|
||||
};
|
||||
dayz_thirst = dayz_thirst + (_thirst / 60) * (dayz_temperatur / dayz_temperaturnormal); //TeeChange Temperatur effects added Max Effects: -25% and + 16.6% waterloss
|
||||
dayz_thirst = (dayz_thirst min SleepWater) max 0;
|
||||
|
||||
|
||||
//diag_log format ["playerSpawn2 %1/%2",dayz_hunger,dayz_thirst];
|
||||
|
||||
|
||||
//Calories
|
||||
if (dayz_nutrition > 0) then {
|
||||
_Nutrition = dayz_nutrition;
|
||||
_hunger = (abs((((r_player_bloodTotal - r_player_blood) / r_player_bloodTotal) * 5) + _speed + dayz_myLoad) * 3);
|
||||
_thirst = 2; if (_refObj == player) then {_thirst = (_speed + 4) * 3;};
|
||||
_NutritionLoss = _Nutrition - (((_thirst / 1000) + (_hunger / 1000)) * (dayz_temperatur / dayz_temperaturnormal));
|
||||
_NutritionLoss = _Nutrition - (((_thirst / 1000) + (_hunger / 1000)) * (dayz_temperatur / dayz_temperaturnormal));
|
||||
r_player_Nutrition = _NutritionLoss;
|
||||
} else {
|
||||
r_player_Nutrition = 0;
|
||||
};
|
||||
dayz_nutrition = r_player_Nutrition;
|
||||
|
||||
|
||||
//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];
|
||||
publicVariableServer "PVDZ_serverStoreVar";
|
||||
|
||||
|
||||
_lastTemp = dayz_temperatur;
|
||||
};
|
||||
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
|
||||
{
|
||||
@@ -190,7 +180,7 @@ while {1 == 1} do {
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
//If has infection reduce blood cough and add shake
|
||||
if (r_player_infected) then {
|
||||
@@ -230,25 +220,21 @@ 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;
|
||||
};
|
||||
|
||||
|
||||
if (r_player_blood > r_player_bloodTotal) then {
|
||||
r_player_blood = r_player_bloodTotal;
|
||||
};
|
||||
@@ -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;
|
||||
};
|
||||
@@ -271,18 +257,18 @@ while {1 == 1} do {
|
||||
if (_messTimer > 60) then {
|
||||
_messTimer = 0;
|
||||
player setVariable ["messing",[dayz_hunger,dayz_thirst,dayz_nutrition],false];
|
||||
|
||||
|
||||
PVDZ_serverStoreVar = [player,"messing",[dayz_hunger,dayz_thirst,dayz_nutrition]];
|
||||
publicVariableServer "PVDZ_serverStoreVar";
|
||||
};
|
||||
|
||||
//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];
|
||||
publicVariableServer "PVDZ_plr_Save";
|
||||
|
||||
|
||||
//PVDZ_serverStoreVar = [player,"Achievements",dayz_playerAchievements];
|
||||
//publicVariableServer "PVDZ_serverStoreVar";
|
||||
//player setVariable ["Achievements",dayz_playerAchievements,false];
|
||||
@@ -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);
|
||||
@@ -344,7 +316,7 @@ while {1 == 1} do {
|
||||
call dayz_meleeMagazineCheck;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
//Two primary guns pickup exploit fix
|
||||
if ((DZE_TwoPrimaries < 2) && (primaryWeapon player != "") && (!(primaryWeapon player in MeleeWeapons)) && (dayz_onBack != "") && (!(dayz_onBack in MeleeWeapons)) && (isNull (findDisplay 106)) &&
|
||||
(animationState player != "amovpknlmstpslowwrfldnon_amovpknlmstpsraswrfldnon" OR animationState player != "amovpercmstpslowwrfldnon_amovpercmstpsraswrfldnon" OR animationState player != "amovpercmstpslowwrfldnon_amovpercmstpsraswrfldnon")) then {
|
||||
@@ -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