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