Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@

# Roblox Studio lock files
/*.rbxlx.lock
/*.rbxl.lock
/*.rbxl.lock

aftman.toml
1 change: 1 addition & 0 deletions sourcemap.json
Original file line number Diff line number Diff line change
@@ -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"]}]}]}]}
1 change: 1 addition & 0 deletions src/Zone/Enum/init.lua
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Zone/ZoneController/Tracker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/Zone/ZoneController/init.lua
Original file line number Diff line number Diff line change
@@ -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


Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
69 changes: 67 additions & 2 deletions src/Zone/init.lua
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -871,6 +871,71 @@ function Zone:destroy()
end
Zone.Destroy = Zone.destroy

export type EnumInstance = number

export type ZoneSignal<T...> = {
Connect: (self: ZoneSignal<T...>, 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<Player>;
playerExited:ZoneSignal<Player>;
partEntered:ZoneSignal<BasePart>;
partExited:ZoneSignal<BasePart>;
itemEntered:ZoneSignal<Instance>;
itemExited:ZoneSignal<BasePart>;

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