Skip to content

v4.0.0: modernized API#84

Open
Froredion wants to merge 4 commits into1ForeverHD:mainfrom
Froredion:main
Open

v4.0.0: modernized API#84
Froredion wants to merge 4 commits into1ForeverHD:mainfrom
Froredion:main

Conversation

@Froredion
Copy link

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
Copy link
Author

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

@1ForeverHD
Copy link
Owner

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

@imezx
Copy link
Contributor

imezx commented Oct 19, 2025

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.

@Froredion
Copy link
Author

Froredion commented Oct 19, 2025

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.

revert if this did not fix the issue.
@imezx
Copy link
Contributor

imezx commented Oct 21, 2025

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.

@Froredion
Copy link
Author

Got it, will do the edit soon.

@AstaWasTaken
Copy link

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

@Froredion
Copy link
Author

I am the creator of Superbullet.

- added a tester for zone destroying
- improved code maintainability
- added selene.toml for people who wants to contribute and has selene installed
@Froredion
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants