DirtyLarry - A quick and dirty GUI library

Could you try this instead;

function on_input(self, action_id, action)
	local clicked_button = false
	dirtylarry:button("button_toggle_turret1", action_id, action, function ()
    	local enabled = not gui.is_enabled(gui.get_node("Turret1"))
    	gui.set_enabled(gui.get_node("Turret1"), enabled)
    	clicked_button = true
	end)
	
	if not clicked_button then
		if gui.is_enabled(gui.get_node("Turret1")) and action_id == hash("LMB") and action.released then
			gui.set_enabled(gui.get_node("Turret1"), disabled)
		end 
	end
end

(This works for me, but I might misunderstand what you are trying to achieve. :slight_smile: )

Also, I realise that the dirtylarry API for buttons might need to return a boolean if the button was clicked or not also. Would make this example somewhat easier.

2 Likes