You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Classes/Observer.luau
+14-11Lines changed: 14 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -113,31 +113,34 @@ local Observer = {}
113
113
Observer.__index=Observer
114
114
115
115
--[=[
116
-
Creates an Observer. Observers listen for entities entering or exiting assigned Zones.
116
+
Creates an Observer. Observers listen for entities subscribed Groups entering or exiting attached Zones.
117
117
118
118
```lua
119
119
localobserver=QuickZone.Observer.new({
120
120
groups= { enemyGroup, playerGroup } -- Immediately subscribe to these groups
121
121
zones= { damageZone } -- Immediately subscribe to these zones
122
-
priority=20, -- The priority value is used to resolve overlaps
123
-
updateRate=20, -- Check at 20Hz
124
-
precision=0.5, -- Ignore movement smaller than 0.5 studs
125
-
enabled=false, -- Observer will not start processing spatial checks
126
-
safety=false, -- Do not wrap callbacks in task.spawn
122
+
priority=20, -- The priority value is used to resolve overlaps (defaults to 0)
123
+
updateRate=20, -- Check at 20Hz (defaults to 30)
124
+
precision=0.5, -- Ignore movement smaller than 0.5 studs (defaults to 0.1)
125
+
enabled=false, -- Observer will not start processing spatial checks (defaults to true)
126
+
safety=false, -- Wrap callbacks in task.spawn (defaults to true)
127
127
})
128
128
```
129
129
130
+
:::warning Safety
131
+
If safety is set to false, any yielding will result in breaking QuickZone.
132
+
Only set it to false if you do not want the overhead of virtual threads.
133
+
:::
134
+
130
135
:::info Resolution Priority
131
136
When an entity is inside multiple zones watched by different observers,
132
137
higher priority observers take complete control.
133
138
:::
134
139
135
-
:::warning Safety
136
-
If set to unsafe, you are not allowed to yield in the callbacks anymore. If you do, QuickZone will throw errors.
137
-
:::
138
-
139
140
:::note Dynamic Instantiation
140
-
QuickZone will warn you if an Observer is created without groups or zones. To suppress this warning when building observers dynamically, explicitly pass an empty table (`zones = {}`) or instantiate the observer as disabled (`enabled = false`).
141
+
QuickZone will warn you if an Observer is created without groups or zones.
142
+
To suppress this warning when building observers dynamically,
143
+
explicitly pass an empty table (`zones = {}`) or instantiate the observer as disabled (`enabled = false`).
0 commit comments