mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-13 19:52:38 +03:00
Updated Vanilla Buildables collision Checks.
Vanilla development commit:
8e2953ab67
This commit is contained in:
@@ -157,6 +157,8 @@ _maxElevation = {
|
|||||||
_r
|
_r
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//Collision system replaced.
|
||||||
|
/*
|
||||||
//Is the placed object inside another object
|
//Is the placed object inside another object
|
||||||
_insideCheck = {
|
_insideCheck = {
|
||||||
private ["_bbb","_building","_ubb","_unit","_check","_min","_max","_myX","_p","_myY"];
|
private ["_bbb","_building","_ubb","_unit","_check","_min","_max","_myX","_p","_myY"];
|
||||||
@@ -189,38 +191,22 @@ _insideCheck = {
|
|||||||
|
|
||||||
false
|
false
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
//check if building being placed and objects around placement is free to be built on.
|
//check if building being placed and objects around placement is free to be built on.
|
||||||
//Fence owners must build all the foundations by one player anyone can still upgrade (pending lock build level)
|
//Fence owners must build all the foundations by one player anyone can still upgrade (pending lock build level)
|
||||||
_checkBuildingCollision = {
|
_checkBuildingCollision =
|
||||||
_objColliding = objNull;
|
|
||||||
{
|
{
|
||||||
_inside = false;
|
_objColliding = objNull;
|
||||||
_ownerID = _x getVariable ["ownerArray",[]];
|
local _wall = _object isKindOf "DZ_buildables";
|
||||||
|
|
||||||
if (count _ownerID > 0) then { _ownerID = _ownerID select 0; } else { _ownerID = (getPlayerUID player); };
|
{
|
||||||
|
if (!(isNull _x || { _x == player || _x == _object}) && { !(_wall && { _x isKindOf "DZ_buildables" && { _x getVariable ["ownerArray", [""]] select 0 == getPlayerUID player } }) && { [_object, _x] call fn_collisions } }) exitWith
|
||||||
if (_object in ["WoodenFence_ghost","MetalFence_ghost","WoodenGate_ghost","MetalGate_ghost"]) then {};
|
{
|
||||||
|
_objColliding = _x;
|
||||||
if(_ownerID != (getPlayerUID player)) then {
|
|
||||||
if ((!isNull _x) and (!(_x == player)) and (!(_x == _object)) ) then {
|
|
||||||
if ((_x isKindOf "Building") or (_x isKindOf "AllVehicles")) then {
|
|
||||||
//_inside = [_object, _x] call _insideCheck;
|
|
||||||
_inside = [_object, _x] call fn_collisions;
|
|
||||||
|
|
||||||
if (!_inside) then {
|
|
||||||
//_inside = [_x, _object] call _insideCheck;
|
|
||||||
_inside = [_x, _object] call fn_collisions;
|
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
};
|
foreach nearestObjects [_object, ["AllVehicles", "Building", "DZ_buildables"], 35];
|
||||||
};
|
|
||||||
|
|
||||||
if (_inside) exitWith { _objColliding = _x; };
|
|
||||||
} forEach (nearestObjects [_object, ["Building", "Air", "LandVehicle", "Ship", "DZ_buildables"], 35]);
|
|
||||||
|
|
||||||
(!isNull _objColliding)
|
|
||||||
// _objColliding contains the building that collides with the ghost object
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//Is placement on a road?
|
//Is placement on a road?
|
||||||
@@ -325,6 +311,8 @@ while {r_action_count != 0 and Dayz_constructionContext select 4} do {
|
|||||||
|
|
||||||
// check now that ghost is not colliding
|
// check now that ghost is not colliding
|
||||||
call _checkBuildingCollision;
|
call _checkBuildingCollision;
|
||||||
|
|
||||||
|
diag_log format ["_objColliding: %1", _objColliding];
|
||||||
};
|
};
|
||||||
|
|
||||||
// try to dock a beam from current ghost to another beams nearby
|
// try to dock a beam from current ghost to another beams nearby
|
||||||
|
|||||||
Reference in New Issue
Block a user