Skip to content

Release 1.2.6 Add get_druid from registered druid widgets for various… - #346

Merged
Insality merged 1 commit into
masterfrom
get_registered_druid
Aug 14, 2026
Merged

Release 1.2.6 Add get_druid from registered druid widgets for various…#346
Insality merged 1 commit into
masterfrom
get_registered_druid

Conversation

@Insality

Copy link
Copy Markdown
Owner

… manipulations

Copilot AI lite review requested due to automatic review settings August 14, 2026 10:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR prepares the 1.2.6 release by introducing a new way to retrieve a registered Druid instance from game object scripts (druid.get_druid) and adding an instance-level style setter (druid_instance:set_style), alongside the usual version/documentation bumps.

Changes:

  • Add druid.get_druid(gui_url) to return the registered Druid instance (without cross-context event wrapping).
  • Add druid_instance:set_style(style) to change the style used for subsequently created components.
  • Bump project/version references and record the new APIs in the changelog.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
wiki/changelog.md Adds 1.2.6 release notes describing the new APIs.
README.md Updates dependency ZIP tag to 1.2.6.
game.project Bumps project version to 1.2.6.
druid/system/druid_instance.lua Adds set_style on the Druid instance to change the style for future components.
druid/druid.lua Adds get_druid and stores registered instance in widget registration entries.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread wiki/changelog.md
Comment on lines +839 to +845
### Druid 1.2.6
- [System] Add `druid.get_druid(gui_url)` to get the Druid instance bound with `druid.register_druid_as_widget()` from a game object script
- Returns the instance as is, without cross-context events wrapping, unlike `druid.get_widget()`
- Returns `nil` if there is no Druid instance registered for this url
- [System] Add `druid_instance:set_style(style)` to set the style of the Druid instance
- The style is applied to the components created after this call, already created components keep their style
- Allows to set the style from a game object script: `druid.get_druid(url):set_style(my_style)`
Comment thread druid/druid.lua
Comment on lines +135 to +154
function M.get_druid(gui_url)
if type(gui_url) == "string" then
gui_url = msg.url(nil, nil, gui_url)
end

gui_url = gui_url or msg.url()
local registered_druids = REGISTERED_GUI_WIDGETS[gui_url.socket]
if not registered_druids then
return nil
end

for index = 1, #registered_druids do
local druid = registered_druids[index]
if druid.fragment == gui_url.fragment and druid.path == gui_url.path then
return druid.instance
end
end

return nil
end
Comment on lines +291 to +299
---Set a style of Druid instance. Pass nil to reset to the default style.
---The style is applied to the components created after this call, already created components keep their style.
---@param style table|nil The Druid style table
---@return druid.instance self The Druid instance itself for chaining
function M:set_style(style)
self._style = style or settings.default_style

return self
end
@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 13.33333% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.57%. Comparing base (f80e3d2) to head (d5cff07).

Files with missing lines Patch % Lines
druid/druid.lua 8.33% 11 Missing ⚠️
druid/system/druid_instance.lua 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #346      +/-   ##
==========================================
- Coverage   70.75%   70.57%   -0.19%     
==========================================
  Files          32       32              
  Lines        4562     4577      +15     
==========================================
+ Hits         3228     3230       +2     
- Misses       1334     1347      +13     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Insality
Insality merged commit fd72f38 into master Aug 14, 2026
4 of 5 checks passed
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.

2 participants