Fix potential undefined error on bear trap trigger

https://github.com/EpochModTeam/DayZ-Epoch/issues/1891#issuecomment-282476563
This commit is contained in:
ebayShopper
2017-02-25 12:37:32 -05:00
parent e8b328ff9c
commit 55eddfead8
8 changed files with 35 additions and 28 deletions

View File

@@ -85,6 +85,7 @@
[FIXED] Mark body now marks all of your bodies instead of just one. @oiad
[FIXED] Group and body markers correctly update on the GPS mini map now.
[FIXED] Vehicle lock and unlock actions are now refreshed correctly without needing to look away and back again. @oiad
[FIXED] A potential undefined error on bear trap trigger. @oiad
[NOTE] The fixes below are included in the 1.0.6 Build C server package released December 29th, 2016 (http://dayzepoch.com/a2dayzepoch.php)
[FIXED] Hive child 309 errors that resulted in broken saving of newly built storage object inventory. @icomrade

View File

@@ -50,18 +50,20 @@ _remove = {
_trigger = {
if (isServer) then {
private ["_entity"];
private "_entity";
_entity = _this select 0;
_trap animate ["LeftShutter", 1];
_trap animate ["RightShutter", 1];
[nil,_trap,rSAY,["trap_bear_0",60]] call RE;
if (_entity isKindOf "Animal") then {
_entity setDamage 1;
} else {
[_entity, "Legs", [_entity]] call server_sendToClient;
if (!isNull _entity) then {
if (_entity isKindOf "Animal") then {
_entity setDamage 1;
} else {
[_entity, "Legs", [_entity]] call server_sendToClient;
};
};
[_trap] call trigger_trap;
@@ -71,7 +73,7 @@ _trigger = {
private ["_event", "_trap", "_args"];
_event = _this select 0;
_trap = if (typeOf (_this select 1) == "EmptyDetector") then { dayz_traps_active select (dayz_traps_trigger find (_this select 1)) } else { _this select 1 };
_args = if (count _this > 2) then { _this select 2 } else { [] };
_args = if (count _this > 2) then { _this select 2 } else { [objNull] };
switch (_event) do {
case "init": {

View File

@@ -51,7 +51,7 @@ _remove = {
_trigger = {
if (isServer) then {
private ["_entity"];
private "_entity";
_entity = _this select 0;
// don't work (due to proxies n stuff)
@@ -59,11 +59,13 @@ _trigger = {
//_trap animate ["RightShutter", 1];
[nil,_trap,rSAY,["trap_bear_0",60]] call RE;
if (_entity isKindOf "Animal") then {
_entity setDamage 1;
} else {
[_entity, "Legs", [_entity]] call server_sendToClient;
if (!isNull _entity) then {
if (_entity isKindOf "Animal") then {
_entity setDamage 1;
} else {
[_entity, "Legs", [_entity]] call server_sendToClient;
};
};
_flare = createVehicle ["RoadFlare", getPosATL _trap, [], 0, "CAN_COLLIDE"];
@@ -90,7 +92,7 @@ _trigger = {
private ["_event", "_trap", "_args"];
_event = _this select 0;
_trap = if (typeOf (_this select 1) == "EmptyDetector") then { dayz_traps_active select (dayz_traps_trigger find (_this select 1)) } else { _this select 1 };
_args = if (count _this > 2) then { _this select 2 } else { [] };
_args = if (count _this > 2) then { _this select 2 } else { [objNull] };
switch (_event) do {
case "init": {

View File

@@ -51,7 +51,7 @@ _remove = {
_trigger = {
if (isServer) then {
private ["_entity"];
private "_entity";
_entity = _this select 0;
// don't work (due to proxies n stuff)
@@ -60,10 +60,12 @@ _trigger = {
[nil,_trap,rSAY,["trap_bear_0",60]] call RE;
if (_entity isKindOf "Animal") then {
_entity setDamage 1;
} else {
[_entity, "Legs", [_entity]] call server_sendToClient;
if (!isNull _entity) then {
if (_entity isKindOf "Animal") then {
_entity setDamage 1;
} else {
[_entity, "Legs", [_entity]] call server_sendToClient;
};
};
createVehicle ["SmokeShell", getPosATL _trap, [], 0, "CAN_COLLIDE"];
@@ -86,7 +88,7 @@ _trigger = {
private ["_event", "_trap", "_args"];
_event = _this select 0;
_trap = if (typeOf (_this select 1) == "EmptyDetector") then { dayz_traps_active select (dayz_traps_trigger find (_this select 1)) } else { _this select 1 };
_args = if (count _this > 2) then { _this select 2 } else { [] };
_args = if (count _this > 2) then { _this select 2 } else { [objNull] };
switch (_event) do {
case "init": {

View File

@@ -51,7 +51,7 @@ _remove = {
_trigger = {
if (isServer) then {
private ["_entity"];
private "_entity";
_entity = _this select 0;
[nil,_trap,rSAY,["z_trap_trigger_0",60]] call RE;
@@ -64,7 +64,7 @@ _trigger = {
private ["_event", "_trap", "_args"];
_event = _this select 0;
_trap = if (typeOf (_this select 1) == "EmptyDetector") then { dayz_traps_active select (dayz_traps_trigger find (_this select 1)) } else { _this select 1 };
_args = if (count _this > 2) then { _this select 2 } else { [] };
_args = if (count _this > 2) then { _this select 2 } else { [objNull] };
switch (_event) do {
case "init": {

View File

@@ -51,7 +51,7 @@ _remove = {
_trigger = {
if (isServer) then {
private ["_entity"];
private "_entity";
_entity = _this select 0;
[nil,_trap,rSAY,["z_trap_trigger_0",60]] call RE;
@@ -72,7 +72,7 @@ _trigger = {
private ["_event", "_trap", "_args"];
_event = _this select 0;
_trap = if (typeOf (_this select 1) == "EmptyDetector") then { dayz_traps_active select (dayz_traps_trigger find (_this select 1)) } else { _this select 1 };
_args = if (count _this > 2) then { _this select 2 } else { [] };
_args = if (count _this > 2) then { _this select 2 } else { [objNull] };
switch (_event) do {
case "init": {

View File

@@ -51,7 +51,7 @@ _remove = {
_trigger = {
if (isServer) then {
private ["_entity"];
private "_entity";
_entity = _this select 0;
[nil,_trap,rSAY,["z_trap_trigger_0",60]] call RE;
@@ -68,7 +68,7 @@ _trigger = {
private ["_event", "_trap", "_args"];
_event = _this select 0;
_trap = if (typeOf (_this select 1) == "EmptyDetector") then { dayz_traps_active select (dayz_traps_trigger find (_this select 1)) } else { _this select 1 };
_args = if (count _this > 2) then { _this select 2 } else { [] };
_args = if (count _this > 2) then { _this select 2 } else { [objNull] };
switch (_event) do {
case "init": {

View File

@@ -51,7 +51,7 @@ _remove = {
_trigger = {
//if (isServer) then {
private ["_entity"];
private "_entity";
_entity = _this select 0;
[nil,_trap,rSAY,["z_trap_trigger_0",60]] call RE;
@@ -68,7 +68,7 @@ _trigger = {
private ["_event", "_trap", "_args"];
_event = _this select 0;
_trap = if (typeOf (_this select 1) == "EmptyDetector") then { dayz_traps_active select (dayz_traps_trigger find (_this select 1)) } else { _this select 1 };
_args = if (count _this > 2) then { _this select 2 } else { [] };
_args = if (count _this > 2) then { _this select 2 } else { [objNull] };
switch (_event) do {
case "init": {