Merge pull request #1431 from raymix/master

snap building plotpole / infinite drag fix
This commit is contained in:
vbawol
2014-07-18 13:40:15 -05:00
3 changed files with 45 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{};
@@ -183,6 +186,7 @@ class SnapBuilding {
{-1.73926,0.05,0,"Bottom"}
};
};
class WoodStairs_DZ: Stairs_DZE {};
class WoodStairs_Preview_DZ: Stairs_DZE {};
class WoodStairsSans_Preview_DZ: Stairs_DZE {};
class WoodStairsSans_DZ: Stairs_DZE {};
@@ -203,6 +207,7 @@ class SnapBuilding {
class WoodSmallWallWin_DZ: WoodSmall_DZE {};
class Land_DZE_WoodDoor: WoodSmall_DZE {};
class Land_DZE_WoodDoorLocked: WoodSmall_DZE {};
class WoodDoor_Preview_DZ: WoodSmall_DZE{};
class WoodLarge_DZE: FloorsWallsStairs { //Large wood walls
points[] = {
@@ -241,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 {};
@@ -277,6 +283,7 @@ class SnapBuilding {
{-2.64, 0, 0.009,"Left"},
{2.64, 0, 0.009,"Right"}
};
radius = 10;
};
class MetalFloor_DZ: FloorsWallsStairs{
points[] = {
@@ -286,6 +293,7 @@ class SnapBuilding {
{-2.64, 0, 0.15,"Left"},
{2.64, 0, 0.15,"Right"}
};
radius = 10;
};
@@ -294,6 +302,7 @@ class SnapBuilding {
snapTo[] = {
"WoodCrate_DZ"
};
radius = 5;
points[] = {
{0,0,0,"Pivot"},
{0,-0.47,0,"Back"},
@@ -308,6 +317,7 @@ class SnapBuilding {
snapTo[] = {
"MetalPanel_DZ"
};
radius = 5;
points[] = {
{0,0,0,"Pivot"},
{-1.5,0,0,"Left"},
@@ -319,6 +329,7 @@ class SnapBuilding {
snapTo[] = {
"MetalGate_DZ"
};
radius = 5;
points[] = {
{0,0,0,"Pivot"},
{-4.1,0,0,"Left"}
@@ -329,6 +340,7 @@ class SnapBuilding {
snapTo[] = {
"StickFence_DZ"
};
radius = 5;
points[] = {
{0,0,0,"Pivot"},
{-2.95,0,0.3,"Left"},
@@ -340,6 +352,7 @@ class SnapBuilding {
snapTo[] = {
"Fence_corrugated_DZ"
};
radius = 5;
points[] = {
{0,0,0,"Pivot"},
{-1.95,0,0.88,"Left"},
@@ -351,6 +364,7 @@ class SnapBuilding {
snapTo[] = {
"WoodRamp_DZ"
};
radius = 5;
points[] = {
{0,0,0,"Pivot"},
{0.65,-1.7,1.2,"Back"},
@@ -364,6 +378,7 @@ class SnapBuilding {
snapTo[] = {
"WoodLadder_DZ"
};
radius = 5;
points[] = {
{0,0,0,"Pivot"},
{-0.4,0,1.725,"Left"},
@@ -377,6 +392,7 @@ class SnapBuilding {
"VaultStorageLocked",
"VaultStorage"
};
radius = 5;
points[] = {
{0,0,0,"Pivot"},
{0,0.284,0.615,"Back"},

View File

@@ -385,6 +385,32 @@ if (isClass (configFile >> "SnapBuilding" >> _classname)) then {
detach _objectHelper;
deleteVehicle _objectHelper;
};
if(_IsNearPlot == 0 && !_isPole) then {
_findNearestPoles = nearestObjects [_objectHelper, ["Plastic_Pole_EP1_DZ"], 30];
_nearestPole = _findNearestPoles select 0;
_objectHelperPos = getPosATL _objectHelper;
if (_objectHelperPos distance _nearestPole < 30) exitWith {
_isOk = false;
_cancel = true;
_reason = "You cannot enter plot pole area while building is in progress";
detach _object;
deleteVehicle _object;
detach _objectHelper;
deleteVehicle _objectHelper;
};
};
if(_location1 distance _objectHelperPos > 10) exitWith {
_isOk = false;
_cancel = true;
_reason = "Object is placed to far away from where you started building (within 10 meters)";
detach _object;
deleteVehicle _object;
detach _objectHelper;
deleteVehicle _objectHelper;
};
if(abs(_objHDiff) > 10) exitWith {
_isOk = false;

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;