Server Done I Think

This commit is contained in:
icomrade
2016-02-29 00:29:23 -05:00
parent b96cd2d971
commit 58acf95dc7
37 changed files with 3919 additions and 1200 deletions

View File

@@ -0,0 +1,28 @@
// (c) facoptere@gmail.com, licensed to DayZMod for the community
{
if (random 1 < 0.33) then {
_flame = createVehicle [ "flamable_DZ", _x, [], 0, "CAN_COLLIDE"];
_flame inflame true;
_flame setVariable ["permaLoot",true]; // = won't be removed by the cleaner, cf. sched_lootpiles.sqf
};
sleep 0.001;
} count [
[11580.2,3391.72,-1.20629], [11604.4,3389.41,0.0161071], [11664.6,3415.82,-0.524297], [11678.4,3421.32,-0.526046], [11681.4,3409.25,0.028707],
[11700.9,3416.6,-0.433657], [11707.7,3431.61,0.597957], [11817.8,12693.7,-0.131821], [11844.7,12749.8,-0.109467], [11845.2,12747.7,-0.119843],
[11846.3,12751.1,-0.234741], [11862.3,12748.1,-0.31282], [11863,12748.5,-0.302368], [11863.9,12749.1,-0.279175], [11911.8,9101.2,0.597935],
[11983,9162.89,0.597931], [12013.1,9159.38,0.597931], [12197.2,9499.66,0.603302], [12210.8,9728.83,0.597929], [12218.7,9752.14,0.597929],
[12247,9746.97,0.597929], [12271.7,9719.5,0.597929], [12407.3,9549.83,0.599188], [12698.9,9523.05,0.039454], [12700.7,9515.4,7.22985],
[12701.1,9516.98,7.29042], [12704,9511.34,0.0394101], [12706.2,9510.56,0.0394883], [12706,9513.22,0.0393739], [12707.3,9520.42,0.03929],
[12707.4,9537.02,0.0394235], [12710.4,9548.67,9.79484], [12712.2,9544.37,9.98028], [12714.3,9535.06,-0.634063], [12715.2,9539.4,0.039432],
[12715.5,9536.36,0.0393863], [12718.4,9550.81,-0.633002], [12718.6,9550.53,0.0454731], [12721.6,9502.26,0.0394025], [1689.3,11754.5,-0.640869],
[1693.15,11750.4,0.0564575], [1698.03,11751.3,0.0558929], [1700.78,11733,0.0564728], [1704.94,11761.2,0.0585327], [1705.92,11728.9,0.0565643],
[1709.39,11727.4,0.0566864], [1713.98,11724.6,0.0566711], [1724.37,11729.1,0.054306], [1725.6,11729.7,0.0551147], [1727.1,11727.7,0.0535278],
[1727.33,11724.1,-0.64357], [1728.14,11729.9,-0.644043], [1729.12,11729.2,0.0558777], [1730.91,11729.7,-0.644058], [1731.99,11728.5,0.0557709],
[1746.26,11721.7,0.0542297], [1782.34,11754.6,0.598038], [4889.27,2234.81,0.272388], [4892.66,2235.29,0.272345], [6043.67,7781.65,0.597931],
[6177.52,2125.36,0.598278], [6291.18,7808.69,0.597961], [6317.3,7835.18,0.597961], [6428.26,2244.95,0.59796], [6513.29,2298.32,0.597929],
[6536.12,2639.35,0.597929], [6545.71,2630.16,0.597929], [6663.22,2286.33,0.597929], [6706.46,3012.04,0.59866], [6725.35,2576.59,0.597929],
[6754.5,2780.37,0.597929], [6760.03,2727.7,0.597929], [6789.35,2692.69,0.597929], [6796.09,2726.09,0.597929], [6810.51,2499.86,0.597929],
[6822.79,2482.01,0.597929], [6832.25,2500.24,0.597929], [6833.6,3176.97,0.59797], [6835.19,2694.23,0.597929], [6847.45,2360.25,0.597929],
[6856.71,2522.75,0.597929], [6864.41,2464.66,0.597929], [7065.12,2622.94,0.597929], [7095.99,2740.68,0.597929]
];

View File

@@ -0,0 +1,4 @@
while {isServer} do {
diag_log ("DEBUG FPS : " + str(diag_fps) );
sleep 360;
};

View File

@@ -0,0 +1,158 @@
#include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"
sched_co_deleteVehicle = {
private "_group";
_this removeAllMPEventHandlers "mpkilled";
_this removeAllMPEventHandlers "mphit";
_this removeAllMPEventHandlers "mprespawn";
_this removeAllEventHandlers "FiredNear";
_this removeAllEventHandlers "HandleDamage";
_this removeAllEventHandlers "Killed";
_this removeAllEventHandlers "Fired";
_this removeAllEventHandlers "GetIn";
_this removeAllEventHandlers "GetOut";
_this removeAllEventHandlers "Local";
_this removeAllEventHandlers "Respawn";
clearVehicleInit _this;
_group = group _this;
deleteVehicle _this;
if (count units _group == 0) then {
deleteGroup _group;
};
_this = nil;
};
sched_corpses = {
private ["_delQtyZ","_delQtyP","_addFlies","_x","_deathTime","_onoff","_delQtyAnimal", "_sound", "_deathPos", "_cpos"];
// EVERY 2 MINUTE
// DELETE UNCONTROLLED ZOMBIES --- PUT FLIES ON FRESH PLAYER CORPSES --- REMOVE OLD FLIES & CORPSES
_delQtyZ = 0;
_delQtyP = 0;
_addFlies = 0;
// diag_log "bodies ...";
{
if (local _x) then {
if (_x isKindOf "zZombie_Base") then {
_x call sched_co_deleteVehicle;
_delQtyZ = _delQtyZ + 1;
} else {
if (_x isKindOf "CAManBase") then {
_deathTime = _x getVariable ["sched_co_deathTime", -1];
if (_deathTime == -1) then {
_deathPos = _x getVariable [ "deathPos", getMarkerPos "respawn_west" ];
_cpos = getPosATL _x;
// forbid a move further than 50 meters, or burried body (antihack)
if (_deathPos distance _cpos > 50 or _deathPos select 2 < -0.2) then {
diag_log [ __FILE__, "Corpse has been moved! CID#",(_x getVariable["characterID", "?"]),"from:", _cpos, "to:", _deathPos ];
_x setPosATL _deathPos;
};
_deathTime = diag_tickTime;
_x setVariable ["sched_co_deathTime", _deathTime];
_x setVariable ["sched_co_fliesAdded", true];
_addFlies = _addFlies + 1;
};
// 40 minutes = how long a player corpse stays on the map
if (diag_tickTime - _deathTime > 40*60) then {
if (_x getVariable ["sched_co_fliesDeleted", false]) then {
// flies have been switched off, we can delete body
_sound = _x getVariable ["sched_co_fliesSource", nil];
if !(isNil "_sound") then {
detach _sound;
deleteVehicle _sound;
};
_x call sched_co_deleteVehicle;
_delQtyP = _delQtyP + 1;
} else {
PVCDZ_flies = [ 0, _x ];
publicVariable "PVCDZ_flies";
_x setVariable ["sched_co_fliesDeleted", true];
// body will be deleted at next round
};
} else {
_onoff = 1;
// remove flies on heavy rain.
if (rain > 0.25) then { _onoff = 0; };
// switch flies sound on/off.
// sound must be deleted/respawned periodically because new players won't ear it otherwise,
// and other players would ear it several times (very loud noise)
_sound = _x getVariable ["sched_co_fliesSource", nil];
if !(isNil "_sound") then {
detach _sound;
deleteVehicle _sound;
_x setVariable ["sched_co_fliesSource", nil];
//diag_log "delete sound";
};
if (_onoff == 1) then {
_sound = createSoundSource["Sound_Flies",getPosATL _x,[],0];
_sound attachTo [_x];
_x setVariable ["sched_co_fliesSource", _sound];
//diag_log "create sound";
};
// broadcast flies status for everyone periodically, to update visible swarm
PVCDZ_flies = [ _onoff, _x ];
publicVariable "PVCDZ_flies";
};
};
};
};
} forEach allDead;
_delQtyAnimal = 0;
{
if (local _x) then {
_x call sched_co_deleteVehicle;
_delQtyAnimal = _delQtyAnimal + 1;
};
} forEach entities "CAAnimalBase";
_delQtyGrp=0;
{
if (count units _x==0) then {
deleteGroup _x;
_delQtyGrp = _delQtyGrp + 1;
};
} forEach allGroups;
#ifdef SERVER_DEBUG
if (_delQtyZ+_delQtyP+_addFlies+_delQtyGrp > 0) then {
diag_log format ["%1: Deleted %2 uncontrolled zombies, %3 uncontrolled animals, %4 dead character bodies and %5 empty groups. Added %6 flies.", __FILE__,
_delQtyZ, _delQtyAnimal, _delQtyP,_delQtyGrp, _addFlies ];
};
#endif
objNull
};
/*
sched_disconnectedPlayers = {
private ["_x","_disconnectTime"];
{
diag_log (_x);
if (local _x) then {
_disconnectTime = _x getVariable ["sched_co_disconnectTime", -1];
if (_disconnectTime == -1) then {
_disconnectTime = diag_tickTime;
_x setVariable ["sched_co_disconnectTime", _disconnectTime];
};
if (diag_tickTime - _disconnectTime > dayz_ghostTimer) then {
if (alive _x) then {
[_x,nil] call server_playerSync;
};
dayz_disconnectPlayers = dayz_disconnectPlayers - [_x];
_x call sched_co_deleteVehicle;
};
diag_log format["%1 - %2",_x,_disconnectTime];
};
} forEach dayz_disconnectPlayers;
objNull
};
*/

View File

@@ -0,0 +1,35 @@
_base="z\addons\dayz_server\system\scheduler\";
call compile preprocessFileLineNumbers (_base+"sched_corpses.sqf");
call compile preprocessFileLineNumbers (_base+"sched_lootpiles.sqf");
//call compile preprocessFileLineNumbers (_base+"sched_playersHivesync.sqf");
//call compile preprocessFileLineNumbers (_base+"sched_vehiclesHivesync.sqf");
call compile preprocessFileLineNumbers (_base+"sched_sync.sqf");
//call compile preprocessFileLineNumbers (_base+"sched_traps.sqf");
call compile preprocessFileLineNumbers (_base+"sched_safetyVehicle.sqf");
[
// period offset code <-> ctx init code ->ctx
//[ 60, 121, sched_playersHivesync, sched_playersHivesync_init ],
//[ 60, 133, sched_vehiclesHivesync, sched_vehiclesHivesync_init ],
[ 60, 224, sched_corpses ],
[ 300, 336, sched_lootpiles_5m, sched_lootpiles_5m_init ],
[ 6, 340, sched_lootpiles ],
[ 900, 0, sched_sync ],
[ 120, 48, sched_safetyVehicle ]
//[ 0.1, 1, sched_traps ]
] execFSM ("z\addons\dayz_code\system\scheduler\scheduler.fsm");
//diag_log [ __FILE__, "Scheduler started"];
/*
// (see ViralZeds.hpp -> zombie_agent.fsm -> zombie_findOwner.sqf), called when a zombie becomes "local" to the server after the player disconnected
zombie_findOwner = {
(_this select 0) call fa_deleteVehicle;
};
*/

View File

@@ -0,0 +1,113 @@
#include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"
sched_lootpiles_5m_init = {
sched_lp_state = 0;
sched_lp_var1 = 0;
sched_lp_lootTotal = 0;
sched_lp_delqty = 0;
sched_lp_players = [];
sched_lp_list = [];
objNull
};
sched_lootpiles_5m = {
private ["_created","_kind","_x"];
if (sched_lp_state == 0) then {
sched_lp_list = [];
sched_lp_lootTotal = 0;
{
_kind = _x;
{
_created = _x getVariable ["created",-1];
if (_created == -1) then {
_created = diag_tickTime;
_x setVariable ["created",_created];
};
if (!(_x getVariable ["permaLoot",false]) AND {(diag_tickTime - _created > 1500)}) then {
sched_lp_list set [ count sched_lp_list, _x ];
};
sched_lp_lootTotal = sched_lp_lootTotal + 1;
} forEach allMissionObjects _kind;
} forEach [ "Blood_Trail_DZ", "ReammoBox", "Land_Fire_DZ", "flamable_DZ" ];
#ifdef SERVER_DEBUG
diag_log ["sched_lootpiles_5mn: reset lootpiles check, total visited:", sched_lp_lootTotal, "listed:", count sched_lp_list];
#endif
if (count sched_lp_list > 0) then {
sched_lp_state = 1;
sched_lp_var1 = 0;
sched_lp_players = +(playableUnits);
};
};
objNull
};
sched_lootpiles = {
private ["_plrBatch","_chunkSize","_imax","_plr","_i","_x", "_changed"];
// EVERY 5 MINUTES, ONE OF THESE TASKS SPACED BY 5 SECONDS:
// LOOK FOR OLD LOOTPILES -OR- IGNORE LOOTPILES NEAR _plrBatch PLAYERS -OR- REMOVE REMAINING _chunkSize LOOTPILES
_chunkSize = 50;
_plrBatch = 10;
switch true do {
case (sched_lp_state == 1): { // forEach players -> ignore nearby loot
_imax = (count sched_lp_players) min (sched_lp_var1 + _plrBatch);
//diag_log format ["%1: lootpiles foreach players from:%2 to:%3 players:%4 old:%5 total:%6", __FILE__, sched_lp_var1, _imax, count sched_lp_players, count sched_lp_list, sched_lp_lootTotal ];
for "_i" from sched_lp_var1 to _imax-1 do {
_plr = (sched_lp_players select _i);
if (!(isNull _plr) AND {(isPlayer _plr)}) then {
_plr = vehicle _plr;
{
if (_x IN sched_lp_list) then {
sched_lp_list = sched_lp_list - [_x];
};
} forEach ((getPosATL _plr) nearObjects ["ReammoBox",250]);
}/*
else {
diag_log format [ "%1 player left? %2", __FILE__, _x ];
}*/;
};
sched_lp_var1 = _imax;
_changed = false;
if (_imax == count sched_lp_players) then { // catch the few players who entered meanwhile
{
if !(_x in sched_lp_players) then {
sched_lp_players set [ count sched_lp_players, _x ];
_changed = true;
};
} forEach playableUnits;
};
if (!_changed) then {
sched_lp_state = 2;
sched_lp_var1 = 0;
sched_lp_delqty = count sched_lp_list;
#ifdef SERVER_DEBUG
diag_log [ "sched_lootpiles:Will delete",sched_lp_delqty,"lootpiles"];
#endif
}
else {
#ifdef SERVER_DEBUG
diag_log [ "sched_lootpiles:Extended loop for new players", _imax, count sched_lp_players];
#endif
};
};
case (sched_lp_state == 2): { // forEAch remaining lootpiles -> delete
_imax = (sched_lp_delqty) min (sched_lp_var1 + _chunkSize);
//diag_log format ["%1: lootpiles foreach loot to del from:%2 to:%3 old:%4 total:%5", __FILE__, sched_lp_var1, _imax, sched_lp_delqty, sched_lp_lootTotal ];
for "_i" from sched_lp_var1 to _imax-1 do {
_x = sched_lp_list select _i;
deleteVehicle _x;
};
sched_lp_var1 = _imax;
if (_imax == sched_lp_delqty) then {
sched_lp_state = 0;
sched_lp_list = [];
#ifdef SERVER_DEBUG
diag_log format ["%1: deleted %2 lootpiles from %3 total", __FILE__, sched_lp_delqty, sched_lp_lootTotal ];
#endif
};
};
}; // switch
objNull
};

View File

@@ -0,0 +1,44 @@
sched_playershivewrite = {
private ["_n","_x","_damage","_pos","_otime","_opos","_odamage"];
// EVERY 1 MINUTE
// FORCE HIVE WRITE FOR PLAYERS WHO NEED IT (HUMANITY OR POSITION OR TIMEOUT CHANGE)
_n = 0;
{
if ((isPlayer _x) AND {(alive _x)}) then {
_damage = _x getVariable [ "USEC_BloodQty", -1 ];
_pos = visiblePosition _x; // genuine position, deals with player in vehicle or not
if (_damage >= 0) then { // not a character?
_otime = _x getVariable [ "sched_ph_sync_time", -1];
_opos = _x getVariable [ "sched_ph_sync_pos", _pos];
_odamage = _x getVariable [ "sched_ph_sync_dmg", _damage];
if (_otime == -1) then {
_otime = diag_tickTime;
_x setVariable [ "sched_ph_sync_time", _otime];
_x setVariable [ "sched_ph_sync_pos", _opos];
_x setVariable [ "sched_ph_sync_dmg", _odamage];
};
if ((diag_tickTime - _otime > 600) OR {((_pos distance _opos > 50) OR {(_odamage != _damage)})}) then {
[_x, nil, true] call server_playerSync;
_x setVariable [ "sched_ph_sync_time", diag_tickTime];
_x setVariable [ "sched_ph_sync_pos", _pos];
_x setVariable [ "sched_ph_sync_dmg", _damage];
_n = _n + 1;
};
};
if ([ -11000+500, 15360-21000+500, 0 ] distance _pos < 2000) then {
diag_log format [ "HACK, player %1 at anti-ESP zone, killing him but no HIVE save for him.", _x call fa_plr2str ];
_x setVariable ["CharacterID", nil, true ];
unassignVehicle _x;
_pos set [2, 2000]; // will be killed by gravity OR kick by anti TP
_x setPosATL _pos;
};
};
} forEach playableUnits;
if (_n > 0) then {
diag_log format ["%1: sync'ed %2 players to HIVE", __FILE__, _n];
};
objNull
};

View File

@@ -0,0 +1,12 @@
sched_safetyVehicle = {
{
if (vehicle _x != _x && !(vehicle _x in dayz_serverObjectMonitor) && (typeOf vehicle _x) != "ParachuteWest") then {
diag_log [ __FILE__, "KILLING A HACKER", name _x, " IN ", typeOf vehicle _x ];
(vehicle _x) setDamage 1;
_x setDamage 1;
};
} forEach allUnits;
objNull
};

View File

@@ -0,0 +1,25 @@
sched_sync = {
private ["_result","_outcome","_date","_hour","_minute"];
// EVERY 15 MINUTES
// RESYNC TIME WITH HIVE DLL SYSTEM CALL
_result = "CHILD:307:" call server_hiveReadWrite;
_outcome = _result select 0;
if(_outcome == "PASS") then {
_date = _result select 1;
_hour = _date select 3;
_minute = _date select 4;
if(dayz_ForcefullmoonNights) then {
_date = [2012,8,2,_hour,_minute];
};
setDate _date;
dayzSetDate = _date;
publicVariable "dayzSetDate";
diag_log [ __FILE__, "TIME SYNC: Local Time set to:", _date, "Fullmoon:",dayz_ForcefullmoonNights, "Date given by HiveExt.dll:", _result select 1];
};
objNull
};

View File

@@ -0,0 +1,33 @@
sched_traps = {
private ["_n","_x"];
// EVERY 5 SECONDS
// CHECK TRAPS STATE
if (!isNil "dayz_traps") then {
_n = 0;
{
if ((isNil "_x") OR {(isNull _x)}) then {
dayz_traps = dayz_traps - [_x];
}
else {
if (_x getVariable ["armed", false]) then {
if !(_x in dayz_traps_active) then {
["arm", _x] call compile getText (configFile >> "CfgVehicles" >> typeOf _x >> "script");
if !(_x in dayz_traps_active) then { dayz_traps_active set [ count dayz_traps_active, _x ]; };
_n = _n + 1;
};
} else {
if (_x in dayz_traps_active) then {
["disarm", _x] call compile getText (configFile >> "CfgVehicles" >> typeOf _x >> "script");
if (_x in dayz_traps_active) then { dayz_traps_active = dayz_traps_active - [_x]; };
_n = _n + 1;
};
};
};
} forEach dayz_traps;
if (_n > 0) then {
diag_log format ["%1: traps polling, changed %2 states", __FILE__, _n];
};
};
objNull
};

View File

@@ -0,0 +1,37 @@
sched_vehicleshivewrite = {
private ["_n","_x","_damage","_pos","_otime","_opos","_odamage"];
// EVERY 1 MINUTE
// FORCE HIVE WRITE FOR VEHICLES WHO NEED IT (DAMAGE OR POSITION OR TIMEOUT CHANGE)
_n = 0;
{
if (_x isKindOf "AllVehicles") then {
_damage = damage _x;
_pos = getPosASL _x;
_otime = _x getVariable [ "sched_vh_sync_time", -1];
_opos = _x getVariable [ "sched_vh_sync_pos", _pos];
_odamage = _x getVariable [ "sched_vh_sync_dmg", _damage];
if (_otime == -1) then {
_otime = diag_tickTime - random 480;
_x setVariable [ "sched_vh_sync_time", _otime];
_x setVariable [ "sched_vh_sync_pos", _opos];
_x setVariable [ "sched_vh_sync_dmg", _odamage];
};
if ((diag_tickTime - _otime > 600) OR {((_pos distance _opos > 50) OR {(_odamage != _damage)})}) then {
_x setVariable [ "sched_vh_sync_time", diag_tickTime];
_x setVariable [ "sched_vh_sync_pos", _pos];
_x setVariable [ "sched_vh_sync_dmg", _damage];
[_x, "all", true] call server_updateObject;
_n = _n + 1;
}/*
else {
diag_log format ["%1: veh %2 %3 %4 %5", __FILE__, _x, _otime, _opos, _odamage];
}*/;
};
} forEach vehicles;
if (_n > 0) then {
diag_log format ["%1: sync'ed %2 vehicles to HIVE", __FILE__, _n];
};
objNull
};

View File

@@ -1,60 +1,73 @@
/*%FSM<COMPILE "D:\Programme\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, DayZ Server Cleanup">*/
/*%FSM<COMPILE "C:\Program Files (x86)\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, DayZ Server Cleanup">*/
/*%FSM<HEAD>*/
/*
item0[] = {"init",0,250,-25.000000,-350.000000,75.000000,-300.000000,0.000000,"init"};
item1[] = {"prepare",2,250,375.000000,-350.000000,475.000000,-300.000000,0.000000,"prepare"};
item2[] = {"initialized",4,218,175.000000,-350.000000,275.000000,-300.000000,0.000000,"initialized"};
item3[] = {"true",8,218,375.000000,-275.000000,475.000000,-225.000000,0.000000,"true"};
item4[] = {"waiting",2,250,375.000000,-200.000000,475.000000,-150.000000,0.000000,"waiting"};
item5[] = {"true",8,218,375.000000,75.000000,475.000000,125.000000,0.000000,"true"};
item6[] = {"general_cleanup",2,250,375.000000,150.000000,475.000000,200.000000,0.000000,"general" \n "cleanup" \n "loop"};
item7[] = {"",7,210,21.000000,170.999985,29.000000,179.000000,0.000000,""};
item8[] = {"",7,210,21.000004,-254.000000,28.999998,-246.000000,0.000000,""};
item9[] = {"",7,210,821.000000,-179.000000,829.000000,-171.000000,0.000000,""};
item10[] = {"",7,210,821.000000,96.000000,829.000000,104.000000,0.000000,""};
item11[] = {"___second_loop",4,218,50.000000,-75.000000,150.000000,-25.000000,1.000000,"3 second" \n "loop"};
item12[] = {"__0s_update__obj",4,218,175.000000,-100.000000,275.000000,-50.000000,2.000000,"50s" \n "update " \n "objects"};
item13[] = {"___min__loop",4,218,300.000000,-125.000000,400.000000,-75.000000,3.000000,"1 min" \n " loop"};
item14[] = {"___min_loop",4,218,450.000000,-125.000000,550.000000,-75.000000,4.000000,"5 min" \n "loop"};
item15[] = {"__0_min__loop",4,218,575.000000,-100.000000,675.000000,-50.000000,5.000000,"10 min" \n " loop"};
item16[] = {"__5_min__loop",4,218,700.000000,-75.000000,800.000000,-25.000000,6.000000,"15 min" \n " loop"};
item17[] = {"cleanup_animals",2,250,700.000000,25.000000,800.000000,75.000000,0.000000,"cleanup" \n "animals && fire"};
item18[] = {"cleanup_dead",2,250,575.000000,0.000000,675.000000,50.000000,0.000000,"cleanup" \n "dead"};
item19[] = {"sync_time",2,250,450.000000,-25.000000,550.000000,25.000000,0.000000,"sync time"};
item20[] = {"cleanup_loot",2,250,300.000000,-25.000000,400.000000,25.000000,0.000000,"cleanup" \n "loot"};
item21[] = {"group_cleanup",2,250,50.000000,25.000000,150.000000,75.000000,0.000000,"group" \n "cleanup"};
item22[] = {"update_objects",2,250,175.000000,0.000000,275.000000,50.000000,0.000000,"update objects"};
link0[] = {0,2};
link1[] = {1,3};
link2[] = {2,1};
link3[] = {3,4};
link4[] = {4,9};
link5[] = {4,11};
link6[] = {4,12};
link7[] = {4,13};
link8[] = {4,14};
link9[] = {4,15};
link10[] = {4,16};
link11[] = {5,6};
link12[] = {6,7};
link13[] = {7,8};
link14[] = {8,3};
link15[] = {9,10};
link16[] = {10,5};
link17[] = {11,21};
link18[] = {12,22};
link19[] = {13,20};
link20[] = {14,19};
link21[] = {15,18};
link22[] = {16,17};
link23[] = {17,5};
link24[] = {18,5};
link25[] = {19,5};
link26[] = {20,5};
link27[] = {21,5};
link28[] = {22,5};
globals[] = {25.000000,1,0,0,0,640,480,1,136,6316128,1,-53.328339,954.791992,443.544983,-436.145996,1044,911,1};
window[] = {2,-1,-1,-1,-1,912,100,1392,100,3,1062};
item0[] = {"init",0,250,-75.000000,-425.000000,25.000000,-375.000000,0.000000,"init"};
item1[] = {"true",8,218,-75.000000,-200.000000,25.000000,-150.000000,0.000000,"true"};
item2[] = {"waiting",2,250,-75.000000,-125.000000,25.000000,-75.000000,0.000000,"waiting"};
item3[] = {"too_many_dead",4,218,-125.000000,0.000000,-25.000000,50.000000,2.000000,"too many" \n "dead"};
item4[] = {"cleanup_dead",2,250,-125.000000,75.000000,-25.000000,125.000000,0.000000,"cleanup" \n "dead"};
item5[] = {"too_many_objects",4,218,175.000000,0.000000,275.000000,50.000000,2.000000,"too many" \n "objects"};
item6[] = {"cleanup_objects",2,4346,175.000000,75.000000,275.000000,125.000000,0.000000,"cleanup" \n "objects"};
item7[] = {"time_sync",4,218,-225.000000,0.000000,-125.000000,50.000000,1.000000,"time" \n "sync"};
item8[] = {"sync_the_time",2,250,-225.000000,175.000000,-125.000000,225.000000,0.000000,"sync" \n "the time"};
item9[] = {"true",8,218,-75.000000,250.000000,25.000000,300.000000,0.000000,"true"};
item10[] = {"general_cleanup",2,250,-75.000000,350.000000,25.000000,400.000000,0.000000,"general" \n "cleanup"};
item11[] = {"",7,210,-254.000015,371.000000,-246.000000,379.000031,0.000000,""};
item12[] = {"",7,210,-254.000015,-179.000000,-246.000000,-171.000000,0.000000,""};
item13[] = {"initialized",4,218,-75.000000,-350.000000,25.000000,-300.000000,0.000000,"initialized"};
item14[] = {"prepare",2,250,-75.000000,-275.000000,25.000000,-225.000000,0.000000,"prepare"};
item15[] = {"update_objects",2,250,-25.000000,75.000000,75.000000,125.000000,0.000000,"update objects"};
item16[] = {"Objects_need_upd",4,218,-25.000000,0.000000,75.000000,50.000000,1.000000,"Objects" \n "need update"};
item17[] = {"",7,210,-29.000000,-41.500000,-21.000000,-33.499996,0.000000,""};
item18[] = {"",7,210,20.999998,-41.500000,29.000000,-33.500000,0.000000,""};
item19[] = {"",7,210,121.000000,-41.500000,129.000000,-33.500000,0.000000,""};
item20[] = {"",7,210,-79.000000,-41.500000,-71.000000,-33.500000,0.000000,""};
item21[] = {"",7,210,-179.000000,-41.499996,-171.000000,-33.500000,0.000000,""};
item22[] = {"",7,210,-79.000000,146.000000,-71.000000,154.000000,0.000000,""};
item23[] = {"",7,210,21.000000,146.000000,28.999998,154.000000,0.000000,""};
item24[] = {"",7,210,-29.000000,146.000000,-20.999998,154.000000,0.000000,""};
item25[] = {"",7,210,308.500000,-104.000000,316.500000,-96.000000,0.000000,""};
item26[] = {"",7,210,308.500031,271.000000,316.499969,279.000000,0.000000,""};
item27[] = {"",7,210,-179.000000,271.000000,-171.000000,279.000000,0.000000,""};
item28[] = {"",7,210,221.000000,-41.500000,229.000000,-33.500000,0.000000,""};
item29[] = {"New_Cleanup_Obje",2,250,375.000000,75.000000,475.000000,125.000000,0.000000,"New Cleanup" \n "Objects"};
item30[] = {"",7,210,221.000031,271.000000,228.999969,279.000000,0.000000,""};
link0[] = {0,13};
link1[] = {1,2};
link2[] = {2,17};
link3[] = {2,25};
link4[] = {3,4};
link5[] = {4,22};
link6[] = {5,6};
link7[] = {6,30};
link8[] = {7,8};
link9[] = {8,27};
link10[] = {9,10};
link11[] = {10,11};
link12[] = {11,12};
link13[] = {12,1};
link14[] = {13,14};
link15[] = {14,1};
link16[] = {15,23};
link17[] = {16,15};
link18[] = {17,18};
link19[] = {17,20};
link20[] = {18,16};
link21[] = {18,19};
link22[] = {19,28};
link23[] = {20,3};
link24[] = {20,21};
link25[] = {21,7};
link26[] = {22,24};
link27[] = {23,24};
link28[] = {24,9};
link29[] = {25,26};
link30[] = {26,30};
link31[] = {27,9};
link32[] = {28,5};
link33[] = {30,9};
globals[] = {25.000000,1,0,0,0,640,480,1,13,6316128,1,-520.235962,640.978394,444.212921,-448.684845,779,599,1};
window[] = {2,-1,-1,-32000,-32000,878,150,1479,150,3,797};
*//*%FSM</HEAD>*/
class FSM
{
@@ -65,7 +78,7 @@ class FSM
class init
{
name = "init";
init = /*%FSM<STATEINIT""">*/"//Major Performance Speedup by Skaronator ;)"/*%FSM</STATEINIT""">*/;
init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
@@ -82,150 +95,58 @@ class FSM
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "prepare">*/
class prepare
{
name = "prepare";
init = /*%FSM<STATEINIT""">*/"diag_log (""CLEANUP: INITIALIZING CLEANUP SCRIPT"");" \n
"" \n
"_lastUpdate = diag_tickTime;" \n
"_lastNeedUpdate = diag_tickTime;" \n
"_lastCleanupVehicles = diag_tickTime;" \n
"_lastCleanupGroups = diag_tickTime;" \n
"_lastCleanupNull = diag_tickTime;" \n
"" \n
"_lastCleanup900 = diag_tickTime;" \n
"" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "true">*/
class true
{
priority = 0.000000;
to="waiting";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "waiting">*/
class waiting
{
name = "waiting";
init = /*%FSM<STATEINIT""">*/"//diag_log ""CLEANUP: Waiting for next task"";" \n
"" \n
"_numDead = {local _x} count allDead;" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "__5_min__loop">*/
class __5_min__loop
/*%FSM<LINK "too_many_dead">*/
class too_many_dead
{
priority = 6.000000;
to="cleanup_animals";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastCleanup900) > 900)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_lastCleanup900 = diag_tickTime;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "__0_min__loop">*/
class __0_min__loop
{
priority = 5.000000;
priority = 2.000000;
to="cleanup_dead";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastCleanupNull) > 600)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_lastCleanupNull = diag_tickTime;"/*%FSM</ACTION""">*/;
condition=/*%FSM<CONDITION""">*/"(_numDead > 100)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "___min_loop">*/
class ___min_loop
/*%FSM<LINK "too_many_objects">*/
class too_many_objects
{
priority = 4.000000;
to="sync_time";
priority = 2.000000;
to="cleanup_objects";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _timeNem) > 150)" \n
"//(((count dayz_deseedloot) > 0) && (!isNil ""sm_done""))"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_timeNem = diag_tickTime;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "time_sync">*/
class time_sync
{
priority = 1.000000;
to="sync_the_time";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastUpdate) > 300)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_lastUpdate = diag_tickTime;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "___min__loop">*/
class ___min__loop
/*%FSM<LINK "Objects_need_upd">*/
class Objects_need_upd
{
priority = 3.000000;
to="cleanup_loot";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastCleanupVehicles) > 60)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_lastCleanupVehicles = diag_tickTime;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "__0s_update__obj">*/
class __0s_update__obj
{
priority = 2.000000;
priority = 1.000000;
to="update_objects";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(( (count needUpdate_objects) > 0) && (diag_tickTime -_lastNeedUpdate> 50))"/*%FSM</CONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(( (count needUpdate_objects) > 0) && (diag_tickTime -_lastNeedUpdate> 5) && (!isNil ""sm_done""))"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_lastNeedUpdate = diag_tickTime;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "___second_loop">*/
class ___second_loop
{
priority = 1.000000;
to="group_cleanup";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastCleanupGroups) > 3)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_lastCleanupGroups = diag_tickTime;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "true">*/
class true
{
priority = 0.000000;
to="general_cleanup";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "general_cleanup">*/
class general_cleanup
{
name = "general_cleanup";
init = /*%FSM<STATEINIT""">*/"//diag_log ""CLEANUP: Starting loop for next task"";" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "true">*/
class true
{
priority = 0.000000;
to="waiting";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "cleanup_animals">*/
class cleanup_animals
{
name = "cleanup_animals";
init = /*%FSM<STATEINIT""">*/"[] spawn server_spawnCleanFire;" \n
"[] spawn server_spawnCleanAnimals;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "true">*/
class true
{
@@ -243,7 +164,7 @@ class FSM
class cleanup_dead
{
name = "cleanup_dead";
init = /*%FSM<STATEINIT""">*/"[] spawn server_spawncleanDead;"/*%FSM</STATEINIT""">*/;
init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
@@ -260,14 +181,11 @@ class FSM
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "sync_time">*/
class sync_time
/*%FSM<STATE "cleanup_objects">*/
class cleanup_objects
{
name = "sync_time";
init = /*%FSM<STATEINIT""">*/"if (DZE_DiagFpsSlow) then {" \n
" call dze_diag_fps;" \n
"};" \n
"call server_timeSync;"/*%FSM</STATEINIT""">*/;
name = "cleanup_objects";
init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
@@ -284,19 +202,70 @@ class FSM
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "cleanup_loot">*/
class cleanup_loot
/*%FSM<STATE "sync_the_time">*/
class sync_the_time
{
name = "cleanup_loot";
init = /*%FSM<STATEINIT""">*/"if (DZE_DiagFpsFast) then {" \n
" call dze_diag_fps;" \n
"};" \n
name = "sync_the_time";
init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "true">*/
class true
{
priority = 0.000000;
to="general_cleanup";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "general_cleanup">*/
class general_cleanup
{
name = "general_cleanup";
init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "true">*/
class true
{
priority = 0.000000;
to="waiting";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "prepare">*/
class prepare
{
name = "prepare";
init = /*%FSM<STATEINIT""">*/"diag_log (""CLEANUP: INITIALIZING CLEANUP SCRIPT"");" \n
"" \n
"[] spawn server_spawnCleanLoot;" \n
"_safety = dayz_serverObjectMonitor;" \n
"_dateNow = (DateToNumber date);" \n
"" \n
"// set player save time based on server performance" \n
"PVDZE_plr_SetSaveTime = round(60 - diag_fps);" \n
"publicVariable ""PVDZE_plr_SetSaveTime"";"/*%FSM</STATEINIT""">*/;
"_lastUpdate = diag_tickTime;" \n
"_timeNem =diag_tickTime;" \n
"_deadBodies = [];" \n
"_lastNeedUpdate = diag_tickTime;" \n
"_timeout = diag_tickTime;" \n
"_maxBodies = 15;" \n
"" \n
"_lootspawnerfdbykr = diag_tickTime; " \n
"_reseedloot = false;" \n
"" \n
"_amount = 0;" \n
"_hour = 0;" \n
"_minute = 0;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
@@ -304,29 +273,7 @@ class FSM
class true
{
priority = 0.000000;
to="general_cleanup";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "group_cleanup">*/
class group_cleanup
{
name = "group_cleanup";
init = /*%FSM<STATEINIT""">*/"[] spawn server_checkHackers;" \n
"[] spawn server_cleanupGroups;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "true">*/
class true
{
priority = 0.000000;
to="general_cleanup";
to="waiting";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
@@ -339,10 +286,14 @@ class FSM
class update_objects
{
name = "update_objects";
init = /*%FSM<STATEINIT""">*/"{" \n
init = /*%FSM<STATEINIT""">*/"diag_log format[""DEBUG: needUpdate_objects=%1"",needUpdate_objects];" \n
"" \n
"{" \n
"// _x setVariable [""needUpdate"",false,true];" \n
" needUpdate_objects = needUpdate_objects - [_x];" \n
" [_x,""damage"",true] call server_updateObject;" \n
"} count needUpdate_objects;"/*%FSM</STATEINIT""">*/;
"} forEach needUpdate_objects;" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
@@ -359,6 +310,86 @@ class FSM
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "New_Cleanup_Obje">*/
class New_Cleanup_Obje
{
name = "New_Cleanup_Obje";
init = /*%FSM<STATEINIT""">*/"diag_log ""DEBUG: New_Cleanup_Obje ""; " \n
"_lootingrids = [];" \n
"" \n
"{" \n
" _loc = _x select 0;" \n
" _ref = _x select 1;" \n
"" \n
" _nearBy = nearestObjects [_loc, [""ReammoBox""], 1500];" \n
" {" \n
" _lootingrids set [count _lootingrids,[_x,_ref]];" \n
" } foreach _nearBy;" \n
"" \n
" dayz_deseedloot set [0,-1];" \n
" dayz_deseedloot = dayz_deseedloot - [-1];" \n
"" \n
"}foreach dayz_deseedloot;" \n
"" \n
"_qty = count _lootingrids;" \n
"diag_log (""CLEANUP:TOTAL "" + str(_qty) + "" LOOT BAGS"");" \n
"" \n
"_delQty = 0;" \n
"_delQtyDroped = 0;" \n
"_delQtySpawned = 0;" \n
"_delQtyPerma = 0;" \n
"" \n
"{" \n
" " \n
" _obj = _x select 0;" \n
" _ref = _x select 1;" \n
"" \n
" diag_log format [""%1,%2"", _obj, _ref];" \n
"" \n
" _Dropped = (_obj getVariable [""Dropped"",false]);" \n
" _Spawned = (_obj getVariable [""spawnedLoot"",false]);" \n
" _Perma = (_obj getVariable [""permaLoot"",false]);" \n
"" \n
" if (!_Spawned and !_Perma) then {" \n
" _obj setVariable [""Dropped"",true];" \n
" };" \n
"" \n
" //Dropped loot" \n
" if (_Dropped) then {" \n
" " \n
" [""Dropped_Loot"",_obj,_ref] call server_systemCleanup;" \n
" _delQtyDroped = _delQtyDroped + 1;" \n
"" \n
" };" \n
"" \n
" //Spawned Loot" \n
" if (_Spawned) then {" \n
"" \n
" [""Spawned_Loot"",_obj,_ref] call server_systemCleanup;" \n
" _delQtySpawned = _delQtySpawned + 1; " \n
" " \n
" };" \n
"" \n
" //Permaloot" \n
" if (_Perma) then {" \n
"" \n
" _delQtyPerma = _delQtyPerma + 1;" \n
"" \n
" };" \n
"" \n
"} foreach _lootingrids;" \n
"" \n
"if ((_delQtySpawned > 0) or (_delQtyDroped > 0) or (_delQtyPerma > 0)) then {" \n
" //diag_log (""CLEANUP: DELETED "" + str(_delQty) + "" LOOT BAGS"");" \n
" diag_log format [""CLEANUP: (DELETED, DroppedLoot: %1, SpawnedLoot: %2), (KEPT, PermaLoot: %3)"", _delQtyDroped, _delQtySpawned, _delQtyPerma];" \n
"};" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
};
};
/*%FSM</STATE>*/
};
initState="init";
finalStates[] =

View File

@@ -0,0 +1,81 @@
_lootype = _this select 0;
_lootobj = _this select 1;
_lootref = _this select 2;
_dateNow = diag_ticktime;
switch (_lootype) do
{
case "Dropped_Loot":
{
/*
diag_log("Dropped Loot");
_created = (_lootobj getVariable ["created",-0.1]);
if (_created == -0.1) then {
_lootobj setVariable ["created",diag_ticktime,false];
_created = diag_ticktime;
};
_age = (_dateNow - _created);
_nearby = {(isPlayer _lootobj) and (alive _lootobj)} count (_lootobj nearEntities [["CAManBase","AllVehicles"], 130]);
if ((_nearby==0) then {
if (_age > 20) then {
_remove = true;
} else {
dayz_droppedlootarray set [count dayz_droppedlootarray,_lootobj];
};
};
*/
//diag_log("Dropped Loot");
deleteVehicle _lootobj;
};
case "Spawned_Loot":
{
//diag_log("Spawned Loot");
deleteVehicle _lootobj;
};
case "Perma_Loot":
{
//diag_log("Perma Loot");
};
};
/*
{
_Dropped = (_x getVariable ["Dropped",false]);
_Spawned = (_x getVariable ["spawnedLoot",false]);
_Perma = (_x getVariable ["permaLoot",false]);
if (!_Spawned and !_Perma) then {
_x setVariable ["Dropped",true];
};
//Dropped loot
if (_Dropped) then {
_x setVariable ["created",diag_ticktime,false];
_created = diag_ticktime;
diag_log("Dropped Loot");
};
//Spawned Loot
if (_Spawned) then {
diag_log("Spawned Loot");
};
//Permaloot
if (_Perma) then {
//Ignore perma loot
diag_log("Perma Loot");
};
} foreach _lootingrids;
if (_delQty > 0) then {
diag_log ("CLEANUP: DELETED " + str(_delQty) + " LOOT BAGS");
};
*/

View File

@@ -1,15 +1,43 @@
private ["_nul","_result","_pos","_wsDone","_dir","_isOK","_countr","_objWpnTypes","_objWpnQty","_dam","_selection","_totalvehicles","_object","_idKey","_type","_ownerID","_worldspace","_inventory","_hitPoints","_fuel","_damage","_key","_vehLimit","_hiveResponse","_objectCount","_codeCount","_data","_status","_val","_traderid","_retrader","_traderData","_id","_lockable","_debugMarkerPosition","_vehicle_0","_bQty","_vQty","_BuildingQueue","_objectQueue","_superkey","_shutdown","_res","_hiveLoaded"];
private ["_date","_year","_month","_day","_hour","_minute","_date1","_hiveResponse","_key","_objectCount","_dir","_point","_i","_action","_dam","_selection","_wantExplosiveParts","_entity","_worldspace","_damage","_booleans","_rawData","_ObjectID","_class","_CharacterID","_inventory","_hitpoints","_fuel","_id","_objectArray","_script","_result","_outcome"];
[]execVM "\z\addons\dayz_server\system\s_fps.sqf"; //server monitor FPS (writes each ~181s diag_fps+181s diag_fpsmin*)
#include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"
waitUntil{!isNil "BIS_MPF_InitDone"};
waitUntil{initialized}; //means all the functions are now defined
if (!isNil "sm_done") exitWith {}; // prevent server_monitor be called twice (bug during login of the first player)
sm_done = false;
dayz_serverIDMonitor = [];
dayz_versionNo = getText(configFile >> "CfgMods" >> "DayZ" >> "version");
dayz_hiveVersionNo = getNumber(configFile >> "CfgMods" >> "DayZ" >> "hiveVersion");
_hiveLoaded = false;
waitUntil{initialized}; //means all the functions are now defined
diag_log "HIVE: Starting";
waituntil{isNil "sm_done"}; // prevent server_monitor be called twice (bug during login of the first player)
//Set the Time
_key = "CHILD:307:";
_result = _key call server_hiveReadWrite;
_outcome = _result select 0;
if(_outcome == "PASS") then {
_date = _result select 1;
//date setup
_year = _date select 0;
_month = _date select 1;
_day = _date select 2;
_hour = _date select 3;
_minute = _date select 4;
if(dayz_ForcefullmoonNights) then {
_date = [2012,8,2,_hour,_minute];
};
diag_log [ "TIME SYNC: Local Time set to:", _date, "Fullmoon:",dayz_ForcefullmoonNights, "Date given by HiveExt.dll:", _result select 1];
setDate _date;
dayzSetDate = _date;
publicVariable "dayzSetDate";
};
// Custom Configs
if(isnil "MaxVehicleLimit") then {
@@ -262,6 +290,100 @@ if (isServer && isNil "sm_done") then {
} forEach (_BuildingQueue + _objectQueue);
// # END SPAWN OBJECTS #
// Draw the pseudo random seeds
call server_plantSpawner;
// launch the legacy task scheduler
[] execFSM "\z\addons\dayz_server\system\server_cleanup.fsm";
// launch the new task scheduler
[] execVM "\z\addons\dayz_server\system\scheduler\sched_init.sqf";
createCenter civilian;
if (isDedicated) then {
endLoadingScreen;
};
allowConnection = true;
sm_done = true;
publicVariable "sm_done";
// Trap loop
[] spawn {
private ["_array","_array2","_array3","_script","_armed"];
_array = str dayz_traps;
_array2 = str dayz_traps_active;
_array3 = str dayz_traps_trigger;
while {1 == 1} do {
if ((str dayz_traps != _array) || (str dayz_traps_active != _array2) || (str dayz_traps_trigger != _array3)) then {
_array = str dayz_traps;
_array2 = str dayz_traps_active;
_array3 = str dayz_traps_trigger;
//diag_log "DEBUG: traps";
//diag_log format["dayz_traps (%2) -> %1", dayz_traps, count dayz_traps];
//diag_log format["dayz_traps_active (%2) -> %1", dayz_traps_active, count dayz_traps_active];
//diag_log format["dayz_traps_trigger (%2) -> %1", dayz_traps_trigger, count dayz_traps_trigger];
//diag_log "DEBUG: end traps";
};
{
if (isNull _x) then {
dayz_traps = dayz_traps - [_x];
};
_script = call compile getText (configFile >> "CfgVehicles" >> typeOf _x >> "script");
_armed = _x getVariable ["armed", false];
if (_armed) then {
if !(_x in dayz_traps_active) then {
["arm", _x] call _script;
};
} else {
if (_x in dayz_traps_active) then {
["disarm", _x] call _script;
};
};
sleep 0.01;
} forEach dayz_traps;
sleep 1;
};
};
//Points of interest
[] execVM "\z\addons\dayz_server\compile\server_spawnInfectedCamps.sqf";
[] execVM "\z\addons\dayz_server\compile\server_spawnCarePackages.sqf";
[] execVM "\z\addons\dayz_server\compile\server_spawnCrashSites.sqf";
[] execVM "\z\addons\dayz_server\system\lit_fireplaces.sqf";
"PVDZ_sec_atp" addPublicVariableEventHandler {
_x = _this select 1;
switch (1==1) do {
case (typeName _x == "STRING") : { // just some logs from the client
diag_log _x;
};
case (count _x == 2) : { // wrong side
diag_log Format [ "P1ayer %1 reports possible 'side' hack... Server may be comprised!", (_x select 1) call fa_plr2Str ];
};
default { // player hit
_unit = _x select 0;
_source = _x select 1;
if (((!(isNil {_source})) AND {(!(isNull _source))}) AND {((_source isKindOf "CAManBase") AND {(owner _unit != owner _source)})}) then {
diag_log format ["P1ayer %1 hit by %2 %3 from %4 meters",
_unit call fa_plr2Str, _source call fa_plr2Str, _x select 2, _x select 3];
if (_unit getVariable["processedDeath", 0] == 0) then {
_unit setVariable [ "attacker", name _source ];
_unit setVariable [ "noatlf4", diag_ticktime ]; // server-side "not in combat" test, if player is not already dead
};
};
};
};
};
// preload server traders menu data into cache
if !(DZE_ConfigTrader) then {
{
@@ -347,13 +469,6 @@ if (isServer && isNil "sm_done") then {
if (isDedicated) then {
// Epoch Events
_id = [] spawn server_spawnEvents;
// server cleanup
[] spawn {
private ["_id"];
uiSleep 200; //Sleep Lootcleanup, don't need directly cleanup on startup + fix some performance issues on serverstart
waitUntil {!isNil "server_spawnCleanAnimals"};
_id = [] execFSM "\z\addons\dayz_server\system\server_cleanup.fsm";
};
// spawn debug box
_debugMarkerPosition = getMarkerPos "respawn_west";

View File

@@ -0,0 +1,203 @@
/*%FSM<COMPILE "C:\Program Files (x86)\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, DayZ Wild Zeds Control">*/
/*%FSM<HEAD>*/
/*
item0[] = {"init",0,250,-75.000000,-400.000000,25.000000,-350.000000,0.000000,"init"};
item1[] = {"No_More_Needed",4,218,-250.000000,-250.000000,-150.000000,-200.000000,0.000000,"No More" \n "Needed"};
item2[] = {"Delay_",2,250,-75.000000,50.000000,25.000000,100.000000,0.000000,"Delay" \n ""};
item3[] = {"Need_more",4,218,-75.000000,-175.000000,25.000000,-125.000000,3.000000,"Need more"};
item4[] = {"Spawn",2,250,-75.000000,-100.000000,25.000000,-50.000000,0.000000,"Spawn"};
item5[] = {"Timeout",4,218,50.000000,-250.000000,150.000000,-200.000000,0.000000,"Timeout"};
item6[] = {"Return",8,218,-75.000000,-25.000000,25.000000,25.000000,0.000000,"Return"};
item7[] = {"initialized",4,218,-75.000000,-325.000000,25.000000,-275.000000,0.000000,"initialized"};
item8[] = {"prepare",2,250,-75.000000,-250.000000,25.000000,-200.000000,0.000000,"prepare"};
item9[] = {"Check",2,250,-250.000000,-25.000000,-150.000000,25.000000,0.000000,"Check"};
item10[] = {"",7,210,-204.000000,-154.000000,-196.000000,-146.000000,0.000000,""};
item11[] = {"Released_Delay_",4,4314,-250.000000,50.000000,-150.000000,100.000000,0.000000,"Released" \n "Delay" \n ""};
link0[] = {0,7};
link1[] = {1,8};
link2[] = {2,11};
link3[] = {3,4};
link4[] = {4,6};
link5[] = {5,8};
link6[] = {6,2};
link7[] = {7,8};
link8[] = {8,3};
link9[] = {8,5};
link10[] = {9,10};
link11[] = {10,1};
link12[] = {10,3};
link13[] = {11,9};
globals[] = {25.000000,1,0,0,0,640,480,1,47,6316128,1,-497.761261,579.685730,295.259521,-641.446960,689,599,1};
window[] = {2,-1,-1,-32000,-32000,930,150,1479,150,3,707};
*//*%FSM</HEAD>*/
class FSM
{
fsmName = "DayZ Wild Zeds Control";
class States
{
/*%FSM<STATE "init">*/
class init
{
name = "init";
init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "initialized">*/
class initialized
{
priority = 0.000000;
to="prepare";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"!isnil ""bis_fnc_init"""/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"diag_log (""WILD SPAWN: INITIALIZING WILD SPAWN SCRIPT"");" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Delay_">*/
class Delay_
{
name = "Delay_";
init = /*%FSM<STATEINIT""">*/"_timeD = diag_tickTime;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Released_Delay_">*/
class Released_Delay_
{
priority = 0.000000;
to="Check";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(diag_tickTime - _timeD) > 5"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Spawn">*/
class Spawn
{
name = "Spawn";
init = /*%FSM<STATEINIT""">*/"_timeN = diag_tickTime;" \n
"" \n
"" \n
"_tmp = [_unitTypes, _amount2Spawn];" \n
"_waiting = _tmp call server_Wildgenerate;" \n
"" \n
"" \n
"" \n
"" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Return">*/
class Return
{
priority = 0.000000;
to="Delay_";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_waiting"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "prepare">*/
class prepare
{
name = "prepare";
init = /*%FSM<STATEINIT""">*/"_timeN = diag_tickTime;" \n
"_spawnmore = false;" \n
"_amount2Spawn = 100;" \n
"_totalamount=1000;" \n
"_unitTypes = [""Wild_Civ_newBase""];" \n
"" \n
"" \n
"_debugarea = getMarkerPos ""respawn_west"";" \n
"_pos = getMarkerPos ""center"";" \n
"" \n
"_wildZombies = {local _x} count (_pos nearEntities [""WildZombie_Base"",7500]);" \n
"_count = _totalamount - _wildZombies;" \n
"" \n
"if (_count > _amount2Spawn) then {" \n
" _spawnmore = true;" \n
"};" \n
"" \n
"diag_log format [""WILD SPAWN: Active: %1, Waiting: %2"",_wildZombies,_count]" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Need_more">*/
class Need_more
{
priority = 3.000000;
to="Spawn";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_spawnmore"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "Timeout">*/
class Timeout
{
priority = 0.000000;
to="prepare";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(diag_tickTime - _timeN) > 600"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Check">*/
class Check
{
name = "Check";
init = /*%FSM<STATEINIT""">*/"_spawnmore = false;" \n
"_wildZombies = {local _x} count (_pos nearEntities [""WildZombie_Base"",7500]);" \n
"_count = 200 - _wildZombies;" \n
"" \n
"if (_count > _amount2Spawn) then {" \n
" _spawnmore = true;" \n
"};"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Need_more">*/
class Need_more
{
priority = 3.000000;
to="Spawn";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_spawnmore"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "No_More_Needed">*/
class No_More_Needed
{
priority = 0.000000;
to="prepare";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"!_spawnmore"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
};
initState="init";
finalStates[] =
{
};
};
/*%FSM</COMPILE>*/