MortenTobiasNielsen / Factorio-TAS-Generator

This is an attempt to create a helper tool for Tool Assisted Speedruns in Factorio. A guide of how to use the tool can be found here: https://www.youtube.com/watch?v=V9tuNoDqc0E&t
MIT License
13 stars 4 forks source link

Support for Supply challenge scenario #335

Closed seky16 closed 1 year ago

seky16 commented 1 year ago

Hello,

I'm interested in creating TAS for Factorio's Supply challenge scenario.

However there's couple of things that would need to be considered and changed in FTG.

mod_gui = require "mod-gui"

if script.mod_name == "level" and script.level and script.level.level_name == "supply" then
    remote.add_interface("DunRaider-TAS-supply",
    { next_level = function(player_index)
            -- fake the "next level" button click event
            local player = game.get_player(player_index)
            local btn = mod_gui.get_button_flow(player).next_level
            if (not btn) or (not btn.enabled) then return end
            local event = {
                name=1,
                tick=game.tick,
                player_index=player_index,
                element=btn,
            }
            story_update(global.story, event, "")
        end,
    })
end

Thank you for your consideration and for developing and maintaining this tool.

MortenTobiasNielsen commented 1 year ago

Hi seky16. Thanks for your suggestion, it sounds like a good addition. I am not currently developing on the project, but maybe theis999 will have a look at it at some point. :)

until then, It seems like you should be able to start your run without being able to go to the next level. You should be able to add the required items to a chest when you plan to press the button and "pretend" that the items no longer exists. This will allow you to get going and when the feature is added it should be easy to just add the "next level" step right after you insert the items into a box - you can add a comment in FTG to remember where you want to go the a new level.

theis999 commented 1 year ago

I suspect option 3 is the easiest and fastest to work on. It is a relatively isolated task to re-create the scenario without the pop-up messages and provide a method for the TAS mod to progress the level. We also need to remove the next level button, as pressing that can only cause issues.

Changing the goals setup should be trivial, however we will also need a new step type for changing the level.

seky16 commented 1 year ago

Yes, for now it's possible (with a little tweak to control.lua - can provide that) to work on this run. I suspect the "next level" steps will probably be used on the very end of the run.

@theis999 Yeah, custom scenario is the easiest way to go now, but I'm not sure it's portable enough. Unless you bundle the custom scenario with the generated mod, no one else would be able to play the TAS themselves.

MortenTobiasNielsen commented 1 year ago

Sounds good. I guess we could change the Launch step to Next when the goal is changed to Supply Challenge. In terms of the custom scenario I would expect that the entire thing will be bundled to a new scenario like it is done with the other goals (steelaxe, etc.) or isn't that possible @theis999?

theis999 commented 1 year ago

In terms of GUI sure, but it'll have to be a different steptype for most purposes.

There are no real problems with including a scenario with a mod.