Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions database/ZombieKill.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/*
*
* Add the zedkills field
* Add the zombie kill counter used by addAccountZombieKill.
*
*/

ALTER TABLE account ADD zedkills int(11) DEFAULT '0'
ALTER TABLE account
ADD COLUMN IF NOT EXISTS zombie_kills INT UNSIGNED NOT NULL DEFAULT 0 AFTER kills;
4 changes: 2 additions & 2 deletions database/extDB2/exile.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[addAccountZombieKill]
SQL1_1 = UPDATE account SET zedkills = zedkills + 1 WHERE uid = ?
SQL1_1 = UPDATE account SET zombie_kills = zombie_kills + 1 WHERE uid = ?
Number Of Inputs = 1
SQL1_INPUTS = 1
SQL1_INPUTS = 1
4 changes: 2 additions & 2 deletions database/extDB3/exile.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[addAccountZombieKill]
SQL1_1 = UPDATE account SET zedkills = zedkills + 1 WHERE uid = ?
SQL1_1 = UPDATE account SET zombie_kills = zombie_kills + 1 WHERE uid = ?

SQL1_INPUTS = 1
SQL1_INPUTS = 1
2 changes: 2 additions & 0 deletions exilez_mod/config.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ EZM_MinSpawnDistance = 20; // Closest distance from any player
EZM_MaxSpawnDistance = 100; // Max distance a zombie should spawn from a player.
EZM_MaxDistance = 300; // Max distance to players before delete.
EZM_MaxTime = 30; // Max time away from a player before delete.
EZM_MonitorInterval = 5; // Seconds between zombie monitor batches.
EZM_MonitorBatchSize = 50; // Maximum zombies checked per monitor batch.
EZM_MaxTimeDead = 300; // Max time for a dead Zombie to stay before delete. (Default 5 minutes)
EZM_RemoveZfromTraders = true; // Will kill zombies when they get too close to a safezone. (the check is done every MaxTime)
EZM_RemoveZfromTerritory = true; // Will kill zombies when they get too close to a flag. (the check is done every MaxTime)
Expand Down
7 changes: 4 additions & 3 deletions exilez_mod/init/fn_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ EZM_ZMPKilled = compileFinal preprocessFileLineNumbers "exilez_mod\scripts\MPKil
EZM_GetRandomLocation = compileFinal preprocessFileLineNumbers "exilez_mod\scripts\GetRandomLocation.sqf";
EZM_VerifyLocation = compileFinal preprocessFileLineNumbers "exilez_mod\scripts\VerifyLocation.sqf";
EZM_TurnTheLightsOff = compileFinal preprocessFileLineNumbers "exilez_mod\scripts\LightsOff.sqf";
EZM_RefreshPlayerCache = compileFinal preprocessFileLineNumbers "exilez_mod\scripts\RefreshPlayerCache.sqf";

// Compile the Zombie Monitor
EZM_ZombieMonitor = compileFinal preprocessFileLineNumbers "exilez_mod\scripts\ZombieMonitor.sqf";
Expand All @@ -312,12 +313,12 @@ EZM_HordeThread = compileFinal preprocessFileLineNumbers "exilez_mod\scripts\Hor
// Add Zombie Monitor to ExileServer Thread
if (EZM_Debug) then
{
[EZM_MaxTime/2, EZM_ZombieMonitor, [], true] call ExileServer_system_thread_addTask;
[EZM_MonitorInterval, EZM_ZombieMonitor, [], true] call ExileServer_system_thread_addTask;
diag_log "ExileZ Mod: Added Debug Zombie Monitor to ExileServer Thread";
}
else
{
[EZM_MaxTime, EZM_ZombieMonitor, [], true] call ExileServer_system_thread_addTask;
[EZM_MonitorInterval, EZM_ZombieMonitor, [], true] call ExileServer_system_thread_addTask;
diag_log "ExileZ Mod: Added Zombie Monitor to ExileServer Thread";
};

Expand Down Expand Up @@ -438,4 +439,4 @@ if ((EZM_UseAreaBlacklist) && (EZM_BlacklistExtendTraders)) then
EZM_BlacklistedPositions append EZM_BlacklistedTraders;
};

diag_log format["ExileZ Mod: Version %1 Started at (%2)", exileZmod_version, time];
diag_log format["ExileZ Mod: Version %1 Started at (%2)", exileZmod_version, time];
3 changes: 3 additions & 0 deletions exilez_mod/init/fn_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ if (isNil "EZM_CompiledOkay") exitWith
// Create Zombie Monitor
EZM_aliveZombies = [];
publicVariable "EZM_aliveZombies";
EZM_playerCache = [];
EZM_playerCacheUpdatedAt = -1;
EZM_zombieMonitorIndex = 0;

// Create Dead Zombie Monitor
EZM_deadZombies = [];
Expand Down
5 changes: 3 additions & 2 deletions exilez_mod/scripts/HarassingZombiesThread.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ExileZ Mod by [FPS]kuplion - Based on ExileZ 2.0 by Patrix87

*/

private ["_chanceRoll","_nPlayer","_sTime","_group","_count","_groupSize","_vestGroup","_lootGroup","_zombieGroup","_playerObj","_playerName","_playerPosition","_skipPlayer"];
private ["_chanceRoll","_nPlayer","_sTime","_group","_count","_groupSize","_vestGroup","_lootGroup","_zombieGroup","_playerObj","_playerName","_playerPosition","_skipPlayer","_players"];

_groupSize = (_this select 0) select 0;
_vestGroup = (_this select 0) select 1;
Expand All @@ -21,6 +21,7 @@ if (time < 120) exitWith
};

// Run the Harassing Zombie Loop
_players = call EZM_RefreshPlayerCache;
{
if (EZM_Debug) then
{
Expand Down Expand Up @@ -137,4 +138,4 @@ if (time < 120) exitWith
};
uisleep 0.5;
}
forEach (allPlayers - entities "HeadlessClient_F");
forEach _players;
8 changes: 3 additions & 5 deletions exilez_mod/scripts/HordeThread.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@ if (time < 120) exitWith

// Run the Horde Loop
// Count players in game
_nPlayer = count (allPlayers - entities "HeadlessClient_F");
_playerObjs = call EZM_RefreshPlayerCache;
_nPlayer = count _playerObjs;
if (_nPlayer >= 1) then
{

//create player list
_playerObjs = allPlayers - entities "HeadlessClient_F";

//try to pick a lucky winner with a possible valid location
for "_i" from 1 to _nPlayer do
{
Expand Down Expand Up @@ -100,4 +98,4 @@ if (_nPlayer >= 1) then
diag_log "ExileZ Mod: No valid player found for The Horde..";
};
};
};
};
16 changes: 16 additions & 0 deletions exilez_mod/scripts/RefreshPlayerCache.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*

ExileZ Mod by [FPS]kuplion - Based on ExileZ 2.0 by Patrix87

*/

if (isNil "EZM_playerCacheUpdatedAt" || {diag_tickTime - EZM_playerCacheUpdatedAt >= 1}) then
{
EZM_playerCache = (allPlayers - entities "HeadlessClient_F") select
{
isPlayer _x && alive _x
};
EZM_playerCacheUpdatedAt = diag_tickTime;
};

EZM_playerCache
9 changes: 5 additions & 4 deletions exilez_mod/scripts/VerifyLocation.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ExileZ Mod by [FPS]kuplion - Based on ExileZ 2.0 by Patrix87
//_validLocation = [_triggerPosition,false] call VerifyLocation;

// Return True if valid
private ["_flags","_validLocation","_distance","_radius","_position","_ignorePlayer"];
private ["_flags","_validLocation","_distance","_radius","_position","_ignorePlayer","_players"];

_ignorePlayer = false;

Expand All @@ -20,6 +20,7 @@ if (count _this == 2) then
};

_validLocation = true;
_players = call EZM_RefreshPlayerCache;

// Check if empty
if ((count _position) == 0) then
Expand Down Expand Up @@ -78,7 +79,7 @@ if (_validLocation) then
// Check for players too close
if (_validLocation && !_ignorePlayer) then
{
if ({isplayer _x} count (_position nearEntities EZM_MinSpawnDistance) == 1) then
if ({(_x distance _position) <= EZM_MinSpawnDistance} count _players > 0) then
{
_validLocation = false;
};
Expand All @@ -87,12 +88,12 @@ if (_validLocation && !_ignorePlayer) then
// Check for absence of players near
if (_validLocation && !_ignorePlayer) then
{
if ({isplayer _x} count (_position nearEntities EZM_MaxSpawnDistance) == 0) then
if ({(_x distance _position) <= EZM_MaxSpawnDistance} count _players == 0) then
{
_validLocation = false;
};
};


// return
_validLocation;
_validLocation;
128 changes: 39 additions & 89 deletions exilez_mod/scripts/ZombieMonitor.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,111 +4,61 @@ ExileZ Mod by [FPS]kuplion - Based on ExileZ 2.0 by Patrix87

*/

private ["_device","_zombie","_zombiePos","_zombieClass","_distance","_radius","_flags"];
private ["_players","_processed","_zombieCount","_zombie","_zombiePos","_remove","_devices"];

if (EZM_ExtendedLogging) then
_players = call EZM_RefreshPlayerCache;
_processed = 0;
_zombieCount = count EZM_aliveZombies;

if (EZM_Debug) then
{
diag_log format["ExileZ Mod: Monitored Zombies | %1 ", (count EZM_aliveZombies)];
diag_log format["ExileZ Mod: Monitoring zombie batch | Alive: %1 | Players: %2", _zombieCount, count _players];
};

while {_processed < EZM_MonitorBatchSize && {_processed < _zombieCount} && {count EZM_aliveZombies > 0}} do
{
_zombie = _x;
_zombieClass = typeOf _zombie;
_zombiePos = getPos _zombie;

if ((isNull _zombie) || (!(alive _zombie))) exitWith
if (EZM_zombieMonitorIndex >= count EZM_aliveZombies) then
{
deleteVehicle _zombie;
EZM_aliveZombies = EZM_aliveZombies - [_zombie];

if (EZM_ExtendedLogging) then
{
diag_log format["ExileZ Mod: Removing 1 Zombie (Probably dead..) | Position : %1 | Class : %2",_zombiePos,_zombieClass];
};
EZM_zombieMonitorIndex = 0;
};

// Check for the absence of players
if (({isplayer _x} count (_zombiePos nearEntities EZM_MaxDistance) == 0) && alive _zombie) then

_zombie = EZM_aliveZombies select EZM_zombieMonitorIndex;
_remove = isNull _zombie || {!alive _zombie};

if (!_remove) then
{
//_zombie setdamage 1;
//uisleep 5;
deleteVehicle _zombie;
EZM_aliveZombies = EZM_aliveZombies - [_zombie];

if (EZM_ExtendedLogging) then
_zombiePos = getPosATL _zombie;
_remove = ({(_x distance _zombiePos) <= EZM_MaxDistance} count _players) == 0;

if (!_remove && {EZM_RemoveZfromTraders}) then
{
diag_log format["ExileZ Mod: Removing 1 Zombie due to no Players | Position : %1 | Class : %2",_zombiePos,_zombieClass];
_remove = _zombiePos call ExileClient_util_world_isInTraderZone;
};
};

// Check for safe zones
if ((EZM_RemoveZfromTraders) && ((getPosATL _zombie) call ExileClient_util_world_isInTraderZone) && (alive _zombie)) then
{
//_zombie setdamage 1;
//uisleep 5;
deleteVehicle _zombie;
EZM_aliveZombies = EZM_aliveZombies - [_zombie];

if (EZM_ExtendedLogging) then

if (!_remove && {EZM_RemoveZfromTerritory}) then
{
diag_log format["ExileZ Mod: Removing 1 Zombie at a SafeZone | Position : %1 | Class : %2",_zombiePos,_zombieClass];
_remove = _zombiePos call ExileClient_util_world_isInTerritory;
};
};

// Check for flags
if ((EZM_RemoveZfromTerritory) && ((getPosATL _zombie) call ExileClient_util_world_isInTerritory) && (alive _zombie)) then
{
//_zombie setdamage 1;
//uisleep 5;
deleteVehicle _zombie;
EZM_aliveZombies = EZM_aliveZombies - [_zombie];

if (EZM_ExtendedLogging) then

if (!_remove) then
{
diag_log format["ExileZ Mod: Removing 1 Zombie at a Territory | Position : %1 | Class : %2",_zombiePos,_zombieClass];
_devices = nearestObjects [_zombiePos, ["Land_Device_assembled_F", "DP_Land_Device_assembled_F", "O_Truck_03_device_F"], 30];
_remove = count _devices > 0;
};
};

// Check for the device
if (alive _zombie)then

if (_remove) then
{
_device = _zombiePos nearObjects ["Land_Device_assembled_F", 30];
if (!isNull _zombie) then
{
_distance = (getPosATL _x) distance _zombiePos;
if (_distance <= 30) exitWith
{
//_zombie setdamage 1;
//uisleep 10;
deleteVehicle _zombie;
EZM_aliveZombies = EZM_aliveZombies - [_zombie];

if (EZM_ExtendedLogging) then
{
diag_log format["ExileZ Mod: Removing 1 Zombie near a Land Device | Position : %1 | Class : %2",_zombiePos,_zombieClass];
};
};
}forEach _device;
};

// Check for the mobile device
if (alive _zombie)then
deleteVehicle _zombie;
};
EZM_aliveZombies deleteAt EZM_zombieMonitorIndex;
}
else
{
_device = _zombiePos nearObjects ["O_Truck_03_device_F", 30];
{
_distance = (getPosATL _x) distance _zombiePos;
if (_distance <= 30) exitWith
{
//_zombie setdamage 1;
//uisleep 10;
deleteVehicle _zombie;
EZM_aliveZombies = EZM_aliveZombies - [_zombie];

if (EZM_ExtendedLogging) then
{
diag_log format["ExileZ Mod: Removing 1 Zombie near a Truck Device | Position : %1 | Class : %2",_zombiePos,_zombieClass];
};
};
}forEach _device;
EZM_zombieMonitorIndex = EZM_zombieMonitorIndex + 1;
};

}forEach EZM_aliveZombies;

_processed = _processed + 1;
};