Update server_publishObject

The hive call in server_publishObject is the same between vanilla and
Epoch. The only difference is vanilla uses the _inventory area for
owner, lock code, etc. variables where as modular Epoch items just store
an empty array there.

The object classname does not need to be sent in the PV because it can
be obtained on the server.

PVDZE_veh_Publish was not used.
This commit is contained in:
ebaydayz
2016-04-02 15:24:20 -04:00
parent 22d7e23d3f
commit 4ce54fbb62
47 changed files with 114 additions and 351 deletions

View File

@@ -1,35 +1,43 @@
private ["_class","_uid","_charID","_object","_worldspace","_key","_allowed"];
//[dayz_characterID,_tent,[_dir,_location],"TentStorage"]
_charID = _this select 0;
#include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"
private ["_type ","_objectUID ","_characterID ","_object","_worldspace","_key", "_ownerArray", "_inventory"];
_characterID = _this select 0;
_object = _this select 1;
_worldspace = _this select 2;
_class = _this select 3;
_inventory = _this select 3;
_type = typeOf _object;
_allowed = [_object, "Server"] call check_publishobject;
if (!_allowed) exitWith { deleteVehicle _object; };
if ([_object, "Server"] call check_publishobject) then {
//diag_log ("PUBLISH: Attempt " + str(_object));
//diag_log ("PUBLISH: Attempt " + str(_object));
_objectUID = _worldspace call dayz_objectUID2;
_object setVariable [ "ObjectUID", _objectUID, true ];
// we can't use getVariable because only the object creation is known from the server (position,direction,variables are not sync'ed yet)
//_characterID = _object getVariable [ "characterID", 0 ];
//_ownerArray = _object getVariable [ "ownerArray", [] ];
_key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:", dayZ_instance, _type, 0, _characterID, _worldspace, _inventory, [], 0,_objectUID ];
//get UID
_uid = _worldspace call dayz_objectUID2;
_key call server_hiveWrite;
//Send request
_key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, 0 , _charID, _worldspace, [], [], 0,_uid];
//diag_log ("HIVE: WRITE: "+ str(_key));
_key call server_hiveWrite;
if !(_object isKindOf "TrapItems") then {
if (DZE_GodModeBase) then {
_object addEventHandler ["HandleDamage", {false}];
} else {
_object addMPEventHandler ["MPKilled",{_this call vehicle_handleServerKilled;}];
};
};
// Test disabling simulation server side on buildables only.
_object enableSimulation false;
_object setVariable ["lastUpdate",time];
_object setVariable ["ObjectUID", _uid,true];
// _object setVariable ["CharacterID",_charID,true];
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object];
if (DZE_GodModeBase) then {
_object addEventHandler ["HandleDamage", {false}];
}else{
_object addMPEventHandler ["MPKilled",{_this call vehicle_handleServerKilled;}];
};
// Test disabling simulation server side on buildables only.
_object enableSimulation false;
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object];
//diag_log ("PUBLISH: Created " + (_class) + " with ID " + _uid);
#ifdef OBJECT_DEBUG
diag_log ["PUBLISH: Created ",_type,"ObjectUID", _objectUID,"characterID", _characterID, " with variables/inventory:", _inventory ];
#endif
}
else {
#ifdef OBJECT_DEBUG
diag_log ("PUBLISH: *NOT* created " + (_type ) + " (not allowed)");
#endif
};