TAS playback mod for factorio
- If using git : clone to
factorio/mods/tas_playback_0.0.2
- If using an archive : Unpack the mod's contents into
factorio/mods/tas_playback_0.0.2
- If using the mod portal (shouldn't be possible at the moment, but whatever) : Install the mod and unpack its contents.
To create a run :
- Create a new folder
factorio/mods/tas_playback_0.0.2/scenarios/YourNewRunName/
- Create a blueprint.dat file containing your run's map, like you would to create a scenario, and copy it into this folder.
To do that :
- Create a new game using your chosen map seed, using the map editor
- Save this scenario without doing anything in the world
- Exit factorio
- Go to the application directory, where mods and saves can be found: https://wiki.factorio.com/Application_directory#User_data_directory
- Go into the scenario folder, find your scenario, open it, copy the file
blueprint.dat
intofactorio/mods/tas_playback_0.0.2/scenarios/YourNewRunName/
- You can now remove the scenario you created.
- Copy the files
configuration.lua
andcontrol.lua
from the folderfactorio/mods/tas_playback_0.0.2/scenarios/Test-TAS/
intofactorio/mods/tas_playback_0.0.2/scenarios/YourNewRunName/
- Create the file that will contain the instructions for your run into the folder
factorio/mods/tas_playback_0.0.2/scenarios/YourNewRunName/
. You can choose the name you want for this file. For example :YourRunFile.lua
- Open the file configuration.lua in a text editor and edit the config.run_name and config.run_file variables to contain the name of your run's scenario and of the file that contains the commands. In our case, we will have :
config.run_name = "YourNewRunName"
config.run_file = "YourRunFile"
ATTENTION : These MUST be the EXACT names used as the folder name and the run's file name. Otherwise, the run will not work !
- you can now start writing your run's commands into
YourRunFile.lua
.
To start playing the run :
- In factorio menu, navigate to Play -> Scenarios
- A scenario will appear as
tas_playback/YourNewRunName
(YourNewRunName being the name you used when you created the run's scenario, of course). Launch it. - If your run's configuration file contains
config.autorun = true
, the run will automatically start when loading the scenario. - If your run's configuration file contains
config.autorun = false
, you can use the chat command/init_run
to start it at any moment. Your player will be repositionned at the right location and your inventory reset. Any modification that happened to the world since the game was started will, however, be kept. - You can at any point save the run.
- When you will reload it, the run will continue playing from the tick when it was saved.
- Any modification that is made to the run between saving and loading and that happens after the tick where the game was saved will be taken into account.
- The mod will not let you start a New Game while it is active.
- If you want to play a regular game, toggle the mod.
- If you want to play a TAS run, please use a scenario as instructed above.
- Due to the way the mod loads the instructions for the run, the scenarios have to be located in the mod's folder and cannot be located in the standard scenarios folder.
- The menu Options -> Mods gives you options about the level of verbosity you want when displaying what the run does.
Your run file (in our example YourRunFile.lua
) should start with the lines :
local commandqueue = {}
commandqueue["settings"] = {
allowspeed = true
}
You can change allowspeed = true
by allowspeed = false
if you want to inhibit the speed
commands of your run.
If you include the line end_tick_debug = true
in the settings
section, the game will give the player back the control of mouse selection after the end of input.
The rest of the file should consist of a series of instruction that take the following form :
commandqueue[<tick>] = {
{<command1>, <options1>},
{<command2>, <options2>},
...
}
Where :
<tick>
is the number of the tick where these commands will be executed (the start of the run being tick 0)- Each
{<command>, <options>}
sequence represents an action to be executed by the TAS. It can be chosen in the following list :{"move","<DIRECTION>"}
commands the player to start moving in a direction or stop. Directions can beN
,S
,E
,W
,NE
,SE
,SW
,NW
orSTOP
.{"craft","<ITEM>", <AMOUNT>}
commands the player to pocket-craft given amount of specified item.{"mine", {<X>,<Y>}}
commands the player to start mining at specified coordinated. To stop mining, replace{<X>,<Y>}
withnil
.{"build","<ITEM>", {<X>,<Y>}, <FACING DIRECTION>}
commands the player to build the specified item at the specified coordinates, with the item facing a certain direction. The<FACING DIRECTION>
should be an element of the factorio classdefines.direction
.{"put",{X,Y},"<ITEM>", <AMOUNT>, <destination inventory type>}
commands the player to put the specified amount of the specified item into the inventory of the entity at the given coordinates. The<destination inventory type>
must be an element of the factorio classdefines.inventory
that says which inventory slot is to be used.{"speed", <speed>}
sets the game speed ifallowspeed
is attrue
. Otherwise, a warning will be generated.{"take",{<X>,<Y>},"<ITEM>",<AMOUNT>,<source inventory type>}
commands the player to take the specified amount of the specified item from the inventory of the entity at the given coordinates. The<source inventory type>
must be an element of the factorio classdefines.inventory
that says which inventory slot is to be used.{"tech", <RESEARCH>}
sets the current research as specified.{"print", "<text>"}
prints some text in the tchat.{"recipe", {<X>,<Y>}, <recipe>}
sets the recipe of the entity at the given coordinates.{"rotate", {<X>,<Y>}, "<direction>"}
rotates the entity at the given coordinates to face the direction specified, among directionsN
,S
,E
,W
.{"stopcraft", <Index>, <Quantity>}
cancels the crafting of the given quantity of the items at the given index in the queue. If the<Quantity>
is not specified, 1 will be used.