mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-13 19:52:38 +03:00
Allow remove with Crowbar in hands or onBack
Now crowbar can be in your toolbelt, hands or onBack when removing modular items, mining ore, opening supply crates, etc.
This commit is contained in:
@@ -4,7 +4,7 @@ DZE_ActionInProgress = true;
|
||||
delete object from db with extra waiting by [VB]AWOL
|
||||
parameters: _obj
|
||||
*/
|
||||
private ["_activatingPlayer","_obj","_playerUID","_objectID","_objectUID","_started","_finished","_animState","_isMedic","_isOk","_proceed","_counter","_limit","_objType","_sfx","_dis","_itemOut","_countOut","_selectedRemoveOutput","_nearestPole","_ownerID","_refundpart","_isWreck","_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","_nearestPole","_ownerID","_refundpart","_isWreck","_IsNearPlot","_brokenTool","_removeTool","_isDestructable","_isRemovable","_objOwnerID","_isOwnerOfObj","_preventRefund","_ipos","_item","_radius","_isWreckBuilding","_nameVehicle","_isModular","_success"];
|
||||
|
||||
player removeAction s_player_deleteBuild;
|
||||
s_player_deleteBuild = 1;
|
||||
@@ -147,21 +147,33 @@ while {_isOk} do {
|
||||
|
||||
};
|
||||
|
||||
_success = true;
|
||||
|
||||
|
||||
if(_brokenTool) then {
|
||||
if(_isWreck) then {
|
||||
_removeTool = "ItemToolbox";
|
||||
if (_brokenTool) then {
|
||||
_success = false;
|
||||
_removeTool = if (_isWreck) then {"ItemToolbox"} else {["ItemCrowbar","ItemToolbox"] call BIS_fnc_selectRandom};
|
||||
if (_removeTool == "ItemCrowbar" && !("ItemCrowbar" in items player)) then {
|
||||
if ("MeleeCrowbar" in weapons player) then {
|
||||
player removeWeapon "MeleeCrowbar";
|
||||
_success = true;
|
||||
} else {
|
||||
if (dayz_onBack == "MeleeCrowbar") then {
|
||||
dayz_onBack = ""; // Remove
|
||||
_success = true;
|
||||
if (!isNull (findDisplay 106)) then {((findDisplay 106) displayCtrl 1209) ctrlSetText "";};
|
||||
};
|
||||
};
|
||||
} else {
|
||||
_removeTool = ["ItemCrowbar","ItemToolbox"] call BIS_fnc_selectRandom;
|
||||
if (([player,_removeTool,1] call BIS_fnc_invRemove) > 0) then {_success = true;};
|
||||
};
|
||||
if(([player,_removeTool,1] call BIS_fnc_invRemove) > 0) then {
|
||||
|
||||
if (_success) then {
|
||||
format[localize "str_epoch_player_164",getText(configFile >> "CfgWeapons" >> _removeTool >> "displayName"),_nameVehicle] call dayz_rollingMessages;
|
||||
};
|
||||
};
|
||||
|
||||
// Remove only if player waited
|
||||
if (_proceed) then {
|
||||
// Remove only if player waited AND tool was successfully removed if broken
|
||||
if (_proceed && _success) then {
|
||||
|
||||
// Double check that object is not null
|
||||
if(!isNull(_obj)) then {
|
||||
|
||||
@@ -5,7 +5,7 @@ scriptName "Functions\misc\fn_selfActions.sqf";
|
||||
- [] call fnc_usec_selfActions;
|
||||
************************************************************/
|
||||
if (DZE_ActionInProgress) exitWith {};
|
||||
private ["_canPickLight","_text","_dir","_canDoThis","_w2m","_bb","_waterHoles","_unlock","_lock","_totalKeys","_temp_keys","_temp_keys_names","_hasKey","_oldOwner","_hasAttached","_isAnimal","_isZombie","_isHarvested","_isMan","_isFuel","_hasRawMeat","_hastinitem","_player_deleteBuild","_player_lockUnlock_crtl","_displayName","_hasIgnators","_menu","_menu1","_allowTow","_liftHeli","_found","_posL","_posC","_height","_attached","_combi","_findNearestGen","_humanity_logic","_low_high","_cancel","_buy","_buyV","_humanity","_traderMenu","_warn","_typeOfCursorTarget","_isVehicle","_isBicycle","_isDestructable","_isGenerator","_ownerID","_isVehicletype","_hasBarrel","_hasFuel20","_hasFuel5","_hasEmptyFuelCan","_itemsPlayer","_hasToolbox","_hasbottleitem","_isAlive","_isPlant","_istypeTent","_upgradeItems","_isCampSite","_isDisallowRefuel","_isDog","_isModular","_isModularDoor","_isHouse","_isGate","_isFence","_isLockableGate","_isUnlocked","_isOpen","_isClosed","_ownerArray","_ownerBuildLock","_ownerPID","_speed","_dog","_vehicle","_inVehicle","_cursorTarget","_primaryWeapon","_currentWeapon","_magazinesPlayer","_onLadder","_canDo","_nearLight","_vehicleOwnerID","_hasHotwireKit","_isPZombie","_dogHandle","_allowedDistance","_id","_upgrade"];
|
||||
private ["_canPickLight","_text","_dir","_canDoThis","_w2m","_bb","_waterHoles","_unlock","_lock","_totalKeys","_temp_keys","_temp_keys_names","_hasKey","_oldOwner","_hasAttached","_isAnimal","_isZombie","_isHarvested","_isMan","_isFuel","_hasRawMeat","_hastinitem","_player_deleteBuild","_player_lockUnlock_crtl","_displayName","_hasIgnators","_menu","_menu1","_allowTow","_liftHeli","_found","_posL","_posC","_height","_attached","_combi","_findNearestGen","_humanity_logic","_low_high","_cancel","_buy","_buyV","_humanity","_traderMenu","_warn","_typeOfCursorTarget","_isVehicle","_isBicycle","_isDestructable","_isGenerator","_ownerID","_isVehicletype","_hasBarrel","_hasFuel20","_hasFuel5","_hasEmptyFuelCan","_itemsPlayer","_hasToolbox","_hasbottleitem","_isAlive","_isPlant","_istypeTent","_upgradeItems","_isCampSite","_isDisallowRefuel","_isDog","_isModular","_isModularDoor","_isHouse","_isGate","_isFence","_isLockableGate","_isUnlocked","_isOpen","_isClosed","_ownerArray","_ownerBuildLock","_ownerPID","_speed","_dog","_vehicle","_inVehicle","_cursorTarget","_primaryWeapon","_currentWeapon","_magazinesPlayer","_onLadder","_canDo","_nearLight","_vehicleOwnerID","_hasHotwireKit","_isPZombie","_dogHandle","_allowedDistance","_id","_upgrade","_weaponsPlayer","_hasCrowbar"];
|
||||
|
||||
_vehicle = vehicle player;
|
||||
_inVehicle = (_vehicle != player);
|
||||
@@ -242,6 +242,8 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
|
||||
_hasFuel5 = "ItemFuelcan" in _magazinesPlayer;
|
||||
_hasEmptyFuelCan = (("ItemJerrycanEmpty" in _magazinesPlayer) || ("ItemFuelcanEmpty" in _magazinesPlayer) || ("ItemFuelBarrelEmpty" in _magazinesPlayer));
|
||||
_itemsPlayer = items player;
|
||||
_weaponsPlayer = weapons player;
|
||||
_hasCrowbar = "ItemCrowbar" in _itemsPlayer or "MeleeCrowbar" in _weaponsPlayer or dayz_onBack == "MeleeCrowbar";
|
||||
_hasToolbox = "ItemToolbox" in _itemsPlayer;
|
||||
_hasbottleitem = (("ItemWaterBottle" in _magazinesPlayer) || ("ItemWaterBottleInfected" in _magazinesPlayer) || ("ItemWaterBottleSafe" in _magazinesPlayer));
|
||||
_isAlive = alive _cursorTarget;
|
||||
@@ -417,13 +419,13 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
|
||||
if (_isAlive) then {
|
||||
//Allow player to delete objects
|
||||
if (_isDestructable || {((_typeOfCursorTarget in DZE_isWreck) or (_typeOfCursorTarget in DZE_isWreckBuilding))} || {(_typeOfCursorTarget in DZE_isRemovable)}) then {
|
||||
if (_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
|
||||
if (_hasToolbox && _hasCrowbar) then {
|
||||
_player_deleteBuild = true;
|
||||
};
|
||||
};
|
||||
|
||||
if(_isModular || _isModularDoor || {_typeOfCursorTarget in DZE_isDestroyableStorage}) then {
|
||||
if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
|
||||
if (_isModular || _isModularDoor || {_typeOfCursorTarget in DZE_isDestroyableStorage}) then {
|
||||
if (_hasToolbox && _hasCrowbar) then {
|
||||
_isOwner = [player, _cursorTarget] call FNC_check_access;
|
||||
if ((_isOwner select 0) or (_isOwner select 2) or (_isOwner select 3)) then {
|
||||
_player_deleteBuild = true;
|
||||
|
||||
Reference in New Issue
Block a user