Druid Blocker Component must be enabled before?

@Insality Hello i faced with a problem when try using druid blocker component.

--This button opens my inventory page
self.inventory_button = self.druid:new_button("InventoryButton",  function()
	gui.set_enabled(gui.get_node("Blocker"), true) -- Again Enable
	show_page(self, "PackPage")
end)

--This button opens my alliance page
self.alliance_button = self.druid:new_button("AllianceButton",  function()
	gui.set_enabled(gui.get_node("Blocker"), true) -- Again Enable
	show_page(self, "AlliancePage")
	
end)

--gui.set_enabled(gui.get_node("Blocker"), true) -- If ı dont tell true here not working
self.blocker = self.druid:new_blocker("Blocker") -- Telling Block
--gui.set_enabled(gui.get_node("Blocker"), false) -- ı hide again because dont want to show default

Problem is here if i want to use blocker i must enable the node otherwise doesnt work

--gui.set_enabled(gui.get_node("Blocker"), true) -- If ı dont tell true here not working

And thus i must again disable blocker

--gui.set_enabled(gui.get_node("Blocker"), false) -- ı hide again because dont want to show default

Am I using flawed logic? Just giving blocker node’s name shouldnt be enough?

The blocker component will block any input component behind it if the node is enabled and the blocker itself is enabled.

The default state of the blocker depends on the node’s enabled state (which now I think a little bit strange, but still), and it can also be controlled with

blocker:set_enabled(true/false)

You can use this toggler in addition to the node’s own enabled state.

Does this help?

2 Likes

Yes, your suggestion worked, thank you very much.