Jump to content

Encroachment Checker for Sky Platforms


Rufus Darkfold
 Share

You are about to reply to a thread that has been inactive for 4530 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

The following is submitted in the interest of helping us all be good neighbors.   It is easy to encroach by accident when one is building in the sky and cannot see property lines.   This can lead to annoyed neighbors, parts of the build getting returned, and  ARs.

This script checks the bounding box to ensure that it is entirely contained in one parcel, and reports any encroachment on other parcels by chat.   If the object crosses a sim, that is reported by chat, and the portion in the adjacent sim is not checked for encroachment.

When the object is moved or resized or clicked on, it is checked again.   It may be necessary to click after moving the object, since the moving_end event does not always fire.

This script could be removed from the platform once it is sized and placed, if it is not expected to be moved again.

A more elaborate encroachment checker is included in the platforms rezzed by primcontrol

/// Check for encroachment on other parcels on move or resize.

list details;
vector newsize;
vector newpos;
rotation newrot;
float fudge = .05; // bounding box seems to be .1x.1 bigger than the object

// Returns parcel ID for current location (region coordinates)
// The rest of the "details" list is also used for reporting
key parcelid(vector pos)
{
    details = llGetParcelDetails(pos, [PARCEL_DETAILS_ID, PARCEL_DETAILS_NAME, PARCEL_DETAILS_OWNER, PARCEL_DETAILS_GROUP]);
    return llList2Key(details,0);
}

// Is this object encroaching on another parcel?
check_encroach()
{
    integer encroached = 0;
    list boundbox = llGetBoundingBox(llGetKey());
    newpos = llGetRootPosition();
    newrot = llGetRootRotation();
    vector lo = llList2Vector(boundbox,0);
    vector hi = llList2Vector(boundbox,1);    
    llOwnerSay("Bounding Box is " + (string)(lo) + " to " + (string)(hi));
    lo = newpos + (lo * newrot);
    hi = newpos + (hi * newrot);
    float t;
    if (lo.x > hi.x) {t = lo.x; lo.x = hi.x; hi.x = t;}
    if (lo.y > hi.y) {t = lo.y; lo.y = hi.y; hi.y = t;}
    if (lo.z > hi.z) {t = lo.z; lo.z = hi.z; hi.z = t;}
    llOwnerSay("Bounding Box is " + (string)(lo) + " to " + (string)(hi));
    lo.x = (float)((llFloor(lo.x + fudge) / 4) * 4); // round down to next lower multiple of 4
    lo.y = (float)((llFloor(lo.y + fudge) / 4 ) * 4); // round down to next lower multiple of 4
    hi.x = (float)(llCeil((hi.x - fudge) / 4 ) * 4); // round down to next lower multiple of 4
    hi.y = (float)(llCeil((hi.y - fudge) / 4 ) * 4); // round down to next lower multiple of 4
    llOwnerSay("Checking from " + (string)lo + " to " + (string)hi);
    key thisid = parcelid(newpos);
    if (llList2Key(details, 2) == llGetOwner()) {
        llOwnerSay("You own this land");
    } else if (llSameGroup(llList2Key(details, 3))) {
        llOwnerSay("You are a member of the group secondlife:///app/group/" + llList2String(details, 3) + "/about");
    } else {
        llOwnerSay("You are neither the owner nor a group member.  Your build might be returned");
    }
    if ((lo.x < 0.0)||(hi.x > 256.0)||(lo.y < 0.0)||(hi.y > 256.0)) {
        llOwnerSay((string)newpos + " crosses a sim boundary");
        encroached++;
    }
    vector p;
    
    for (p.x = lo.x; p.x < hi.x; p.x += 4.0) {
        for (p.y = lo.y; p.y < hi.y; p.y += 4.0) {
            if (parcelid(p) != thisid) {
                encroached++;
                llOwnerSay("Encroaches @" + (string)p + " on " + llList2String(details,1) +
                           " owned by secondlife:///app/agent/" + llList2String(details,2) + "/about" );
            }
        }
    }
    if (!encroached) {
        llOwnerSay("Entirely contained in parcel " + llList2String(details, 1));
    }
}


// Call it whenever we move or resize or get touched.
// Note that the moving_end event doesn't always fire.  Touch to check if it doesn't.
                                                                                 
default
{
    state_entry()
    {
        check_encroach();
    }
    
    on_rez(integer start)
    {
        check_encroach();
    }
    
    moving_end()
    {
        check_encroach();
    }
   
    changed(integer what)
    {
        if (what & CHANGED_SCALE) {
           check_encroach();
        }
    }
    
    touch_end(integer num)
    {
        check_encroach();
    }
}

updated for better accuracy at the margins.

updated to account for root prim rotation.

Link to comment
Share on other sites

That is a very cool script! I just checked it out. Thank you.

One thing to note - it only checks the bounding box of the prim the script is in. If this is in the root prim of a linked skybox, for example, it can't detect if the other linked parts of the skybox extend past the parcel edges. I tested this by linking two prims, putting this script in the root, and then streached the non-root prim over the parcel edge. The script fired off with the change, but still said it was entirely within my parcel.

It would be very cool if this checked the bounding box of the complete linkset, and not just the prim it was in.

Link to comment
Share on other sites


Jacki Silverfall wrote:

Why not just build it on your property then send it up? :matte-motes-nerdy:

Yeah.

First thing I do when I get land, rez a prim at ground, size it to the land, put the free NCI grid texture on it so it has gridlines every 1m, name it 'build platform' if I remember, and then raise it to an empty area in the sky.

If I ever need to check if something I have or a neighbor has encroaches, I just pass this prim through the height of the respective build. It should fully encase my build, and never touch anyone else's.

- easy as can be.

 

Link to comment
Share on other sites

Yes, the second version works correctly for linksets. Thank you very much for sharing this script!

My own practice is to place a tall, slender prim cylinder on the ground, at the corners and mid-point edges of the parcel, and then send those prims to the altitude I intend to build at. They then form a visible "fence" at the property edges, up in the sky.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4530 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...