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 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 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..3420caa 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,71 @@ function Zone:destroy() end Zone.Destroy = Zone.destroy +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<>; + playerEntered:ZoneSignal; + playerExited:ZoneSignal; + partEntered:ZoneSignal; + partExited:ZoneSignal; + itemEntered:ZoneSignal; + itemExited:ZoneSignal; + + accuracy:EnumInstance; + enterDetection:EnumInstance; + exitDetection:EnumInstance; + autoUpdate:boolean; + respectUpdateQueue:boolean; + zoneParts:{BasePart}; + enum:Enumerators; + + + 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:Enumerators +} -return Zone +return Zone::ZonePlus