Merged
Conversation
Introduces DropletsFolder as a shared workspace folder for droplets, refactors DropletClientManager and DropletServerManager to use consistent naming and singleton patterns, and improves droplet collection and magnetization logic. Adds new resource type data options, updates attachment/welding API, and fixes various edge cases in droplet claiming and collecting. Also improves type safety and code clarity throughout the droplet manager modules.
Introduces per-droplet MagnetizationRadius and MustSettleBeforeCollect options, allowing droplets to start moving toward players at configurable distances and optionally require settling before collection. Updates Droplet, DropletClientManager, DropletUtil, and ExampleResourceTypeData to support and document these features. Adds Heap dependency for efficient radius management.
Updated calls from droplet:AttachModel to droplet:Attach when attaching VisualModel. This change ensures compatibility with the updated droplet API.
Renamed all source files from .lua to .luau for Luau compatibility. Updated Droplet class: fixed signal name casing, changed MustSettleBeforeCollect default to false, reorganized and clarified method documentation, and improved method ordering for clarity. Updated type annotations in init.luau for DropletManager.Server and DropletManager.Client.
Replaces class-based singleton logic in DropletClientManager and DropletServerManager with module-level state and functions. Removes unnecessary inheritance and singleton assertions, simplifying initialization and usage. Updates references and event connections to use module state directly. Also updates constants, improves naming consistency, and adds new dependencies to wally.toml.
Replaces hardcoded constants with DropletUtil exports, adds support for arbitrary ejection directions, and refactors ejection velocity calculation to use direction vectors. Updates Octree usage, improves type annotations, and centralizes default values and radii in DropletUtil. Also fixes task naming and improves server/client separation in DropletManager initialization.
Updated DropletManager version to 0.1.0 in README and wally.toml. Clarified EjectionDirection documentation in DropletUtil.luau to remove reference to CFrame.LookVector default.
There was a problem hiding this comment.
Pull request overview
This PR refactors the DropletManager system from a singleton pattern to a module-based approach, adds new features for droplet magnetization and settling behavior, and improves code organization. The changes include enhanced droplet lifecycle management, better ejection velocity calculations with arbitrary direction support, and new configuration options for magnetization and collection behavior.
Changes:
- Refactored both server and client managers from singleton classes to static module tables
- Added new droplet properties: magnetization radius, settle-before-collect requirement, and improved settling detection
- Enhanced ejection velocity calculations to support arbitrary ejection directions with proper vector math
- Moved constants to DropletUtil for centralized configuration and added comprehensive documentation
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| wally.toml | Updated version to 0.1.0 and added new dependencies (Heap, Janitor, Signal) |
| init.luau | Updated lazy initialization to return modules directly instead of singleton instances |
| DropletServerManager.luau | Converted from singleton class to module with static state, removed BaseObject dependency |
| ExampleResourceTypeData.luau | Added new default properties for magnetization radius and settle requirements, updated API calls |
| DropletUtil.luau | Added centralized constants for player mass, magnetization limits, and default values with documentation |
| DropletsFolder.luau | New file creating workspace folder for droplet instances |
| DropletClientManager.luau | Refactored to module pattern, improved ejection velocity with orthonormal basis, added heap-based radius tracking |
| Droplet.luau | Added settling detection, magnetization radius methods, timeout promise handling, enhanced Attach method |
| README.md | Updated version number to 0.1.0 |
Comments suppressed due to low confidence (19)
lib/dropletmanager/src/ExampleResourceTypeData.luau:40
- The comment says "Maxiumum" which should be "Maximum".
lib/dropletmanager/src/ExampleResourceTypeData.luau:222 - The comment says "dissapears" which should be "disappears".
lib/dropletmanager/src/Client/Droplet.luau:206 - Indentation uses tabs instead of spaces. This is inconsistent with the rest of the file which uses spaces. Mixing tabs and spaces can cause issues with code editors and version control.
lib/dropletmanager/src/Client/Droplet.luau:43 - The raycast filter management has a potential issue. Line 38 uses AddToFilter() which modifies the FilterDescendantsInstances array, but line 41-42 manually modifies the same array and then clones it. This creates inconsistency - either use the AddToFilter/RemoveFromFilter API consistently, or manually manage the array. Mixing both approaches can lead to unexpected behavior.
lib/dropletmanager/src/Client/DropletClientManager.luau:105 - The module refactoring changes the API from instance methods to module-level methods, but the connection callbacks cast DropletClientManager to any to call methods with colon syntax. This is semantically incorrect - if these are module-level functions, they should be called with dot notation and not use 'self'. The casting to any bypasses type safety without actually fixing the underlying design issue.
lib/dropletmanager/src/Server/DropletServerManager.luau:272 - The iteration has been changed from using pairs() to first collecting all keys with RailUtil.Table.Keys() and then iterating with ipairs(). This change ensures deterministic iteration order and avoids issues with modifying a table during iteration (since Claim() may modify serverData.DropletData).
lib/dropletmanager/src/ExampleResourceTypeData.luau:32 - The comment says "dissapears" which should be "disappears".
lib/dropletmanager/src/DropletUtil.luau:166 - The comment says "dissapears" which should be "disappears".
lib/dropletmanager/src/Client/Droplet.luau:369 - The method now uses QueryDescendants("BasePart") which may not exist on all Roblox instance types. The correct method is GetDescendants() with a filter check. QueryDescendants is not a standard Roblox API method.
lib/dropletmanager/src/Client/Droplet.luau:383 - The method AttachModel has been renamed to Attach, but an alias is provided at line 383 for backward compatibility. While this maintains compatibility, consider documenting this as deprecated in favor of the new name, or decide whether to keep both or only the new name for cleaner API design.
lib/dropletmanager/src/Client/Droplet.luau:239 - The settled state is reset to 0 only in the else branch, but it should also be reset when the droplet starts moving again (velocity exceeds threshold). This logic appears incomplete - if a droplet settles, then gets disturbed, settledFor won't be reset properly if the velocity check fails.
lib/dropletmanager/src/init.luau:167 - The type annotation shows these are typed as the module itself rather than instances. The variables Server and Client should be typed as the return types of the respective manager modules if they're meant to be singleton instances, not the module types themselves.
lib/dropletmanager/src/ExampleResourceTypeData.luau:231 - The comment says "Maxiumum" which should be "Maximum".
lib/dropletmanager/src/Client/Droplet.luau:559 - The export type has changed from an instance type to the module type itself. This breaks the type system as
Dropletshould represent an instance created byDroplet.new(), not the module table. The originaltypeof(Droplet.new({} :: any))was correct.
lib/dropletmanager/src/Server/DropletServerManager.luau:296 - The warning is now always displayed instead of being conditional on a DEBUG flag. This may produce excessive console noise in production. Consider using the DEBUG flag consistently throughout the module or removing it entirely if debug logging is no longer needed.
lib/dropletmanager/src/Client/DropletClientManager.luau:220 - The signal name changed from "Timedout" to "TimedOut". While this improves consistency with standard casing conventions (PascalCase for compound words), this is a breaking API change that will break any external code listening to the old signal name.
lib/dropletmanager/src/init.luau:64 - The variable name "SetupData" is used consistently in the return statement at line 64, but the earlier comment at line 60 says "Create metadata to be used in the render functions". The return statement now correctly returns "SetupData" instead of the undefined "CustomData", fixing the bug.
lib/dropletmanager/src/Server/DropletServerManager.luau:411 - The seed generation range changed from 2^16 (65,536) to 2^20 (1,048,576). This significantly increases the seed space which reduces collision probability. However, this is a breaking change if any external systems depend on the previous seed range. Consider documenting this change in release notes.
lib/dropletmanager/src/Server/DropletServerManager.luau:370 OnServerCollectis invoked purely based on the client‑firedDropletCollectedevent, with no server‑side verification that the player actually reached or collided with the droplet. A compromised client can callDropletCollectedfor any droplet it is targeted for (and front‑run other players forSingleCollectordroplets), causing server logic like awarding money/EXP inOnServerCollectto run even when the in‑game collection conditions were never met. To prevent this, treat the server as authoritative: derive and validate collection eligibility on the server (e.g. using the player’s character position and droplet state) before callingOnServerCollect, rather than trusting the client’s notification alone.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors and enhances the client-side droplet logic in the droplet manager system. The changes improve code organization, add new features for droplet behavior, and update APIs for clarity and flexibility. The most important changes are grouped below.
Droplet Behavior and Features
Dropletclass to support magnetization, settling, and collection logic, includingGetMagnetizationRadius,IsSettled, andMustSettleBeforeCollect. These allow droplets to magnetize towards players and require settling before being collected. [1] [2]API and Code Organization
AttachModeltoAttach, updating parameter handling, and adding detailed doc comments. Methods for fetching droplet data (value, metadata, resource type, position, etc.) are now more clearly documented and organized. [1] [2]Utilities and Constants
PLAYER_MASSandMAX_MAGNETIZATION_RADIUStoDropletUtilfor central management, and updated references throughout the codebase for consistency. [1] [2] [3]DropletClientManagerto support arbitrary directions and improved vector math for more flexible droplet launching.Type and File Updates
Dropletexport, and renamed files from.luato.luauto reflect the use of Luau-specific features.These changes collectively improve the flexibility, maintainability, and clarity of the droplet client logic.