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

Console/zh: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(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...")
 
No edit summary
Line 1: Line 1:
{{Languages}}
{{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.
控制台是lua命令接口,它有点像命令行界面和查看Java脚本的控制台。
像其他lua-program命令类程序一样,你可以调出几乎所有的内部命令,这意味着你可以畅游游戏的大部分内部组建。
换句话说异星工厂其实并不需要任何专门的作弊器,它自带有一个控制台,只要你知道指令,你就可以可以作弊。
== 如何打开控制台?==


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
: <code>game.player.print(game.evolutionfactor)</code>
: <code>game.player.print(game.evolutionfactor)</code>
* Turn off night
* 忽视夜晚
: <code>game.alwaysday=true</code>
: <code>game.alwaysday=true</code>
* Kill everything that moves
* 杀死所有可移动的东西
: <code>game.killallenemies()</code>
: <code>game.killallenemies()</code>
* Gain 100 iron plates
* 获得铁片
: <code>game.player.insert{name="iron-plate",count=100}</code>
: <code>game.player.insert{name="iron-plate",count=100}</code>
* Finish research
: 注:name="游戏内部物品名",count="数量"
* 解锁科技树
: <code>for n,t in pairs(game.player.force.technologies) do t.researched=t.enabled end</code>
: <code>for n,t in pairs(game.player.force.technologies) do t.researched=t.enabled end</code>
* Mine faster
* 极速手工采矿
: <code>game.player.force.manualminingspeedmodifier=1000</code>
: <code>game.player.force.manualminingspeedmodifier=1000</code>
* Craft faster
* 极速手工制造
: <code>game.player.force.manualcraftingspeedmodifier=1000</code>
: <code>game.player.force.manualcraftingspeedmodifier=1000</code>
* Switching on peacfulmode
* 开启和平模式
: <code>game.peacefulmode = true</code>
: <code>game.peacefulmode = true</code>
: After setting, you should do <code>game.killallenemies()</code> because some, if not all, existing biters will still not be on peaceful mode.
:已经存在的虫子无效
* Faster research
* 快速研究
: <code>game.player.force.laboratoryspeedmodifier = 1</code>
: <code>game.player.force.laboratoryspeedmodifier = 1</code>
: 1 is normal speed, 2 is double speed 3 is triple etc. I think it goes up to 100.
: 1表示的是倍数
* [http://www.factorioforums.com/forum/viewtopic.php?f=18&t=5178 Cancel deconstruction]
* [http://www.factorioforums.com/forum/viewtopic.php?f=18&t=5178 Cancel deconstruction]
: <code>
: <code>
Line 46: Line 43:
   entity.canceldeconstruction(game.player.force)
   entity.canceldeconstruction(game.player.force)
  end</code>
  end</code>
* [http://www.factorioforums.com/forum/viewtopic.php?f=18&t=5686 Destroy rocks in sandbox-mode] (you don't have a player here, so you can't destroy anything):
* 破坏自由模式中视野内的岩石
: <code>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</code>
: <code>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</code>
: you need to center the rock in your vision range
* 用print()指令简写代替game.player.print()指令
* [http://www.factorioforums.com/forum/viewtopic.php?f=41&t=5638 Use print() instead of game.player.print()]
: <code>print = function(text) game.player.print(text) end</code>
: <code>print = function(text) game.player.print(text) end</code>
* [http://www.factorioforums.com/forum/viewtopic.php?f=14&t=4761&p=44184#p44184 Generate a section of the world and explore it at the same time]:
* Generate a section of the world and explore it at the same time:
: <code>game.forces.player.chart({lefttop = {x = -1024, y = -1024}, rightbottom = {x = 1024, y = 1024}})</code>
: <code>game.forces.player.chart({lefttop = {x = -1024, y = -1024}, rightbottom = {x = 1024, y = 1024}})</code>
: 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.
: 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.
* [http://www.factorioforums.com/forum/viewtopic.php?f=5&t=6066&p=47758#p47758 Check water level in a pipe]:
* 检查水位:
: <code>game.player.print(game.player.selected.getliquid().amount)</code>
: <code>game.player.print(game.player.selected.getliquid().amount)</code>


More commands can be looked up in the [[Modding|modding-section]].
More commands can be looked up in the [[Modding|modding-section]].


== See also ==
== 参见 ==


* [http://www.factorioforums.com/forum/viewtopic.php?f=18&t=4752 The Console: What is it and How do I use it?]
* [http://www.factorioforums.com/forum/viewtopic.php?f=18&t=4752 The Console: What is it and How do I use it?]
: Some interesting cheats or useful commands and tips.
: Some interesting cheats or useful commands and tips.

Revision as of 00:00, 1 November 2014

控制台是lua命令接口,它有点像命令行界面和查看Java脚本的控制台。 像其他lua-program命令类程序一样,你可以调出几乎所有的内部命令,这意味着你可以畅游游戏的大部分内部组建。 换句话说异星工厂其实并不需要任何专门的作弊器,它自带有一个控制台,只要你知道指令,你就可以可以作弊。

如何打开控制台?

你可以通过长按~键打开指令台。 你也可以修改快捷键。

控制台命令的编辑

游戏在编辑控制台时候会忽视换行,而代码一般也可以读懂,这就意味着你可以通过快捷键复制粘贴代码输入控制器。这让控制台的编辑变得很容易。

代码

  • 检查虫子进化程度
game.player.print(game.evolutionfactor)
  • 忽视夜晚
game.alwaysday=true
  • 杀死所有可移动的东西
game.killallenemies()
  • 获得铁片
game.player.insert{name="iron-plate",count=100}
注:name="游戏内部物品名",count="数量"
  • 解锁科技树
for n,t in pairs(game.player.force.technologies) do t.researched=t.enabled end
  • 极速手工采矿
game.player.force.manualminingspeedmodifier=1000
  • 极速手工制造
game.player.force.manualcraftingspeedmodifier=1000
  • 开启和平模式
game.peacefulmode = true
已经存在的虫子无效
  • 快速研究
game.player.force.laboratoryspeedmodifier = 1
1表示的是倍数
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
  • 用print()指令简写代替game.player.print()指令
print = function(text) game.player.print(text) end
  • Generate a section of the world and explore it at the same time:
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.

参见

Some interesting cheats or useful commands and tips.