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