From de46a173dcb122a2c2d439f04fa0abc5087557ba Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Sun, 6 Nov 2016 13:05:46 -0500 Subject: [PATCH] Fix errors when removing traps Vanilla commit: https://github.com/DayZMod/DayZ/commit/b558351a0696724da9e17c31bd4c73b85e525a43 --- SQF/dayz_code/Configs/CfgVehicles/Traps.hpp | 7 +++++++ SQF/dayz_code/traps/functions/remove.sqf | 12 +++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/SQF/dayz_code/Configs/CfgVehicles/Traps.hpp b/SQF/dayz_code/Configs/CfgVehicles/Traps.hpp index 0daf2bc34..20fd47271 100644 --- a/SQF/dayz_code/Configs/CfgVehicles/Traps.hpp +++ b/SQF/dayz_code/Configs/CfgVehicles/Traps.hpp @@ -12,6 +12,7 @@ class BearTrap_DZ : TrapItems { singleUse = 0; nounderground = 0; requireplot = 0; + constructioncount = 1; class Eventhandlers { init = "['init', _this select 0] spawn beartrap;"; @@ -124,6 +125,7 @@ class TrapBearTrapFlare : TrapItems { vehicleClass = "Fortifications"; nounderground = 0; requireplot = 0; + constructioncount = 1; script = "beartrapflare"; // compiled script variable name (used by server side loop) initState = 1; // initial armed state @@ -175,6 +177,7 @@ class TrapBearTrapSmoke : TrapItems { vehicleClass = "Fortifications"; nounderground = 0; requireplot = 0; + constructioncount = 1; script = "beartrapsmoke"; // compiled script variable name (used by server side loop) initState = 1; // initial armed state @@ -230,6 +233,7 @@ class Trap_Cans : TrapItems { initState = 1; // initial armed state singleUse = 0; requireplot = 0; + constructioncount = 1; class Eventhandlers { init = "['init', _this select 0] spawn tripcans;"; @@ -281,6 +285,7 @@ class TrapTripwireFlare : TrapItems { initState = 1; // initial armed state singleUse = 0; requireplot = 0; + constructioncount = 1; class Eventhandlers { init = "['init', _this select 0] spawn tripflare;"; @@ -332,6 +337,7 @@ class TrapTripwireGrenade : TrapItems { initState = 1; // initial armed state singleUse = 0; requireplot = 0; + constructioncount = 1; class Eventhandlers { init = "['init', _this select 0] spawn tripgrenade;"; @@ -383,6 +389,7 @@ class TrapTripwireSmoke : TrapItems { initState = 1; // initial armed state singleUse = 0; requireplot = 0; + constructioncount = 1; class Eventhandlers { init = "['init', _this select 0] spawn tripsmoke;"; diff --git a/SQF/dayz_code/traps/functions/remove.sqf b/SQF/dayz_code/traps/functions/remove.sqf index 48a4b179a..f34117879 100644 --- a/SQF/dayz_code/traps/functions/remove.sqf +++ b/SQF/dayz_code/traps/functions/remove.sqf @@ -1 +1,11 @@ -[nil,nil,nil,_this select 0] call compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\remove.sqf" \ No newline at end of file +private ["_obj","_objectID","_objectUID"]; + +_obj = _this select 0; +_objectID = _obj getVariable ["ObjectID","0"]; +_objectUID = _obj getVariable ["ObjectUID","0"]; + +if (isServer) then { + [_objectID,_objectUID,"__SERVER__"] call server_deleteObj; +} else { + [nil,nil,nil,_obj] execVM "\z\addons\dayz_code\actions\remove.sqf"; +}; \ No newline at end of file