mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 04:02:37 +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
|
DayZ Epoch anti wall
|
||||||
Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com.
|
Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private ["_vehicle","_vehiclePos","_playerPos","_activated","_id","_intersectsWith"];
|
private ["_vehicle","_vehiclePos","_playerPos","_activated","_id","_intersectsWith"];
|
||||||
|
|
||||||
_activated = false;
|
_activated = false;
|
||||||
_vehicle = _this;
|
_vehicle = _this;
|
||||||
|
|
||||||
|
// position usually the drivers head area
|
||||||
_vehiclePos = aimpos _vehicle;
|
_vehiclePos = aimpos _vehicle;
|
||||||
|
|
||||||
|
// works best for this type of check on players
|
||||||
_playerPos = visiblePositionASL player;
|
_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];
|
_playerPos set [2,(_playerPos select 2)+1];
|
||||||
|
|
||||||
|
// Look for any intersecting objects
|
||||||
_intersectsWith = lineIntersectsWith [_playerPos, _vehiclePos, player, _vehicle];
|
_intersectsWith = lineIntersectsWith [_playerPos, _vehiclePos, player, _vehicle];
|
||||||
|
|
||||||
if ((count _intersectsWith) > 0) then {
|
if ((count _intersectsWith) > 0) then {
|
||||||
{
|
{
|
||||||
//diag_log format ["DEBUG: AntiWall: %1", (typeOf _x)];
|
// buildings
|
||||||
//diag_log format ["DEBUG: AntiWall2: %1", _x];
|
|
||||||
if (_x isKindOf "Building" or _x isKindOf "DZE_Housebase") exitWith {
|
if (_x isKindOf "Building" or _x isKindOf "DZE_Housebase") exitWith {
|
||||||
_activated = true;
|
_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;
|
_activated = true;
|
||||||
};
|
};
|
||||||
} forEach _intersectsWith;
|
} forEach _intersectsWith;
|
||||||
|
};
|
||||||
|
|
||||||
if(_activated) then {
|
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{
|
// this method is said to be faster than switch, lets try it.
|
||||||
case ((_vehicle emptyPositions "driver") > 0):
|
call {
|
||||||
{
|
if (DZE_AntiWallCounter == DZE_AntiWallLimit) exitWith {
|
||||||
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"];
|
cutText [(localize "str_epoch_player_9"), "PLAIN DOWN"];
|
||||||
_id = [player,"crushed"] spawn player_death;
|
_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;
|
DZE_HaloJump = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if(isNil "DZE_AntiWallLimit") then {
|
||||||
|
DZE_AntiWallLimit = 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
DZE_AntiWallCounter = 0;
|
||||||
|
|
||||||
DZE_FreshSpawn = false;
|
DZE_FreshSpawn = false;
|
||||||
|
|
||||||
DZE_myHaloVehicle = objNull;
|
DZE_myHaloVehicle = objNull;
|
||||||
|
|||||||
@@ -3010,13 +3010,13 @@
|
|||||||
<Czech></Czech>
|
<Czech></Czech>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_EPOCH_PLAYER_36">
|
<Key ID="STR_EPOCH_PLAYER_36">
|
||||||
<Original>No recent Deaths.</Original>
|
<Original>\n\nNo recent Deaths.</Original>
|
||||||
<English>No recent Deaths.</English>
|
<English>\n\nNo recent Deaths.</English>
|
||||||
<German></German>
|
<German></German>
|
||||||
<Russian>Нет последних смертей.</Russian>
|
<Russian>\n\nНет последних смертей.</Russian>
|
||||||
<Spanish></Spanish>
|
<Spanish></Spanish>
|
||||||
<Dutch>Niet recent doodgegaan.</Dutch>
|
<Dutch>\n\nNiet recent doodgegaan.</Dutch>
|
||||||
<French>Pas de décès récents.</French>
|
<French>\n\nPas de décès récents.</French>
|
||||||
<Czech></Czech>
|
<Czech></Czech>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_EPOCH_PLAYER_37">
|
<Key ID="STR_EPOCH_PLAYER_37">
|
||||||
|
|||||||
Reference in New Issue
Block a user