ZonePlus icon indicating copy to clipboard operation
ZonePlus copied to clipboard

v4.0.0: modernized API

Open Froredion opened this issue 2 months ago • 6 comments

Added

  • Zone.fromBox(cframe, size) - Creates optimized box-shaped zones using GetPartBoundsInBox
  • Zone.fromSphere(position, radius) - Creates optimized spherical zones using GetPartBoundsInRadius
  • Zone:setZoneShape(enumIdOrName) - Allows manual control over spatial query method
  • ZoneShape enum with options: Auto, Box, Sphere
  • Modern OverlapParams management with automatic reuse for better performance
  • Comprehensive documentation on spatial query API usage

Changed

  • BREAKING: Replaced deprecated Region3 with modern CFrame + Size approach
    • zone.region is now split into zone.regionCFrame and zone.regionSize
    • zone.exactRegion is now zone.exactRegionCFrame and zone.exactRegionSize
  • Updated all FilterType.Whitelist/Blacklist to modern FilterType.Include/Exclude
  • Optimized OverlapParams reuse throughout the codebase
  • Enhanced spatial query method selection based on zone geometry
  • Improved README with modern API comparison and performance tips

Froredion avatar Oct 06 '25 21:10 Froredion

PS: I have an automated formatter, so it unnecessarily realigned many of the source files.

Froredion avatar Oct 06 '25 21:10 Froredion

Many thanks for the Pull Request @Froredion, it looks like a collection of fantastic improvements, and I'm excited to fully dive in and review once a few other projects are wrapped up in 2026

1ForeverHD avatar Oct 07 '25 13:10 1ForeverHD

so i tested it in live game but..

image

its using .fromBox with medium accuracy. im also added table.clear(self) and setmetatable(self, nil) when calling .destroy on zone.

imezx avatar Oct 19 '25 08:10 imezx

When you destroy a zone with table.clear(self) and setmetatable(self, nil), the zone object's properties (like zone.regionCFrame, zone.regionSize) become nil. However, the ZoneController's heartbeat connections might still be running and trying to access these properties before the zone is fully deregistered.

Is this what you mean? If so, I can see why it's happening.

Froredion avatar Oct 19 '25 23:10 Froredion

yeah seems its fixed and i dont think you have to do this:

local occupantsDict = zonesAndOccupants[zone] or {}
local occupantsPresent = false
for k, v in pairs(occupantsDict) do
    occupantsPresent = true
    break
end

it should be:

local occupantsDict = zonesAndOccupants[zone] or {}
local occupantsPresent = next(occupantsDict) ~= nil

also, i dont think if you still have to use pairs(tbl) in 2025.

imezx avatar Oct 21 '25 05:10 imezx

Got it, will do the edit soon.

Froredion avatar Oct 26 '25 05:10 Froredion

This seems fully Ai written, assuming it’s entirely ai since its from superbullet

AstaWasTaken avatar Nov 20 '25 02:11 AstaWasTaken

I am the creator of Superbullet.

Froredion avatar Nov 20 '25 03:11 Froredion

yeah seems its fixed and i dont think you have to do this:

local occupantsDict = zonesAndOccupants[zone] or {}
local occupantsPresent = false
for k, v in pairs(occupantsDict) do
    occupantsPresent = true
    break
end

it should be:

local occupantsDict = zonesAndOccupants[zone] or {}
local occupantsPresent = next(occupantsDict) ~= nil

also, i dont think if you still have to use pairs(tbl) in 2025.

I've added the following:

  • added a tester for zone destroying
  • improved code maintainability (your comments)
  • added selene.toml for people who wants to contribute and has selene installed

I can say that all are now properly tested.

Froredion avatar Nov 20 '25 04:11 Froredion