From 033df1551db584f7836cacfaa445a937ddee2bd5 Mon Sep 17 00:00:00 2001 From: thekingofspace <37231416+thekingofspace@users.noreply.github.com> Date: Mon, 24 Nov 2025 01:21:13 -0800 Subject: [PATCH 1/4] Update .gitignore --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8e4b339..8a7293f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,6 @@ # Roblox Studio lock files /*.rbxlx.lock -/*.rbxl.lock \ No newline at end of file +/*.rbxl.lock + +aftman.toml \ No newline at end of file From 9e2f7eb7d70f34720c447ec42fa8d79d6f12e101 Mon Sep 17 00:00:00 2001 From: thekingofspace <37231416+thekingofspace@users.noreply.github.com> Date: Mon, 24 Nov 2025 01:46:50 -0800 Subject: [PATCH 2/4] Added static typing makes it easier to work with. --- src/Zone/Enum/init.lua | 1 + src/Zone/ZoneController/Tracker.lua | 2 +- src/Zone/ZoneController/init.lua | 5 +- src/Zone/init.lua | 72 ++++++++++++++++++++++++++++- 4 files changed, 75 insertions(+), 5 deletions(-) diff --git a/src/Zone/Enum/init.lua b/src/Zone/Enum/init.lua index a6bda60..ef29929 100644 --- a/src/Zone/Enum/init.lua +++ b/src/Zone/Enum/init.lua @@ -1,3 +1,4 @@ +--!nocheck -- Custom enum implementation that provides an effective way to compare, send -- and store values. Instead of returning a userdata value, enum items return -- their corresponding itemValue (an integer) when indexed. Enum items can diff --git a/src/Zone/ZoneController/Tracker.lua b/src/Zone/ZoneController/Tracker.lua index d3749d9..3839d38 100644 --- a/src/Zone/ZoneController/Tracker.lua +++ b/src/Zone/ZoneController/Tracker.lua @@ -230,7 +230,7 @@ function Tracker:update() -- This creates the whitelist so that self.whitelistParams = OverlapParams.new() - self.whitelistParams.FilterType = Enum.RaycastFilterType.Whitelist + self.whitelistParams.FilterType = Enum.RaycastFilterType.Include self.whitelistParams.MaxParts = #self.parts self.whitelistParams.FilterDescendantsInstances = self.parts end diff --git a/src/Zone/ZoneController/init.lua b/src/Zone/ZoneController/init.lua index 57be585..eeb6aef 100644 --- a/src/Zone/ZoneController/init.lua +++ b/src/Zone/ZoneController/init.lua @@ -1,4 +1,5 @@ -- CONFIG +--!nocheck local WHOLE_BODY_DETECTION_LIMIT = 729000 -- This is roughly the volume where Region3 checks begin to exceed 0.5% in Script Performance @@ -413,7 +414,7 @@ function ZoneController.getTouchingZones(item, onlyActiveZones, recommendedDetec local partToZoneDict = (onlyActiveZones and activePartToZone) or allPartToZone local boundParams = OverlapParams.new() - boundParams.FilterType = Enum.RaycastFilterType.Whitelist + boundParams.FilterType = Enum.RaycastFilterType.Include boundParams.MaxParts = #partsTable boundParams.FilterDescendantsInstances = partsTable @@ -442,7 +443,7 @@ function ZoneController.getTouchingZones(item, onlyActiveZones, recommendedDetec if totalRemainingBoundParts > 0 then local preciseParams = OverlapParams.new() - preciseParams.FilterType = Enum.RaycastFilterType.Whitelist + preciseParams.FilterType = Enum.RaycastFilterType.Include preciseParams.MaxParts = totalRemainingBoundParts preciseParams.FilterDescendantsInstances = boundPartsThatRequirePreciseChecks diff --git a/src/Zone/init.lua b/src/Zone/init.lua index 62de930..a9aac51 100644 --- a/src/Zone/init.lua +++ b/src/Zone/init.lua @@ -1,9 +1,9 @@ -- LOCAL +--!nocheck local players = game:GetService("Players") local runService = game:GetService("RunService") local heartbeat = runService.Heartbeat local localPlayer = runService:IsClient() and players.LocalPlayer -local replicatedStorage = game:GetService("ReplicatedStorage") local httpService = game:GetService("HttpService") local Enum_ = require(script.Enum) local enum = Enum_.enums @@ -871,6 +871,74 @@ function Zone:destroy() end Zone.Destroy = Zone.destroy +export type EnumInstance = { + [string]: number, + getName: (valueOrProperty: any) -> string?, + getValue: (nameOrProperty: any) -> number?, + getProperty: (nameOrValue: any) -> any?, +} + +export type ZoneSignal = { + Connect: (self: ZoneSignal, callback: (T...) -> ()) -> () +} + +export type Zone = { + localPlayerEntered:ZoneSignal<>; + localPlayerExited:ZoneSignal<>; + playerEntered:ZoneSignal; + playerExited:ZoneSignal; + partEntered:ZoneSignal; + partExited:ZoneSignal; + itemEntered:ZoneSignal; + itemExited:ZoneSignal; + + accuracy:EnumInstance; + enterDetection:EnumInstance; + exitDetection:EnumInstance; + autoUpdate:boolean; + respectUpdateQueue:boolean; + zoneParts:{BasePart}; + + + findLocalPlayer:(self:Zone) -> boolean; + findPlayer:(self:Zone, Player:Player) -> boolean; + findPart:(self:Zone, basePart:BasePart) -> (boolean, {Instance}?); -- TODO: Resolve if this does return a aray of instances + findItem:(self:Zone, basePartOrCharacter:Instance) -> (boolean, {Instance}?); + findPoint:(self:Zone, Point:Vector3) -> (boolean, {Instance}?); + getPlayers:(self:Zone) -> {Player}; + getParts:(self:Zone) -> {BasePart}; + getItems:(self:Zone) -> {Instance}; + getRandomPoint:(self:Zone) -> (Vector3, {Instance}); + trackItem:(self:Zone, characterOrBasePart:Model | BasePart) -> nil; -- TODO: solve wether or not this has a return value. + untrackItem:(self:Zone, characterOrBasePart:Model | BasePart) -> nil; -- TODO: solve wether or not this has a return value. + + ---- TODO ADD GROUP THINGS HERE NEED TO DO MORE RESEARCH INTO HOW THEY WORK + + setDetection:(self:Zone, EnumInstance | string) -> nil; + relocate:(self:Zone) -> nil; + onItemEnter:(self:Zone, characterOrBasePart:Model | BasePart, Callback:() -> nil) -> nil; + onItemExit:(self:Zone, characterOrBasePart:Model | BasePart, Callback:() -> nil) -> nil; + destroy:(self:Zone) -> nil; +} + +export type ZonePlus = { + new:(container:Instance) -> Zone; + fromRegion:(CFrame:CFrame, Size:Vector3) -> Zone; + + enum:{ + Detection:{ + WholeBody:EnumInstance; + Centre:EnumInstance + }; + + Accuracy:{ + Low:EnumInstance; + Medium:EnumInstance; + High:EnumInstance; + Precise:EnumInstance + } + } +} -return Zone +return Zone::ZonePlus From 128ba1ff3e02ebd53a1e639113c637f79523063a Mon Sep 17 00:00:00 2001 From: thekingofspace <37231416+thekingofspace@users.noreply.github.com> Date: Mon, 24 Nov 2025 01:48:52 -0800 Subject: [PATCH 3/4] Update init.lua --- src/Zone/init.lua | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/src/Zone/init.lua b/src/Zone/init.lua index a9aac51..3420caa 100644 --- a/src/Zone/init.lua +++ b/src/Zone/init.lua @@ -871,18 +871,26 @@ function Zone:destroy() end Zone.Destroy = Zone.destroy -export type EnumInstance = { - [string]: number, - - getName: (valueOrProperty: any) -> string?, - getValue: (nameOrProperty: any) -> number?, - getProperty: (nameOrValue: any) -> any?, -} +export type EnumInstance = number export type ZoneSignal = { Connect: (self: ZoneSignal, callback: (T...) -> ()) -> () } +export type Enumerators = { + Detection:{ + WholeBody:EnumInstance; + Centre:EnumInstance + }; + + Accuracy:{ + Low:EnumInstance; + Medium:EnumInstance; + High:EnumInstance; + Precise:EnumInstance + } +} + export type Zone = { localPlayerEntered:ZoneSignal<>; localPlayerExited:ZoneSignal<>; @@ -899,7 +907,8 @@ export type Zone = { autoUpdate:boolean; respectUpdateQueue:boolean; zoneParts:{BasePart}; - + enum:Enumerators; + findLocalPlayer:(self:Zone) -> boolean; findPlayer:(self:Zone, Player:Player) -> boolean; @@ -926,19 +935,7 @@ export type ZonePlus = { new:(container:Instance) -> Zone; fromRegion:(CFrame:CFrame, Size:Vector3) -> Zone; - enum:{ - Detection:{ - WholeBody:EnumInstance; - Centre:EnumInstance - }; - - Accuracy:{ - Low:EnumInstance; - Medium:EnumInstance; - High:EnumInstance; - Precise:EnumInstance - } - } + enum:Enumerators } return Zone::ZonePlus From 1d3359d1c8311b0ec3b907719ed8f0b43ce8eabd Mon Sep 17 00:00:00 2001 From: thekingofspace <37231416+thekingofspace@users.noreply.github.com> Date: Mon, 24 Nov 2025 02:44:51 -0800 Subject: [PATCH 4/4] Create sourcemap.json --- sourcemap.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 sourcemap.json diff --git a/sourcemap.json b/sourcemap.json new file mode 100644 index 0000000..0904c56 --- /dev/null +++ b/sourcemap.json @@ -0,0 +1 @@ +{"name":"ZonePlus","className":"DataModel","filePaths":["default.project.json"],"children":[{"name":"ReplicatedStorage","className":"ReplicatedStorage","children":[{"name":"Zone","className":"ModuleScript","filePaths":["src/Zone/init.lua"],"children":[{"name":"Enum","className":"ModuleScript","filePaths":["src/Zone/Enum/init.lua"],"children":[{"name":"Accuracy","className":"ModuleScript","filePaths":["src/Zone/Enum/Accuracy.lua"]},{"name":"Detection","className":"ModuleScript","filePaths":["src/Zone/Enum/Detection.lua"]}]},{"name":"Janitor","className":"ModuleScript","filePaths":["src/Zone/Janitor.lua"]},{"name":"OldSignal","className":"ModuleScript","filePaths":["src/Zone/OldSignal.lua"]},{"name":"Signal","className":"ModuleScript","filePaths":["src/Zone/Signal.lua"]},{"name":"VERSION","className":"ModuleScript","filePaths":["src/Zone/VERSION.lua"]},{"name":"ZoneController","className":"ModuleScript","filePaths":["src/Zone/ZoneController/init.lua"],"children":[{"name":"CollectiveWorldModel","className":"ModuleScript","filePaths":["src/Zone/ZoneController/CollectiveWorldModel.lua"]},{"name":"Tracker","className":"ModuleScript","filePaths":["src/Zone/ZoneController/Tracker.lua"]}]},{"name":"ZonePlusReference","className":"ModuleScript","filePaths":["src/Zone/ZonePlusReference.lua"]}]}]}]} \ No newline at end of file