mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-02-27 02:01:49 +03:00
Update remove/deconstruct, add helpers
Removing and Deconstructing Objects - Now adds colored helpers to modular objects. - Green: Refund one kit. - Blue: Refund entire recipe of parts (multiple items). - Red: No refund will be given. Either because the object is too damaged, or the refund feature is disabled. - If the object has a door open while selected, no helper will display/float in the open door space. - The gear panel will only open if a refund is available. - If a lit fire barrel is removed, the flame will now be extinguished. - If a plot pole is removed, plot boundary helpers will now be deleted. - Refunds for non-modular objects are handled by their respective config settings. - Removed non-lockable storage objects will now refund their contents. - The corresponding storage kit will be refunded. - If there is room outdoors, backpacks will be arranged in a neat circle close to the refund point. - If the spawn point is too close to a building, backpacks will spawn at the player's location. - Helpers will now appear on wrecked/ruined modular objects. - Helper color arrays were changed to helper transparency values only, to make it easier (and safer) for server owners. Upgrading, Downgrading, Maintaining and Packing Objects - Now includes colored helper spheres for improved player experience. - Reapply damage to upgraded/downgraded object if necessary. Changes made by @Victor-the-Cleaner
This commit is contained in:
@@ -219,14 +219,14 @@ if (_isPZombie) then {
|
||||
};
|
||||
|
||||
// Increase distance only if AIR, SHIP or TANK
|
||||
local _allowedDistance = [4, 8] select ((_cursorTarget isKindOf "Air") || {_cursorTarget isKindOf "Ship"} || {_cursorTarget isKindOf "Tank"});
|
||||
local _typeOfCursorTarget = typeOf _cursorTarget;
|
||||
local _allowedDistance = [5, 9] select ((_typeOfCursorTarget in DZE_largeObjects) || {_cursorTarget isKindOf "Air" || {_cursorTarget isKindOf "Ship" || {_cursorTarget isKindOf "Tank"}}});
|
||||
local _distance = floor((player distance _cursorTarget) * 100) / 100; // truncate to 2 decimal places for stationary objects
|
||||
local _isVehicle = _cursorTarget isKindOf "AllVehicles";
|
||||
if (_isVehicle) then {_distance = floor(player distance _cursorTarget)}; // truncate to 0 decimal places for jittery vehicles
|
||||
local _noChange = ((_cursorTarget == DZE_prevTarget) && (_distance == DZE_prevDistance));
|
||||
|
||||
if (!isNull _cursorTarget && _noChange && !_inVehicle && !_isPZombie && _canDo && (_distance <= _allowedDistance)) then {
|
||||
local _typeOfCursorTarget = typeOf _cursorTarget;
|
||||
local _isBicycle = _cursorTarget isKindOf "Bicycle";
|
||||
local _isDestructable = _cursorTarget isKindOf "BuiltItems";
|
||||
local _isGenerator = _typeOfCursorTarget == "Generator_DZ";
|
||||
@@ -259,8 +259,8 @@ if (!isNull _cursorTarget && _noChange && !_inVehicle && !_isPZombie && _canDo &
|
||||
};
|
||||
|
||||
local _isDog = (_cursorTarget isKindOf "Pastor" || _cursorTarget isKindOf "Fin");
|
||||
local _isModular = _cursorTarget isKindOf "ModularItems";
|
||||
local _isModularDoor = _typeOfCursorTarget in ["Land_DZE_WoodDoor","Land_DZE_LargeWoodDoor","Land_DZE_GarageWoodDoor","CinderWallDoor_DZ","CinderWallDoorSmall_DZ","WoodenGate_foundation_DZ","WoodenGate_1_DZ","WoodenGate_2_DZ","WoodenGate_3_DZ","WoodenGate_4_DZ","Land_DZE_WoodGate","Land_DZE_WoodOpenTopGarageDoor","CinderGate_DZ","CinderGarageOpenTop_DZ","CinderDoorHatch_DZ","Door_DZ","Concrete_Bunker_DZ","Metal_Drawbridge_DZ"];
|
||||
local _isModular = (_cursorTarget isKindOf "ModularItems" || {_typeOfCursorTarget in DZE_modularDoors});
|
||||
local _hasDeconstructAccess = false;
|
||||
local _player_deleteBuild = false;
|
||||
local _player_lockUnlock_crtl = false;
|
||||
|
||||
@@ -378,20 +378,22 @@ if (!isNull _cursorTarget && _noChange && !_inVehicle && !_isPZombie && _canDo &
|
||||
};
|
||||
};
|
||||
|
||||
// Remove Object
|
||||
if (_isAlive) then {
|
||||
local _restrict = _typeOfCursorTarget in DZE_restrictRemoval;
|
||||
|
||||
//Allow player to remove objects with no ownership or access required
|
||||
if (!_restrict && {_isDestructable || {_typeOfCursorTarget in DZE_isWreck} || {_typeOfCursorTarget in DZE_isWreckBuilding} || {_typeOfCursorTarget in DZE_isRemovable}}) then {
|
||||
// Allow player to remove objects with no ownership or access required
|
||||
if (!_restrict && (_isDestructable || {_typeOfCursorTarget in DZE_isWreck || {_typeOfCursorTarget in DZE_isWreckBuilding || {_typeOfCursorTarget in DZE_isRemovable}}})) then {
|
||||
if (_hasToolbox && _hasCrowbar) then {
|
||||
_player_deleteBuild = true;
|
||||
};
|
||||
};
|
||||
//Allow player to remove objects only if they have proper ownership or access
|
||||
if (_restrict || _isModular || _isModularDoor || _isGenerator || {_typeOfCursorTarget in DZE_isDestroyableStorage}) then {
|
||||
// Allow player to remove objects only if they have proper ownership or access
|
||||
if (_restrict || _isModular || _isGenerator || {_typeOfCursorTarget in DZE_isDestroyableStorage}) then {
|
||||
if (_hasToolbox && _hasCrowbar) then {
|
||||
_hasAccess = [player, _cursorTarget] call FNC_check_access;
|
||||
if ((_hasAccess select 0) || {_hasAccess select 2} || {_hasAccess select 3}) then {
|
||||
if ((_hasAccess select 0) || (_hasAccess select 2) || (_hasAccess select 3)) then {
|
||||
_hasDeconstructAccess = true;
|
||||
_player_deleteBuild = true;
|
||||
};
|
||||
};
|
||||
@@ -402,14 +404,27 @@ if (!isNull _cursorTarget && _noChange && !_inVehicle && !_isPZombie && _canDo &
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if (_player_deleteBuild) then {
|
||||
if (s_player_deleteBuild < 0) then {
|
||||
s_player_deleteBuild = player addAction [format[localize "STR_EPOCH_REMOVE",_text], "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, false, true];
|
||||
|
||||
s_player_deleteBuild = player addAction [format[localize "STR_EPOCH_REMOVE", _text], "\z\addons\dayz_code\actions\remove.sqf",[_cursorTarget, 2, _isModular], -3, false, true];
|
||||
};
|
||||
} else {
|
||||
player removeAction s_player_deleteBuild;
|
||||
s_player_deleteBuild = -1;
|
||||
|
||||
};
|
||||
|
||||
// Deconstruct Modular Object
|
||||
if (DZE_refundModular && DZE_allowDeconstruct && _hasDeconstructAccess && _isModular && !((DZE_RefundDamageLimit > 0) && (damage _cursorTarget > DZE_RefundDamageLimit))) then {
|
||||
if !(_typeOfCursorTarget in DZE_modularExclude) then { // check if class allows refunds
|
||||
if (s_player_deconstruct < 0) then {
|
||||
s_player_deconstruct = player addAction [format[localize "STR_EPOCH_DECONSTRUCT", _text], "\z\addons\dayz_code\actions\remove.sqf",[_cursorTarget, 3, _isModular], -4, false, true];
|
||||
};
|
||||
};
|
||||
} else {
|
||||
player removeAction s_player_deconstruct;
|
||||
s_player_deconstruct = -1;
|
||||
};
|
||||
|
||||
//remove Own objects
|
||||
@@ -1066,6 +1081,8 @@ if (!isNull _cursorTarget && _noChange && !_inVehicle && !_isPZombie && _canDo &
|
||||
s_player_sleep = -1;
|
||||
player removeAction s_player_deleteBuild;
|
||||
s_player_deleteBuild = -1;
|
||||
player removeAction s_player_deconstruct;
|
||||
s_player_deconstruct = -1;
|
||||
player removeAction s_player_cook;
|
||||
s_player_cook = -1;
|
||||
player removeAction s_player_boil;
|
||||
@@ -1141,8 +1158,6 @@ if (!isNull _cursorTarget && _noChange && !_inVehicle && !_isPZombie && _canDo &
|
||||
s_player_maint_build = -1;
|
||||
player removeAction s_player_downgrade_build;
|
||||
s_player_downgrade_build = -1;
|
||||
player removeAction s_player_towing;
|
||||
s_player_towing = -1;
|
||||
player removeAction s_player_fuelauto;
|
||||
s_player_fuelauto = -1;
|
||||
player removeAction s_player_fuelauto2;
|
||||
|
||||
Reference in New Issue
Block a user