Properly disable antiTP and sched security when dayz_antihack=0;

This prevents them being called unnecessarily on loop.
This commit is contained in:
ebaydayz
2017-01-25 15:02:05 -05:00
parent 7d6319fa30
commit c641bc20a8
4 changed files with 18 additions and 14 deletions

View File

@@ -6,8 +6,8 @@
*/
sched_antiTP_init = {
if (dayz_antihack == 1) then { diag_log [ diag_ticktime, __FILE__, "Anti Teleport inited"]; };
[dayz_antihack == 1, [], 0, 0, objNull, respawn_west_original]
diag_log [ diag_ticktime, __FILE__, "Anti Teleport inited"];
[true, [], 0, 0, objNull, respawn_west_original]
};
sched_antiTP = {
@@ -21,7 +21,7 @@ sched_antiTP = {
_lastVehicle = _this select 4;
_debug = _this select 5;
if (((_antihack) and {(typeName player == "OBJECT")}) AND {((player in playableUnits) AND {(alive player)})}) then {
if (typeName player == "OBJECT" && {(player in playableUnits) && (alive player)}) then {
if (count _lastpos != 3) then {
_lastpos = getPosATL (vehicle player);
_lastheight = (ATLtoASL _lastpos) select 2;

View File

@@ -7,8 +7,6 @@ call compile preprocessFileLineNumbers (_base+"sched_bloodstains.sqf");
call compile preprocessFileLineNumbers (_base+"sched_animals.sqf");
call compile preprocessFileLineNumbers (_base+"sched_buriedZeds.sqf");
call compile preprocessFileLineNumbers (_base+"sched_gravity.sqf");
call compile preprocessFileLineNumbers (_base+"sched_security.sqf");
call compile preprocessFileLineNumbers (_base+"sched_antiTeleport.sqf");
call compile preprocessFileLineNumbers (_base+"sched_newDay.sqf");
call compile preprocessFileLineNumbers (_base+"sched_spawnCheck.sqf");
call compile preprocessFileLineNumbers (_base+"sched_playerActions.sqf");
@@ -17,6 +15,11 @@ call compile preprocessFileLineNumbers (_base+"sched_medical.sqf");
call compile preprocessFileLineNumbers (_base+"sched_gui.sqf");
call compile preprocessFileLineNumbers (_base+"sched_buildingBubble.sqf");
if (dayz_antihack == 1) then {
call compile preprocessFileLineNumbers (_base+"sched_security.sqf");
call compile preprocessFileLineNumbers (_base+"sched_antiTeleport.sqf");
};
if (dayz_townGenerator) then {
call compile preprocessFileLineNumbers (_base+"sched_towngenerator.sqf");
call compile preprocessFileLineNumbers (_base+"sched_planthint.sqf");
@@ -29,8 +32,6 @@ if (count _list == 0) then {
// period offset loop code <-> ctx, init code ->ctx
[ 0, 0, sched_onEachFrame, sched_onEachFrame_init ], // SPECIAL: nul period -> code returns boolean requesting to skip other tasks
[ 0.2, 20, sched_gravity, sched_gravity_init ],
[ 0.2, 0.15, sched_security, sched_security_init ],
[ 0.2, 0.05, sched_antiTP, sched_antiTP_init ],
[ 0.1, 0.01, sched_playerActions ],
[ 0.2, 0.12, sched_gui, sched_gui_init ],
[ 2, 0.13, sched_medical_effects, sched_medical_effects_init ],
@@ -47,6 +48,11 @@ if (count _list == 0) then {
[ 1, 0.51, sched_buriedZeds, sched_buriedZeds_init ]
];
if (dayz_antihack == 1) then {
_list set [count _list, [0.2, 0.15, sched_security, sched_security_init]];
_list set [count _list, [0.2, 0.05, sched_antiTP, sched_antiTP_init]];
};
//Disable townGenerator for alternative maps or when junk is not wanted on Chernarus
if (dayz_townGenerator) then {
_list set [count _list, [0.2, 0.07, sched_townGenerator, sched_townGenerator_init]];

View File

@@ -1,15 +1,13 @@
// (c) facoptere@gmail.com, licensed to DayZMod for the community
sched_security_init = {
if (dayz_antihack == 1) then { diag_log [ diag_ticktime, __FILE__, "Some security routines inited"]; };
if (dayz_antihack == 1) then { [ "", time, 0, 0, grpNull ] } else { [] }
diag_log [ diag_ticktime, __FILE__, "Some security routines inited"];
[ "", time, 0, 0, grpNull ]
};
sched_security = {
private ["_netid","_timeTrickCount","_idTrickCount","_time","_otime","_pid", "_quit", "_list"];
if (count _this != 5) exitWith { [] };
_netid = _this select 0;
_otime = _this select 1;
_idTrickCount = _this select 2;
@@ -50,7 +48,7 @@ sched_security = {
};
};
if (isNull _grp) then { _grp = group ((allmissionobjects 'FunctionsManager') select 0); };
if (isNull _grp) then { _grp = group ((entities 'FunctionsManager') select 0); };
if (!isNull _grp) then {
_list = units _grp;
if (count _list > 1) then {