Detecting oil rig crate being hacked?

Hi,

I've come up with a solution for detecting when the oil rig crate is being hacked, and wondered if anyone else had any ideas that might work better than mine?

It's simply this:

void OnCrateHack(HackableLockedCrate crate)
{
    Vector3 cratePos = crate.transform.position;
    if (Vector3Ex.Distance2D(CH47LandingZone.GetClosest(cratePos), cratePos) < 50f)
        Puts("Oil rig crate being hacked");
}

It calculates the distance from the crate to the helipad landing zone, if it is less than 50 then it's a crate that's on the oil rig being hacked. Or at least almost always likely.

Distances from oil rig crates to landing zones:
Small oil rig: 11.69496f
Large oil rig: 41.63598f

The distance to the bottom of each oil rig is about 45f.

This is a pretty solid way to determine if it is the oil rig crate being hacked as I couldn't find any way to specifically identify the crate.

Does anyone have anything better than this? If not I'll just go with it.

Looks pretty concise to me.  There can't be too many landing zones for the Chinook, so it's probably being done in a very small number of distance checks.

You could also grab the locations of both oil rig monuments when the plugin loads, and compare against those.  Slightly less checking.
Zugzwang
Looks pretty concise to me.  There can't be too many landing zones for the Chinook, so it's probably being done in a very small number of distance checks.

You could also grab the locations of both oil rig monuments when the plugin loads, and compare against those.  Slightly less checking.

There are exactly two landing zones each time I've checked.

I did also check HackableLockedCrate.wasDropped, and all oil rig crates are false and chinook crates true, but if a chinook crate is left until restart, after the restart wasDropped turns to false.

How would I grab the locations of the oil rig monuments?
If there are only two landing zones, then there's no need to look for the oil rig monuments.  Two distance checks is the best case scenario and you have already reached it.

Merged post

I suppose if you looped through CH47LandingZone.landingZones yourself, you might find it in one distance check.  Not much savings but technically better.
Thanks for your input!