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,30 @@
// Remove preview build by RimBlock (http://epochmod.com/forum/index.php?/user/12612-rimblock/)
private ["_location","_object","_objects","_i","_dir","_nearPlotPole","_validMarkers","_findNearestPoles","_poleinv","_IsNearPlot","_plotpole"];
_distance = (DZE_PlotPole select 0) + 5;
// check for near plot
_plotpole = nearestobject [(vehicle player),"Plastic_Pole_EP1_DZ"];
_findNearestPoles = (position _plotpole) nearEntities ["Land_coneLight", _distance];
_validMarkers = [];
_isnearplot = 0;
{
_poleinv = _x getVariable ["inventory",[]];
if (_poleinv select 0 == "PPMarker") then {
_validMarkers set [count _validMarkers,_x];
};
} count _findNearestPoles;
_IsNearPlot = count _validMarkers;
// If no plot poles found with ppMarker in the inventory.
if (_IsNearPlot > 0) then{
{
diag_log format["Object remove plot radius: [Destroying object: %1]",_x];
deleteVehicle _x;
} count _validMarkers;
};

View File

@@ -0,0 +1,26 @@
// Build preview adopted from Axe Cop (@vos) Base Destruction Script
// Amended by RimBlock (http://epochmod.com/forum/index.php?/user/12612-rimblock/) to allow plot radius removal.
private ["_location","_object","_i","_dir","_nearPlotPole","_light","_lightlocationtemp","_lightlocation","_lightarray"];
// global vars
_nearPlotPole = nearestObject [player, "Plastic_Pole_EP1_DZ"];
_lightarray = [];
//"privatized" center variable
_BD_radius = DZE_PlotPole select 0;
_BD_center = [_nearPlotPole] call FNC_getPos;
_color = "#(argb,8,8,3)color(0.99,0.65,0.06,1,ca)"; //dark orange
// circle
for "_i" from 0 to 360 step (450 / _BD_radius) do {
_location = [(_BD_center select 0) + ((cos _i) * _BD_radius), (_BD_center select 1) + ((sin _i) * _BD_radius), (_BD_center select 2) - 0.18];
_object = createVehicle ["Land_coneLight", _location, [], 0, "CAN_COLLIDE"];
_object setVariable ["Inventory", ["PPMarker"],true];
_object enableSimulation false;
_object setpos _location;
};

View File

@@ -0,0 +1,95 @@
// Plot Take Ownership by RimBlock (http://epochmod.com/forum/index.php?/user/12612-rimblock/)
//
// This script allows Plot pole owners to take ownership of all allowed buildables on their plot except lockable storage and tents.
//
// Note:
// This code calls server_publishFullObject which also saves damage, inventory and fuel. Hitpoints are assumed to be empty as this is for buildables only.
private ["_distance","_plotpole","_playerUID","_isowner", "_findNearestObjects","_classname","_objectID", "_objectUID", "_position", "_worldspace", "_object", "_key","_invW","_invM","_invB","_itemsExist","_charID","_inventory","_changecount"];
_distance = (DZE_PlotPole select 0) + 1;
_plotpole = nearestobject [(vehicle player),"Plastic_Pole_EP1_DZ"];
_playerUID = [player] call FNC_GetPlayerUID;
_changecount = 0;
// Check is owner of the plot pole.
_isowner = [player, _plotpole, DZE_plotManagement] call FNC_check_owner;
_itemsExist = false;
if ((_isowner select 0 )) then {
_findNearestObjects = (position _plotpole) nearEntities _distance;
{
_object = _x;
_classname = typeOf _object;
if (_classname in DZE_plotTakeOwnershipItems)then {
_isowner = [player, _object, DZE_plotManagement] call FNC_check_owner;
diag_log text "Plot Take Ownership: Object in DZE_plotTakeOwnershipItems";
if !( _isowner select 0 ) then{
diag_log text "Plot Take Ownership: Is not already the owner";
_objectID = _object getVariable ["ObjectID","0"];
_objectUID = _object getVariable ["ObjectUID","0"];
sleep 0.01;
PVDZE_obj_Delete = [_objectID, _objectUID, player];
publicVariableServer "PVDZE_obj_Delete";
sleep 0.01;
_object setvariable["ObjectID", "0"];
if (_classname in DZE_DoorsLocked) then {
_charID = _object getVariable ["characterID",dayz_characterID];
}else{
_charID = dayz_characterID;
};
_position = getPosATL _object;
_worldspace = [round(direction _object),_position,_playerUID];
_invW = getWeaponCargo _object;
{
if ((count _x) != 0) then {_itemsExist = true;};
}foreach _invW;
_invM = getMagazineCargo _object;
if !(_itemsExist) then{
{
if ((count _x) != 0) then {_itemsExist = true;};
}foreach _invM;
};
_invB = getBackpackCargo _object;
if !(_itemsExist) then{
{
if ((count _x) != 0) then {_itemsExist = true;};
}foreach _invB;
};
if (_itemsExist) then{
_inventory = format["[%1,%2,%3]", _invW, _invM, _invB];
}else{
_inventory = "[]";
};
_hitpoints = '[]';
_damage = damage _object;
_fuel = fuel _object;
PVDZE_fullobj_Publish = [_charID,_object,_worldspace,_classname, _inventory, _hitpoints, _damage, _fuel];
publicVariableServer "PVDZE_fullobj_Publish";
_object setvariable["ownerPUID", _playerUID];
_changecount = _changecount + 1;
};
};
} count _findNearestObjects;
cutText [format["Take Ownership: %1 objects ownership changed.",_changecount], "PLAIN DOWN"];
};

View File

@@ -0,0 +1,74 @@
private ["_location","_isOk","_pondPos","_isPond","_dir","_dis","_sfx","_classname","_object","_playerPos","_item","_hastentitem","_building","_config","_text","_objectsPond","_playerUID"];
//check if can pitch here
call gear_ui_init;
_playerPos = getPosATL player;
_item = _this;
_hastentitem = _this in magazines player;
_location = player modeltoworld [0,2.5,0];
_location set [2,0];
_building = nearestObject [(vehicle player), "HouseBase"];
_isOk = [(vehicle player),_building] call fnc_isInsideBuilding;
_playerUID = [player] call FNC_GetPlayerUID;
//_isOk = true;
//diag_log ("Pitch Tent: " + str(_isok) );
_config = configFile >> "CfgMagazines" >> _item;
_text = getText (_config >> "displayName");
if (!_hastentitem) exitWith {cutText [format[(localize "str_player_31"),_text,"pitch"] , "PLAIN DOWN"]};
//blocked
if (["concrete",dayz_surfaceType] call fnc_inString) then { _isOk = true; diag_log ("surface concrete"); };
//Block Tents in pounds
_objectsPond = nearestObjects [_playerPos, [], 10];
{
_isPond = ["pond",str(_x),false] call fnc_inString;
if (_isPond) then {
_pondPos = (_x worldToModel _playerPos) select 2;
if (_pondPos < 0) then {
_isOk = true;
};
};
} count _objectsPond;
//diag_log ("Pitch Tent: " + str(_isok) );
if (!_isOk) then {
//remove tentbag
player removeMagazine _item;
_dir = round(direction player);
[1,1] call dayz_HungerThirst;
//wait a bit
player playActionNow "Medic";
sleep 1;
_dis=20;
_sfx = "tentunpack";
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
_classname = getText (configFile >> "CfgMagazines" >> _item >> "ItemActions" >> "Pitch" >> "create");
sleep 5;
//place tent (local)
_object = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
_object setdir _dir;
_object setpos _location;
player reveal _object;
_location = getPosATL _object;
_object setVariable ["CharacterID",dayz_characterID,true];
_object setVariable ["ownerPUID",_playerUID,true];
//["PVDZE_obj_Publish",[dayz_characterID,_tent,[_dir,_location],_classname]] call callRpcProcedure;
PVDZE_obj_Publish = [dayz_characterID,_object,[_dir,_location, _playerUID],_classname];
publicVariableServer "PVDZE_obj_Publish";
cutText [localize "str_success_tent_pitch", "PLAIN DOWN"];
} else {
cutText [localize "str_fail_tent_pitch", "PLAIN DOWN"];
};

View File

@@ -15,6 +15,7 @@ _isWater = dayz_isSwimming;
_cancel = false;
_reason = "";
_canBuildOnPlot = false;
_playerUID = [player] call FNC_GetPlayerUID;
_vehicle = vehicle player;
_inVehicle = (_vehicle != player);
@@ -432,9 +433,11 @@ if (_canBuild select 0) then {
};
_tmpbuilt setVariable ["CharacterID",_combination,true];
PVDZ_obj_Publish = [_combination,_tmpbuilt,[_dir,_location],[]];
if (DZE_plotforLife) then {
_tmpbuilt setVariable ["ownerPUID",_playerUID,true];
PVDZ_obj_Publish = [_combination,_tmpbuilt,[_dir,_location,_playerUID],_classname];
};
publicVariableServer "PVDZ_obj_Publish";
format[localize "str_epoch_player_140",_combinationDisplay,_text] call dayz_rollingMessages;
@@ -442,12 +445,17 @@ if (_canBuild select 0) then {
} else {
_tmpbuilt setVariable ["CharacterID",dayz_characterID,true];
if (DZE_plotforLife) then {
_tmpbuilt setVariable ["ownerPUID",_playerUID,true];
};
// fire?
if(_tmpbuilt isKindOf "Land_Fire_DZ") then {
_tmpbuilt spawn player_fireMonitor;
} else {
PVDZ_obj_Publish = [dayz_characterID,_tmpbuilt,[_dir,_location],[]];
if (DZE_plotforLife) then {
PVDZ_obj_Publish = [dayz_characterID,_tmpbuilt,[_dir,_location,_playerUID],_classname];
};
publicVariableServer "PVDZ_obj_Publish";
};
};

View File

@@ -10,61 +10,35 @@ DZE_ActionInProgress = true;
player removeAction s_player_downgrade_build;
s_player_downgrade_build = 1;
_distance = 30;
_distance = DZE_PlotPole select 0;
_needText = localize "str_epoch_player_246";
// check for near plot
_findNearestPoles = nearestObjects [(vehicle player), ["Plastic_Pole_EP1_DZ"], _distance];
_findNearestPole = [];
{
if (alive _x) then {
_findNearestPole set [(count _findNearestPole),_x];
};
} count _findNearestPoles;
_IsNearPlot = count (_findNearestPole);
_playerUID = [player] call FNC_GetPlayerUID;
_canBuildOnPlot = false;
_plotcheck = [player, false] call FNC_find_plots;
_distance = _plotcheck select 0;
_IsNearPlot = _plotcheck select 1;
_nearestPole = _plotcheck select 2;
if(_IsNearPlot == 0) then {
_canBuildOnPlot = true;
} else {
// check nearby plots ownership && then for friend status
_nearestPole = _findNearestPole select 0;
// Find owner
_ownerID = _nearestPole getVariable["CharacterID","0"];
// diag_log format["DEBUG BUILDING: %1 = %2", dayz_characterID, _ownerID];
// check if friendly to owner
if(dayz_characterID == _ownerID) then {
_canBuildOnPlot = true;
} else {
// plotManagement //
if( DZE_plotManagement ) then {
_friendlies = _nearestPole getVariable ["plotfriends",[]];
_fuid = [];
{
_friendUID = _x select 0;
_fuid = _fuid + [_friendUID];
} forEach _friendlies;
// check if friendly to owner
if(dayz_playerUID in _fuid) then {
if (DZE_plotManagement || DZE_plotforLife) then {
_buildcheck = [player, _nearestPole, DZE_plotManagement] call FNC_check_owner;
_isowner = _buildcheck select 0;
_isfriendly = _buildcheck select 1;
if (_isowner || _isfriendly) then {
_canBuildOnPlot = true;
};
} else {
// plotManagement //
_friendlies = player getVariable ["friendlyTo",[]];
// check if friendly to owner
_friendlies = player getVariable ["friendlyTo",[]];
if(_ownerID in _friendlies) then {
_canBuildOnPlot = true;
};
// plotManagement //
};
// plotManagement //
};
};
@@ -77,6 +51,7 @@ _obj = _this select 3;
// Current charID
_objectCharacterID = _obj getVariable ["CharacterID","0"];
if (DZE_Lock_Door != _objectCharacterID) exitWith {DZE_ActionInProgress = false; localize "str_epoch_player_49" call dayz_rollingMessages;};
// Find objectID
@@ -158,6 +133,9 @@ if ((count _upgrade) > 0) then {
format[localize "str_epoch_player_142",_text] call dayz_rollingMessages;
PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location],_classname,_obj,player];
if (DZE_plotforLife) then {
PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location,_playerUID],_classname,_obj,player];
};
publicVariableServer "PVDZE_obj_Swap";
player reveal _object;

View File

@@ -5,8 +5,13 @@ _caller = _this select 1;
call fnc_usec_medic_removeActions;
r_action = false;
_callerID = _caller getVariable ["CharacterID", "0"];
_targetID = _target getVariable ["CharacterID", "0"];
if (DZE_plotforLife) then {
_callerID = [_caller] call FNC_GetPlayerUID;
_targetID = [_target] call FNC_GetPlayerUID;
} else {
_callerID = _caller getVariable ["CharacterID", "0"];
_targetID = _target getVariable ["CharacterID", "0"];
};
if ((_callerID != "0") && (_targetID != "0")) then {
_friendlies = _caller getVariable ["friendlies", []];
_friendlies set [count _friendlies, _targetID];

View File

@@ -9,63 +9,35 @@ DZE_ActionInProgress = true;
player removeAction s_player_upgrade_build;
s_player_upgrade_build = 1;
_distance = 30;
_distance = DZE_PlotPole select 0;
_needText = localize "str_epoch_player_246";
// check for near plot
_findNearestPoles = nearestObjects [(vehicle player), ["Plastic_Pole_EP1_DZ"], _distance];
_findNearestPole = [];
{
if (alive _x) then {
_findNearestPole set [(count _findNearestPole),_x];
};
} count _findNearestPoles;
_IsNearPlot = count (_findNearestPole);
_canBuildOnPlot = false;
_plotcheck = [player, false] call FNC_find_plots;
_distance = _plotcheck select 0;
_IsNearPlot = _plotcheck select 1;
_nearestPole = _plotcheck select 2;
if(_IsNearPlot == 0) then {
_canBuildOnPlot = true;
} else {
// check nearby plots ownership && then for friend status
_nearestPole = _findNearestPole select 0;
// Find owner
_ownerID = _nearestPole getVariable["CharacterID","0"];
// diag_log format["DEBUG BUILDING: %1 = %2", dayz_characterID, _ownerID];
// check if friendly to owner
if(dayz_characterID == _ownerID) then {
_canBuildOnPlot = true;
} else {
// plotManagement //
if( DZE_plotManagement ) then {
_friendlies = _nearestPole getVariable ["plotfriends",[]];
_fuid = [];
{
_friendUID = _x select 0;
_fuid = _fuid + [_friendUID];
} forEach _friendlies;
// check if friendly to owner
if(dayz_playerUID in _fuid) then {
if (DZE_plotManagement || DZE_plotforLife) then {
_buildcheck = [player, _nearestPole, DZE_plotManagement] call FNC_check_owner;
_isowner = _buildcheck select 0;
_isfriendly = _buildcheck select 1;
if (_isowner || _isfriendly) then {
_canBuildOnPlot = true;
};
} else {
// plotManagement //
_friendlies = player getVariable ["friendlyTo",[]];
// check if friendly to owner
if(_ownerID in _friendlies) then {
_canBuildOnPlot = true;
};
// plotManagement //
};
// plotManagement //
};
};
@@ -166,6 +138,10 @@ if ((count _upgrade) > 0) then {
// Set location
_object setPosATL _location;
if (DZE_plotforLife) then {
_ownerID = _obj getVariable["ownerPUID","0"];
_object setVariable ["ownerPUID",_ownerID,true];
};
if (_lockable == 3) then {

View File

@@ -4,15 +4,25 @@ DZE_ActionInProgress = true;
delete object from db with extra waiting by [VB]AWOL
parameters: _obj
*/
private ["_activatingPlayer","_obj","_objectID","_objectUID","_started","_finished","_animState","_isMedic","_isOk","_proceed","_counter","_limit","_objType","_sfx","_dis","_itemOut","_countOut","_selectedRemoveOutput","_friendlies","_nearestPole","_ownerID","_refundpart","_isWreck","_findNearestPoles","_findNearestPole","_IsNearPlot","_brokenTool","_removeTool","_isDestructable","_isRemovable","_objOwnerID","_isOwnerOfObj","_preventRefund","_ipos","_item","_radius","_isWreckBuilding","_nameVehicle","_isModular"];
private ["_activatingPlayer","_obj","_playerUID","_objectID","_objectUID","_started","_finished","_animState","_isMedic","_isOk","_proceed","_counter","_limit","_objType","_sfx","_dis","_itemOut","_countOut","_selectedRemoveOutput","_friendlies","_nearestPole","_ownerID","_refundpart","_isWreck","_findNearestPoles","_findNearestPole","_IsNearPlot","_brokenTool","_removeTool","_isDestructable","_isRemovable","_objOwnerID","_isOwnerOfObj","_preventRefund","_ipos","_item","_radius","_isWreckBuilding","_nameVehicle","_isModular"];
player removeAction s_player_deleteBuild;
s_player_deleteBuild = 1;
_obj = _this select 3;
_activatingPlayer = player;
_objOwnerID = _obj getVariable["CharacterID","0"];
_isOwnerOfObj = (_objOwnerID == dayz_characterID);
_objOwnerID = "0";
_playerUID = "1";
_isOwnerOfObj = false;
if (DZE_plotforLife) then {
_objOwnerID = _obj getVariable["ownerPUID","0"];
_playerUID = [player] call FNC_GetPlayerUID;
_isOwnerOfObj = (_objOwnerID == _playerUID);
} else {
_objOwnerID = _obj getVariable["CharacterID","0"];
_isOwnerOfObj = (_objOwnerID == dayz_characterID);
};
if (_obj in DZE_DoorsLocked) exitWith {DZE_ActionInProgress = false; localize "STR_EPOCH_ACTIONS_20" call dayz_rollingMessages;};
if (_obj getVariable ["GeneratorRunning", false]) exitWith {DZE_ActionInProgress = false; localize "str_epoch_player_89" call dayz_rollingMessages;};
@@ -31,6 +41,7 @@ _isRemovable = _objType in DZE_isRemovable;
_isWreckBuilding = _objType in DZE_isWreckBuilding;
_isMine = _objType in ["Land_iron_vein_wreck","Land_silver_vein_wreck","Land_gold_vein_wreck"];
_isModular = _obj isKindOf "ModularItems";
_distance = DZE_PlotPole select 0;
_limit = 3;
if (DZE_StaticConstructionCount > 0) then {
@@ -42,27 +53,18 @@ else {
};
};
_findNearestPoles = nearestObjects[player, ["Plastic_Pole_EP1_DZ"], 30];
_findNearestPole = [];
{if (alive _x) then {_findNearestPole set [(count _findNearestPole),_x];};} count _findNearestPoles;
_IsNearPlot = count (_findNearestPole);
_plotcheck = [player, false] call FNC_find_plots;
_distance = _plotcheck select 0;
_IsNearPlot = _plotcheck select 1;
_nearestPole = _plotcheck select 2;
if(_IsNearPlot >= 1) then {
_nearestPole = _findNearestPole select 0;
// Find owner
_ownerID = _nearestPole getVariable["CharacterID","0"];
// check if friendly to owner
if(dayz_characterID != _ownerID) then {
_friendlies = player getVariable ["friendlyTo",[]];
// check if friendly to owner
if(!(_ownerID in _friendlies)) then {
_limit = round(_limit*2);
};
// Since there are plot poles nearby we need to check ownership && friend status
_buildcheck = [player, _nearestPole, DZE_plotManagement] call FNC_check_owner;
_isowner = _buildcheck select 0;
_isfriendly = _buildcheck select 1;
if (!_isowner && !_isfriendly) then {
_limit = round(_limit*2);
};
};

View File

@@ -20,6 +20,7 @@ _offset_z_attach = 0.5;
_location = player modeltoworld [_offset_x,_offset_y,_offset_z];
_playerUID = [player] call FNC_GetPlayerUID;
// Allow placement anywhere.
_isOk = true;
@@ -159,7 +160,7 @@ if(!_cancel) then {
_tent setVariable ["CharacterID",_combination,true];
_tent setVariable ["OEMPos",_location,true];
PVDZ_obj_Publish = [_combination,_tent,[_dir,_location],[]];
PVDZ_obj_Publish = [_combination,_tent,[_dir,_location, _playerUID],"VaultStorageLocked"];
publicVariableServer "PVDZ_obj_Publish";
format[localize "str_epoch_player_179",_combination] call dayz_rollingMessages;