snap optimization for large bases

This commit is contained in:
raymix
2014-07-17 20:00:26 +01:00
parent 077da12271
commit 95077f35f8
2 changed files with 17 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ class SnapBuilding {
"BagFenceRound_DZ",
"Fort_RazorWire"
};
radius = 5;
};
//snap points
class Land_HBarrier5Preview: Barrier{ //fix for broken offsets in ghost
@@ -122,6 +123,7 @@ class SnapBuilding {
"CinderWallDoorSmall_DZ",
"MetalFloor_DZ"
};
radius = 5;
};
class WoodFloorQuarter_Preview_DZ: FloorsWallsStairs { //fix for broken offsets in ghost
@@ -171,6 +173,7 @@ class SnapBuilding {
{-2.45,0,0.130,"Left"},
{2.45,0,0.130,"Right"}
};
radius = 10;
};
class WoodFloor_DZ: WoodFloor_Preview_DZ{};
@@ -243,6 +246,7 @@ class SnapBuilding {
{2.752, 0, 1.5,"Right"},
{0, 0, 3.37042,"Top"}
};
radius = 5;
};
class CinderWall_Preview_DZ: Cinder_DZE {};
class CinderWallDoorway_Preview_DZ: Cinder_DZE {};
@@ -279,6 +283,7 @@ class SnapBuilding {
{-2.64, 0, 0.009,"Left"},
{2.64, 0, 0.009,"Right"}
};
radius = 10;
};
class MetalFloor_DZ: FloorsWallsStairs{
points[] = {
@@ -288,6 +293,7 @@ class SnapBuilding {
{-2.64, 0, 0.15,"Left"},
{2.64, 0, 0.15,"Right"}
};
radius = 10;
};
@@ -296,6 +302,7 @@ class SnapBuilding {
snapTo[] = {
"WoodCrate_DZ"
};
radius = 5;
points[] = {
{0,0,0,"Pivot"},
{0,-0.47,0,"Back"},
@@ -310,6 +317,7 @@ class SnapBuilding {
snapTo[] = {
"MetalPanel_DZ"
};
radius = 5;
points[] = {
{0,0,0,"Pivot"},
{-1.5,0,0,"Left"},
@@ -321,6 +329,7 @@ class SnapBuilding {
snapTo[] = {
"MetalGate_DZ"
};
radius = 5;
points[] = {
{0,0,0,"Pivot"},
{-4.1,0,0,"Left"}
@@ -331,6 +340,7 @@ class SnapBuilding {
snapTo[] = {
"StickFence_DZ"
};
radius = 5;
points[] = {
{0,0,0,"Pivot"},
{-2.95,0,0.3,"Left"},
@@ -342,6 +352,7 @@ class SnapBuilding {
snapTo[] = {
"Fence_corrugated_DZ"
};
radius = 5;
points[] = {
{0,0,0,"Pivot"},
{-1.95,0,0.88,"Left"},
@@ -353,6 +364,7 @@ class SnapBuilding {
snapTo[] = {
"WoodRamp_DZ"
};
radius = 5;
points[] = {
{0,0,0,"Pivot"},
{0.65,-1.7,1.2,"Back"},
@@ -366,6 +378,7 @@ class SnapBuilding {
snapTo[] = {
"WoodLadder_DZ"
};
radius = 5;
points[] = {
{0,0,0,"Pivot"},
{-0.4,0,1.725,"Left"},
@@ -379,6 +392,7 @@ class SnapBuilding {
"VaultStorageLocked",
"VaultStorage"
};
radius = 5;
points[] = {
{0,0,0,"Pivot"},
{0,0.284,0.615,"Back"},

View File

@@ -3,7 +3,7 @@
// July 10 2014 //
/*--------------------------------*/
private ["_object","_objectSnapGizmo","_objColorActive","_objColorInactive","_classname","_whitelist","_points","_cfg","_cnt","_pos","_findWhitelisted","_nearbyObject","_posNearby","_selectedAction","_newPos","_pointsNearby","_onWater"];
private ["_object","_objectSnapGizmo","_objColorActive","_objColorInactive","_classname","_whitelist","_points","_radius","_cfg","_cnt","_pos","_findWhitelisted","_nearbyObject","_posNearby","_selectedAction","_newPos","_pointsNearby","_onWater"];
//Args
snapActionState = _this select 3 select 0;
_object = _this select 3 select 1;
@@ -15,6 +15,7 @@ _selectedAction = _this select 3 select 4;
_cfg = (configFile >> "SnapBuilding" >> _classname);
_whitelist = getArray (_cfg >> "snapTo");
_points = getArray (_cfg >> "points");
_radius = getNumber (_cfg >> "radius");
//colors
_objColorActive = "#(argb,8,8,3)color(0,0.92,0.06,1,ca)";
@@ -58,7 +59,7 @@ fnc_initSnapPoints = {
fnc_initSnapPointsNearby = {
_pos = getPosATL _object;
_findWhitelisted = []; _pointsNearby = [];
_findWhitelisted = nearestObjects [_pos,_whitelist,10]-[_object];
_findWhitelisted = nearestObjects [_pos,_whitelist,_radius]-[_object];
snapGizmosNearby = [];
{
_nearbyObject = _x;