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,9 +1,11 @@
#include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"
private["_character","_clientID"];
_character = _this select 0;
_clientID = owner _character;
#ifdef DZE_SERVER_DEBUG
#ifdef SERVER_DEBUG
diag_log ("HIVE: Player Death list Request by ClientID: "+ str(_clientID));
diag_log(PlayerDeaths);
#endif

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
};

View File

@@ -1,59 +0,0 @@
private ["_weather","_windX","_windY","_weatherOptions","_numWeatherOptions","_forcastTime"];
//[overCast,Fog,wind,rain]
//wind is split randomly in to east-west/north-south direction
_weatherOptions =
[
[0, 0, 4, 0],
[0.1, 0.1, 5, 0.1],
[0.3, 0.2, 6, 0.2],
[0.4, 0.3, 7, 0.3],
[0.5, 0.4, 8, 0.4],
[0.5, 0.5, 9, 0.5],
[0.6, 0.4, 10, 0.6],
[0.7, 0.3, 11, 0.7],
[0.8, 0.2, 12, 0.8],
[0.9, 0.1, 13, 0.9],
[1, 1, 15, 1]
];
_numWeatherOptions = count _weatherOptions;
// get inital weather forcast for the next 5 minutes
_forcastTime = 300;
if (isNil "WeatherForcast" && isNil "WeatherForcastTime") then {
WeatherForcast = floor(random(_numWeatherOptions));
WeatherForcastTime = diag_tickTime;
} else {
// after 60 minutes get a new forcast
if (WeatherForcastTime >= _forcastTime) then {
WeatherForcast = floor(random(_numWeatherOptions));
WeatherForcastTime = diag_tickTime;
};
};
if (isNil "CurrentWeatherOption") then {
// set inital weather to current forcast
CurrentWeatherOption = WeatherForcast;
} else {
if(CurrentWeatherOption < WeatherForcast) then {
// start transition up if forcast is higher in the array than current weather
CurrentWeatherOption = ((CurrentWeatherOption + 1) min _numWeatherOptions);
} else {
// start transition down if forcast is lower in the array than current weather
if (CurrentWeatherOption != WeatherForcast && WeatherForcastTime >= _forcastTime) then {
CurrentWeatherOption = ((CurrentWeatherOption - 1) max 0) ;
};
};
};
// current weather
_weather = _weatherOptions select CurrentWeatherOption;
_windX = floor(random(_weather select 2));
_windY = (_weather select 2) - _windX;
_weather set [2,[_windX,_windY]];
diag_log format["Weather %1", _weather];
PVDZE_plr_SetWeather = _weather;
publicVariable "PVDZE_plr_SetWeather";

View File

@@ -1,5 +1,5 @@
private ["_random","_lastIndex","_weights","_index","_vehicle","_velimit","_qty","_isAir","_isShip","_position","_dir","_istoomany","_veh","_objPosition","_iClass","_itemTypes","_cntWeights","_itemType","_num","_allCfgLoots"];
// do not make _roadList or _buildingList private in this function
private ["_random","_lastIndex","_index","_vehicle","_velimit","_qty","_isAir","_isShip","_position","_dir","_istoomany","_veh","_objPosition","_iClass","_num","_allCfgLoots"];
// do not make _roadList, _buildingList or _serverVehicleCounter private in this function
#include "\z\addons\dayz_code\util\Math.hpp"
#include "\z\addons\dayz_code\util\Vector.hpp"
#include "\z\addons\dayz_code\loot\Loot.hpp"
@@ -11,7 +11,7 @@ while {count AllowedVehiclesList > 0} do {
_vehicle = _random select 0;
_velimit = _random select 1;
_qty = {_x == _vehicle} count serverVehicleCounter;
_qty = {_x == _vehicle} count _serverVehicleCounter;
if (_qty <= _velimit) exitWith {}; // If under limit allow to proceed
// vehicle limit reached, remove vehicle from list
@@ -22,10 +22,10 @@ while {count AllowedVehiclesList > 0} do {
};
if (count AllowedVehiclesList == 0) then {
diag_log "DEBUG: unable to find suitable vehicle to spawn";
diag_log "DEBUG: unable to find suitable random vehicle to spawn";
} else {
// add vehicle to counter for next pass
serverVehicleCounter set [count serverVehicleCounter,_vehicle];
_serverVehicleCounter set [count _serverVehicleCounter,_vehicle];
// Find Vehicle Type to better control spawns
_isAir = _vehicle isKindOf "Air";
@@ -45,14 +45,12 @@ if (count AllowedVehiclesList == 0) then {
// Spawn around buildings and 50% near roads
if ((random 1) > 0.5) then {
_position = _roadList call BIS_fnc_selectRandom;
_position = _position modelToWorld [0,0,0];
_position = _position modelToWorld [0,0,0];
_position = [_position,0,10,10,0,2000,0] call BIS_fnc_findSafePos;
//diag_log("DEBUG: spawning near road " + str(_position));
} else {
_position = _buildingList call BIS_fnc_selectRandom;
_position = _position modelToWorld [0,0,0];
_position = [_position,0,40,5,0,2000,0] call BIS_fnc_findSafePos;
//diag_log("DEBUG: spawning around buildings " + str(_position));
};