mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-13 19:52:38 +03:00
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:
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
};
|
||||
|
||||
@@ -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"];
|
||||
|
||||
};
|
||||
74
SQF/dayz_code/actions/A_Plot_for_Life/tent_pitch.sqf
Normal file
74
SQF/dayz_code/actions/A_Plot_for_Life/tent_pitch.sqf
Normal 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"];
|
||||
};
|
||||
|
||||
@@ -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";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -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
|
||||
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;
|
||||
|
||||
@@ -5,8 +5,13 @@ _caller = _this select 1;
|
||||
call fnc_usec_medic_removeActions;
|
||||
r_action = false;
|
||||
|
||||
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];
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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 = "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,29 +53,20 @@ 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 {
|
||||
// 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);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
_nameVehicle = getText(configFile >> "CfgVehicles" >> _objType >> "displayName");
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
33
SQF/dayz_code/compile/A_Plot_for_Life/fn_check_owner.sqf
Normal file
33
SQF/dayz_code/compile/A_Plot_for_Life/fn_check_owner.sqf
Normal file
@@ -0,0 +1,33 @@
|
||||
// Check Ownership by RimBlock (http://epochmod.com/forum/index.php?/user/12612-rimblock/)
|
||||
|
||||
private ["_player","_object","_playerUID","_ObjectOwner","_owner","_friendlies","_friendly"];
|
||||
|
||||
_player = _this select 0;
|
||||
_Object = _this select 1;
|
||||
_PlotManagement = _this select 2;
|
||||
|
||||
_Owner = false;
|
||||
_friendly = false;
|
||||
_friendlies = [];
|
||||
_ObjectOwner = "0";
|
||||
|
||||
if (_PlotManagement) then {
|
||||
_friendlies = [_Object, true, false] call dze_getPlotFriends;
|
||||
} else {
|
||||
_friendlies = _player getVariable ["friendlyTo",[]];
|
||||
};
|
||||
|
||||
if (DZE_plotforLife) then {
|
||||
_playerUID = [_player] call FNC_GetPlayerUID;
|
||||
_ObjectOwner = _object getVariable ["ownerPUID","0"];
|
||||
_owner = (_playerUID == _ObjectOwner);
|
||||
} else {
|
||||
_ObjectOwner = _object getVariable["CharacterID","0"];
|
||||
_owner = (_ObjectOwner == dayz_characterID);
|
||||
};
|
||||
|
||||
if (_ObjectOwner in _friendlies) then {
|
||||
_friendly = true;
|
||||
};
|
||||
|
||||
[_owner, _friendly];
|
||||
24
SQF/dayz_code/compile/A_Plot_for_Life/fn_find_plots.sqf
Normal file
24
SQF/dayz_code/compile/A_Plot_for_Life/fn_find_plots.sqf
Normal file
@@ -0,0 +1,24 @@
|
||||
// Find Plots by RimBlock (http://epochmod.com/forum/index.php?/user/12612-rimblock/)
|
||||
|
||||
private ["_player","_ispole","_IsNearPlot","_nearestPole","_distance","_findNearestPoles","_findNearestPole","_friendly","_return"];
|
||||
|
||||
_player = _this select 0;
|
||||
_ispole = _this select 1;
|
||||
_IsNearPlot = 0;
|
||||
_nearestPole = "";
|
||||
_findNearestPole = [];
|
||||
|
||||
if(_isPole) then {
|
||||
_distance = DZE_PlotPole select 1;
|
||||
}else{
|
||||
_distance = DZE_PlotPole select 0;
|
||||
};
|
||||
|
||||
// check for near plot
|
||||
_findNearestPole = (position (vehicle _player)) nearEntities ["Plastic_Pole_EP1_DZ", _distance];
|
||||
|
||||
_IsNearPlot = count (_findNearestPole);
|
||||
if (_IsNearPlot > 0) then{_nearestPole = _findNearestPole select 0;}else{_nearestPole = objNull;};
|
||||
|
||||
_return = [_distance, _IsNearPlot, _nearestPole];
|
||||
_return
|
||||
@@ -22,32 +22,28 @@ _nearestPole = objNull;
|
||||
_ownerID = 0;
|
||||
_friendlies = [];
|
||||
|
||||
_findNearestPoles = nearestObjects [_pos, ["Plastic_Pole_EP1_DZ"], _distance];
|
||||
_findNearestPole = [];
|
||||
{
|
||||
if (alive _x) then {
|
||||
_findNearestPole set [count _findNearestPole,_x];
|
||||
};
|
||||
} count _findNearestPoles;
|
||||
_distance = DZE_PlotPole select 0;
|
||||
_needText = localize "str_epoch_player_246";
|
||||
|
||||
_plotcheck = [player, false] call FNC_find_plots;
|
||||
_distance = _plotcheck select 0;
|
||||
_IsNearPlot = _plotcheck select 1;
|
||||
_nearestPole = _plotcheck select 2;
|
||||
|
||||
_IsNearPlot = count _findNearestPole;
|
||||
if(_isPole && {_IsNearPlot > 0}) exitWith {DZE_ActionInProgress = false; format[localize "str_epoch_player_44",_distance] call dayz_rollingMessages; [_canBuild, _isPole];};
|
||||
|
||||
if(_IsNearPlot == 0) then {
|
||||
if (_requireplot == 0 || _isLandFireDZ) then {
|
||||
_canBuild = true;
|
||||
};
|
||||
} else {
|
||||
_nearestPole = _findNearestPole select 0;
|
||||
_ownerID = _nearestPole getVariable["CharacterID","0"];
|
||||
if(dayz_characterID == _ownerID) then {
|
||||
if (!_isPole) then {
|
||||
_canBuild = true;
|
||||
};
|
||||
} else {
|
||||
if(!_isPole) then {
|
||||
if( DZE_plotManagement ) then {
|
||||
_allowedUIDs = [_nearestPole, false, true] call dze_getPlotFriends;
|
||||
if((dayz_playerUID in _allowedUIDs) || (dayz_characterID in _allowedUIDs)) 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 {
|
||||
_canBuild = true;
|
||||
};
|
||||
} else {
|
||||
@@ -58,7 +54,7 @@ if(_IsNearPlot == 0) then {
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if(!_canBuild) exitWith { DZE_ActionInProgress = false; format[localize "STR_EPOCH_PLAYER_135",_needText,_distance] call dayz_rollingMessages; [_canBuild, _isPole];};
|
||||
|
||||
_buildables = DZE_maintainClasses + DZE_LockableStorage + ["DZ_buildables","DZ_storage_base"];
|
||||
|
||||
@@ -212,7 +212,10 @@ if (isPlayer cursorTarget) then {
|
||||
if (_unit isKindOf "Man") then {
|
||||
// should only fire if cursor target is man and not vehicle
|
||||
_charID = _unit getVariable ["CharacterID", 0];
|
||||
_friendlies = player getVariable ["friendlies", []];
|
||||
if (DZE_plotforLife) then {
|
||||
_charID = [_unit] call FNC_GetPlayerUID;
|
||||
};
|
||||
_friendlies = [player, _unit, DZE_plotManagement] call FNC_check_owner;
|
||||
if !(_charID in _friendlies) then {
|
||||
r_action = true;
|
||||
_action = _unit addAction ["Tag as friendly", "\z\addons\dayz_code\actions\player_tagFriendly.sqf", [], 0, false, true];
|
||||
|
||||
@@ -232,7 +232,6 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
|
||||
_isDestructable = _cursorTarget isKindOf "BuiltItems";
|
||||
_isHarvested = _cursorTarget getVariable["meatHarvested",false];
|
||||
_isGenerator = _cursorTarget isKindOf "Generator_DZ";
|
||||
_ownerID = _cursorTarget getVariable ["characterID","0"];
|
||||
_isVehicletype = _typeOfCursorTarget in ["ATV_US_EP1","ATV_CZ_EP1"];
|
||||
_isFuel = false;
|
||||
_hasBarrel = "ItemFuelBarrel" in _magazinesPlayer;
|
||||
@@ -248,6 +247,14 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
|
||||
_istypeTent = (_cursorTarget isKindOf "TentStorage_base") or (_cursorTarget isKindOf "IC_Tent");
|
||||
_upgradeItems = ["TentStorage","TentStorage0","TentStorage1","TentStorage2","TentStorage3","StashSmall","StashSmall1","StashSmall2","StashSmall3","StashSmall4","StashMedium","StashMedium1","StashMedium2","StashMedium3","DomeTentStorage","DomeTentStorage0","DomeTentStorage1","DomeTentStorage2","DomeTentStorage3","DomeTentStorage4"];
|
||||
_isCampSite = _cursorTarget isKindOf "IC_Fireplace1";
|
||||
_ownerID = _cursorTarget getVariable ["characterID","0"];
|
||||
_playerUID = dayz_characterID;
|
||||
|
||||
if (DZE_plotforLife) then {
|
||||
_playerUID = [player] call FNC_GetPlayerUID;
|
||||
_ownerID = _cursorTarget getVariable ["ownerPUID","0"];
|
||||
};
|
||||
_characterID = _cursorTarget getVariable ["CharacterID","0"];
|
||||
|
||||
_isDisallowRefuel = _typeOfCursorTarget in ["M240Nest_DZ","MMT_Civ","MMT_USMC","Old_bike_TK_CIV_EP1","Old_bike_TK_INS_EP1"];
|
||||
_isDog = (_cursorTarget isKindOf "DZ_Pastor" || _cursorTarget isKindOf "DZ_Fin");
|
||||
@@ -413,17 +420,17 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
|
||||
};
|
||||
};
|
||||
|
||||
if (DZE_plotManagement) then {
|
||||
if (DZE_plotManagement || DZE_plotforLife) then {
|
||||
if(_isModular || _isModularDoor) then {
|
||||
if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
|
||||
_allowedUIDs = [objNull, true, true] call dze_getPlotFriends;
|
||||
if( (dayz_playerUID in _allowedUIDs) || (dayz_characterID in _allowedUIDs) ) then {
|
||||
_isowner = [player, _cursorTarget, DZE_plotManagement] call FNC_check_owner; //compile also calls dze_getPlotFriends and lists s_player_plotManagement friendlies
|
||||
If ((_isowner select 0) || (_isowner select 1)) then {
|
||||
_player_deleteBuild = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
} else {
|
||||
if ((_isModularDoor || _isModular) && (dayz_characterID == _ownerID)) then {
|
||||
if ((_isModularDoor || _isModular) && {_playerUID == _ownerID}) then {
|
||||
if (_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
|
||||
_player_deleteBuild = true;
|
||||
};
|
||||
@@ -447,7 +454,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
|
||||
};
|
||||
|
||||
//remove Own objects
|
||||
if (_ownerID == dayz_characterID) then {
|
||||
if (_ownerID == _playerUID) then {
|
||||
//upgrade items
|
||||
if (_typeOfCursorTarget in _upgradeItems) then {
|
||||
if (s_player_upgradestroage < 0) then {
|
||||
@@ -634,12 +641,13 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
|
||||
};
|
||||
|
||||
if ((_cursorTarget isKindOf "Plastic_Pole_EP1_DZ") && {_canDo && speed player <= 1}) then {
|
||||
if( DZE_plotManagement) then {
|
||||
if( DZE_plotManagement || DZE_plotforLife) then {
|
||||
if (s_player_plotManagement < 0) then {
|
||||
_allowedUIDs = [_cursorTarget, false, true] call dze_getPlotFriends;
|
||||
if( (dayz_playerUID in _allowedUIDs) || (dayz_characterID in _allowedUIDs) ) then {
|
||||
s_player_plotManagement = player addAction ["<t color='#0059FF'>Manage Plot</t>", "\z\addons\dayz_code\actions\plotManagement\initPlotManagement.sqf", [], 5, false];
|
||||
_isowner = [player, _cursorTarget, DZE_plotManagement] call FNC_check_owner; //compile also calls dze_getPlotFriends and lists s_player_plotManagement friendlies
|
||||
If ((_isowner select 0) || (_isowner select 1)) then {
|
||||
s_player_plot_take_ownership = player addAction ["Take plot items ownership", "\z\addons\dayz_code\actions\A_Plot_for_Life\plot_take_ownership.sqf", "", 1, false];
|
||||
};
|
||||
s_player_plotManagement = player addAction ["<t color='#0059FF'>Manage Plot</t>", "\z\addons\dayz_code\actions\plotManagement\initPlotManagement.sqf", [], 5, false];
|
||||
};
|
||||
} else {
|
||||
if (s_player_maintain_area < 0) then {
|
||||
@@ -647,6 +655,28 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
|
||||
s_player_maintain_area_preview = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_MAINTPREV"], "\z\addons\dayz_code\actions\maintain_area.sqf", "preview", 5, false];
|
||||
};
|
||||
};
|
||||
if (DZE_plotforLife) then {
|
||||
_plotDistance = (DZE_PlotPole select 0);
|
||||
_PlotsmarkersNear = count (_cursorTarget nearEntities ["Land_coneLight", _PlotDistance]);
|
||||
if (s_player_plot_boundary_on < 0) then {
|
||||
If (_PlotsmarkersNear == 0 ) then{
|
||||
s_player_plot_boundary_on = player addAction ["Show plot boundary", "\z\addons\dayz_code\actions\A_Plot_for_Life\object_showPlotRadius.sqf", "", 1, false];
|
||||
};
|
||||
};
|
||||
if (s_player_plot_boundary_off < 0) then {
|
||||
If (_PlotsmarkersNear > 0 ) then{
|
||||
s_player_plot_boundary_off = player addAction ["Remove plot boundary", "\z\addons\dayz_code\actions\A_Plot_for_Life\object_removePlotRadius.sqf", "", 1, false];
|
||||
};
|
||||
};
|
||||
if (s_player_plot_take_ownership < 0) then {
|
||||
if (DZE_PlotOwnership) then {
|
||||
_isowner = [player, _cursorTarget, DZE_plotManagement] call FNC_check_owner; //compile also calls dze_getPlotFriends and lists s_player_plotManagement friendlies
|
||||
If (_isowner select 0) then {
|
||||
s_player_plot_take_ownership = player addAction ["Take plot items ownership", "\z\addons\dayz_code\actions\A_Plot_for_Life\plot_take_ownership.sqf", "", 1, false];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
} else {
|
||||
player removeAction s_player_plotManagement;
|
||||
s_player_plotManagement = -1;
|
||||
@@ -654,6 +684,12 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
|
||||
s_player_maintain_area = -1;
|
||||
player removeAction s_player_maintain_area_preview;
|
||||
s_player_maintain_area_preview = -1;
|
||||
player removeAction s_player_plot_boundary_on;
|
||||
s_player_plot_boundary_on = -1;
|
||||
player removeAction s_player_plot_boundary_off;
|
||||
s_player_plot_boundary_off = -1;
|
||||
player removeAction s_player_plot_take_ownership;
|
||||
s_player_plot_take_ownership = -1;
|
||||
};
|
||||
|
||||
if (DZE_HeliLift) then {
|
||||
@@ -702,11 +738,11 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
|
||||
_totalKeys = call epoch_tempKeys;
|
||||
_temp_keys = _totalKeys select 0;
|
||||
_temp_keys_names = _totalKeys select 1;
|
||||
_hasKey = _ownerID in _temp_keys;
|
||||
_oldOwner = (_ownerID == dayz_playerUID);
|
||||
_hasKey = _characterID in _temp_keys;
|
||||
_oldOwner = (_characterID == dayz_playerUID);
|
||||
if (locked _cursorTarget) then {
|
||||
if (_hasKey || _oldOwner) then {
|
||||
_unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",[_cursorTarget,(_temp_keys_names select (parseNumber _ownerID))], 2, true, true];
|
||||
_unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",[_cursorTarget,(_temp_keys_names select (parseNumber _characterID))], 2, true, true];
|
||||
s_player_lockunlock set [count s_player_lockunlock,_unlock];
|
||||
s_player_lockUnlock_crtl = 1;
|
||||
} else {
|
||||
@@ -742,10 +778,10 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
|
||||
};
|
||||
|
||||
//Allow owner to unlock vault
|
||||
if ((_typeOfCursorTarget in DZE_LockableStorage) && {_ownerID != "0"} && {player distance _cursorTarget < 3}) then {
|
||||
if ((_typeOfCursorTarget in DZE_LockableStorage) && {_characterID != "0"} && {player distance _cursorTarget < 3}) then {
|
||||
if (s_player_unlockvault < 0) then {
|
||||
if (_typeOfCursorTarget in DZE_LockedStorage) then {
|
||||
if (_ownerID == dayz_combination || _ownerID == dayz_playerUID) then {
|
||||
if (_characterID == dayz_combination || _ownerID == dayz_playerUID) then {
|
||||
_combi = player addAction [format[localize "STR_EPOCH_ACTIONS_OPEN",_text], "\z\addons\dayz_code\actions\vault_unlock.sqf",_cursorTarget, 0, false, true];
|
||||
s_player_combi set [count s_player_combi,_combi];
|
||||
} else {
|
||||
@@ -754,7 +790,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
|
||||
};
|
||||
s_player_unlockvault = 1;
|
||||
} else {
|
||||
if (_ownerID != dayz_combination && _ownerID != dayz_playerUID) then {
|
||||
if (_characterID != dayz_combination && _ownerID != dayz_playerUID) then {
|
||||
_combi = player addAction [localize "STR_EPOCH_ACTIONS_RECOMBO", "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true];
|
||||
s_player_combi set [count s_player_combi,_combi];
|
||||
s_player_unlockvault = 1;
|
||||
@@ -767,13 +803,13 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
|
||||
};
|
||||
|
||||
//Allow owner to pack vault
|
||||
if ((_typeOfCursorTarget in DZE_UnLockedStorage) && {_ownerID != "0"} && {player distance _cursorTarget < 3}) then {
|
||||
if ((_typeOfCursorTarget in DZE_UnLockedStorage) && {_characterID != "0"} && {player distance _cursorTarget < 3}) then {
|
||||
if (s_player_lockvault < 0) then {
|
||||
if (_ownerID == dayz_combination || _ownerID == dayz_playerUID) then {
|
||||
if (_characterID == dayz_combination || _ownerID == dayz_playerUID) then {
|
||||
s_player_lockvault = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\vault_lock.sqf",_cursorTarget, 0, false, true];
|
||||
};
|
||||
};
|
||||
if (s_player_packvault < 0 && (_ownerID == dayz_combination || _ownerID == dayz_playerUID)) then {
|
||||
if (s_player_packvault < 0 && (_characterID == dayz_combination || _ownerID == dayz_playerUID)) then {
|
||||
s_player_packvault = player addAction [format["<t color='#ff0000'>%1</t>",(format[localize "STR_EPOCH_ACTIONS_PACK",_text])], "\z\addons\dayz_code\actions\vault_pack.sqf",_cursorTarget, 0, false, true];
|
||||
};
|
||||
} else {
|
||||
@@ -802,7 +838,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
|
||||
if (alive _x && (_x getVariable ["GeneratorRunning", false])) then {
|
||||
_findNearestGen set [count _findNearestGen,_x];
|
||||
};
|
||||
} count (nearestObjects [player,["Generator_DZ"],30]);
|
||||
} count ([player] call FNC_getPos) nearEntities ["Generator_DZ", 30];
|
||||
|
||||
// show that pump needs power if no generator nearby.
|
||||
if ((count _findNearestGen) > 0) then {
|
||||
@@ -849,7 +885,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
|
||||
};
|
||||
|
||||
// downgrade system
|
||||
if ((DZE_Lock_Door == _ownerID) && {_isDestructable || _cursorTarget isKindOf "Land_DZE_WoodDoorLocked_Base" || _cursorTarget isKindOf "CinderWallDoorLocked_DZ_Base"}) then {
|
||||
if ((DZE_Lock_Door == _characterID) && {_isDestructable || _cursorTarget isKindOf "Land_DZE_WoodDoorLocked_Base" || _cursorTarget isKindOf "CinderWallDoorLocked_DZ_Base"}) then {
|
||||
if ((s_player_lastTarget select 1) != _cursorTarget) then {
|
||||
if (s_player_downgrade_build > 0) then {
|
||||
player removeAction s_player_downgrade_build;
|
||||
|
||||
@@ -28,10 +28,14 @@ uiSleep 5;
|
||||
_playerNear = _obj call dze_isnearest_player;
|
||||
if (_playerNear) exitWith {DZE_ActionInProgress = false; localize "str_epoch_player_11" call dayz_rollingMessages;};
|
||||
|
||||
_ownerID = _obj getVariable["CharacterID","0"];
|
||||
_objectID = _obj getVariable["ObjectID","0"];
|
||||
_objectUID = _obj getVariable["ObjectUID","0"];
|
||||
|
||||
_ownerID = _obj getVariable["CharacterID","0"];
|
||||
if (DZE_plotforLife) then {
|
||||
_ownerID = _obj getVariable["ownerPUID", "0"];
|
||||
};
|
||||
|
||||
if((_ownerID != dayz_combination) && (_ownerID != dayz_playerUID)) exitWith {DZE_ActionInProgress = false; s_player_lockvault = -1; format[localize "str_epoch_player_115",_text] call dayz_rollingMessages; };
|
||||
|
||||
_alreadyPacking = _obj getVariable["packing",0];
|
||||
@@ -58,6 +62,9 @@ if (!isNull _obj) then {
|
||||
_holder setVariable["ObjectID",_objectID,true];
|
||||
_holder setVariable["ObjectUID",_objectUID,true];
|
||||
_holder setVariable ["OEMPos", _pos, true];
|
||||
if (DZE_plotforLife) then {
|
||||
_holder setVariable ["ownerPUID", _ownerID , true];
|
||||
};
|
||||
|
||||
_weapons = getWeaponCargo _obj;
|
||||
_magazines = getMagazineCargo _obj;
|
||||
|
||||
@@ -7,6 +7,9 @@ _obj = _this;
|
||||
_ownerID = _obj getVariable["CharacterID","0"];
|
||||
_objectID = _obj getVariable["ObjectID","0"];
|
||||
_objectUID = _obj getVariable["ObjectUID","0"];
|
||||
if (DZE_plotforLife) then {
|
||||
_ownerID = _obj getVariable["ownerPUID","0"];
|
||||
};
|
||||
_pickup = false;
|
||||
_packobj = getText (configFile >> "CfgVehicles" >> typeOf _obj >> "pack");
|
||||
_activatingPlayer = player;
|
||||
|
||||
@@ -24,13 +24,19 @@ if(_playerNear) exitWith {DZE_ActionInProgress = false; localize "str_epoch_play
|
||||
_ownerID = _obj getVariable["CharacterID","0"];
|
||||
_objectID = _obj getVariable["ObjectID","0"];
|
||||
_objectUID = _obj getVariable["ObjectUID","0"];
|
||||
_ComboMatch = (_ownerID == dayz_combination);
|
||||
if (DZE_plotforLife) then {
|
||||
_combination = _obj getVariable["characterID","0"];
|
||||
_ownerID = _obj getVariable["ownerPUID","0"];
|
||||
_ComboMatch = (_combination == dayz_combination);
|
||||
};
|
||||
|
||||
player removeAction s_player_packvault;
|
||||
s_player_packvault = 1;
|
||||
|
||||
if(_objectID == "0" && _objectUID == "0") exitWith {DZE_ActionInProgress = false; s_player_packvault = -1; format[localize "str_epoch_player_118",_text] call dayz_rollingMessages;};
|
||||
|
||||
if((_ownerID != dayz_combination) && (_ownerID != dayz_playerUID)) exitWith { DZE_ActionInProgress = false; s_player_packvault = -1; format[localize "str_epoch_player_119",_text] call dayz_rollingMessages;};
|
||||
if(!_ComboMatch && (_ownerID != dayz_playerUID)) exitWith { DZE_ActionInProgress = false; s_player_packvault = -1; format[localize "str_epoch_player_119",_text] call dayz_rollingMessages;};
|
||||
|
||||
_alreadyPacking = _obj getVariable["packing",0];
|
||||
|
||||
|
||||
@@ -32,11 +32,18 @@ _text = getText (configFile >> "CfgVehicles" >> _objType >> "displayName");
|
||||
_alreadyPacking = _obj getVariable["packing",0];
|
||||
_claimedBy = _obj getVariable["claimed","0"];
|
||||
_ownerID = _obj getVariable["CharacterID","0"];
|
||||
_characterID = _ownerID;
|
||||
_ComboMatch = (_ownerID == dayz_combination);
|
||||
if (DZE_plotforLife) then {
|
||||
_combination = _obj getVariable["characterID","0"];
|
||||
_ownerID = _obj getVariable["ownerPUID","0"];
|
||||
_ComboMatch = (_combination == dayz_combination);
|
||||
};
|
||||
|
||||
if (_alreadyPacking == 1) exitWith {DZE_ActionInProgress = false; format[localize "str_epoch_player_124",_text] call dayz_rollingMessages;};
|
||||
|
||||
// Promt user for password if _ownerID != dayz_playerUID
|
||||
if ((_ownerID == dayz_combination) || (_ownerID == dayz_playerUID)) then {
|
||||
if (_ComboMatch || (_ownerID == dayz_playerUID)) then {
|
||||
|
||||
// Check if any players are nearby if not allow player to claim item.
|
||||
_playerNear = {isPlayer _x} count (player nearEntities ["CAManBase", 6]) > 1;
|
||||
@@ -82,10 +89,13 @@ if ((_ownerID == dayz_combination) || (_ownerID == dayz_playerUID)) then {
|
||||
_holder setPosATL _pos;
|
||||
player reveal _holder;
|
||||
|
||||
_holder setVariable["CharacterID",_ownerID,true];
|
||||
_holder setVariable["CharacterID",_characterID,true];
|
||||
_holder setVariable["ObjectID",_objectID,true];
|
||||
_holder setVariable["ObjectUID",_objectUID,true];
|
||||
_holder setVariable ["OEMPos", _pos, true];
|
||||
if (DZE_plotforLife) then {
|
||||
_holder setVariable ["ownerPUID", _ownerID , true];
|
||||
};
|
||||
|
||||
if (count _weapons > 0) then {
|
||||
//Add weapons
|
||||
|
||||
@@ -184,8 +184,11 @@ if (!isNull _humanityTarget && {isPlayer _humanityTarget} && {alive _humanityTar
|
||||
// Display name if player opt-in or if friend
|
||||
_friendlies = player getVariable ["friendlies", []];
|
||||
_charID = player getVariable ["CharacterID", "0"];
|
||||
|
||||
_rcharID = _humanityTarget getVariable ["CharacterID", "0"];
|
||||
if (DZE_plotforLife) then {
|
||||
_charID = [player] call FNC_GetPlayerUID;
|
||||
_rcharID = [_humanityTarget] call FNC_GetPlayerUID;
|
||||
};
|
||||
_rfriendlies = _humanityTarget getVariable ["friendlies", []];
|
||||
_rfriendlyTo = _humanityTarget getVariable ["friendlyTo", []];
|
||||
|
||||
|
||||
@@ -62,7 +62,9 @@ DZE_plotManagement = true;
|
||||
DZE_PlotManagementAdmins = []; //Array of admin PlayerUIDs enclosed in quotations, UIDs in this list are able to access every pole's management menu and delete or build any buildable with a pole nearby
|
||||
DZE_MaxPlotFriends = 6; //Maximum number of friends allowed on a plot pole. (default 6)
|
||||
// see also: https://github.com/RimBlock/Epoch/tree/master/A%20Plot%20for%20Life
|
||||
DZE_plotforLife = false; // NOT IMPLEMENTED. Set always to false - value is used by plotManagement
|
||||
DZE_plotforLife = true; //Enable or disable a plot for life mod
|
||||
DZE_PlotOwnership = true; //allows plot owner to take ownership of buildables (excluding lockable items) near a plot pole. Useful for servers that allow base capturing so the new owner can modify/delete/upgrade existing structures
|
||||
|
||||
////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
|
||||
@@ -92,6 +92,9 @@ if (!isDedicated) then {
|
||||
} else {
|
||||
player_build = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_build.sqf";
|
||||
};
|
||||
FNC_check_owner = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\A_Plot_for_Life\fn_check_owner.sqf";
|
||||
FNC_find_plots = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\A_Plot_for_Life\fn_find_plots.sqf";
|
||||
|
||||
player_buildVanilla = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_buildVanilla.sqf";
|
||||
fn_buildCamera = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_buildCamera.sqf";
|
||||
object_build = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\object_build.sqf";
|
||||
|
||||
@@ -76,6 +76,7 @@ if (isServer) then {
|
||||
"PVDZ_plr_Save" addPublicVariableEventHandler {_id = (_this select 1) call server_playerSync;};
|
||||
"PVDZ_plr_SwitchMove" addPublicVariableEventHandler {((_this select 1) select 0) switchMove ((_this select 1) select 1);}; //Needed to execute switchMove on server machine. rSwitchMove only executes on other clients
|
||||
"PVDZ_obj_Publish" addPublicVariableEventHandler {(_this select 1) call server_publishObj}; //Used by built items (Epoch and Vanilla)
|
||||
"PVDZE_fullobj_Publish" addPublicVariableEventHandler {(_this select 1) call server_publishFullObject};
|
||||
"PVDZ_veh_Save" addPublicVariableEventHandler {(_this select 1) call server_updateObject};
|
||||
"PVDZ_plr_Login1" addPublicVariableEventHandler {_id = (_this select 1) call server_playerLogin};
|
||||
"PVDZ_plr_Login2" addPublicVariableEventHandler {(_this select 1) call server_playerSetup};
|
||||
|
||||
@@ -239,9 +239,10 @@ dayz_resetSelfActions = {
|
||||
s_player_toggleSnapSelect = -1;
|
||||
s_player_toggleSnapSelectPoint = [];
|
||||
snapActions = -1;
|
||||
// plotManagement //
|
||||
s_player_plot_boundary_on = -1;
|
||||
s_player_plot_boundary_off = -1;
|
||||
s_player_plot_take_ownership = -1;
|
||||
s_player_plotManagement = -1;
|
||||
// plotManagement //
|
||||
};
|
||||
call dayz_resetSelfActions;
|
||||
|
||||
@@ -487,6 +488,10 @@ DZE_isWreck = ["SKODAWreck","HMMWVWreck","UralWreck","datsun01Wreck","hiluxWreck
|
||||
DZE_isWreckBuilding = ["Land_wreck_cinder","Land_wood_wreck_quarter","Land_wood_wreck_floor","Land_wood_wreck_third","Land_wood_wreck_frame","Land_iron_vein_wreck","Land_silver_vein_wreck","Land_gold_vein_wreck","Land_ammo_supply_wreck"];
|
||||
DZE_isNewStorage = ["VaultStorage","OutHouse_DZ","Wooden_shed_DZ","WoodShack_DZ","StorageShed_DZ","GunRack_DZ","WoodCrate_DZ"];
|
||||
helperDetach = false;
|
||||
DZE_snapExtraRange = 0;
|
||||
if (isNil "DZE_plotOwnershipExclusions") then {
|
||||
DZE_plotTakeOwnershipItems = DayZ_SafeObjects - (DZE_LockableStorage + ["Plastic_Pole_EP1_DZ","TentStorage","TentStorageDomed","TentStorageDomed2"]);
|
||||
};
|
||||
isInTraderCity = false;
|
||||
PlayerDeaths = [];
|
||||
PVDZE_obj_Trade = []; // For all traders increment qty
|
||||
@@ -507,6 +512,7 @@ if (isNil "DZE_MissionLootTable") then {DZE_MissionLootTable = false;};
|
||||
if (isNil "DZE_SelfTransfuse") then {DZE_SelfTransfuse = false;};
|
||||
if (isNil "DZE_selfTransfuse_Values") then {DZE_selfTransfuse_Values = [12000,15,300];};
|
||||
if (isNil "DZE_PlotPole") then {DZE_PlotPole = [30,45];};
|
||||
DZE_checkNearbyRadius = DZE_PlotPole select 0;
|
||||
DZE_maintainRange = ((DZE_PlotPole select 0)+20);
|
||||
if (isNil "DZE_slowZombies") then {DZE_slowZombies = false;};
|
||||
|
||||
|
||||
26
SQF/dayz_server/compile/KK_Functions.sqf
Normal file
26
SQF/dayz_server/compile/KK_Functions.sqf
Normal 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
|
||||
]
|
||||
};
|
||||
42
SQF/dayz_server/compile/server_publishFullObject.sqf
Normal file
42
SQF/dayz_server/compile/server_publishFullObject.sqf
Normal 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);
|
||||
@@ -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", [] ];
|
||||
|
||||
@@ -47,14 +47,17 @@ 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));
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -77,6 +77,12 @@ if (_status == "ObjectStreamStart") then {
|
||||
_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 {
|
||||
|
||||
Reference in New Issue
Block a user