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,8 +157,10 @@ _maxElevation = {
|
||||
_r
|
||||
};
|
||||
|
||||
//Is the placed object inside another object
|
||||
_insideCheck = {
|
||||
//Collision system replaced.
|
||||
/*
|
||||
//Is the placed object inside another object
|
||||
_insideCheck = {
|
||||
private ["_bbb","_building","_ubb","_unit","_check","_min","_max","_myX","_p","_myY"];
|
||||
|
||||
_building = _this select 0;
|
||||
@@ -188,39 +190,23 @@ _insideCheck = {
|
||||
if (call _check) exitWith {true};
|
||||
|
||||
false
|
||||
};
|
||||
};
|
||||
*/
|
||||
|
||||
//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)
|
||||
_checkBuildingCollision = {
|
||||
_checkBuildingCollision =
|
||||
{
|
||||
_objColliding = objNull;
|
||||
local _wall = _object isKindOf "DZ_buildables";
|
||||
|
||||
{
|
||||
_inside = false;
|
||||
_ownerID = _x getVariable ["ownerArray",[]];
|
||||
|
||||
if (count _ownerID > 0) then { _ownerID = _ownerID select 0; } else { _ownerID = (getPlayerUID player); };
|
||||
|
||||
if (_object in ["WoodenFence_ghost","MetalFence_ghost","WoodenGate_ghost","MetalGate_ghost"]) then {};
|
||||
|
||||
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;
|
||||
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
|
||||
{
|
||||
_objColliding = _x;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
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
|
||||
}
|
||||
foreach nearestObjects [_object, ["AllVehicles", "Building", "DZ_buildables"], 35];
|
||||
};
|
||||
|
||||
//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
|
||||
call _checkBuildingCollision;
|
||||
|
||||
diag_log format ["_objColliding: %1", _objColliding];
|
||||
};
|
||||
|
||||
// try to dock a beam from current ghost to another beams nearby
|
||||
|
||||
Reference in New Issue
Block a user