Skip to content

Abstract data actions#124

Draft
davight wants to merge 8 commits intoDenizenScript:masterfrom
davight:abstract_data_actions
Draft

Abstract data actions#124
davight wants to merge 8 commits intoDenizenScript:masterfrom
davight:abstract_data_actions

Conversation

@davight
Copy link
Copy Markdown
Contributor

@davight davight commented Apr 19, 2026

This Pull-Request adds support for ObjectTag to define its own data actions.
(Keeping this as draft for now to hear your opinions on the design and everything)

Related discussion thread: https://discord.com/channels/315163488085475337/1468638851802075270

Additions:

  • New interface Actionable<T extends ObjectTag> that provides 4 methods xOperation(ObjectTag value, TagContext context), where x is substraction, multiplication, division, addition. With default implementation of throwing exception that the given object does not support given operation.
  • DurationTag support for addition and subtraction operation. (DurationTag:+:DurationTag, DurationTag:-:DurationTag)
  • TimeTag support for addition and subtraction operation. (TimeTag:+:DurationTag, TimeTag:-:DurationTag)
  • VectorTag support for addition, subtraction, multiplication and division (VectorTag:+:VectorTag, VectorTag:-:VectorTag, VectorTag:*:ElementTag, VectorTag:/:ElementTag)
  • Support for accessing first value of ListTag (in DataActionHelper) using first just like we have for last using last

Changes:

  • Moved ElementTag support for addition, subtraction, multiplication and division to the ElementTag.class (for the new Actionable system)
  • Cleaned up the DataAction.class
  • Minor cleanup of DataActionHelper.class

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant