Page 1 of 1

removing a button from top-left corner?

Posted: Sun Jun 28, 2026 5:38 am
by leoric
I'm trying to update GUI for https://mods.factorio.com/mod/Teleportation_Redux/

One of the improvements I've made is creating a button in shortcut bar that opens a new beacon management window.

But now I can't get rid of that old button in the top-left corner!
I can't find neither the tooltip text nor the relevant icon in the source (it's not tooltip-button-main or teleporter_icon.png)

https://imgbox.com/41kZdRoT

I've removed all calls to

Code: Select all

--Shows mod's main button in player's GUI.
function Teleportation_ShowMainButton(player)
  if player ~= nil and player.valid then
    local gui = player.gui.top
    if not gui.teleportation_main_button then
      local button = gui.add({type="button", name="teleportation_main_button", style = "teleportation_main_button_style"})
      button.tooltip = {"tooltip-button-main"}
    end
  end
end
but the icon still pops up, even in the old saves

Where the hell is it created?

Re: removing a button from top-left corner?

Posted: Sun Jun 28, 2026 3:04 pm
by EvilPLa
This is how I remove the "mod-gui" button of my mod. It looks like your button is added to the "top" gui. Hope that helps
06-28-2026, 16-58-19.png
06-28-2026, 16-58-19.png (22.26 KiB) Viewed 84 times

Re: removing a button from top-left corner?

Posted: Sun Jun 28, 2026 3:11 pm
by EvilPLa
And here is what you are looking for
https://github.com/Silari/Teleportation ... #L867-L874

Re: removing a button from top-left corner?

Posted: Sun Jun 28, 2026 11:01 pm
by leoric
this button is mod_gui_top_frame as
/c local f=game.player.gui.top.mod_gui_top_frame if f and f.valid then f.destroy() end
removes it.

But if I just start the game normally - even a new game - the button is there despite the migration
https://imgbox.com/v0gzSNSL

Code: Select all

--Hides mod's toolbar button for player.
function Teleportation_HideMainButton(player)
  log("Try Destroying teleportation main button")
    if player ~= nil and player.valid then
    local gui = player.gui.top
    if gui.mod_gui_top_frame then
      log("Destroying mod_gui_top_frame")
      gui.mod_gui_top_frame.destroy()
    end
  end
end
log:

Code: Select all

  36.271 Script @__Teleportation_Redux__/control-teleportation.lua:1288: Try Destroying teleportation main button
  36.271 Script @__Teleportation_Redux__/control-teleportation.lua:1292: Destroying mod_gui_top_frame
  

Re: removing a button from top-left corner?

Posted: Mon Jun 29, 2026 1:24 am
by Silari
I'm not sure where you're getting the mod_gui_top_frame name from, but if you want to remove the button for Teleporation Redux, than you want to destroy the
teleportation_main_button element it's creating.

In the console, that would be

Code: Select all

game.player.gui.top.teleportation_main_button.destroy()

In your code, it should be

Code: Select all

--Hides mod's toolbar button for player.
function Teleportation_HideMainButton(player)
  log("Try Destroying teleportation main button")
    if player ~= nil and player.valid then
    local gui = player.gui.top
    if gui.teleportation_main_button then
      log("Destroying mod_gui_top_frame")
      gui.teleportation_main_button.destroy()
    end
  end
end

Re: removing a button from top-left corner?

Posted: Mon Jun 29, 2026 2:42 am
by leoric
that's the question, innit. I've remvoed the code that creates teleportation_main_button - and the button still there. According to logs, there is no teleportation_main_button in game.player.gui.top. But there is that mod_gui_top_frame - and only when this mod is enabled

case closed, GUI Unifyer did that:

Code: Select all

local newbuttonlist = {
		--mod					button name 								sprite 							tooltip 									show button (for some there's already a setting to toggle button)
...
		{"Teleportation_Redux",	"teleportation_main_button",				"teleportation_button",			{'guiu.teleportation_button'},				true},