Sandbox buttons and mods

This subforum contains all the issues which we already resolved.
User avatar
y.petremann
Filter Inserter
Filter Inserter
Posts: 421
Joined: Mon Mar 17, 2014 4:24 pm
Contact:

Sandbox buttons and mods

Post by y.petremann »

In sandbox scenario, there is two questions with two buttons, one to accept, the other to refuse ...
The main problem is that when you uses some mods that asks questions at the same time like test mode, it would consider that they have been answered since a button has been triggered.

Firstly, you can simply make theses changes :

Replace :

Code: Select all

    function(event)
      if event.name == defines.events.onguiclick then
        local player = game.getplayer(event.playerindex)
        if event.element.name == "button_use_chest" then
          buildstartingchest(player)
        end
        player.gui.top.button_use_chest.destroy()
        player.gui.top.button_no_chest.destroy()
        return true
      end
      return false
    end
by

Code: Select all

    function(event)
      if event.name == defines.events.onguiclick then
        local player = game.getplayer(event.playerindex)
        if event.element.name == "button_use_chest" then
          buildstartingchest(player)
        elseif event.element.name ~= "button_no_chest" then
          return false
        end
        player.gui.top.button_use_chest.destroy()
        player.gui.top.button_no_chest.destroy()
        return true
      end
      return false
    end
Replace :

Code: Select all

    function(event)
      if event.name == defines.events.onguiclick then
        local player = game.getplayer(event.playerindex)
        if event.element.name == "button_technologies_researched" then
          player.force.researchalltechnologies()
        end
        player.gui.top.button_technologies_researched.destroy()
        player.gui.top.button_technologies_normal.destroy()
        return true
      end
      return false
    end
by

Code: Select all

    function(event)
      if event.name == defines.events.onguiclick then
        local player = game.getplayer(event.playerindex)
        if event.element.name == "button_technologies_researched" then
          player.force.researchalltechnologies()
        elseif event.element.name ~= "button_technologies_normal" then
          return false
        end
        player.gui.top.button_technologies_researched.destroy()
        player.gui.top.button_technologies_normal.destroy()
        return true
      end
      return false
    end
Secondly, I may ask you if there is a correct way to insert a question like that after (or before) they appear ?
kovarex
Factorio Staff
Factorio Staff
Posts: 8207
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: Sandbox buttons and mods

Post by kovarex »

You are completely right, thanks for the help, it is fixed for 0.11.17
y.petremann wrote:Secondly, I may ask you if there is a correct way to insert a question like that after (or before) they appear ?
Well I believe that the best way is to insert the question independently of the main script story logic
Post Reply

Return to “Resolved Problems and Bugs”