1.0.1.7 DEV TEST

+ [CHANGED] Can now fill empty fuel barrels on standard fuel tanks.
+ [CHANGED] Increased range of crafting from 2m to 3m
+ [FIXED] Removed repair action from tow truck with VIL_asistvan_DZE
+ [ADDED] Tow truck VIL_asistvan_DZE can tow vehicles that fit within
the bounding box of the model.
+ [ADDED] Ability for fuel trucks to fill nearby vehicles 30m when
engine is running.
+ [CHANGED] Reworked Epoch events scheduler and made it more accurate.
+ [REMOVED] Road debris no longer spawn loot, helps with performance and
we have added extra loot positions in the world.
+ and more
This commit is contained in:
[VB]AWOL
2013-08-05 11:09:26 -05:00
parent 9b1a3b3927
commit 9e5957b89d
40 changed files with 641 additions and 599 deletions

View File

@@ -11,11 +11,15 @@ if (isServer) then {
//Send request
_key = format["CHILD:304:%1:",_id];
_key call server_hiveWrite;
#ifdef DZE_SERVER_DEBUG_HIVE
diag_log format["DELETE: Deleted by ID: %1",_id];
#endif
} else {
//Send request
_key = format["CHILD:310:%1:",_uid];
_key call server_hiveWrite;
#ifdef DZE_SERVER_DEBUG_HIVE
diag_log format["DELETE: Deleted by UID: %1",_uid];
#endif
};
};

View File

@@ -1,6 +1,3 @@
/*
*/
private ["_object","_myGroup","_id","_playerID","_playerName","_characterID","_playerIDtoarray","_timeout"];
_playerID = _this select 0;
_playerName = _this select 1;
@@ -18,27 +15,31 @@ if (vehicle _object != _object) then {
if (59 in _playerIDtoarray) exitWith { };
if ((_timeout - time) > 0) then {
diag_log format["COMBAT LOGGED: %1 (%2)", _playerName,_timeout];
_object setVariable["NORRN_unconscious",true, true];
_object setVariable["unconsciousTime",300,true];
diag_log format["SET UNCONCIOUSNESS: %1", _playerName];
//_message = format["PLAYER COMBAT LOGGED: %1 (%2)",_playerName, _killerName, _weapon];
//[nil, nil, rspawn, [_object, _message], { (_this select 0) globalChat (_this select 1) }] call RE;
#ifdef DZE_SERVER_DEBUG
diag_log format["COMBAT LOGGED: %1 (%2)", _playerName,_timeout];
diag_log format["SET UNCONCIOUSNESS: %1", _playerName];
#endif
// Message whole server when player combat logs
_message = format["PLAYER COMBAT LOGGED: %1",_playerName];
[nil,nil,"per",rTITLETEXT,_message,"PLAIN DOWN"] call RE;
};
#ifdef DZE_SERVER_DEBUG
diag_log format["DISCONNECT: %1 (%2) Object: %3, _characterID: %4", _playerName,_playerID,_object,_characterID];
#endif
_id = [_playerID,_characterID,2] spawn dayz_recordLogin;
dayz_disco = dayz_disco - [_playerID];
if (!isNull _object) then {
//Update Vehicle
//Update Vehicle
{ [_x,"gear"] call server_updateObject } foreach
(nearestObjects [getPosATL _object, dayz_updateObjects, 10]);
if (alive _object) then {
[_object,(magazines _object),true,true] call server_playerSync;
//[_object,[],true,false] call server_playerSync;
_myGroup = group _object;
deleteVehicle _object;
deleteGroup _myGroup;

View File

@@ -3,9 +3,10 @@ private["_character","_clientID"];
_character = _this select 0;
_clientID = owner _character;
#ifdef DZE_SERVER_DEBUG
diag_log ("HIVE: Player Death list Request by ClientID: "+ str(_clientID));
diag_log(PlayerDeaths);
#endif
dayzPlayerDeathsResult = PlayerDeaths;

View File

@@ -33,7 +33,10 @@ if (_killerName != "nil") then
_loc_message = format["PKILL: %1 was killed by %2 with weapon %3 from %4m", _victimName, _killerName, _weapon, _distance];
};
#ifdef DZE_SERVER_DEBUG_PKILL
diag_log _loc_message;
#endif
if(DZE_DeathMsgGlobal) then {
[nil, nil, rspawn, [_killer, _message], { (_this select 0) globalChat (_this select 1) }] call RE;
};
@@ -57,13 +60,6 @@ if (_killerName != "nil") then
dayz_disco = dayz_disco - [_playerID];
_newObject setVariable["processedDeath",time];
/*
diag_log ("DW_DEBUG: (isnil _characterID): " + str(isnil "_characterID"));
if (isnil "_characterID") then {
diag_log ("DW_DEBUG: _newObject: " + str(_newObject));
};
*/
if (typeName _minutes == "STRING") then
{
_minutes = parseNumber _minutes;
@@ -72,7 +68,9 @@ if (typeName _minutes == "STRING") then
if (_characterID != "0") then
{
_key = format["CHILD:202:%1:%2:%3:",_characterID,_minutes,_infected];
//diag_log ("HIVE: WRITE: "+ str(_key));
#ifdef DZE_SERVER_DEBUG_HIVE
diag_log ("HIVE: WRITE: "+ str(_key));
#endif
_key call server_hiveWrite;
}
else
@@ -80,16 +78,6 @@ else
deleteVehicle _newObject;
};
#ifdef DZE_SERVER_DEBUG_PKILL
diag_log ("PDEATH: Player Died " + _playerID);
/*
_eh = [_newObject] spawn {
_body = _this select 0;
_method = _body getVariable["deathType","unknown"];
_name = _body getVariable["bodyName","unknown"];
waitUntil{!isPlayer _body;sleep 1};
_body setVariable["deathType",_method,true];
_body setVariable["bodyName",_name,true];
diag_log ("PDEATH: Player Left Body " + _name);
};
*/
//dead_bodyCleanup set [count dead_bodyCleanup,_newObject];
#endif

View File

@@ -1,20 +1,20 @@
private ["_isInfected","_doLoop","_hiveVer","_isHiveOk","_playerID","_playerObj","_primary","_key","_charID","_playerName","_backpack","_isNew","_inventory","_survival","_model","_mags","_wpns","_bcpk","_config","_newPlayer"];
//Set Variables
#ifdef DZE_SERVER_DEBUG_LOGIN
diag_log ("STARTING LOGIN: " + str(_this));
#endif
_playerID = _this select 0;
_playerObj = _this select 1;
_playerName = name _playerObj;
//_worldspace = [];
if (_playerName == '__SERVER__' || _playerID == '' || local player) exitWith {};
// Cancel any login until server_monitor terminates.
// This is mandatory since all vehicles must be spawned before the first players spawn on the map.
// Otherwise, all vehicle event handlers won't be created on players' client side.
if (isNil "sm_done") exitWith { diag_log ("Login cancelled, server is not ready. " + str(_playerObj)); };
if (isNil "sm_done") exitWith {
#ifdef DZE_SERVER_DEBUG_LOGIN
diag_log ("Login cancelled, server is not ready. " + str(_playerObj));
#endif
};
if (count _this > 2) then {
dayz_players = dayz_players - [_this select 2];
@@ -23,29 +23,23 @@ if (count _this > 2) then {
//Variables
_inventory = [];
_backpack = [];
//_items = [];
//_magazines = [];
//_weapons = [];
//_medicalStats = [];
_survival = [0,0,0];
//_tent = [];
//_state = [];
//_direction = 0;
_isInfected = 0;
_model = "";
//_newUnit = objNull;
//_botActive = false;
if (_playerID == "") then {
_playerID = getPlayerUID _playerObj;
};
if ((_playerID == "") or (isNil "_playerID")) exitWith {
#ifdef DZE_SERVER_DEBUG_LOGIN
diag_log ("LOGIN FAILED: Player [" + _playerName + "] has no login ID");
#endif
};
//??? endLoadingScreen;
#ifdef DZE_SERVER_DEBUG_LOGIN
diag_log ("LOGIN ATTEMPT: " + str(_playerID) + " " + _playerName);
#endif
//Do Connection Attempt
_doLoop = 0;
@@ -61,20 +55,25 @@ while {_doLoop < 5} do {
};
if (isNull _playerObj or !isPlayer _playerObj) exitWith {
#ifdef DZE_SERVER_DEBUG
diag_log ("LOGIN RESULT: Exiting, player object null: " + str(_playerObj));
#endif
};
if ((_primary select 0) == "ERROR") exitWith {
#ifdef DZE_SERVER_DEBUG_LOGIN
diag_log format ["LOGIN RESULT: Exiting, failed to load _primary: %1 for player: %2 ",_primary,_playerID];
#endif
};
//Process request
_newPlayer = _primary select 1;
_isNew = count _primary < 7; //_result select 1;
_charID = _primary select 2;
//_randomSpot = false;
//diag_log ("LOGIN RESULT: " + str(_primary));
#ifdef DZE_SERVER_DEBUG_LOGIN
diag_log ("LOGIN RESULT: " + str(_primary));
#endif
/* PROCESS */
_hiveVer = 0;
@@ -127,18 +126,17 @@ if (!_isNew) then {
_key call server_hiveWrite;
};
};
diag_log ("LOGIN LOADED: " + str(_playerObj) + " Type: " + (typeOf _playerObj));
_isHiveOk = false; //EDITED
#ifdef DZE_SERVER_DEBUG_LOGIN
diag_log ("LOGIN LOADED: " + str(_playerObj) + " Type: " + (typeOf _playerObj));
#endif
_isHiveOk = false;
if (_hiveVer >= dayz_hiveVersionNo) then {
_isHiveOk = true;
};
//diag_log ("SERVER RESULT: " + str("X") + " " + str(dayz_hiveVersionNo));
//Server publishes variable to clients and WAITS
//_playerObj setVariable ["publish",[_charID,_inventory,_backpack,_survival,_isNew,dayz_versionNo,_model,_isHiveOk,_newPlayer],true];
dayzPlayerLogin = [_charID,_inventory,_backpack,_survival,_isNew,dayz_versionNo,_model,_isHiveOk,_newPlayer,_isInfected];
if(!isNull _playerObj) then {
(owner _playerObj) publicVariableClient "dayzPlayerLogin";
};
};

View File

@@ -1,17 +1,23 @@
private ["_characterID","_playerObj","_playerID","_dummy","_worldspace","_state","_doLoop","_key","_primary","_medical","_stats","_humanity","_lastinstance","_friendlies","_randomSpot","_position","_debug","_distance","_hit","_fractures","_score","_findSpot","_pos","_isIsland","_w","_clientID","_spawnMC"];
//Wait for HIVE to be free
//diag_log ("SETUP: attempted with " + str(_this));
#ifdef DZE_SERVER_DEBUG_PSETUP
diag_log ("SETUP: attempted with " + str(_this));
#endif
_characterID = _this select 0;
_playerObj = _this select 1;
_playerID = getPlayerUID _playerObj;
if (isNull _playerObj) exitWith {
#ifdef DZE_SERVER_DEBUG_PSETUP
diag_log ("SETUP INIT FAILED: Exiting, player object null: " + str(_playerObj));
#endif
};
//Add MPHit event handler
#ifdef DZE_SERVER_DEBUG_PSETUP
diag_log("Adding MPHit EH for " + str(_playerObj));
#endif
_playerObj addMPEventHandler ["MPHit", {_this spawn fnc_plyrHit;}];
if (_playerID == "") then {
@@ -19,13 +25,17 @@ if (_playerID == "") then {
};
if (_playerID == "") exitWith {
#ifdef DZE_SERVER_DEBUG_PSETUP
diag_log ("SETUP INIT FAILED: Exiting, no player ID: " + str(_playerObj));
#endif
};
private["_dummy"];
_dummy = getPlayerUID _playerObj;
if ( _playerID != _dummy ) then {
#ifdef DZE_SERVER_DEBUG_PSETUP
diag_log format["DEBUG: _playerID miscompare with UID! _playerID:%1",_playerID];
#endif
_playerID = _dummy;
};
@@ -48,11 +58,15 @@ while {_doLoop < 5} do {
};
if (isNull _playerObj or !isPlayer _playerObj) exitWith {
#ifdef DZE_SERVER_DEBUG_PSETUP
diag_log ("SETUP RESULT: Exiting, player object null: " + str(_playerObj));
#endif
};
//Wait for HIVE to be free
//diag_log ("SETUP: RESULT: Successful with " + str(_primary));
#ifdef DZE_SERVER_DEBUG_PSETUP
diag_log ("SETUP: RESULT: Successful with " + str(_primary));
#endif
_medical = _primary select 1;
_stats = _primary select 2;
@@ -62,14 +76,11 @@ _humanity = _primary select 5;
_lastinstance = _primary select 6;
_namespace = profileNamespace;
_friendlies = _namespace getVariable ["friendlies", []];;
//Set position
_randomSpot = false;
//diag_log ("WORLDSPACE: " + str(_worldspace));
if (count _worldspace > 0) then {
_position = _worldspace select 1;
@@ -98,7 +109,9 @@ if (count _worldspace > 0) then {
_randomSpot = true;
};
//diag_log ("LOGIN: Location: " + str(_worldspace) + " doRnd?: " + str(_randomSpot));
#ifdef DZE_SERVER_DEBUG_PSETUP
diag_log ("LOGIN: Location: " + str(_worldspace) + " doRnd?: " + str(_randomSpot));
#endif
//set medical values
if (count _medical > 0) then {
@@ -110,16 +123,8 @@ if (count _medical > 0) then {
_playerObj setVariable["USEC_isCardiac",(_medical select 5),true];
_playerObj setVariable["USEC_lowBlood",(_medical select 6),true];
_playerObj setVariable["USEC_BloodQty",(_medical select 7),true];
_playerObj setVariable["unconsciousTime",(_medical select 10),true];
// if (_playerID in dayz_disco) then {
// _playerObj setVariable["NORRN_unconscious",true, true];
// _playerObj setVariable["unconsciousTime",300,true];
// } else {
// _playerObj setVariable["unconsciousTime",(_medical select 10),true];
// };
_playerObj setVariable["unconsciousTime",(_medical select 10),true];
//Add Wounds
{
_playerObj setVariable[_x,true,true];
@@ -192,7 +197,6 @@ if (_randomSpot) then {
endLoadingScreen;
};
//Spawn modify via mission init.sqf
if(isnil "spawnArea") then {
spawnArea = 1500;
@@ -240,7 +244,6 @@ if (_randomSpot) then {
};
};
//Record player for management
dayz_players set [count dayz_players,_playerObj];
@@ -263,9 +266,9 @@ if(!isNull _playerObj) then {
_playerObj setVariable ["lastTime",time];
//_playerObj setVariable ["model_CHK",typeOf _playerObj];
#ifdef DZE_SERVER_DEBUG_PSETUP
diag_log ("LOGIN PUBLISHING: " + str(_playerObj) + " Type: " + (typeOf _playerObj));
#endif
dayzLogin = null;
dayzLogin2 = null;
//Save Login
dayzLogin2 = null;

View File

@@ -1,21 +1,4 @@
private ["_character","_magazines","_force","_characterID","_charPos","_isInVehicle","_timeSince","_humanity","_debug","_distance","_isNewMed","_isNewPos","_isNewGear","_playerPos","_playerGear","_playerBackp","_medical","_distanceFoot","_lastPos","_backpack","_kills","_killsB","_killsH","_headShots","_lastTime","_timeGross","_timeLeft","_currentWpn","_currentAnim","_config","_onLadder","_isTerminal","_currentModel","_modelChk","_muzzles","_temp","_currentState","_array","_key","_pos","_forceGear"];
//[player,array]
//diag_log ("UPDATE: " + str(_this) );
//waituntil {(typeName(_this) == "ARRAY");sleep 0.01;}; //seems to cause often infinite waits (but not for first n players)
//this only happens when we don't follow the correct parameter format...
//(like supplying just the player object instead of the array in player_eat.sqf)
//i've fixed this in player_eat so i can comment this part out
/*if ( typeName(_this) == "OBJECT" ) then {
_this = [_this,[],true];
//diag_log ("DW_DEBUG: #manual fix _this: " + str(_this));
};*/
//correct
//"UPDATE: [B 1-1-B:1 (THE BEAST) REMOTE,[],true]"
//error
//"UPDATE: B 1-1-B:1 (THE BEAST) REMOTE"
_character = _this select 0;
_magazines = _this select 1;
@@ -29,30 +12,35 @@ _isInVehicle = vehicle _character != _character;
_timeSince = 0;
_humanity = 0;
//diag_log ("DW_DEBUG: (isnil _characterID): " + str(isnil "_characterID"));
/*
if !(isnil "_characterID") then {
diag_log ("DW_DEBUG: _characterID: " + str(_characterID));
};
*/
#ifdef DZE_SERVER_DEBUG_SYNC
diag_log ("DW_DEBUG: (isnil _characterID): " + str(isnil "_characterID"));
#endif
if (_character isKindOf "Animal") exitWith {
#ifdef DZE_SERVER_DEBUG_SYNC
diag_log ("ERROR: Cannot Sync Character " + (name _character) + " is an Animal class");
#endif
};
if (isnil "_characterID") exitWith {
#ifdef DZE_SERVER_DEBUG_SYNC
diag_log ("ERROR: Cannot Sync Character " + (name _character) + " has nil characterID");
#endif
};
if (_characterID == "0") exitWith {
#ifdef DZE_SERVER_DEBUG_SYNC
diag_log ("ERROR: Cannot Sync Character " + (name _character) + " as no characterID");
#endif
};
private["_debug","_distance"];
_debug = getMarkerpos "respawn_west";
_distance = _debug distance _charPos;
if (_distance < 2000) exitWith {
#ifdef DZE_SERVER_DEBUG_SYNC
diag_log format["ERROR: server_playerSync: Cannot Sync Player %1 [%2]. Position in debug! %3",name _character,_characterID,_charPos];
#endif
};
//Check for server initiated updates
@@ -60,8 +48,6 @@ _isNewMed = _character getVariable["medForceUpdate",false]; //Med Update is fo
_isNewPos = _character getVariable["posForceUpdate",false]; //Med Update is forced when a player receives some kind of med incident
_isNewGear = (count _magazines) > 0;
//diag_log ("Starting Save... MED: " + str(_isNewMed) + " / POS: " + str(_isNewPos)); sleep 0.05;
//Check for player initiated updates
if (_characterID != "0") then {
_playerPos = [];

View File

@@ -10,15 +10,24 @@ diag_log("EPOCH EVENTS INIT");
EventSchedulerLastTime = "";
epoch_eventIsAny = {
private ["_boolReturn","_event","_real"];
private ["_boolReturn","_event","_date"];
_event = _this select 0;
_real = _this select 1;
_date = _this select 1;
_boolReturn = false;
if (typeName _event == "STRING") then {
_boolReturn = (_event == "any");
} else {
_boolReturn = (_real == _event);
};
_index = 0;
{
_bool = false;
if (typeName _x == "STRING") then {
_boolReturn = true;
} else {
_boolReturn = ((_date select _index) == _x);
};
if (!_boolReturn) exitWith {};
_index = _index + 1;
} forEach _event;
_boolReturn
};
@@ -36,41 +45,28 @@ while {true} do {
_datestr = str(_date);
if (EventSchedulerLastTime != _datestr) then {
// This is only ran every minute.
// Once a minute.
EventSchedulerLastTime = _datestr;
// diag_log ("EVENTS: Local Time is: " + str(_date));
diag_log ("EVENTS: Local Time is: " + _datestr);
{
if([(_x select 0),(date select 0)] call epoch_eventIsAny) then {
if([(_x select 1),(date select 1)] call epoch_eventIsAny) then {
if([(_x select 2),(date select 2)] call epoch_eventIsAny) then {
if([(_x select 3),(date select 3)] call epoch_eventIsAny) then {
if([(_x select 4),(date select 4)] call epoch_eventIsAny) then {
// EXECUTE SCRIPT
diag_log ("RUNNING EVENT: " + (_x select 5) + " on " + EventSchedulerLastTime);
_handle = [] execVM "\z\addons\dayz_server\modules\" + (_x select 5) + ".sqf";
};
};
};
};
if([[(_x select 0),(_x select 1),(_x select 2),(_x select 3),(_x select 4)],_date] call epoch_eventIsAny) then {
diag_log ("RUNNING EVENT: " + (_x select 5) + " on " + _datestr);
_handle = [] execVM "\z\addons\dayz_server\modules\" + (_x select 5) + ".sqf";
};
} forEach EpochEvents;
_time = diag_tickTime;
// perform cleanup here
if ((_time - zero_cleanDead) > 600) then
{
if ((_time - zero_cleanDead) > 600) then {
call server_cleanDead;
zero_cleanDead = _time;
};
if ((_time - zero_cleanLoot) > 1800) then
{
if ((_time - zero_cleanLoot) > 1800) then {
call server_cleanLoot;
zero_cleanLoot = _time;
};
};
};
sleep 5;
sleep 10;
};

View File

@@ -1,5 +1,8 @@
private["_unit"];
_unit = _this select 0;
#ifdef DZE_SERVER_DEBUG
diag_log ("CLEANUP: DELETE UNCONTROLLED ZOMBIE: " + (typeOf _unit) + " OF: " + str(_unit) );
#endif
deleteVehicle _unit;

View File

@@ -1,3 +1,9 @@
#define DZE_SERVER_DEBUG
#define DZE_SERVER_DEBUG_HIVE
#define DZE_SERVER_DEBUG_PKILL
#define DZE_SERVER_DEBUG_LOGIN
#define DZE_SERVER_DEBUG_PSETUP
class CfgPatches {
class dayz_server {
units[] = {};

View File

@@ -347,33 +347,7 @@ spawn_roadblocks = {
_veh setDir round(random 360);
_veh setpos _position;
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_veh];
_veh setVariable ["ObjectID","1",true];
_num = round(random 3);
_config = configFile >> "CfgBuildingLoot" >> _spawnloot;
_itemType = [] + getArray (_config >> "itemType");
_itemChance = [] + getArray (_config >> "itemChance");
waituntil {!isnil "fnc_buildWeightedArray"};
_weights = [];
_weights = [_itemType,_itemChance] call fnc_buildWeightedArray;
for "_x" from 1 to _num do {
//create loot
_index = _weights call BIS_fnc_selectRandom;
sleep 1;
if (count _itemType > _index) then {
_iArray = _itemType select _index;
_iArray set [2,_position];
_iArray set [3,5];
_iArray call spawn_loot;
_nearby = _position nearObjects ["WeaponHolder",20];
{
_x setVariable ["permaLoot",true];
} forEach _nearBy;
};
};
};
};

View File

@@ -4,49 +4,39 @@
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};
item3[] = {"time_sync",4,218,-275.000000,-25.000000,-175.000000,25.000000,1.000000,"time" \n "sync"};
item4[] = {"sync_the_time",2,250,-275.000000,50.000000,-175.000000,100.000000,0.000000,"sync" \n "the time"};
item5[] = {"true",8,218,-75.000000,125.000000,25.000000,175.000000,0.000000,"true"};
item6[] = {"general_cleanup",2,4346,-75.000000,200.000000,25.000000,250.000000,0.000000,"general" \n "cleanup"};
item7[] = {"",7,210,-304.000000,220.999985,-296.000000,229.000015,0.000000,""};
item8[] = {"",7,210,-304.000000,-154.000000,-296.000000,-146.000000,0.000000,""};
item9[] = {"",7,210,221.000000,-79.000000,229.000000,-71.000000,0.000000,""};
item10[] = {"",7,210,221.000000,146.000000,229.000000,154.000000,0.000000,""};
item11[] = {"initialized",4,218,-75.000000,-325.000000,25.000000,-275.000000,0.000000,"initialized"};
item12[] = {"prepare",2,250,-75.000000,-250.000000,25.000000,-200.000000,0.000000,"prepare"};
item13[] = {"update_objects",2,250,100.000000,50.000000,200.000000,100.000000,0.000000,"update objects"};
item14[] = {"need_update",4,218,100.000000,-25.000000,200.000000,25.000000,1.000000,"need update"};
item15[] = {"",7,210,221.000000,-79.000000,229.000000,-71.000000,0.000000,""};
link0[] = {0,11};
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};
link3[] = {2,9};
link4[] = {2,14};
link5[] = {3,4};
link6[] = {4,5};
link7[] = {5,6};
link8[] = {6,7};
link9[] = {7,8};
link10[] = {8,1};
link11[] = {9,10};
link12[] = {9,15};
link13[] = {10,5};
link14[] = {11,12};
link15[] = {12,1};
link16[] = {13,5};
link17[] = {14,13};
globals[] = {25.000000,1,0,0,0,640,480,1,24,6316128,1,-419.782135,377.473389,490.440002,-241.733459,910,880,1};
window[] = {2,-1,-1,-1,-1,784,1706,2984,26,3,928};
*//*%FSM</HEAD>*/
class FSM
{
@@ -79,19 +69,19 @@ class FSM
{
name = "waiting";
init = /*%FSM<STATEINIT""">*/"//diag_log ""CLEANUP: Waiting for next task"";" \n
"_numDead = {local _x} count allDead;" \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
/*%FSM<LINK "need_update">*/
class need_update
{
priority = 2.000000;
to="cleanup_dead";
priority = 1.000000;
to="update_objects";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(_numDead > 300)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
condition=/*%FSM<CONDITION""">*/"( (count needUpdate_objects) > 0 && (diag_tickTime -_lastNeedUpdate>40) )"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_lastNeedUpdate = time;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "time_sync">*/
@@ -100,164 +90,10 @@ class FSM
priority = 1.000000;
to="sync_the_time";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((time - _lastUpdate) > 300)"/*%FSM</CONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _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
{
@@ -281,14 +117,23 @@ class FSM
"_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
" if(dayz_fullMoonNights) then {" \n
" //date setup" \n
" _year = _date select 0;" \n
" _month = _date select 1;" \n
" _day = _date select 2;" \n
" _hour = _date select 3;" \n
" _minute = _date select 4;" \n
" " \n
" //Force full moon nights" \n
" _date = [2012,6,6,_hour,_minute];" \n
" };" \n
"" \n
" setDate _date;" \n
" dayzSetDate = _date;" \n
" publicVariable ""dayzSetDate"";" \n
" diag_log (""TIME SYNC: Local Time set to "" + str(_date)); " \n
"};" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
@@ -320,45 +165,15 @@ class FSM
" };" \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
" if(vehicle _x != _x && !(vehicle _x in _safety) && (isPlayer _x) && (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
@@ -383,11 +198,12 @@ class FSM
init = /*%FSM<STATEINIT""">*/"diag_log (""CLEANUP: INITIALIZING CLEANUP SCRIPT"");" \n
"" \n
"_safety = dayz_serverObjectMonitor;" \n
"_dateNow = (DateToNumber date);" \n
"" \n
"_lastUpdate = time;" \n
"_timeNem = time;" \n
"_deadBodies = [];" \n
"_lastNeedUpdate = time;" \n
"_lastUpdate = diag_tickTime;" \n
"_timeNem =diag_tickTime;" \n
"" \n
"_lastNeedUpdate = diag_tickTime;" \n
"_maxBodies = 15;" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;

View File

@@ -36,7 +36,6 @@ if(_outcome == "PASS") then {
};
if(isDedicated) then {
//["dayzSetDate",_date] call broadcastRpcCallAll;
setDate _date;
dayzSetDate = _date;
publicVariable "dayzSetDate";
@@ -280,8 +279,12 @@ if (isServer and isNil "sm_done") then {
nul = [3, 4, (50 * 60), (15 * 60), 0.75, 'center', HeliCrashArea, true, false] spawn server_spawnCrashSite;
};
// Epoch Events
nul = [] spawn server_spawnEvents;
if (isDedicated) then {
// Epoch Events
_id = [] spawn server_spawnEvents;
// server cleanup
_id = [] execFSM "\z\addons\dayz_server\system\server_cleanup.fsm";
};
allowConnection = true;
sm_done = true;