diff --git a/SQF/dayz_code/compile/player_antiWall.sqf b/SQF/dayz_code/compile/player_antiWall.sqf index f922fa65d..e19e257a1 100644 --- a/SQF/dayz_code/compile/player_antiWall.sqf +++ b/SQF/dayz_code/compile/player_antiWall.sqf @@ -2,57 +2,71 @@ DayZ Epoch anti wall Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com. */ - private ["_vehicle","_vehiclePos","_playerPos","_activated","_id","_intersectsWith"]; + _activated = false; _vehicle = _this; +// position usually the drivers head area _vehiclePos = aimpos _vehicle; + +// works best for this type of check on players _playerPos = visiblePositionASL player; + +// ignore if distance is too far +if((_playerPos distance _vehiclePos) < 10) exitWith {}; + +// Important! without this we looking at the players feet this gets us torso area _playerPos set [2,(_playerPos select 2)+1]; +// Look for any intersecting objects _intersectsWith = lineIntersectsWith [_playerPos, _vehiclePos, player, _vehicle]; - if ((count _intersectsWith) > 0) then { { - //diag_log format ["DEBUG: AntiWall: %1", (typeOf _x)]; - //diag_log format ["DEBUG: AntiWall2: %1", _x]; + // buildings if (_x isKindOf "Building" or _x isKindOf "DZE_Housebase") exitWith { _activated = true; }; - if (["wall_", str _x, false] call fnc_inString) exitWith { + // walls + if ((typeOf _x) == "" and {["wall_", str _x, false] call fnc_inString}) exitWith { _activated = true; }; } forEach _intersectsWith; - - if(_activated) then { - // limit distance just incase - if((_playerPos distance _vehiclePos) < 10) then { - //diag_log format["Player Wall glitched %1 - player: %2 vehicle:%3", player,_playerPos,_vehiclePos]; - - switch(true)do{ - case ((_vehicle emptyPositions "driver") > 0): - { - player action ["getInDriver", _vehicle]; - }; - case ((_vehicle emptyPositions "gunner") > 0): - { - player action ["GetInGunner", _vehicle]; - }; - case ((_vehicle emptyPositions "commander") > 0): - { - player action ["GetInCommander", _vehicle]; - }; - case ((_vehicle emptyPositions "cargo") > 0): - { - player action ["GetInCargo", _vehicle]; - }; - default - { - cutText [(localize "str_epoch_player_9"), "PLAIN DOWN"]; - _id = [player,"crushed"] spawn player_death; - }; - }; - }; - }; }; + +if(_activated) then { + + // this method is said to be faster than switch, lets try it. + call { + if (DZE_AntiWallCounter == DZE_AntiWallLimit) exitWith { + cutText [(localize "str_epoch_player_9"), "PLAIN DOWN"]; + _id = [player,"crushed"] spawn player_death; + }; + if ((_vehicle emptyPositions "driver") > 0) exitWith { + cutText ["Another object is blocking the vehicle exit.", "PLAIN DOWN"]; + player action ["getInDriver", _vehicle]; + DZE_AntiWallCounter = DZE_AntiWallCounter + 1; + }; + if ((_vehicle emptyPositions "gunner") > 0) exitWith { + cutText ["Another object is blocking the vehicle exit.", "PLAIN DOWN"]; + player action ["GetInGunner", _vehicle]; + DZE_AntiWallCounter = DZE_AntiWallCounter + 1; + }; + if ((_vehicle emptyPositions "commander") > 0) exitWith { + cutText ["Another object is blocking the vehicle exit.", "PLAIN DOWN"]; + player action ["getInCommander", _vehicle]; + DZE_AntiWallCounter = DZE_AntiWallCounter + 1; + }; + if ((_vehicle emptyPositions "cargo") > 0) exitWith { + cutText ["Another object is blocking the vehicle exit.", "PLAIN DOWN"]; + player action ["getInCargo", _vehicle]; + DZE_AntiWallCounter = DZE_AntiWallCounter + 1; + }; + // kill player if none of the above are matched + cutText [(localize "str_epoch_player_9"), "PLAIN DOWN"]; + _id = [player,"crushed"] spawn player_death; + }; + +} else { + DZE_AntiWallCounter = 0; +}; \ No newline at end of file diff --git a/SQF/dayz_code/init/variables.sqf b/SQF/dayz_code/init/variables.sqf index 48c36e164..31c7fa554 100644 --- a/SQF/dayz_code/init/variables.sqf +++ b/SQF/dayz_code/init/variables.sqf @@ -648,6 +648,12 @@ if(!isDedicated) then { DZE_HaloJump = true; }; + if(isNil "DZE_AntiWallLimit") then { + DZE_AntiWallLimit = 1; + }; + + DZE_AntiWallCounter = 0; + DZE_FreshSpawn = false; DZE_myHaloVehicle = objNull; diff --git a/SQF/dayz_epoch_b/stringtable.xml b/SQF/dayz_epoch_b/stringtable.xml index 0ebff0b2c..8197fbc33 100644 --- a/SQF/dayz_epoch_b/stringtable.xml +++ b/SQF/dayz_epoch_b/stringtable.xml @@ -3010,13 +3010,13 @@ - No recent Deaths. - No recent Deaths. + \n\nNo recent Deaths. + \n\nNo recent Deaths. - Нет последних смертей. + \n\nНет последних смертей. - Niet recent doodgegaan. - Pas de décès récents. + \n\nNiet recent doodgegaan. + \n\nPas de décès récents.