mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 20:13:13 +03:00
10% * constcount chance break tools on removals
This commit is contained in:
@@ -18,6 +18,11 @@ _isOk = true;
|
|||||||
_proceed = false;
|
_proceed = false;
|
||||||
_objType = typeOf _obj;
|
_objType = typeOf _obj;
|
||||||
|
|
||||||
|
// Chance to break tools
|
||||||
|
_isDestructable = _obj isKindOf "BuiltItems";
|
||||||
|
_isWreck = _objType in DZE_isWreck;
|
||||||
|
_isRemovable = _objType in DZE_isRemovable;
|
||||||
|
|
||||||
_limit = 5;
|
_limit = 5;
|
||||||
if(isNumber (configFile >> "CfgVehicles" >> _objType >> "constructioncount")) then {
|
if(isNumber (configFile >> "CfgVehicles" >> _objType >> "constructioncount")) then {
|
||||||
_limit = getNumber(configFile >> "CfgVehicles" >> _objType >> "constructioncount");
|
_limit = getNumber(configFile >> "CfgVehicles" >> _objType >> "constructioncount");
|
||||||
@@ -52,6 +57,8 @@ cutText [format["Starting de-construction of %1.",_objType], "PLAIN DOWN"];
|
|||||||
// Alert zombies once.
|
// Alert zombies once.
|
||||||
[player,50,true,(getPosATL player)] spawn player_alertZombies;
|
[player,50,true,(getPosATL player)] spawn player_alertZombies;
|
||||||
|
|
||||||
|
_brokenTool = false;
|
||||||
|
|
||||||
// Start de-construction loop
|
// Start de-construction loop
|
||||||
_counter = 0;
|
_counter = 0;
|
||||||
while {_isOk} do {
|
while {_isOk} do {
|
||||||
@@ -99,6 +106,16 @@ while {_isOk} do {
|
|||||||
|
|
||||||
if(_finished) then {
|
if(_finished) then {
|
||||||
_counter = _counter + 1;
|
_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"];
|
cutText [format["De-constructing %1 stage %2 of %3 walk away at anytime to cancel.",_objType, _counter,_limit], "PLAIN DOWN"];
|
||||||
@@ -110,27 +127,28 @@ 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
|
// Remove only if player waited
|
||||||
if (_proceed) then {
|
if (_proceed) then {
|
||||||
|
|
||||||
// Double check that object is not null
|
// Double check that object is not null
|
||||||
if(!isNull(_obj)) then {
|
if(!isNull(_obj)) then {
|
||||||
cutText [format["De-constructing %1.",_objType], "PLAIN DOWN"];
|
|
||||||
|
|
||||||
// TODO add hideobject to have it sink into ground then delete
|
deleteVehicle _obj;
|
||||||
dayzHideObject = _obj;
|
|
||||||
hideObject _obj; // local player
|
|
||||||
publicVariable "dayzHideObject"; // remote player
|
|
||||||
sleep 5;
|
|
||||||
|
|
||||||
|
|
||||||
//["dayzDeleteObj",[_objectID,_objectUID]] call callRpcProcedure;
|
|
||||||
dayzDeleteObj = [_objectID,_objectUID];
|
dayzDeleteObj = [_objectID,_objectUID];
|
||||||
publicVariableServer "dayzDeleteObj";
|
publicVariableServer "dayzDeleteObj";
|
||||||
|
|
||||||
_isWreck = (typeOf _obj) in ["SKODAWreck","HMMWVWreck","UralWreck","datsun01Wreck","hiluxWreck","datsun02Wreck","UAZWreck","Land_Misc_Garb_Heap_EP1","Fort_Barricade_EP1","Rubbish2"];
|
cutText [format["De-constructing %1.",_objType], "PLAIN DOWN"];
|
||||||
|
|
||||||
deleteVehicle _obj;
|
|
||||||
|
|
||||||
_selectedRemoveOutput = [];
|
_selectedRemoveOutput = [];
|
||||||
if(_isWreck) then {
|
if(_isWreck) then {
|
||||||
|
|||||||
@@ -134,8 +134,8 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
|
|||||||
_isDog = (_cursorTarget isKindOf "DZ_Pastor" || _cursorTarget isKindOf "DZ_Fin");
|
_isDog = (_cursorTarget isKindOf "DZ_Pastor" || _cursorTarget isKindOf "DZ_Fin");
|
||||||
_isZombie = _cursorTarget isKindOf "zZombie_base";
|
_isZombie = _cursorTarget isKindOf "zZombie_base";
|
||||||
_isDestructable = _cursorTarget isKindOf "BuiltItems";
|
_isDestructable = _cursorTarget isKindOf "BuiltItems";
|
||||||
_isWreck = _typeOfCursorTarget in ["SKODAWreck","HMMWVWreck","UralWreck","datsun01Wreck","hiluxWreck","datsun02Wreck","UAZWreck","Land_Misc_Garb_Heap_EP1","Fort_Barricade_EP1","Rubbish2"];
|
_isWreck = _typeOfCursorTarget in DZE_isWreck;
|
||||||
_isRemovable = _typeOfCursorTarget in ["Fence_corrugated_DZ","M240Nest_DZ","ParkBench_DZ","SandNest_DZ","Plastic_Pole_EP1_DZ"];
|
_isRemovable = _typeOfCursorTarget in DZE_isRemovable;
|
||||||
_isDisallowRepair = _typeOfCursorTarget in ["M240Nest_DZ"];
|
_isDisallowRepair = _typeOfCursorTarget in ["M240Nest_DZ"];
|
||||||
|
|
||||||
_isTent = _cursorTarget isKindOf "TentStorage";
|
_isTent = _cursorTarget isKindOf "TentStorage";
|
||||||
|
|||||||
@@ -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_updateObjects = ["Car", "Helicopter", "Motorcycle", "Ship", "TentStorage", "VaultStorage","M240Nest_DZ","OutHouse_DZ","Wooden_shed_DZ","WoodShack_DZ","StorageShed_DZ"];
|
||||||
dayz_disallowedVault = ["TentStorage", "BuiltItems"];
|
dayz_disallowedVault = ["TentStorage", "BuiltItems"];
|
||||||
dayz_reveal = ["AllVehicles","WeaponHolder","TentStorage","VaultStorage","VaultStorageLocked","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
|
// 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"];
|
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"];
|
||||||
|
|||||||
Reference in New Issue
Block a user