切换语言: 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...")
 
(modify header level)
 
(15 intermediate revisions by 3 users not shown)
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>
<syntaxhighlight lang="lua">
* Turn off night
game.player.print(game.evolutionfactor)
: <code>game.alwaysday=true</code>
</syntaxhighlight>
* Kill everything that moves
: <code>game.killallenemies()</code>
* Gain 100 iron plates
: <code>game.player.insert{name="iron-plate",count=100}</code>
* Finish research
: <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>
* Craft faster
: <code>game.player.force.manualcraftingspeedmodifier=1000</code>
* Switching on peacfulmode
: <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>
: 1 is normal speed, 2 is double speed 3 is triple etc. I think it goes up to 100.
* [http://www.factorioforums.com/forum/viewtopic.php?f=18&t=5178 Cancel deconstruction]
: <code>
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</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>
: you need to center the rock in your vision range
* [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>
* [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]:
: <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.
* [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>


More commands can be looked up in the [[Modding|modding-section]].
=== 忽视夜晚 ===
<syntaxhighlight lang="lua">
game.alwaysday=true
</syntaxhighlight>


== See also ==
=== 杀死所有可移动的东西 ===
<syntaxhighlight lang="lua">
game.killallenemies()
</syntaxhighlight>


* [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.
<syntaxhighlight lang="lua">
game.player.insert{name="iron-plate",count=100}
</syntaxhighlight>
 
注:name="游戏内部物品名",count="数量"
=== 解锁科技树 ===
<syntaxhighlight lang="lua">
for n,t in pairs(game.player.force.technologies) do t.researched=t.enabled end
</syntaxhighlight>
 
=== 极速手工采矿 ===
<syntaxhighlight lang="lua">
game.player.force.manualminingspeedmodifier=1000
</syntaxhighlight>
 
=== 极速手工制造 ===
<syntaxhighlight lang="lua">
game.player.force.manualcraftingspeedmodifier=1000
</syntaxhighlight>
 
=== 开启和平模式 ===
<syntaxhighlight lang="lua">
game.peacefulmode = true
</syntaxhighlight>
 
已经存在的虫子无效
=== 快速研究 ===
<syntaxhighlight lang="lua">
game.player.force.laboratoryspeedmodifier = 1
</syntaxhighlight>
 
1表示的是倍数
=== 取消红图勾选建筑 ===
<syntaxhighlight lang="lua">
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
</syntaxhighlight>
 
=== 破坏自由模式中视野内的岩石 ===
<syntaxhighlight lang="lua">
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
</syntaxhighlight>
 
=== 用print()指令简写代替game.player.print()指令 ===
<syntaxhighlight lang="lua">
print = function(text) game.player.print(text) end
</syntaxhighlight>
 
=== 强行重置地图 ===
<syntaxhighlight lang="lua">
game.forces.player.chart({lefttop = {x = -1024, y = -1024}, rightbottom = {x = 1024, y = 1024}})
</syntaxhighlight>
 
重建并探索地图。默认大小64*64 (4096),大多实体会被重置(树、资源、虫群)。
 
=== 检查水位 ===
<syntaxhighlight lang="lua">
game.player.print(game.player.selected.getliquid().amount)
</syntaxhighlight>
 
更多命令参见[[Modding|Mod制作]].
 
== 物品名 ==
*repair-pack=修理包
*stone=石头
*wood=木板
*raw-wood=原木
*copper-ore=铜矿
*iron-ore=铁矿
*coal=煤矿
*copper-plate=铜板
*iron-plate=铁板
*steel-plate=钢板
*stone-brick=石砖
*iron-axe=铁斧镐
*steel-axe=钢斧镐
*iron-gear-wheel=铁齿轮
*iron-stick=铁棒
*copper-cable=铜线
*pistol=手枪
*submachine-gun=冲锋枪
*rocket-launcher=火箭筒
*flame-thrower=火焰喷射器
*flame-thrower-ammo=油料储罐
*electronic-circuit=电路板
*advanced-circuit=高级电路板
*processing-unit=处理器
*basic-armor=基础护甲
*heavy-armor=重型护甲
*power-armor=能量装甲
*power-armor-mk2=能量装甲MK2
*basic-modular-armor=模块装甲
*rocket=制式火箭弹
*explosive-rocket=爆炸火箭弹
*basic-bullet-magazine=标准弹盒
*piercing-bullet-magazine=穿甲弹盒
*laser-turret=激光炮塔
*solar-panel=太阳能板
*fish=鱼
*raw-fish=鲜鱼
*computer=计算机
*lab=研究中心
*science-pack-1=科技包I
*science-pack-2=科技包II
*science-pack-3=科技包III
*alien-science-pack=异星科技包
*red-wire=红线缆
*green-wire=绿线缆
*alien-artifact=虫巢核心
*speed-module=速度插件I
*speed-module-2=速度插件II
*speed-module-3=速度插件III
*productivity-module=生产力插件I
*productivity-module-2=生产力插件II
*productivity-module-3=生产力插件III
*effectivity-module=节能插件I
*effectivity-module-2=节能插件II
*effectivity-module-3=节能插件III
*shotgun=霰弹枪
*combat-shotgun=冲锋霰弹枪
*shotgun-shell=制式霰弹
*piercing-shotgun-shell=穿甲霰弹
*railgun=电磁枪
*railgun-dart=电磁弹
*defender-capsule=防御机器人(胶囊)
*distractor-capsule=掩护机器人(胶囊)
*destroyer-capsule=进攻机器人(胶囊)
*poison-capsule=剧毒手雷(胶囊)
*slowdown-capsule=减速手雷(胶囊)
*basic-grenade=制式手雷
*basic-electric-discharge-defense-remote=放电防御模块发射器
*blueprint=建造计划(蓝图)
*deconstruction-planner=拆除计划(红图)
*sulfur=硫磺
*solid-fuel=固体燃料
*plastic-bar=塑料
*engine-unit=内燃机
*electric-engine-unit=电动机
*flying-robot-frame=机器人飞行框架
*explosives=炸药
*battery=电池
*empty-barrel=空桶
*crude-oil-barrel=原油桶
*small-plane=小型飞机

Latest revision as of 17:23, 2 May 2019

控制台是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

强行重置地图

game.forces.player.chart({lefttop = {x = -1024, y = -1024}, rightbottom = {x = 1024, y = 1024}})

重建并探索地图。默认大小64*64 (4096),大多实体会被重置(树、资源、虫群)。

检查水位

game.player.print(game.player.selected.getliquid().amount)

更多命令参见Mod制作.

物品名

  • repair-pack=修理包
  • stone=石头
  • wood=木板
  • raw-wood=原木
  • copper-ore=铜矿
  • iron-ore=铁矿
  • coal=煤矿
  • copper-plate=铜板
  • iron-plate=铁板
  • steel-plate=钢板
  • stone-brick=石砖
  • iron-axe=铁斧镐
  • steel-axe=钢斧镐
  • iron-gear-wheel=铁齿轮
  • iron-stick=铁棒
  • copper-cable=铜线
  • pistol=手枪
  • submachine-gun=冲锋枪
  • rocket-launcher=火箭筒
  • flame-thrower=火焰喷射器
  • flame-thrower-ammo=油料储罐
  • electronic-circuit=电路板
  • advanced-circuit=高级电路板
  • processing-unit=处理器
  • basic-armor=基础护甲
  • heavy-armor=重型护甲
  • power-armor=能量装甲
  • power-armor-mk2=能量装甲MK2
  • basic-modular-armor=模块装甲
  • rocket=制式火箭弹
  • explosive-rocket=爆炸火箭弹
  • basic-bullet-magazine=标准弹盒
  • piercing-bullet-magazine=穿甲弹盒
  • laser-turret=激光炮塔
  • solar-panel=太阳能板
  • fish=鱼
  • raw-fish=鲜鱼
  • computer=计算机
  • lab=研究中心
  • science-pack-1=科技包I
  • science-pack-2=科技包II
  • science-pack-3=科技包III
  • alien-science-pack=异星科技包
  • red-wire=红线缆
  • green-wire=绿线缆
  • alien-artifact=虫巢核心
  • speed-module=速度插件I
  • speed-module-2=速度插件II
  • speed-module-3=速度插件III
  • productivity-module=生产力插件I
  • productivity-module-2=生产力插件II
  • productivity-module-3=生产力插件III
  • effectivity-module=节能插件I
  • effectivity-module-2=节能插件II
  • effectivity-module-3=节能插件III
  • shotgun=霰弹枪
  • combat-shotgun=冲锋霰弹枪
  • shotgun-shell=制式霰弹
  • piercing-shotgun-shell=穿甲霰弹
  • railgun=电磁枪
  • railgun-dart=电磁弹
  • defender-capsule=防御机器人(胶囊)
  • distractor-capsule=掩护机器人(胶囊)
  • destroyer-capsule=进攻机器人(胶囊)
  • poison-capsule=剧毒手雷(胶囊)
  • slowdown-capsule=减速手雷(胶囊)
  • basic-grenade=制式手雷
  • basic-electric-discharge-defense-remote=放电防御模块发射器
  • blueprint=建造计划(蓝图)
  • deconstruction-planner=拆除计划(红图)
  • sulfur=硫磺
  • solid-fuel=固体燃料
  • plastic-bar=塑料
  • engine-unit=内燃机
  • electric-engine-unit=电动机
  • flying-robot-frame=机器人飞行框架
  • explosives=炸药
  • battery=电池
  • empty-barrel=空桶
  • crude-oil-barrel=原油桶
  • small-plane=小型飞机