切换语言: Deutsch English 日本語 한국어 Русский

控制台

From Official Factorio Wiki
Revision as of 22:56, 31 October 2014 by GhosterFT (talk | contribs) (Created page with "{{Languages}} The console is the built in interface for lua-commands. It works a bit like any command-line-interface or the java-script-console for your browser. Basically yo...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The console is the built in interface for lua-commands. It works a bit like any command-line-interface or the java-script-console for your browser.

Basically you can fire here all commands, like from any other lua-program (= Modding). This means you have full access to all in-game-internals.

In other words: Factorio doesn't need any special cheats, it has a console, which allows you to cheat around any limition, if you know how.

How to open the console?

You open the console by default with the key '/' or '~'. But depending on your keyboard-layout and operating system, this doesn't work.

Go for that case into the keyboard control and change "Toggle Lua console" to a useful key.

Editing

The game ignores newlines when pasting "scriptlets" in the console. This means they can be written in a human readable form in an editor and copy/pasted into the console, making understanding and editing a bit easier.

Useful commands (cheats)

  • Check how far the biters have evolved
game.player.print(game.evolutionfactor)
  • Turn off night
game.alwaysday=true
  • Kill everything that moves
game.killallenemies()
  • Gain 100 iron plates
game.player.insert{name="iron-plate",count=100}
  • Finish research
for n,t in pairs(game.player.force.technologies) do t.researched=t.enabled end
  • Mine faster
game.player.force.manualminingspeedmodifier=1000
  • Craft faster
game.player.force.manualcraftingspeedmodifier=1000
  • Switching on peacfulmode
game.peacefulmode = true
After setting, you should do game.killallenemies() because some, if not all, existing biters will still not be on peaceful mode.
  • Faster research
game.player.force.laboratoryspeedmodifier = 1
1 is normal speed, 2 is double speed 3 is triple etc. I think it goes up to 100.
for _, entity in ipairs(game.findentities{
  {game.player.position.x-20, game.player.position.y-20},
  {game.player.position.x+20, game.player.position.y+20}})
do 
  entity.canceldeconstruction(game.player.force)
end
for _, entity in ipairs(game.findentitiesfiltered{area={{game.player.position.x-32, game.player.position.y-32},{game.player.position.x+32, game.player.position.y+32}}, name="stone-rock"}) do entity.destroy() end
you need to center the rock in your vision range
print = function(text) game.player.print(text) end
game.forces.player.chart({lefttop = {x = -1024, y = -1024}, rightbottom = {x = 1024, y = 1024}})
Simply change the bounding box to the size you want and it will generate the map and explore it in that area. Keep In mind that command is telling Factorio to generate 64*64 (4096) chunks so it's going to take a while before all the background entity generation (trees, resources, biters) are placed in the world.
game.player.print(game.player.selected.getliquid().amount)

More commands can be looked up in the modding-section.

See also

Some interesting cheats or useful commands and tips.