Switch often called functions from private to local

This commit is contained in:
AirwavesMan
2021-01-14 09:24:06 +01:00
parent 1d826ac331
commit 63a3535f37
12 changed files with 368 additions and 375 deletions

View File

@@ -11,14 +11,11 @@ sched_antiTP_init = {
};
sched_antiTP = {
private ["_lastpos","_lastheight","_lasttime","_lastVehicle","_debug","_curpos","_distance","_curtime","_difftime",
"_curheight","_speed","_topSpeed","_terrainHeight","_safetyVehicle","_curPos"];
_lastpos = _this select 1;
_lastheight = _this select 2;
_lasttime = _this select 3;
_lastVehicle = _this select 4;
_debug = _this select 5;
local _lastpos = _this select 1;
local _lastheight = _this select 2;
local _lasttime = _this select 3;
local _lastVehicle = _this select 4;
local _debug = _this select 5;
if (typeName player == "OBJECT" && {(player in playableUnits) && (alive player)}) then {
if (count _lastpos != 3) then {
@@ -27,22 +24,22 @@ sched_antiTP = {
_lasttime = diag_ticktime;
_lastVehicle = vehicle player;
};
_curpos = getPosATL (vehicle player);
_distance = _lastpos distance _curpos;
_curtime = diag_ticktime;
_difftime = _curtime - _lasttime;
local _curpos = getPosATL (vehicle player);
local _distance = _lastpos distance _curpos;
local _curtime = diag_ticktime;
local _difftime = _curtime - _lasttime;
if ((_distance > 10) OR {(_difftime > 1)}) then {
_curheight = (ATLtoASL _curpos) select 2;
_speed = _distance / _difftime;
_topSpeed = 10;
local _curheight = (ATLtoASL _curpos) select 2;
local _speed = _distance / _difftime;
local _topSpeed = 10;
if (vehicle player != player) then {
_topSpeed = (getNumber (configFile >> "CfgVehicles" >> typeOf (vehicle player) >> "maxSpeed")) min 500;
};
_terrainHeight = getTerrainHeightASL [_curpos select 0, _curpos select 1];
_safetyVehicle = vehicle player;
local _terrainHeight = getTerrainHeightASL [_curpos select 0, _curpos select 1];
local _safetyVehicle = vehicle player;
if (_lastVehicle == vehicle player) then {
if ((_speed > _topSpeed) && (alive player) && ((driver (vehicle player) == player) or (isNull (driver (vehicle player)))) && (_debug distance _lastpos > 3000) && !((vehicle player == player) && (_curheight < _lastheight) && ((_curheight - _terrainHeight) > 1))) then {

View File

@@ -6,26 +6,24 @@ sched_gravity_init = {
};
sched_gravity = {
private ["_otime","_opos","_offtime","_offpos","_oid","_idTrickCount","_timeTrickCount","_time","_ppos","_fftime","_ffpos","_pid","_netid","_initDone"];
if ((!(_this select 5) and !isNil 'Dayz_loginCompleted') and {(Dayz_loginCompleted)}) then {
_this = [ time, VisiblePositionASL player, time, VisiblePositionASL player, false, true];
//diag_log [ diag_tickTime, __FILE__, "freefall inited" ];
};
_otime = _this select 0;
_opos = _this select 1;
_offtime = _this select 2;
_offpos = _this select 3;
_inprogress = _this select 4;
_initDone = _this select 5;
local _otime = _this select 0;
local _opos = _this select 1;
local _offtime = _this select 2;
local _offpos = _this select 3;
local _inprogress = _this select 4;
local _initDone = _this select 5;
if (_initDone) then {
// detect and save freefall start
_time = time;
_ppos = VisiblePositionASL player;
_fftime = _time;
_ffpos = +(_ppos);
local _time = time;
local _ppos = VisiblePositionASL player;
local _fftime = _time;
local _ffpos = +(_ppos);
if ((_opos select 2) - (_ppos select 2) >= if (_inprogress) then {0.1} else {0.39} ) then {
_fftime = _offtime;
_ffpos = +(_offpos);

View File

@@ -4,13 +4,11 @@ sched_gui_init = { [false] };
sched_gui = {
HIDE_FSM_VARS
private [ "_array", "_initDone", "_ui"];
local _initDone = _this select 0;
_initDone = _this select 0;
if ((!_initDone and !isNil 'Dayz_loginCompleted') and {(Dayz_loginCompleted)}) then {
if (!_initDone && !isNil 'Dayz_loginCompleted' && {Dayz_loginCompleted}) then {
if !(DZE_UI == 0) then {
_ui = call {
local _ui = call {
if (DZE_UI == 1) exitWith {"playerStatusGUI"};
if (DZE_UI == 2) exitWith {"playerStatusGUI_epoch"};
"playerStatusGUI_legacy";
@@ -28,7 +26,7 @@ sched_gui = {
// diag_log [ diag_Ticktime, __FILE__, "waiting", _initDone,Dayz_loginCompleted];
//};
if (_initDone) then {
_array = player call world_surfaceNoise;
local _array = player call world_surfaceNoise;
dayz_surfaceNoise = _array select 1;
dayz_surfaceType = _array select 0;
call player_checkStealth;

View File

@@ -17,10 +17,8 @@ sched_medical_slow = { // 10 seconds
sched_medical_init = { [ []spawn{} ] };
sched_medical = { // 1 second
HIDE_FSM_VARS
private ["_unconHdlr","_lowBlood"];
_unconHdlr = _this select 0;
local _unconHdlr = _this select 0;
if (r_player_blood == r_player_bloodTotal) then {
r_player_foodstack = 0;
@@ -33,7 +31,7 @@ sched_medical = { // 1 second
};
if (!canStand player) then { // be consistant with player_updateGui.sqf
if ((player getVariable ["hit_legs", 0] < 1) OR !r_fracture_legs) then {
if ((player getVariable ["hit_legs", 0] < 1) || !r_fracture_legs) then {
player setVariable ["hit_legs",1,true];
r_fracture_legs = true;
};
@@ -50,8 +48,8 @@ sched_medical = { // 1 second
};
"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 {
local _lowBlood = player getVariable ["USEC_lowBlood", false];
if ((r_player_blood < r_player_bloodTotal) && !_lowBlood) then {
player setVariable["USEC_lowBlood",true,true];
};
@@ -61,7 +59,7 @@ sched_medical = { // 1 second
};
//Handle Unconscious player
if ((r_player_unconscious) and {!r_player_unconsciousInProgress} and {scriptDone _unconHdlr}) then {
if ((r_player_unconscious) && !r_player_unconsciousInProgress && (scriptDone _unconHdlr)) then {
//localize "CLIENT: Start Unconscious Function";
_unconHdlr = [] spawn fnc_usec_unconscious;
};
@@ -79,13 +77,11 @@ sched_medical = { // 1 second
};
sched_medical_effects_init = {
private ["_hndCC", "_hndDB", "_hndRB"];
_hndCC = ppEffectCreate ["colorCorrections", 3];
local _hndCC = ppEffectCreate ["colorCorrections", 3];
_hndCC ppEffectEnable true;
_hndDB = ppEffectCreate ["dynamicBlur", 2];
local _hndDB = ppEffectCreate ["dynamicBlur", 2];
_hndDB ppEffectEnable true;
_hndRB = ppEffectCreate ["radialBlur", 1];
local _hndRB = ppEffectCreate ["radialBlur", 1];
_hndRB ppEffectEnable true;
_hndRB ppEffectAdjust [0, 0, 0.5, 0.5];
_hndRB ppEffectCommit 0;
@@ -97,12 +93,12 @@ sched_medical_effects = {
// every 2 seconds:
// change saturation, blur and vignetting according to blood level
// Shivering if character temperature is near the minimum
private ["_hndCC", "_hndDB", "_tmp1", "_tmp2", "_tmp3","_hndRB"];
_hndCC = _this select 0;
_hndDB = _this select 1;
_hndRB = _this select 2;
local _hndCC = _this select 0;
local _hndDB = _this select 1;
local _hndRB = _this select 2;
local _tmp1 = 0;
local _tmp2 = 0;
local _tmp3 = 0;
if (r_player_infected) then {
_tmp1 = 0.4 + 0.06 * cos(diag_tickTime * 360 / 12);
@@ -131,7 +127,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) && {((vehicle player == player) && (speed player < 5)) || (vehicle player != player)}) then {
addCamShake [0.6 * (dayz_temperaturmin / dayz_temperatur), 2, 30];
};
@@ -142,7 +138,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 || 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];
@@ -150,7 +146,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 || {vehicle player != player}}) then {
[player,"cough",1,false] call dayz_zombieSpeak;
};
};

View File

@@ -10,8 +10,7 @@ sched_onEachFrame_init = {
};
sched_onEachFrame = {
private ["_ret"];
_ret = (1==0);
local _ret = (1==0);
if (diag_fpsmin < 10) then {
sched_ef_lowFPSctr = sched_ef_lowFPSctr +1;

View File

@@ -6,14 +6,12 @@ sched_security_init = {
};
sched_security = {
private ["_netid","_timeTrickCount","_idTrickCount","_time","_otime","_pid", "_quit", "_list"];
_netid = _this select 0;
_otime = _this select 1;
_idTrickCount = _this select 2;
_timeTrickCount = _this select 3;
_grp = _this select 4;
_time = time;
local _netid = _this select 0;
local _otime = _this select 1;
local _idTrickCount = _this select 2;
local _timeTrickCount = _this select 3;
local _grp = _this select 4;
local _time = time;
if (typeName player != "OBJECT") then {
PVDZ_sec_atp = format["WARNING typename error for play3r UID#%1", getPlayerUID player];
@@ -38,7 +36,7 @@ sched_security = {
};
};
_pid = netid player;
local _pid = netid player;
_idTrickCount = _idTrickCount * 0.8;
if (_pid != _netid) then {
_idTrickCount = _idTrickCount +1;
@@ -50,13 +48,13 @@ sched_security = {
if (isNull _grp) then { _grp = group ((entities 'FunctionsManager') select 0); };
if (!isNull _grp) then {
_list = units _grp;
local _list = units _grp;
if (count _list > 1) then {
_quit = false;
local _quit = false;
for "_i" from 2 to (count _list)-1 do {
_u = (_list select _i);
local _u = (_list select _i);
if (!isNull _u) then {
_pos = getPosATL _u;
local _pos = getPosATL _u;
PVDZ_sec_atp = format ["From play3r UID#%1: illegal gr0up m3mber %2 at %3,%4... Server may be compromised!", getPlayerUID player, typeOf _u, _pos select 0, _pos select 1];
publicVariableServer "PVDZ_sec_atp";
deleteVehicle _u;

View File

@@ -12,10 +12,8 @@ sched_throwable_init = {
};
sched_throwable = {
private ["_stance","_cur_muzz","_type", "_x"];
if ((!isNil "player") and {(!isNull player)}) then {
_cur_muzz = currentMuzzle player;
local _cur_muzz = currentMuzzle player;
if (((!isNil "_cur_muzz") and {(_cur_muzz != "")}) AND {(0 == getNumber(configFile >> "CfgWeapons" >> _cur_muzz >> "type"))}) then {
if (sched_throwable_prevmuzz != _cur_muzz) then {
sched_throwable_prevmuzz = currentMuzzle player;
@@ -26,9 +24,9 @@ sched_throwable = {
};
};
if (abs(sched_throwable_time-diag_tickTime)<2) then {
_stance = toArray (animationState player);
local _stance = toArray (animationState player);
_stance = if ((!isNil "_stance") and {(count _stance>17)}) then {toString [_stance select 17]} else {""};
_type = 4096;
local _type = 4096;
switch _stance do {
case "p": { _type = 2; };
case "r": { _type = 1; };