removing a button from top-left corner?

Place to get help with not working mods / modding interface.
leoric
Burner Inserter
Burner Inserter
Posts: 6
Joined: Sun Nov 24, 2024 8:40 am
Contact:

removing a button from top-left corner?

Post 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?
User avatar
EvilPLa
Long Handed Inserter
Long Handed Inserter
Posts: 67
Joined: Sat Nov 14, 2020 7:26 am
Contact:

Re: removing a button from top-left corner?

Post 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 91 times
I haven't lost my mind, it's backed up on tape somewhere.
User avatar
EvilPLa
Long Handed Inserter
Long Handed Inserter
Posts: 67
Joined: Sat Nov 14, 2020 7:26 am
Contact:

Re: removing a button from top-left corner?

Post by EvilPLa »

And here is what you are looking for
https://github.com/Silari/Teleportation ... #L867-L874
I haven't lost my mind, it's backed up on tape somewhere.
leoric
Burner Inserter
Burner Inserter
Posts: 6
Joined: Sun Nov 24, 2024 8:40 am
Contact:

Re: removing a button from top-left corner?

Post 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
  
User avatar
Silari
Filter Inserter
Filter Inserter
Posts: 621
Joined: Sat Jan 27, 2018 10:04 pm
Contact:

Re: removing a button from top-left corner?

Post 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
leoric
Burner Inserter
Burner Inserter
Posts: 6
Joined: Sun Nov 24, 2024 8:40 am
Contact:

Re: removing a button from top-left corner?

Post 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},
	
Post Reply

Return to “Modding help”