mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-04-17 17:56:40 +03:00
Organize files a bit and removed non source pbo's
This commit is contained in:
10
SQF/dayz_server/system/s_fps.sqf
Normal file
10
SQF/dayz_server/system/s_fps.sqf
Normal file
@@ -0,0 +1,10 @@
|
||||
while {isServer} do {
|
||||
while {isServer} do {
|
||||
while {isServer} do {
|
||||
diag_log ("DEBUG FPS : " + str(diag_fps) );
|
||||
sleep 181;
|
||||
};
|
||||
sleep 181;
|
||||
};
|
||||
sleep 181;
|
||||
};
|
||||
443
SQF/dayz_server/system/server_cleanup.fsm
Normal file
443
SQF/dayz_server/system/server_cleanup.fsm
Normal file
@@ -0,0 +1,443 @@
|
||||
/*%FSM<COMPILE "F:\Program Files (x86)\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, DayZ Server Cleanup">*/
|
||||
/*%FSM<HEAD>*/
|
||||
/*
|
||||
item0[] = {"init",0,250,-75.000000,-400.000000,25.000000,-350.000000,0.000000,"init"};
|
||||
item1[] = {"true",8,218,-75.000000,-175.000000,25.000000,-125.000000,0.000000,"true"};
|
||||
item2[] = {"waiting",2,250,-75.000000,-100.000000,25.000000,-50.000000,0.000000,"waiting"};
|
||||
item3[] = {"too_many_dead",4,218,-150.000000,-25.000000,-50.000000,25.000000,2.000000,"too many" \n "dead"};
|
||||
item4[] = {"cleanup_dead",2,250,-150.000000,50.000000,-50.000000,100.000000,0.000000,"cleanup" \n "dead"};
|
||||
item5[] = {"too_many_objects",4,218,-25.000000,-25.000000,75.000000,25.000000,0.000000,"too many" \n "objects"};
|
||||
item6[] = {"cleanup_objects",2,250,-25.000000,50.000000,75.000000,100.000000,0.000000,"cleanup" \n "objects"};
|
||||
item7[] = {"time_sync",4,218,-275.000000,-25.000000,-175.000000,25.000000,1.000000,"time" \n "sync"};
|
||||
item8[] = {"sync_the_time",2,250,-275.000000,50.000000,-175.000000,100.000000,0.000000,"sync" \n "the time"};
|
||||
item9[] = {"true",8,218,-75.000000,125.000000,25.000000,175.000000,0.000000,"true"};
|
||||
item10[] = {"general_cleanup",2,4346,-75.000000,200.000000,25.000000,250.000000,0.000000,"general" \n "cleanup"};
|
||||
item11[] = {"",7,210,-304.000000,220.999985,-296.000000,229.000015,0.000000,""};
|
||||
item12[] = {"",7,210,-304.000000,-154.000000,-296.000000,-146.000000,0.000000,""};
|
||||
item13[] = {"",7,210,221.000000,-79.000000,229.000000,-71.000000,0.000000,""};
|
||||
item14[] = {"",7,210,221.000000,146.000000,229.000000,154.000000,0.000000,""};
|
||||
item15[] = {"initialized",4,218,-75.000000,-325.000000,25.000000,-275.000000,0.000000,"initialized"};
|
||||
item16[] = {"prepare",2,250,-75.000000,-250.000000,25.000000,-200.000000,0.000000,"prepare"};
|
||||
item17[] = {"update_objects",2,250,100.000000,50.000000,200.000000,100.000000,0.000000,"update objects"};
|
||||
item18[] = {"need_update",4,218,100.000000,-25.000000,200.000000,25.000000,1.000000,"need update"};
|
||||
item19[] = {"",7,210,221.000000,-79.000000,229.000000,-71.000000,0.000000,""};
|
||||
link0[] = {0,15};
|
||||
link1[] = {1,2};
|
||||
link2[] = {2,3};
|
||||
link3[] = {2,5};
|
||||
link4[] = {2,7};
|
||||
link5[] = {2,13};
|
||||
link6[] = {2,18};
|
||||
link7[] = {3,4};
|
||||
link8[] = {4,9};
|
||||
link9[] = {5,6};
|
||||
link10[] = {6,9};
|
||||
link11[] = {7,8};
|
||||
link12[] = {8,9};
|
||||
link13[] = {9,10};
|
||||
link14[] = {10,11};
|
||||
link15[] = {11,12};
|
||||
link16[] = {12,1};
|
||||
link17[] = {13,14};
|
||||
link18[] = {13,19};
|
||||
link19[] = {14,9};
|
||||
link20[] = {15,16};
|
||||
link21[] = {16,1};
|
||||
link22[] = {17,9};
|
||||
link23[] = {18,17};
|
||||
globals[] = {25.000000,1,0,0,0,640,480,1,24,6316128,1,-378.181000,335.872437,502.526184,-187.229050,911,880,1};
|
||||
window[] = {2,-1,-1,-1,-1,936,156,1485,156,3,929};
|
||||
*//*%FSM</HEAD>*/
|
||||
class FSM
|
||||
{
|
||||
fsmName = "DayZ Server Cleanup";
|
||||
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""">*/""/*%FSM</ACTION""">*/;
|
||||
};
|
||||
/*%FSM</LINK>*/
|
||||
};
|
||||
};
|
||||
/*%FSM</STATE>*/
|
||||
/*%FSM<STATE "waiting">*/
|
||||
class waiting
|
||||
{
|
||||
name = "waiting";
|
||||
init = /*%FSM<STATEINIT""">*/"//diag_log ""CLEANUP: Waiting for next task"";" \n
|
||||
"_numDead = {local _x} count allDead;" \n
|
||||
""/*%FSM</STATEINIT""">*/;
|
||||
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
|
||||
class Links
|
||||
{
|
||||
/*%FSM<LINK "too_many_dead">*/
|
||||
class too_many_dead
|
||||
{
|
||||
priority = 2.000000;
|
||||
to="cleanup_dead";
|
||||
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
||||
condition=/*%FSM<CONDITION""">*/"(_numDead > 300)"/*%FSM</CONDITION""">*/;
|
||||
action=/*%FSM<ACTION""">*/""/*%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""">*/"((time - _lastUpdate) > 300)"/*%FSM</CONDITION""">*/;
|
||||
action=/*%FSM<ACTION""">*/"_lastUpdate = time;"/*%FSM</ACTION""">*/;
|
||||
};
|
||||
/*%FSM</LINK>*/
|
||||
/*%FSM<LINK "need_update">*/
|
||||
class need_update
|
||||
{
|
||||
priority = 1.000000;
|
||||
to="update_objects";
|
||||
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
||||
condition=/*%FSM<CONDITION""">*/"( (count needUpdate_objects) > 0 && (time-_lastNeedUpdate>20) )"/*%FSM</CONDITION""">*/;
|
||||
action=/*%FSM<ACTION""">*/"_lastNeedUpdate = time;"/*%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<LINK "too_many_objects">*/
|
||||
class too_many_objects
|
||||
{
|
||||
priority = 0.000000;
|
||||
to="cleanup_objects";
|
||||
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
||||
condition=/*%FSM<CONDITION""">*/"((time - _timeNem) > 60)"/*%FSM</CONDITION""">*/;
|
||||
action=/*%FSM<ACTION""">*/"_timeNem = time;"/*%FSM</ACTION""">*/;
|
||||
};
|
||||
/*%FSM</LINK>*/
|
||||
};
|
||||
};
|
||||
/*%FSM</STATE>*/
|
||||
/*%FSM<STATE "cleanup_dead">*/
|
||||
class cleanup_dead
|
||||
{
|
||||
name = "cleanup_dead";
|
||||
init = /*%FSM<STATEINIT""">*/"diag_log (""CLEANUP: TOO MANY DEAD BODIES"");" \n
|
||||
"" \n
|
||||
"diag_log (""CLEANUP: PERFORMING BODY CLEANUP ON "" + str(_numDead) + "" BODIES"");" \n
|
||||
"" \n
|
||||
"_delQtyZ = 0;" \n
|
||||
"_numZombie = {_x isKindOf ""zZombie_Base""} count allDead;" \n
|
||||
"{" \n
|
||||
" if (local _x) then {" \n
|
||||
" if (_x isKindOf ""zZombie_Base"") then {" \n
|
||||
" deleteVehicle _x;" \n
|
||||
" _delQtyZ = _delQtyZ + 1;" \n
|
||||
" } else {" \n
|
||||
" _exists = _x in _deadBodies;" \n
|
||||
" if(!_exists) then {" \n
|
||||
" _deadBodies set [count _deadBodies,_x];" \n
|
||||
" };" \n
|
||||
" };" \n
|
||||
" };" \n
|
||||
"} forEach allDead;" \n
|
||||
"" \n
|
||||
"//Cleanup players" \n
|
||||
"_body = objNull;" \n
|
||||
"_delQtyP = 0;" \n
|
||||
"_delDo = _numDead - _numZombie;" \n
|
||||
"_delDo = ((_delDo min (count _deadBodies)) -1);" \n
|
||||
"if (_delDo<1) then {_delDo=1};" \n
|
||||
"for ""_i"" from 0 to _delDo do {" \n
|
||||
" _body = _deadBodies select _i;" \n
|
||||
" if(!isNil ""_body"") then {" \n
|
||||
" _pos = getPosATL _body;" \n
|
||||
" _sfx = nearestObject [_pos,""Sound_Flies""];" \n
|
||||
" if (!(isNull _sfx)) then {" \n
|
||||
" deleteVehicle _sfx;" \n
|
||||
" };" \n
|
||||
" deleteVehicle _body;" \n
|
||||
" _delQtyP = _delQtyP + 1;" \n
|
||||
" };" \n
|
||||
" _deadBodies set [_i,""DEL""];" \n
|
||||
"" \n
|
||||
"//Let's move this into the body removal sequence so uncontrolled flies are removed only if corpses are cleaned" \n
|
||||
"//Check Flies" \n
|
||||
"_isOK=-1;" \n
|
||||
"_dwUSOFC=0;" \n
|
||||
"{" \n
|
||||
" //_isOk = {!alive _x} count (nearestObjects [_x, [""CAManBase""], 2]);" \n
|
||||
" _isOk = {!alive _x} count (_x nearEntities [[""CAManBase""], 2]);" \n
|
||||
" if (_isOk>-1) then {" \n
|
||||
" diag_log (""DW_DEBUG _isOK: "" + str(_isOK) );" \n
|
||||
" };" \n
|
||||
" if ((_isOk>-1) AND (_isOK<1)) then {" \n
|
||||
" //diag_log (""CLEANUP: DELETING A SOUND OF FLIES"");" \n
|
||||
"_dwUSOFC=_dwUSOFC+1;" \n
|
||||
" deleteVehicle _x;" \n
|
||||
" diag_log (""CLEANUP: DELETED AN UNCONTROLLED SOUND OF FLIES:"" + str(_dwUSOFC) );" \n
|
||||
" };" \n
|
||||
"} forEach allMissionObjects ""Sound_Flies"";" \n
|
||||
"" \n
|
||||
"" \n
|
||||
"//Let's move this into the body removal sequence so uncontrolled fireplaces are removed only if corpses are cleaned" \n
|
||||
"//clean fireplaces" \n
|
||||
"_dwUFPC=0;" \n
|
||||
"{" \n
|
||||
" if (local _x) then {" \n
|
||||
" //diag_log (""CLEANUP: DELETING A UNCONTROLLED FIREPLACE"");" \n
|
||||
" deleteVehicle _x;" \n
|
||||
"_dwUFPC=_dwUFPC+1;" \n
|
||||
" diag_log (""CLEANUP: DELETED AN UNCONTROLLED FIREPLACE:"" + str(_dwUFPC) );" \n
|
||||
" };" \n
|
||||
"} forEach allMissionObjects ""Land_Fire_DZ"";" \n
|
||||
"" \n
|
||||
"};" \n
|
||||
"_deadBodies = _deadBodies - [""DEL""];" \n
|
||||
"" \n
|
||||
"diag_log (""CLEANUP: DELETED "" + str(_delQtyP) + "" PLAYER BODIES AND "" + str(_delQtyZ) + "" BODIES"");" \n
|
||||
""/*%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 "cleanup_objects">*/
|
||||
class cleanup_objects
|
||||
{
|
||||
name = "cleanup_objects";
|
||||
init = /*%FSM<STATEINIT""">*/"_missionObjs = allMissionObjects ""WeaponHolder"";" \n
|
||||
"_qty = count _missionObjs;" \n
|
||||
"" \n
|
||||
"//diag_log (""CLEANUP: PERFORMING ITEM CLEANUP: TOTAL "" + str(_qty) + "" LOOT BAGS"");" \n
|
||||
"_delQty = 0;" \n
|
||||
"{" \n
|
||||
" if (local _x) then {" \n
|
||||
" _keep = _x getVariable [""permaLoot"",false];" \n
|
||||
" _nearby = {isPlayer _x} count (_x nearEntities [[""CAManBase""], 100]);" \n
|
||||
" if ( (!_keep) && (_nearby==0) ) then {" \n
|
||||
" deleteVehicle _x;" \n
|
||||
" _delQty = _delQty + 1;" \n
|
||||
" };" \n
|
||||
" };" \n
|
||||
"} forEach _missionObjs;" \n
|
||||
"if (_delQty > 0) then {" \n
|
||||
" diag_log (""CLEANUP: DELETED "" + str(_delQty) + "" LOOT BAGS"");" \n
|
||||
"};" \n
|
||||
""/*%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 "sync_the_time">*/
|
||||
class sync_the_time
|
||||
{
|
||||
name = "sync_the_time";
|
||||
init = /*%FSM<STATEINIT""">*/"//Send request" \n
|
||||
"_key = ""CHILD:307:"";" \n
|
||||
"_result = _key call server_hiveReadWrite;" \n
|
||||
"_outcome = _result select 0;" \n
|
||||
"if(_outcome == ""PASS"") then {" \n
|
||||
" _date = _result select 1; " \n
|
||||
" _dateNum = dateToNumber(_date); " \n
|
||||
" _diff = ( _dateNum - dateToNumber (date) )*365*24*60;" \n
|
||||
" if ( abs(_diff)>5 ) then {" \n
|
||||
" setDate _date;" \n
|
||||
" dayzSetDate = _date;" \n
|
||||
" publicVariable ""dayzSetDate"";" \n
|
||||
" diag_log (""TIME SYNC: Local Time set to "" + str(_date));" \n
|
||||
" };" \n
|
||||
"};" \n
|
||||
""/*%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""">*/"//Clean groups" \n
|
||||
"{" \n
|
||||
" //diag_log (""CLEANUP: CHECKING GROUP WITH "" + str(count units _x) + "" UNITS"");" \n
|
||||
" if (count units _x==0) then {" \n
|
||||
" deleteGroup _x;" \n
|
||||
" //diag_log (""CLEANUP: DELETING A GROUP"");" \n
|
||||
" };" \n
|
||||
"} forEach allGroups;" \n
|
||||
"" \n
|
||||
"/*" \n
|
||||
"//Check for Ammobox" \n
|
||||
" {" \n
|
||||
" if(!(_x isKindOf ""WeaponHolder"")) then {" \n
|
||||
" diag_log (""CLEANUP: DELETING AN AMMOBOX "" + (typeOf _x));" \n
|
||||
" deleteVehicle _x;" \n
|
||||
" };" \n
|
||||
" } forEach allMissionObjects ""ReammoBox"";" \n
|
||||
"*/" \n
|
||||
"" \n
|
||||
"//Check for hackers" \n
|
||||
" {" \n
|
||||
" if(vehicle _x != _x && !(vehicle _x in _safety) && (typeOf vehicle _x) != ""ParachuteWest"") then {" \n
|
||||
" diag_log (""CLEANUP: KILLING A HACKER "" + (name _x) + "" "" + str(_x) + "" IN "" + (typeOf vehicle _x));" \n
|
||||
" (vehicle _x) setDamage 1;" \n
|
||||
" _x setDamage 1;" \n
|
||||
" };" \n
|
||||
" } forEach allUnits;" \n
|
||||
"" \n
|
||||
"/*" \n
|
||||
"//Let's move this into the body removal sequence so uncontrolled flies are removed only if corpses are cleaned" \n
|
||||
"//Check Flies" \n
|
||||
"_isOK=-1;" \n
|
||||
"_dwUSOFC=0;" \n
|
||||
"{" \n
|
||||
" //_isOk = {!alive _x} count (nearestObjects [_x, [""CAManBase""], 2]);" \n
|
||||
" _isOk = {!alive _x} count (_x nearEntities [[""CAManBase""], 2]);" \n
|
||||
" if (_isOk>-1) then {" \n
|
||||
" diag_log (""DW_DEBUG _isOK: "" + str(_isOK) );" \n
|
||||
" };" \n
|
||||
" if ((_isOk>-1) AND (isOK<1)) then {" \n
|
||||
" //diag_log (""CLEANUP: DELETING A SOUND OF FLIES"");" \n
|
||||
"_dwUSOFC=_dwUSOFC+1;" \n
|
||||
" deleteVehicle _x;" \n
|
||||
" diag_log (""CLEANUP: DELETED AN UNCONTROLLED SOUND OF FLIES:"" + str(_dwUSOFC) );" \n
|
||||
" };" \n
|
||||
"} forEach allMissionObjects ""Sound_Flies"";" \n
|
||||
"*/" \n
|
||||
"" \n
|
||||
"dayz_serverObjectMonitor = _safety;"/*%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
|
||||
"_safety = dayz_serverObjectMonitor;" \n
|
||||
"" \n
|
||||
"_lastUpdate = time;" \n
|
||||
"_timeNem = time;" \n
|
||||
"_deadBodies = [];" \n
|
||||
"_lastNeedUpdate = time;" \n
|
||||
"_maxBodies = 15;" \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 "update_objects">*/
|
||||
class update_objects
|
||||
{
|
||||
name = "update_objects";
|
||||
init = /*%FSM<STATEINIT""">*/"diag_log format[""DEBUG: needUpdate_objects=%1"",needUpdate_objects];" \n
|
||||
"{" \n
|
||||
"// _x setVariable [""needUpdate"",false,true];" \n
|
||||
" needUpdate_objects = needUpdate_objects - [_x];" \n
|
||||
" [_x,""all""] call server_updateObject;" \n
|
||||
"" \n
|
||||
"} forEach needUpdate_objects;" \n
|
||||
""/*%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>*/
|
||||
};
|
||||
initState="init";
|
||||
finalStates[] =
|
||||
{
|
||||
};
|
||||
};
|
||||
/*%FSM</COMPILE>*/
|
||||
294
SQF/dayz_server/system/server_monitor.sqf
Normal file
294
SQF/dayz_server/system/server_monitor.sqf
Normal file
@@ -0,0 +1,294 @@
|
||||
private ["_result","_pos","_wsDone","_dir","_block","_isOK","_countr","_objWpnTypes","_objWpnQty","_dam","_selection","_totalvehicles","_object","_idKey","_type","_ownerID","_worldspace","_intentory","_hitPoints","_fuel","_damage","_date","_script","_key","_outcome","_vehLimit","_hiveResponse","_objectCount","_codeCount","_objectArray"];
|
||||
[]execVM "\z\addons\dayz_server\system\s_fps.sqf"; //server monitor FPS (writes each ~181s diag_fps+181s diag_fpsmin*)
|
||||
|
||||
dayz_versionNo = getText(configFile >> "CfgMods" >> "DayZ" >> "version");
|
||||
dayz_hiveVersionNo = getNumber(configFile >> "CfgMods" >> "DayZ" >> "hiveVersion");
|
||||
_script = getText(missionConfigFile >> "onPauseScript");
|
||||
|
||||
if ((count playableUnits == 0) and !isDedicated) then {
|
||||
isSinglePlayer = true;
|
||||
};
|
||||
|
||||
waitUntil{initialized}; //means all the functions are now defined
|
||||
|
||||
diag_log "HIVE: Starting";
|
||||
|
||||
if (_script != "") then
|
||||
{
|
||||
diag_log "MISSION: File Updated";
|
||||
} else {
|
||||
while {true} do
|
||||
{
|
||||
diag_log "MISSION: File Needs Updating";
|
||||
sleep 1;
|
||||
};
|
||||
};
|
||||
|
||||
waituntil{isNil "sm_done"}; // prevent server_monitor be called twice (bug during login of the first player)
|
||||
|
||||
//Set the Time
|
||||
//Send request
|
||||
_key = "CHILD:307:";
|
||||
_result = _key call server_hiveReadWrite;
|
||||
_outcome = _result select 0;
|
||||
if(_outcome == "PASS") then {
|
||||
_date = _result select 1;
|
||||
|
||||
if(dayz_fullMoonNights) then {
|
||||
//date setup
|
||||
_year = _date select 0;
|
||||
_month = _date select 1;
|
||||
_day = _date select 2;
|
||||
_hour = _date select 3;
|
||||
_minute = _date select 4;
|
||||
|
||||
//Force full moon nights
|
||||
_date = [2012,6,6,_hour,_minute];
|
||||
};
|
||||
|
||||
if(isDedicated) then {
|
||||
//["dayzSetDate",_date] call broadcastRpcCallAll;
|
||||
setDate _date;
|
||||
dayzSetDate = _date;
|
||||
publicVariable "dayzSetDate";
|
||||
};
|
||||
|
||||
diag_log ("HIVE: Local Time set to " + str(_date));
|
||||
};
|
||||
|
||||
|
||||
// Custom Configs
|
||||
if(isnil "MaxVehicleLimit") then {
|
||||
MaxVehicleLimit = 50;
|
||||
};
|
||||
if(isnil "MaxHeliCrashes") then {
|
||||
MaxHeliCrashes = 5;
|
||||
};
|
||||
if(isnil "MaxDynamicDebris") then {
|
||||
MaxDynamicDebris = 100;
|
||||
};
|
||||
// Custon Configs End
|
||||
|
||||
if (isServer and isNil "sm_done") then {
|
||||
|
||||
serverVehicleCounter = [];
|
||||
_hiveResponse = [];
|
||||
|
||||
for "_i" from 1 to 5 do {
|
||||
diag_log "HIVE: trying to get objects";
|
||||
_key = format["CHILD:302:%1:", dayZ_instance];
|
||||
_hiveResponse = _key call server_hiveReadWrite;
|
||||
if ((((isnil "_hiveResponse") || {(typeName _hiveResponse != "ARRAY")}) || {((typeName (_hiveResponse select 1)) != "SCALAR")}) || {(_hiveResponse select 1 > 2000)}) then {
|
||||
diag_log ("HIVE: connection problem... HiveExt response:"+str(_hiveResponse));
|
||||
_hiveResponse = ["",0];
|
||||
}
|
||||
else {
|
||||
diag_log ("HIVE: found "+str(_hiveResponse select 1)+" objects" );
|
||||
_i = 99; // break
|
||||
};
|
||||
};
|
||||
|
||||
_objectArray = [];
|
||||
if ((_hiveResponse select 0) == "ObjectStreamStart") then {
|
||||
_objectCount = _hiveResponse select 1;
|
||||
diag_log ("HIVE: Commence Object Streaming...");
|
||||
for "_i" from 1 to _objectCount do {
|
||||
_hiveResponse = _key call server_hiveReadWrite;
|
||||
_objectArray set [_i - 1, _hiveResponse];
|
||||
//diag_log (format["HIVE dbg %1 %2", typeName _hiveResponse, _hiveResponse]);
|
||||
};
|
||||
diag_log ("HIVE: got " + str(count _objectArray) + " objects");
|
||||
};
|
||||
|
||||
// # START OF STREAMING #
|
||||
_countr = 0;
|
||||
_totalvehicles = 0;
|
||||
{
|
||||
//Parse Array
|
||||
_countr = _countr + 1;
|
||||
|
||||
_idKey = _x select 1;
|
||||
_type = _x select 2;
|
||||
_ownerID = _x select 3;
|
||||
|
||||
_worldspace = _x select 4;
|
||||
_intentory= _x select 5;
|
||||
_hitPoints= _x select 6;
|
||||
_fuel = _x select 7;
|
||||
_damage = _x select 8;
|
||||
|
||||
_dir = 0;
|
||||
_pos = [0,0,0];
|
||||
_wsDone = false;
|
||||
if (count _worldspace >= 2) then
|
||||
{
|
||||
_dir = _worldspace select 0;
|
||||
if (count (_worldspace select 1) == 3) then {
|
||||
_pos = _worldspace select 1;
|
||||
_wsDone = true;
|
||||
}
|
||||
};
|
||||
if (!_wsDone) then {
|
||||
if (count _worldspace >= 1) then { _dir = _worldspace select 0; };
|
||||
_pos = [getMarkerPos "center",0,4000,10,0,2000,0] call BIS_fnc_findSafePos;
|
||||
if (count _pos < 3) then { _pos = [_pos select 0,_pos select 1,0]; };
|
||||
diag_log ("MOVED OBJ: " + str(_idKey) + " of class " + _type + " to pos: " + str(_pos));
|
||||
};
|
||||
|
||||
if (_damage < 1) then {
|
||||
diag_log format["OBJ: %1 - %2", _idKey,_type];
|
||||
|
||||
//Create it
|
||||
_object = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"];
|
||||
_object setVariable ["lastUpdate",time];
|
||||
_object setVariable ["ObjectID", _idKey, true];
|
||||
|
||||
// fix for leading zero issues on safe codes after restart
|
||||
if (_object isKindOf "VaultStorageLocked") then {
|
||||
_codeCount = (count (toArray _ownerID));
|
||||
if(_codeCount == 3) then {
|
||||
_ownerID = format["0%1", _ownerID];
|
||||
};
|
||||
if(_codeCount == 2) then {
|
||||
_ownerID = format["00%1", _ownerID];
|
||||
};
|
||||
if(_codeCount == 1) then {
|
||||
_ownerID = format["000%1", _ownerID];
|
||||
};
|
||||
};
|
||||
|
||||
_object setVariable ["CharacterID", _ownerID, true];
|
||||
|
||||
clearWeaponCargoGlobal _object;
|
||||
clearMagazineCargoGlobal _object;
|
||||
|
||||
if ((typeOf _object) in dayz_allowedObjects) then {
|
||||
_object addMPEventHandler ["MPKilled",{_this call object_handleServerKilled;}];
|
||||
// Test disabling simulation server side on buildables only.
|
||||
_object enableSimulation false;
|
||||
};
|
||||
|
||||
_object setdir _dir;
|
||||
_object setpos _pos;
|
||||
_object setDamage _damage;
|
||||
|
||||
if (count _intentory > 0) then {
|
||||
if (_object isKindOf "VaultStorageLocked") then {
|
||||
// Fill variables with loot
|
||||
_object setVariable ["WeaponCargo", (_intentory select 0), true];
|
||||
_object setVariable ["MagazineCargo", (_intentory select 1), true];
|
||||
_object setVariable ["BackpackCargo", (_intentory select 2), true];
|
||||
_object setVariable ["OEMPos", _pos, true];
|
||||
} else {
|
||||
|
||||
//Add weapons
|
||||
_objWpnTypes = (_intentory select 0) select 0;
|
||||
_objWpnQty = (_intentory select 0) select 1;
|
||||
_countr = 0;
|
||||
{
|
||||
if (_x == "Crossbow") then { _x = "Crossbow_DZ" }; // Convert Crossbow to Crossbow_DZ
|
||||
_isOK = isClass(configFile >> "CfgWeapons" >> _x);
|
||||
if (_isOK) then {
|
||||
_block = getNumber(configFile >> "CfgWeapons" >> _x >> "stopThis") == 1;
|
||||
if (!_block) then {
|
||||
_object addWeaponCargoGlobal [_x,(_objWpnQty select _countr)];
|
||||
};
|
||||
};
|
||||
_countr = _countr + 1;
|
||||
} forEach _objWpnTypes;
|
||||
|
||||
//Add Magazines
|
||||
_objWpnTypes = (_intentory select 1) select 0;
|
||||
_objWpnQty = (_intentory select 1) select 1;
|
||||
_countr = 0;
|
||||
{
|
||||
if (_x == "BoltSteel") then { _x = "WoodenArrow" }; // Convert BoltSteel to WoodenArrow
|
||||
_isOK = isClass(configFile >> "CfgMagazines" >> _x);
|
||||
if (_isOK) then {
|
||||
_block = getNumber(configFile >> "CfgMagazines" >> _x >> "stopThis") == 1;
|
||||
if (!_block) then {
|
||||
_object addMagazineCargoGlobal [_x,(_objWpnQty select _countr)];
|
||||
};
|
||||
};
|
||||
_countr = _countr + 1;
|
||||
} forEach _objWpnTypes;
|
||||
|
||||
//Add Backpacks
|
||||
_objWpnTypes = (_intentory select 2) select 0;
|
||||
_objWpnQty = (_intentory select 2) select 1;
|
||||
_countr = 0;
|
||||
{
|
||||
_isOK = isClass(configFile >> "CfgVehicles" >> _x);
|
||||
if (_isOK) then {
|
||||
_block = getNumber(configFile >> "CfgVehicles" >> _x >> "stopThis") == 1;
|
||||
if (!_block) then {
|
||||
_object addBackpackCargoGlobal [_x,(_objWpnQty select _countr)];
|
||||
};
|
||||
};
|
||||
_countr = _countr + 1;
|
||||
} forEach _objWpnTypes;
|
||||
};
|
||||
};
|
||||
|
||||
if (_object isKindOf "AllVehicles") then {
|
||||
{
|
||||
_selection = _x select 0;
|
||||
_dam = _x select 1;
|
||||
if (_selection in dayZ_explosiveParts and _dam > 0.8) then {_dam = 0.8};
|
||||
[_object,_selection,_dam] call object_setFixServer;
|
||||
} forEach _hitpoints;
|
||||
|
||||
_object setFuel _fuel;
|
||||
|
||||
if (!((typeOf _object) in dayz_allowedObjects)) then {
|
||||
|
||||
_object setvelocity [0,0,1];
|
||||
_object call fnc_vehicleEventHandler;
|
||||
|
||||
if(_ownerID != "0") then {
|
||||
_object setvehiclelock "locked";
|
||||
};
|
||||
|
||||
_totalvehicles = _totalvehicles + 1;
|
||||
|
||||
// total each vehicle
|
||||
serverVehicleCounter set [count serverVehicleCounter,_type];
|
||||
};
|
||||
};
|
||||
|
||||
//Monitor the object
|
||||
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object];
|
||||
};
|
||||
} forEach _objectArray;
|
||||
// # END OF STREAMING #
|
||||
|
||||
// spawn_vehicles
|
||||
_vehLimit = MaxVehicleLimit - _totalvehicles;
|
||||
diag_log ("HIVE: Spawning # of Vehicles: " + str(_vehLimit));
|
||||
if(_vehLimit > 0) then {
|
||||
for "_x" from 1 to _vehLimit do {
|
||||
[] spawn spawn_vehicles;
|
||||
};
|
||||
};
|
||||
// spawn_roadblocks
|
||||
diag_log ("HIVE: Spawning # of Debris: " + str(MaxDynamicDebris));
|
||||
for "_x" from 1 to MaxDynamicDebris do {
|
||||
[] spawn spawn_roadblocks;
|
||||
};
|
||||
|
||||
if(isnil "dayz_MapArea") then {
|
||||
dayz_MapArea = 10000;
|
||||
};
|
||||
if(isnil "HeliCrashArea") then {
|
||||
HeliCrashArea = dayz_MapArea / 2;
|
||||
};
|
||||
|
||||
// [_guaranteedLoot, _randomizedLoot, _frequency, _variance, _spawnChance, _spawnMarker, _spawnRadius, _spawnFire, _fadeFire]
|
||||
nul = [3, 4, (50 * 60), (15 * 60), 0.75, 'center', HeliCrashArea, true, false] spawn server_spawnCrashSite;
|
||||
|
||||
// Epoch Events
|
||||
nul = [] spawn server_spawnEvents;
|
||||
|
||||
allowConnection = true;
|
||||
sm_done = true;
|
||||
};
|
||||
Reference in New Issue
Block a user