another sync with trader fixes

This commit is contained in:
A Clark
2012-11-22 09:37:02 -06:00
parent da5766e46b
commit 638ceee5c6
152 changed files with 786 additions and 1579 deletions

View File

@@ -11,24 +11,28 @@ _timeout = _object getVariable["combattimeout",0];
_playerIDtoarray = [];
_playerIDtoarray = toArray _playerID;
if (59 in _playerIDtoarray) exitWith {};
if ((_timeout - time) > 0) then {
diag_log("DEBUG: COMBAT LOG TIMER: " + str(_timeout));
_playerName call player_combatLogged;
};
if (vehicle _object != _object) then {
_object action ["eject", vehicle _object];
};
if (59 in _playerIDtoarray) exitWith { diag_log ("Exited"); };
if ((_timeout - time) > 0) then {
//_playerName call player_combatLogged;
private["_playerName","_center","_group"];
_playerName = name player;
_timeout = _object getVariable["combattimeout",0];
diag_log format["COMBAT LOGGED: %1 (%2)", _playerName,_timeout];
};
diag_log format["DISCONNECT: %1 (%2) Object: %3, _characterID: %4", _playerName,_playerID,_object,_characterID];
dayz_disco = dayz_disco - [_playerID];
if (!isNull _object) then {
//Update Vehicle
{ [_x,"gear"] call server_updateObject } foreach
(nearestObjects [getPosATL _object, ["Car", "Helicopter", "Motorcycle", "Ship", "TentStorage"], 10]);
(nearestObjects [getPosATL _object, ["Car", "Helicopter", "Motorcycle", "Ship", "TentStorage", "VaultStorage"], 10]);
if (alive _object) then {
[_object,[],true] call server_playerSync;
_id = [_playerID,_characterID,2] spawn dayz_recordLogin;

View File

@@ -16,20 +16,19 @@ diag_log ("DW_DEBUG: _newObject: " + str(_newObject));
};
*/
_characterID = parseNumber _characterID;
_minutes = parseNumber "_minutes";
if !(isnil "_characterID") then {
if (typeName _minutes == "STRING") then
{
_minutes = parseNumber _minutes;
};
if (_characterID != 0) then {
if (_characterID != "0") then
{
_key = format["CHILD:202:%1:%2:",_characterID,_minutes];
//diag_log ("HIVE: WRITE: "+ str(_key));
_key call server_hiveWrite;
} else {
deleteVehicle _newObject;
};
} else {
}
else
{
deleteVehicle _newObject;
};

View File

@@ -12,7 +12,7 @@ if (count _this > 2) then {
dayz_players = dayz_players - [_this select 2];
};
waitUntil{allowConnection};
//waitUntil{allowConnection};
//Variables
_inventory = [];

View File

@@ -202,7 +202,7 @@ if (_characterID != "0") then {
_pos = _this select 0;
{
[_x, "gear"] call server_updateObject;
} forEach nearestObjects [_pos, ["Car", "Helicopter", "Motorcycle", "Ship", "TentStorage"], 10];
} forEach nearestObjects [_pos, ["Car", "Helicopter", "Motorcycle", "Ship", "TentStorage", "VaultStorage"], 10];
//[_charPos] call server_updateNearbyObjects;
//Reset timer

View File

@@ -3,4 +3,4 @@ _pos = _this select 0;
{
[_x, "gear"] call server_updateObject;
} forEach nearestObjects [_pos, ["Car", "Helicopter", "Motorcycle", "Ship", "TentStorage"], 10];
} forEach nearestObjects [_pos, ["Car", "Helicopter", "Motorcycle", "Ship", "TentStorage", "VaultStorage"], 10];

View File

@@ -1,14 +1,37 @@
/*
[_object,_type] spawn server_updateObject;
*/
private["_object","_type","_objectID","_uid","_lastUpdate","_needUpdate"];
private ["_object","_type","_objectID","_uid","_lastUpdate","_needUpdate","_object_position","_object_inventory","_object_damage","_isNotOk"];
_object = _this select 0;
_type = _this select 1;
_parachuteWest = typeOf _object == "ParachuteWest";
_isNotOk = false;
_objectID = _object getVariable ["ObjectID","0"];
_uid = _object getVariable ["ObjectUID","0"];
if (_objectID == "0" && _uid == "0") then { _uid = _object call dayz_objectUID; }; //seems never been call
if ((typeName _objectID != "string") || (typeName _uid != "string")) then
{
diag_log(format["Non-string Object: ID %1 UID %2", _objectID, _uid]);
//force fail
_objectID = "0";
_uid = "0";
};
if (!_parachuteWest) then {
if (_objectID == "0" && _uid == "0") then
{
_object_position = getPosATL _object;
diag_log(format["Deleting object %1 with invalid ID at pos [%2,%3,%4]",
typeOf _object,
_object_position select 0,
_object_position select 1,
_object_position select 2]);
_isNotOk = true;
};
};
if (_isNotOk) exitWith { deleteVehicle _object; };
_lastUpdate = _object getVariable ["lastUpdate",time];
_needUpdate = _object in needUpdate_objects;

View File

@@ -1,46 +1,5 @@
private["_unit","_potential","_newOwner","_client"];
private["_unit"];
_unit = _this select 0;
diag_log ("CLEANUP: DELETE UNCONTROLLED ZOMBIE: " + (typeOf _unit) + " OF: " + str(_unit) );
deleteVehicle _unit;
/*
//Not server then exit
if(!isServer) exitWith {
diag_log ("DW_DEBUG: #findOwner exits as not server: " + str(isServer));
};
//Not local then exit
if(!local _unit) exitWith {
diag_log ("DW_DEBUG: #findOwner exits _unit not local: " + str(local _unit));
};
//Find a new owner
_potential = (getposATL _unit) nearEntities [["CAManBase"],300];
_newOwner = objNull;
{
if (isPlayer _x) then {
_newOwner = _x;
};
if (!isNull _newOwner) exitWith {
//diag_log ("DW_DEBUG: #findOwner potencial _newOwner: " + str(_newOwner));
};
} forEach _potential;
//If no nearby player, delete the agent
//diag_log ("DW_DEBUG: #findOwner isNull _newOwner: " + str(isNull _newOwner));
if(isNull _newOwner) exitWith {
diag_log ("CLEANUP: NOTHING TO TRANSFER OWNERSHIP OF TYPE: " + (typeOf _unit) + " OF: " + str(_unit) );
deleteVehicle _unit;
};
//set client as controller
_client = owner _newOwner;
_unit setOwner _client;
diag_log ("CLEANUP: TRANSFERRED OWNERSHIP OF TYPE: " + (typeOf _unit) + " OF _unit: " + str(_unit) + " TO _client: " + str(_client) );
*/
deleteVehicle _unit;

View File

@@ -5,11 +5,8 @@ object_spawnDamVehicle = compile preprocessFileLineNumbers "\z\addons\dayz_code\
server_playerLogin = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerLogin.sqf";
server_playerSetup = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerSetup.sqf";
server_onPlayerDisconnect = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_onPlayerDisconnect.sqf";
server_routinePlayerCheck = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_routinePlayerCheck.sqf";
server_updateObject = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_updateObject.sqf";
server_playerDied = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerDied.sqf";
server_updatePlayer = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_updatePlayer.sqf";
server_playerStat = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerStat.sqf";
server_publishObj = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishObject.sqf";
server_publishVeh = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishVehicle.sqf"; // Custom to add vehicles
server_publishBank = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishBank.sqf";
@@ -18,7 +15,6 @@ local_publishObj = compile preprocessFileLineNumbers "\z\addons\dayz_code\com
local_deleteObj = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_deleteObj.sqf"; //Creates the object in DB
local_createObj = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_createObj.sqf"; //Creates the object in DB
server_playerSync = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerSync.sqf";
//zombie_initialize = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\zombie_initialize.sqf";
zombie_findOwner = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\zombie_findOwner.sqf";
server_updateNearbyObjects = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_updateNearbyObjects.sqf";
@@ -29,8 +25,13 @@ vehicle_handleInteract = {
[_object, "all"] call server_updateObject;
};
player_combatLogged = {
};
//event Handlers
eh_localCleanup = {
private ["_object"];
_object = _this select 0;
_object addEventHandler ["local", {
if(_this select 1) then {
@@ -44,7 +45,7 @@ eh_localCleanup = {
};
server_characterSync = {
//dayzCharDisco = [_characterID,_playerPos,[_weapons,_magazines],[typeOf _backpack,getWeaponCargo _backpack,getMagazineCargo _backpack],_medical,_currentState,_currentModel];
private ["_characterID","_playerPos","_playerGear","_playerBackp","_medical","_currentState","_currentModel","_key"];
_characterID = _this select 0;
_playerPos = _this select 1;
_playerGear = _this select 2;
@@ -65,7 +66,7 @@ fnc_buildWeightedArray = compile preprocessFileLineNumbers "\z\addons\dayz_code
onPlayerDisconnected "[_uid,_name] call server_onPlayerDisconnect;";
server_hiveWrite = {
private["_resultArray","_data"];
private["_data"];
//diag_log ("ATTEMPT WRITE: " + _this);
_data = "HiveEXT" callExtension _this;
diag_log ("WRITE: " + _data);
@@ -234,6 +235,10 @@ spawn_vehicles = {
clearWeaponCargoGlobal _veh;
clearMagazineCargoGlobal _veh;
_veh setVehicleInit "this lock true; this lockCargo true;";
processInitCommands;
[_veh,[_dir,_objPosition],_vehicle,true,"0"] call server_publishVeh;
};

View File

@@ -190,7 +190,7 @@ class FSM
" if (_isOk>-1) then {" \n
" diag_log (""DW_DEBUG _isOK: "" + str(_isOK) );" \n
" };" \n
" if ((_isOk>-1) AND (isOK<1)) then {" \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

View File

@@ -90,6 +90,10 @@ diag_log "HIVE: Starting";
_pos set [2,0];
_object setpos _pos;
};
if (_object isKindOf "VaultStorage") then {
_pos set [2,0];
_object setpos _pos;
};
_object setdir _dir;
_object setDamage _damage;
@@ -141,6 +145,10 @@ diag_log "HIVE: Starting";
};
if (_object isKindOf "AllVehicles") then {
if(_ownerID != 0) then {
_object setVehicleInit "this lock true; this lockCargo true;";
processInitCommands;
};
{
_selection = _x select 0;
_dam = _x select 1;
@@ -228,4 +236,6 @@ for "_x" from 1 to MaxHeliCrashes do {
};
// Allow connection after road debris spawns
allowConnection = true;