mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-13 19:52:38 +03:00
player anti wall v2 now with counter/limt and more comments
This commit is contained in:
@@ -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;
|
||||
};
|
||||
@@ -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;
|
||||
|
||||
@@ -3010,13 +3010,13 @@
|
||||
<Czech></Czech>
|
||||
</Key>
|
||||
<Key ID="STR_EPOCH_PLAYER_36">
|
||||
<Original>No recent Deaths.</Original>
|
||||
<English>No recent Deaths.</English>
|
||||
<Original>\n\nNo recent Deaths.</Original>
|
||||
<English>\n\nNo recent Deaths.</English>
|
||||
<German></German>
|
||||
<Russian>Нет последних смертей.</Russian>
|
||||
<Russian>\n\nНет последних смертей.</Russian>
|
||||
<Spanish></Spanish>
|
||||
<Dutch>Niet recent doodgegaan.</Dutch>
|
||||
<French>Pas de décès récents.</French>
|
||||
<Dutch>\n\nNiet recent doodgegaan.</Dutch>
|
||||
<French>\n\nPas de décès récents.</French>
|
||||
<Czech></Czech>
|
||||
</Key>
|
||||
<Key ID="STR_EPOCH_PLAYER_37">
|
||||
|
||||
Reference in New Issue
Block a user