Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support tags #70

Open
Anaminus opened this issue May 9, 2022 · 0 comments
Open

Support tags #70

Anaminus opened this issue May 9, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@Anaminus
Copy link
Owner

Anaminus commented May 9, 2022

Support tags

Tags should be supported somehow.

Considerations:

  • We can have multiple DataModels.
  • We want to scope by DataModel, or globally.
  • Use descriptor extensions (Descriptor extensions #65) to configure the serialized property for tags?
    • The property used for tags can be changed on the fly. How would this interact with the tag database?
      • Treat configuration differently; to get tag support, config must be applied globally to all instances, and cannot be refined per instance.
      • Implement by only considering config of rbxmk.globalDesc?
  • Instead, skip descriptor extensions. Use distinct API instead.
  • For global database, use rbxmk.tags.
    • Value is a type that matches the CollectionService API without actually being an instance.
    • Can configure tag property (default "Tags").
      • Changing this does a complete database reevaluation.
    • Can configure class used for database scoped to DataModel (default "CollectionService").
      • What happens to existing instances of previous class? The additional behavior just drops. Would have to be implemented as a condition.
    • Can produce variation that scopes each method to a particular instance. This considers only the instance and its descendants.
  • For DataModel-scoped database, match CollectionService API?
    • Would be union of Instance and above tags type.
    • Would be accessed via CollectionService instance under game. Class can be configured.
    • To support on the fly configuration of the class, this is implemented as a condition, similar to how GetService works for DataModel.
    • Selects scope by getting parent DataModel.

Tags API

  • Type name?
    • Tags
    • TagCollection
    • TagDatabase
  • Tags:WithScope(scope: Instance?): Tags
    • Return Tags that limits database to tree of scope.
    • Can scope out as well as in.
    • If scope is nil, scope is global.
    • Support multiple scopes? result is a union of each scope.
    • Ideally does not require any setup. Should be cheap to run.
  • Tags:GetTagProperty(): string
    • Gets the name of the property used to serialize tags.
  • Tags:SetTagProperty(name: string, transferMethod: Enum.TagTransferMethod = Move)
    • Sets the name of the property used to serialize tags.
    • transferMethod determines what to do with existing tag properties.
  • Tags.ScopingClass: string?
    • Gets or sets the name of the class treated as CollectionService.
    • Can be set to nil to disable.
    • Initially set to "CollectionService".
  • Reflected APIs:
    • Tags:AddTag(instance: Instance, tag: string)
      • Add tag to instance.
    • Tags:GetAllTags(): {string}
      • Get list of all tags.
    • Tags:GetTagged(tag: string): Objects
      • Get list of instances tagged with tag.
    • Tags:GetTags(instance: Instance): {string}
      • Get list of tags for instance.
    • Tags:HasTag(instance: Instance, tag: string): boolean
      • Return whether instance has tag.
    • Tags:RemoveTag(instance: Instance, tag: string)
      • Remove tag from instance.

Adds rbxmk.Enum.TagTransferMethod, which determines how SetTagProperty handles properties of the previous and next names:

Item Value Previous property Next property
None 0 Untouched Untouched
Copy 1 Untouched Set from previous
Move 2 Removed Set from previous
@Anaminus Anaminus added the enhancement New feature or request label May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant