Add A Plot For Life modification by RimBlock

A Plot For Life also includes Precise Base Building by Mikeeeyy. Precise
base building has no variable to switch it on or off, I don't think it
should.

Seems to work well enough, this may conflict with the duplicate object
uid fix, it appears to spam my server rpt.
This commit is contained in:
icomrade
2016-05-02 20:42:37 -04:00
parent 16fe17645f
commit 575682b7c8
31 changed files with 591 additions and 171 deletions

View File

@@ -0,0 +1,26 @@
// KK_Functions
//
// All functions inside created 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])
};
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
]
};

View File

@@ -0,0 +1,42 @@
private ["_class","_uid","_charID","_object","_worldspace","_key","_allowed"];
_charID = _this select 0;
_object = _this select 1;
_worldspace = _this select 2;
_class = _this select 3;
_inventory = _this select 4;
_hitpoints = _this select 5;
_damage = _this select 6;
_fuel = _this select 7;
_allowed = [_object, "Server"] call check_publishobject;
if (!_allowed) exitWith { deleteVehicle _object; };
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];
//diag_log ("HIVE: WRITE: "+ str(_key));
_key call server_hiveWrite;
_object setVariable ["lastUpdate",time];
_object setVariable ["ObjectUID", _uid,true];
// _object setVariable ["CharacterID",_charID,true];
if (DZE_GodModeBase) then {
_object addEventHandler ["HandleDamage", {false}];
}else{
_object addMPEventHandler ["MPKilled",{_this call object_handleServerKilled;}];
};
// Test disabling simulation server side on buildables only.
_object enableSimulation false;
PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_object];
diag_log ("PUBLISH: Created " + (_class) + " with ID " + _uid);

View File

@@ -13,6 +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", [] ];

View File

@@ -46,15 +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];
//diag_log ("HIVE: WRITE: "+ str(_key));

View File

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

View File

@@ -10,6 +10,7 @@ BIS_MPF_remoteExecutionServer = {
call compile preprocessFileLineNumbers "\z\addons\dayz_code\util\compile.sqf";
call compile preprocessFileLineNumbers "\z\addons\dayz_code\loot\compile.sqf";
call compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\KK_Functions.sqf";
BIS_Effects_Burn = {};
dayz_disconnectPlayers = [];
@@ -19,6 +20,7 @@ server_onPlayerDisconnect = compile preprocessFileLineNumbers "\z\addons\dayz_se
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_publishObj = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishObject.sqf"; //Creates the object in DB
server_publishFullObject = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishFullObject.sqf";
server_deleteObj = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_deleteObj.sqf"; //Removes the object from the DB
server_playerSync = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerSync.sqf";
zombie_findOwner = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\zombie_findOwner.sqf";

View File

@@ -76,7 +76,13 @@ if (_status == "ObjectStreamStart") then {
_dir = floor(random(360));
_pos = getMarkerpos "respawn_west";
_wsDone = false;
if (count _worldspace >= 2) then {
if ((typeName (_worldspace select 0)) == "STRING") then {
_worldspace set [0, call compile (_worldspace select 0)];
_worldspace set [1, call compile (_worldspace select 1)];
};
};
if (count _worldspace >= 1 && {(typeName (_worldspace select 0)) == "SCALAR"}) then {
_dir = _worldspace select 0;
};
@@ -96,6 +102,13 @@ if (_status == "ObjectStreamStart") then {
diag_log ("MOVED OBJ: " + str(_idKey) + " of class " + _type + " to pos: " + str(_pos));
};
// Realign characterID to OwnerPUID - need to force save though.
if (count _worldspace < 3) then {
_worldspace set [count _worldspace, "0"];
};
_ownerPUID = _worldspace select 2;
if (_damage < 1) then {
//diag_log format["OBJ: %1 - %2,%3,%4,%5,%6,%7,%8", _idKey,_type,_ownerID,_worldspace,_inventory,_hitPoints,_fuel,_damage];
@@ -120,6 +133,7 @@ if (_status == "ObjectStreamStart") then {
// prevent immediate hive write when vehicle parts are set up
_object setVariable ["lastUpdate",diag_ticktime];
_object setVariable ["ObjectID", _idKey, true];
_object setVariable ["OwnerPUID", _ownerPUID, true];
// plotManagement //
if( DZE_plotManagement && (typeOf (_object) == "Plastic_Pole_EP1_DZ") ) then {