diff --git a/SQF/dayz_code/actions/remove.sqf b/SQF/dayz_code/actions/remove.sqf index 3f4d1d6d8..66d6f8b0b 100644 --- a/SQF/dayz_code/actions/remove.sqf +++ b/SQF/dayz_code/actions/remove.sqf @@ -18,6 +18,11 @@ _isOk = true; _proceed = false; _objType = typeOf _obj; +// Chance to break tools +_isDestructable = _obj isKindOf "BuiltItems"; +_isWreck = _objType in DZE_isWreck; +_isRemovable = _objType in DZE_isRemovable; + _limit = 5; if(isNumber (configFile >> "CfgVehicles" >> _objType >> "constructioncount")) then { _limit = getNumber(configFile >> "CfgVehicles" >> _objType >> "constructioncount"); @@ -52,6 +57,8 @@ cutText [format["Starting de-construction of %1.",_objType], "PLAIN DOWN"]; // Alert zombies once. [player,50,true,(getPosATL player)] spawn player_alertZombies; +_brokenTool = false; + // Start de-construction loop _counter = 0; while {_isOk} do { @@ -99,6 +106,16 @@ while {_isOk} do { if(_finished) then { _counter = _counter + 1; + // 10% chance to break a required tool each pass + if(_isDestructable or _isRemovable) then { + if((random 10) <= 1) then { + _brokenTool = true; + }; + }; + }; + if(_brokenTool) exitWith { + _isOk = false; + _proceed = false; }; cutText [format["De-constructing %1 stage %2 of %3 walk away at anytime to cancel.",_objType, _counter,_limit], "PLAIN DOWN"]; @@ -110,28 +127,29 @@ while {_isOk} do { }; +if(_brokenTool){ + if(_isRemovable) then { + _removeTool = ["ItemCrowbar","ItemToolbox"] call BIS_fnc_selectRandom; + } else { + _removeTool = "ItemToolbox"; + }; + if([player,_removeTool,1] call BIS_fnc_invRemove) then { + cutText [format["Tool (%1) broke cannot remove %2.",_removeTool,_objType], "PLAIN DOWN"]; + }; +}; + // Remove only if player waited if (_proceed) then { // Double check that object is not null if(!isNull(_obj)) then { - cutText [format["De-constructing %1.",_objType], "PLAIN DOWN"]; - - // TODO add hideobject to have it sink into ground then delete - dayzHideObject = _obj; - hideObject _obj; // local player - publicVariable "dayzHideObject"; // remote player - sleep 5; - - - //["dayzDeleteObj",[_objectID,_objectUID]] call callRpcProcedure; + + deleteVehicle _obj; dayzDeleteObj = [_objectID,_objectUID]; publicVariableServer "dayzDeleteObj"; + + cutText [format["De-constructing %1.",_objType], "PLAIN DOWN"]; - _isWreck = (typeOf _obj) in ["SKODAWreck","HMMWVWreck","UralWreck","datsun01Wreck","hiluxWreck","datsun02Wreck","UAZWreck","Land_Misc_Garb_Heap_EP1","Fort_Barricade_EP1","Rubbish2"]; - - deleteVehicle _obj; - _selectedRemoveOutput = []; if(_isWreck) then { // Find one random part to give back diff --git a/SQF/dayz_code/compile/fn_selfActions.sqf b/SQF/dayz_code/compile/fn_selfActions.sqf index 502ae1266..496580bb0 100644 --- a/SQF/dayz_code/compile/fn_selfActions.sqf +++ b/SQF/dayz_code/compile/fn_selfActions.sqf @@ -134,8 +134,8 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu _isDog = (_cursorTarget isKindOf "DZ_Pastor" || _cursorTarget isKindOf "DZ_Fin"); _isZombie = _cursorTarget isKindOf "zZombie_base"; _isDestructable = _cursorTarget isKindOf "BuiltItems"; - _isWreck = _typeOfCursorTarget in ["SKODAWreck","HMMWVWreck","UralWreck","datsun01Wreck","hiluxWreck","datsun02Wreck","UAZWreck","Land_Misc_Garb_Heap_EP1","Fort_Barricade_EP1","Rubbish2"]; - _isRemovable = _typeOfCursorTarget in ["Fence_corrugated_DZ","M240Nest_DZ","ParkBench_DZ","SandNest_DZ","Plastic_Pole_EP1_DZ"]; + _isWreck = _typeOfCursorTarget in DZE_isWreck; + _isRemovable = _typeOfCursorTarget in DZE_isRemovable; _isDisallowRepair = _typeOfCursorTarget in ["M240Nest_DZ"]; _isTent = _cursorTarget isKindOf "TentStorage"; diff --git a/SQF/dayz_code/init/variables.sqf b/SQF/dayz_code/init/variables.sqf index a01589482..b77400621 100644 --- a/SQF/dayz_code/init/variables.sqf +++ b/SQF/dayz_code/init/variables.sqf @@ -441,7 +441,11 @@ if(isNil "dayz_zedsAttackVehicles") then { dayz_updateObjects = ["Car", "Helicopter", "Motorcycle", "Ship", "TentStorage", "VaultStorage","M240Nest_DZ","OutHouse_DZ","Wooden_shed_DZ","WoodShack_DZ","StorageShed_DZ"]; dayz_disallowedVault = ["TentStorage", "BuiltItems"]; dayz_reveal = ["AllVehicles","WeaponHolder","TentStorage","VaultStorage","VaultStorageLocked","BuiltItems"]; -dayz_allowedObjects = ["TentStorage","TentStorageDomed","TentStorageDomed2", "VaultStorageLocked", "Hedgehog_DZ", "Sandbag1_DZ","TrapBear","Fort_RazorWire","WoodGate_DZ","Land_HBarrier1_DZ","Fence_corrugated_DZ","M240Nest_DZ","CanvasHut_DZ","ParkBench_DZ","MetalGate_DZ","OutHouse_DZ","Wooden_shed_DZ","WoodShack_DZ","StorageShed_DZ","Plastic_Pole_EP1_DZ","Generator_DZ","StickFence_DZ","LightPole_DZ","FuelPump_DZ","DesertCamoNet_DZ","ForestCamoNet_DZ","DesertLargeCamoNet_DZ","ForestLargeCamoNet_DZ","SandNest_DZ","DeerStand_DZ"]; +dayz_allowedObjects = ["TentStorage","TentStorageDomed","TentStorageDomed2", "VaultStorageLocked", "Hedgehog_DZ", "Sandbag1_DZ","TrapBear","Fort_RazorWire","WoodGate_DZ","Land_HBarrier1_DZ","Fence_corrugated_DZ","M240Nest_DZ","CanvasHut_DZ","ParkBench_DZ","MetalGate_DZ","OutHouse_DZ","Wooden_shed_DZ","WoodShack_DZ","StorageShed_DZ","Plastic_Pole_EP1_DZ","Generator_DZ","StickFence_DZ","LightPole_DZ","FuelPump_DZ","DesertCamoNet_DZ","ForestCamoNet_DZ","DesertLargeCamoNet_DZ","ForestLargeCamoNet_DZ","SandNest_DZ","DeerStand_DZ","DeerStand_DZ"]; + +// List of removable items that require crowbar +DZE_isRemovable = ["Fence_corrugated_DZ","M240Nest_DZ","ParkBench_DZ","SandNest_DZ","Plastic_Pole_EP1_DZ"]; +DZE_isWreck = ["SKODAWreck","HMMWVWreck","UralWreck","datsun01Wreck","hiluxWreck","datsun02Wreck","UAZWreck","Land_Misc_Garb_Heap_EP1","Fort_Barricade_EP1","Rubbish2"]; // These work with just a running generator dayz_fuelpumparray = ["FuelPump_DZ","Land_A_FuelStation_Feed","Land_Ind_FuelStation_Feed_EP1","Land_FuelStation_Feed_PMC","FuelStation","Land_ibr_FuelStation_Feed","Land_fuelstation_army","Land_fuelstation","land_fuelstation_w","Land_benzina_schnell"];