Update Precise Base Building to v1.0.5 by @Mikeeeyy

Note @icomrade : 1.0.6 test servers need to empty object_data or run the
SQL query linked below before applying this update.

http://epochmod.com/forum/topic/15813-release-v105-precise-base-building-persistent-bases-after-restart-updated-220915/#comment-118663
This commit is contained in:
ebaydayz
2016-05-07 13:06:20 -04:00
parent 03e3293795
commit 26e67270cb
8 changed files with 44 additions and 52 deletions

View File

@@ -1,26 +1,32 @@
// KK_Functions
//
// All functions inside created by KillZoneKid (http://killzonekid.com/)
// by KillZoneKid (http://killzonekid.com/)
//
//
// Precise positioning functions.
KK_fnc_floatToString = {
private "_arr";
if (abs (_this - _this % 1) == 0) exitWith { str _this };
_arr = toArray str abs (_this % 1);
_arr set [0, 32];
toString (toArray str (
abs (_this - _this % 1) * _this / abs _this
) + _arr - [32])
private "_arr";
if (abs (_this - _this % 1) == 0) exitWith { str _this };
_arr = toArray str abs (_this % 1);
_arr set [0, 32];
toString (toArray str (
abs (_this - _this % 1) * _this / abs _this
) + _arr - [32])
};
KK_fnc_positionToString = {
format [
"[%1,%2,%3]",
_this select 0 call KK_fnc_floatToString,
_this select 1 call KK_fnc_floatToString,
_this select 2 call KK_fnc_floatToString
]
format [
"[%1,%2,%3]",
_this select 0 call KK_fnc_floatToString,
_this select 1 call KK_fnc_floatToString,
_this select 2 call KK_fnc_floatToString
]
};
AN_fnc_formatWorldspace = {
private "_ws";
_ws = toArray str _this;
format ["[%1,%2%3]", _this select 0 call KK_fnc_floatToString, _this select 1 call KK_fnc_positionToString, toString ([_ws, (_ws find 93) + 1, count _ws - 2] call BIS_fnc_subSelect)]
};

View File

@@ -17,11 +17,8 @@ diag_log ("PUBLISH: Attempt " + str(_object));
//get UID
_uid = _worldspace call dayz_objectUID2;
_worldspace set [0, (_worldspace select 0) call KK_fnc_floatToString];
_worldspace set [1, (_worldspace select 1) call KK_fnc_positionToString];
//Send request
_key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, _damage, _charID, _worldspace, _inventory, _hitpoints, _fuel,_uid];
_key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, _damage, _charID, _worldspace call AN_fnc_formatWorldspace, _inventory, _hitpoints, _fuel,_uid]; // Precise Base Building 1.0.5
//diag_log ("HIVE: WRITE: "+ str(_key));
_key call server_hiveWrite;
@@ -32,11 +29,11 @@ _object setVariable ["ObjectUID", _uid,true];
if (DZE_GodModeBase) then {
_object addEventHandler ["HandleDamage", {false}];
}else{
_object addMPEventHandler ["MPKilled",{_this call object_handleServerKilled;}];
_object addMPEventHandler ["MPKilled",{_this call vehicle_handleServerKilled;}];
};
// Test disabling simulation server side on buildables only.
_object enableSimulation false;
PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_object];
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object];
diag_log ("PUBLISH: Created " + (_class) + " with ID " + _uid);

View File

@@ -13,15 +13,11 @@ if ([_object, "Server"] call check_publishobject) then {
_objectUID = _worldspace call dayz_objectUID2;
_object setVariable [ "ObjectUID", _objectUID, true ];
//Precise base building
_worldspace set [0, (_worldspace select 0) call KK_fnc_floatToString];
_worldspace set [1, (_worldspace select 1) call KK_fnc_positionToString];
// 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 ];
//_key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:", dayZ_instance, _type, 0, _characterID, _worldspace, _inventory, [], 0,_objectUID ];
_key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _type, 0 , _characterID, _worldspace call AN_fnc_formatWorldspace, _inventory, [], 0,_objectUID]; // Precise Base Building 1.0.5
_key call server_hiveWrite;

View File

@@ -46,20 +46,18 @@ if (!_allowed || !_proceed) exitWith {
// Publish variables
_object setVariable ["CharacterID",_charID,true];
//_object setVariable ["ObjectUID",_objectUID,true];
_object setVariable ["OEMPos",(_worldspace select 1),true];
//diag_log ("PUBLISH: Attempt " + str(_object));
//get UID
_uid = _worldspace call dayz_objectUID2;
_worldspace set [0, (_worldspace select 0) call KK_fnc_floatToString];
_worldspace set [1, (_worldspace select 1) call KK_fnc_positionToString];
//_object setVariable ["ObjectUID",_objectUID,true];
_object setVariable ["OEMPos", call compile (_worldspace select 1), true];
//diag_log ("PUBLISH: Attempt " + str(_object));
//Send request
_key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, 0 , _charID, _worldspace, [], [], 0,_uid];
//_key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, 0 , _charID, _worldspace, [], [], 0,_uid];
_key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, 0 , _charID, _worldspace call AN_fnc_formatWorldspace, [], [], 0,_uid]; // Precise Base Building 1.0.5
//diag_log ("HIVE: WRITE: "+ str(_key));
_key call server_hiveWrite;

View File

@@ -52,7 +52,8 @@ _needUpdate = _object in needUpdate_objects;
_object_position = {
private ["_position","_worldspace","_fuel","_key"];
_position = getPosATL _object;
_worldspace = [(getDir _object) call KK_fnc_floatToString, _position call KK_fnc_positionToString];
//_worldspace = [round (direction _object),_position];
_worldspace = [getDir _object, _position] call AN_fnc_formatWorldspace; // Precise Base Building 1.0.5
_fuel = if (_object isKindOf "AllVehicles") then {fuel _object} else {0};
_key = format["CHILD:305:%1:%2:%3:",_objectID,_worldspace,_fuel];