Factorio

Factorio

338 Bewertungen
Console/Lua commands (Factorio Version 0.17 )
Von Blaze und 2 Helfern
The Console is Factorio's command-line interface.

The in-game console is used for:
  • Chatting with other players
  • Running commands / scripts / cheats
  • Occasional status updates
There are three types of commands:
  • Normal - Display information about the game and customize your experience.
  • Multiplayer - Message filtering, banning users, etc.
  • Scripting/Cheating - Run small Lua scripts (but they disable achievements for the save game)

This is a very powerful feature, which also allows cheating, and as such achievements will be permanently disabled for the save as soon as you use a script command.
5
   
Preis verleihen
Favorisieren
Favorisiert
Entfernen
Using the console
The console display can be toggled with the / (slash) or ~ (tilde) keys.

You can customize the keys via Options Menu → Keyboard → Toggle Lua console. When the console is open, you'll see a blinking cursor at the bottom of the screen; type your message or command and hit Return to send it (this will also close the console). Documentation about message and command prefixes can be found further down this page.

When console is closed, only the most recent messages/commands will be displayed, but they will gradually fade away (opening the console will immediately re-display all recent messages). Note that by default, all executed commands are made visible to all users. You can set the fade out time via Options Menu → Other Settings → Message Delay.

If you want to immediately hide the console, open the console and then press Escape key (or press Return without entering any message/command). This not only closes the console, but it also hides all the recent messages/commands. The console can be cleared with the /clear command.

Note that the console can also accept raw Lua code as well as game commands.
Console history
The console has an inbuilt history; it's a bit like a text editor where only one line of text is displayed at a time.

Use the ↑ and ↓ keys to scroll through the console history.

Use the ← and → keys to cursor through the currently displayed message or command, which you can edit (delete, insert, etc.) and resend (by pressing Return).

The Tab key will auto-complete commands and player ids.
Videos

Misc Commands
Faster Mining
/c game.player.force.manual_mining_speed_modifier=1000
-----------------------------------------------------------------------------------------------------------------------------------
Faster Crafting
/c game.player.force.manual_crafting_speed_modifier=1000
-----------------------------------------------------------------------------------------------------------------------------------
Unlock and Research All Technologies
/c game.player.force.research_all_technologies()
-----------------------------------------------------------------------------------------------------------------------------------
Unresearch All Technologies
This does not reset manually applied bonuses.
/c for _, tech in pairs(game.player.force.technologies) do tech.researched=false game.player.force.set_saved_technology_progress(tech, 0) end
-----------------------------------------------------------------------------------------------------------------------------------
Turn Off Night
Enables eternal day.
/c game.player.surface.always_day=true
-----------------------------------------------------------------------------------------------------------------------------------
Turn On Night
Disables eternal day.
/c game.player.surface.always_day=false
-----------------------------------------------------------------------------------------------------------------------------------
Change Game Speed
0.5 is half speed, 1 is default, 2 is double speed, etc. Minimum is 0.01. This can be used for a lot of things like when you know you will have to wait for long periods of time for something to complete. Increasing will decrease performance, be careful.
/c game.speed=1
-----------------------------------------------------------------------------------------------------------------------------------
Freeze time
Stops the advancement of the time.
/c game.player.surface.freeze_daytime=true
-----------------------------------------------------------------------------------------------------------------------------------
Unfreeze time
Resume the advancement of the time.
/c game.player.surface.freeze_daytime=false
-----------------------------------------------------------------------------------------------------------------------------------
Remove all pollution
/c game.player.surface.clear_pollution()
-----------------------------------------------------------------------------------------------------------------------------------
Completely turn off pollution
/c for _, surface in pairs(game.surfaces) do surface.clear_pollution() end game.map_settings.pollution.enabled = false
Add/Remove Mining Resources to map
Adding Mineable Resources

This creates a new 11×11 patch of resources, centered on the player character, where the ground is not water. The patch it creates is perfectly square but it randomizes the amount similar to natural generation, with fewer ore at the edges and more ore in the center. The default numbers result in a patch with 2500-3000 ore.

If you want a larger patch, change "local size = 5" to a larger number. A larger patch will have exponentially more ore. Entering a number above 30 is not recommended.

If you want a richer patch, change "local density = 10" to a larger number. Entering a very large number shouldn't hurt anything but you probably don't need to go above 100.

Image
Resources
Code
Coal
/c local surface=game.player.surface
local ore=nil
local size=5
local density=10
for y=-size, size do
for x=-size, size do
a=(size+1-math.abs(x))*10
b=(size+1-math.abs(y))*10
if a<b then
ore=math.random(a*density-a*(density-8), a*density+a*(density-8))
end
if b<a then
ore=math.random(b*density-b*(density-8), b*density+b*(density-8))
end
if surface.get_tile(game.player.position.x+x, game.player.position.y+y).collides_with("ground-tile") then
surface.create_entity({name="coal", amount=ore, position={game.player.position.x+x, game.player.position.y+y}})
end
end
end
Stone
/c local surface=game.player.surface
local ore=nil
local size=5
local density=10
for y=-size, size do
for x=-size, size do
a=(size+1-math.abs(x))*10
b=(size+1-math.abs(y))*10
if a<b then
ore=math.random(a*density-a*(density-8), a*density+a*(density-8))
end
if b<a then
ore=math.random(b*density-b*(density-8), b*density+b*(density-8))
end
if surface.get_tile(game.player.position.x+x, game.player.position.y+y).collides_with("ground-tile") then
surface.create_entity({name="stone", amount=ore, position={game.player.position.x+x, game.player.position.y+y}})
end
end
end
Iron Ore
/c local surface=game.player.surface
local ore=nil
local size=5
local density=10
for y=-size, size do
for x=-size, size do
a=(size+1-math.abs(x))*10
b=(size+1-math.abs(y))*10
if a<b then
ore=math.random(a*density-a*(density-8), a*density+a*(density-8))
end
if b<a then
ore=math.random(b*density-b*(density-8), b*density+b*(density-8))
end
if surface.get_tile(game.player.position.x+x, game.player.position.y+y).collides_with("ground-tile") then
surface.create_entity({name="iron-ore", amount=ore, position={game.player.position.x+x, game.player.position.y+y}})
end
end
end
Copper Ore
/c local surface=game.player.surface
local ore=nil
local size=5
local density=10
for y=-size, size do
for x=-size, size do
a=(size+1-math.abs(x))*10
b=(size+1-math.abs(y))*10
if a<b then
ore=math.random(a*density-a*(density-8), a*density+a*(density-8))
end
if b<a then
ore=math.random(b*density-b*(density-8), b*density+b*(density-8))
end
if surface.get_tile(game.player.position.x+x, game.player.position.y+y).collides_with("ground-tile") then
surface.create_entity({name="copper-ore", amount=ore, position={game.player.position.x+x, game.player.position.y+y}})
end
end
end
Uranium Ore
/c local surface=game.player.surface
local ore=nil
local size=5
local density=10
for y=-size, size do
for x=-size, size do
a=(size+1-math.abs(x))*10
b=(size+1-math.abs(y))*10
if a<b then
ore=math.random(a*density-a*(density-8), a*density+a*(density-8))
end
if b<a then
ore=math.random(b*density-b*(density-8), b*density+b*(density-8))
end
if surface.get_tile(game.player.position.x+x, game.player.position.y+y).collides_with("ground-tile") then
surface.create_entity({name="uranium-ore", amount=ore, position={game.player.position.x+x, game.player.position.y+y}})
end
end
end

Adding new oil patch

This creates 9 crude oil patches in a 3×3 square.

Crude Oil
/c for y=0,2 do
for x=0,2 do
game.player.surface.create_entity({name="crude-oil", amount=25000000, position={game.player.position.x+x*7-7, game.player.position.y+y*7-7}})
end
end

Remove resources around the player

Removes all resource patches from the ground in a 50 x 50 area around the player.

/c local surface=game.player.surface
local size=50
local pos=game.player.position

for _, e in pairs(surface.find_entities_filtered{area={{pos.x-size, pos.y-size},{pos.x+size,pos.y+size}}, type="resource"})
do e.destroy()
end
Items and Recipes
Logistics

-----------------------------------------------------------------------------------------------------------------------------------
Production

-----------------------------------------------------------------------------------------------------------------------------------
Intermediate Products

-----------------------------------------------------------------------------------------------------------------------------------
Combat

Add items to the player's inventory
All the codes are base of One Stack Size.
Logistics


Storage
Icon
Item
Code
Wooden Chest
/c game.player.insert{name="wooden-chest", count=50}
Iron Chest
/c game.player.insert{name="iron-chest", count=50}
Steel Chest
/c game.player.insert{name="steel-chest", count=50}
Storage Tank
/c game.player.insert{name="storage-tank", count=50}
==========================================================================
Belt Transport System
Transport Belts
Icon
Item
Code
Transport Belt
/c game.player.insert{name="transport-belt", count=100}
Fast Transport Belt
/c game.player.insert{name="fast-transport-belt", count=100}
Express Transport Belt
/c game.player.insert{name="express-transport-belt", count=100}
-----------------------------------------------------------------------------------------------------------------------------------
Underground Belts
Icon
Item
Code
Underground Belt
/c game.player.insert{name="underground-belt", count=50}
Fast Underground Belt
/c game.player.insert{name="fast-underground-belt", count=50}
Express Underground Belt
/c game.player.insert{name="express-underground-belt", count=50}
-----------------------------------------------------------------------------------------------------------------------------------
Splitters
Icon
Item
Code
Splitter
/c game.player.insert{name="splitter", count=50}
Fast Splitter
/c game.player.insert{name="fast-splitter", count=50}
Express Splitter
/c game.player.insert{name="express-splitter", count=50}
==========================================================================
Inserters
Icon
Item
Code
Burner Inserter
/c game.player.insert{name="burner-inserter", count=50}
Inserter
/c game.player.insert{name="inserter", count=50}
Long Handed Inserter
/c game.player.insert{name="long-handed-inserter", count=50}
Fast Inserter
/c game.player.insert{name="fast-inserter", count=50}
Filter Inserter
/c game.player.insert{name="filter-inserter", count=50}
Stack Inserter
/c game.player.insert{name="stack-inserter", count=50}
Stack Filter Inserter
/c game.player.insert{name="stack-filter-inserter", count=50}
==========================================================================
Energy & Pipe Distribution
Icon
Item
Code
Small Electric Pole
/c game.player.insert{name="small-electric-pole", count=50}
Medium Electric Pole
/c game.player.insert{name="medium-electric-pole", count=50}
Big Electric Pole
/c game.player.insert{name="big-electric-pole", count=50}
Substation
/c game.player.insert{name="substation", count=50}
Pipe
/c game.player.insert{name="pipe", count=100}
Pipe to Ground
/c game.player.insert{name="pipe-to-ground", count=50}
Pump
/c game.player.insert{name="pump", count=50}
Logistics (Continued)


Transport
Icon
Item
Code
Rail
/c game.player.insert{name="rail", count=100}
Train Stop
/c game.player.insert{name="train-stop", count=10}
Rail Signal
/c game.player.insert{name="rail-signal", count=50}
Rail Chain Signal
/c game.player.insert{name="rail-chain-signal", count=50}
Locomotive
/c game.player.insert{name="diesel-locomotive", count=5}
Cargo Wagon
/c game.player.insert{name="cargo-wagon", count=5}
Fluid Wagon
/c game.player.insert{name="fluid-wagon", count=5}
Artillery Wagon
/c game.player.insert{name="artillery-wagon", count=5}
Car
/c game.player.insert{name="car", count=1}
Tank
/c game.player.insert{name="tank", count=1}
==========================================================================
Logistic Network
Icon
Item
Code
Logistic Robot
/c game.player.insert{name="logistic-robot", count=50}
Construction Robot
/c game.player.insert{name="construction-robot", count=50}
Active Provider Chest
/c game.player.insert{name="logistic-chest-active-provider", count=50}
Passive Provider Chest
/c game.player.insert{name="logistic-chest-passive-provider", count=50}
Storage Chest
/c game.player.insert{name="logistic-chest-storage", count=50}
Buffer Chest
/c game.player.insert{name="logistic-chest-buffer", count=50}
Requester Chest
/c game.player.insert{name="logistic-chest-requester", count=50}
Roboport
/c game.player.insert{name="roboport", count=10}
==========================================================================
Circuit Network
Icon
Item
Code
Lamp
/c game.player.insert{name="small-lamp", count=50}
Red Wire
/c game.player.insert{name="red-wire", count=200}
Green Wire
/c game.player.insert{name="green-wire", count=200}
Arithmetic Combinator
/c game.player.insert{name="arithmetic-combinator", count=50}
Decider Combinator
/c game.player.insert{name="decider-combinator", count=50}
Constant Combinator
/c game.player.insert{name="constant-combinator", count=50}
Power Switch
/c game.player.insert{name="power-switch", count=50}
Programmable Speaker
/c game.player.insert{name="programmable-speaker", count=50}
Logistics (Continued)


Terrain
Icon
Item
Code
Stone Brick
/c game.player.insert{name="stone-brick", count=100}
Concrete
/c game.player.insert{name="concrete", count=100}
Hazard Concrete
/c game.player.insert{name="hazard-concrete", count=100}
Refined Concrete
/c game.player.insert{name="refined-concrete", count=100}
Refined Hazard Concrete
/c game.player.insert{name="refined-hazard-concrete", count=100}
Landfill
/c game.player.insert{name="landfill", count=100}
Cliff Explosives
/c game.player.insert{name="cliff-explosives", count=20}
Production


Tools
Icon
Item
Code
Repair pack
/c game.player.insert{name="repair-pack", count=100}
==========================================================================
Electricity
Icon
Item
Code
Boiler
/c game.player.insert{name="boiler", count=50}
Steam Engine
/c game.player.insert{name="steam-engine", count=10}
Steam Turbine
/c game.player.insert{name="steam-turbine", count=10}
Solar Panel
/c game.player.insert{name="solar-panel", count=50}
Accumulator
/c game.player.insert{name="accumulator", count=50}
Nuclear Reactor
/c game.player.insert{name="nuclear-reactor", count=10}
Heat Exchanger
/c game.player.insert{name="heat-boiler", count=50}
Heat Pipe
/c game.player.insert{name="heat-pipe", count=50}
==========================================================================
Resource Extraction
Icon
Item
Code
Burner Mining Drill
/c game.player.insert{name="burner-mining-drill", count=50}
Electric Mining Drill
/c game.player.insert{name="electric-mining-drill", count=50}
Offshore Pump
/c game.player.insert{name="offshore-pump", count=20}
Pumpjack
/c game.player.insert{name="pumpjack", count=20}
==========================================================================
Furnaces
Icon
Item
Code
Stone Furnace
/c game.player.insert{name="stone-furnace", count=50}
Steel Furnace
/c game.player.insert{name="steel-furnace", count=50}
Electric Furnace
/c game.player.insert{name="electric-furnace", count=50}
Production (Continued)


Production
Icon
Item
Code
Assembling Machine 1
/c game.player.insert{name="assembling-machine-1", count=50}
Assembling Machine 2
/c game.player.insert{name="assembling-machine-2", count=50}
Assembling Machine 3
/c game.player.insert{name="assembling-machine-3", count=50}
Oil Refinery
/c game.player.insert{name="oil-refinery", count=10}
Chemical plant
/c game.player.insert{name="chemical-plant", count=10}
Centrifuge
/c game.player.insert{name="centrifuge", count=10}
Lab
/c game.player.insert{name="lab", count=10}
==========================================================================
Modules
Icon
Item
Code
Beacon
/c game.player.insert{name="beacon", count=10}
Speed Module
/c game.player.insert{name="speed-module", count=50}
Speed Module 2
/c game.player.insert{name="speed-module-2", count=50}
Speed Module 3
/c game.player.insert{name="speed-module-3", count=50}
Efficiency Module
/c game.player.insert{name="effectivity-module", count=50}
Efficiency Module 2
/c game.player.insert{name="effectivity-module-2", count=50}
Efficiency Module 3
/c game.player.insert{name="effectivity-module-3", count=50}
Productivity Module
/c game.player.insert{name="productivity-module", count=50}
Productivity Module 2
/c game.player.insert{name="productivity-module-2", count=50}
Productivity Module 3
/c game.player.insert{name="productivity-module-3", count=50}
Intermediate Products


Resources and Fluids
Icon
Item
Code
Wood
/c game.player.insert{name="wood", count=100}
Coal
/c game.player.insert{name="coal", count=50}
Stone
/c game.player.insert{name="stone", count=50}
Iron Ore
/c game.player.insert{name="iron-ore", count=50}
Copper Ore
/c game.player.insert{name="copper-ore", count=50}
Uranium Ore
/c game.player.insert{name="uranium-ore", count=50}
Raw Fish
/c game.player.insert{name="fish", count=100}
==========================================================================
Materials
Icon
Item
Code
Iron Plate
/c game.player.insert{name="iron-plate", count=100}
Copper Plate
/c game.player.insert{name="copper-plate", count=100}
Solid Fuel
/c game.player.insert{name="solid-fuel", count=50}
Steel Plate
/c game.player.insert{name="steel-plate", count=100}
Plastic Bar
/c game.player.insert{name="plastic-bar", count=100}
Sulfur
/c game.player.insert{name="sulfur", count=50}
Battery
/c game.player.insert{name="battery", count=200}
Explosives
/c game.player.insert{name="explosives", count=50}
Intermediate Products (Continued)


Crafting Components
Icon
Item
Code
Copper Cable
/c game.player.insert{name="copper-cable", count=200}
Iron Stick
/c game.player.insert{name="iron-stick", count=100}
Iron Gear Wheel
/c game.player.insert{name="iron-gear-wheel", count=100}
Electronic Circuit
/c game.player.insert{name="electronic-circuit", count=200}
Advanced Circuit
/c game.player.insert{name="advanced-circuit", count=200}
Processing Unit
/c game.player.insert{name="processing-unit", count=100}
Engine Unit
/c game.player.insert{name="engine-unit", count=50}
Electric Engine Unit
/c game.player.insert{name="electric-engine-unit", count=50}
Flying Robot Frame
/c game.player.insert{name="flying-robot-frame", count=50}
Satellite
/c game.player.insert{name="satellite", count=1}
Rocket Part
/c game.player.insert{name="rocket-part", count=5}
Rocket Control Unit
/c game.player.insert{name="rocket-control-unit", count=10}
Low Density Structure
/c game.player.insert{name="rocket-structure", count=10}
Rocket Fuel
/c game.player.insert{name="rocket-fuel", count=10}
Nuclear Fuel
/c game.player.insert{name="nuclear-fuel", count=1}
Uranium-235
/c game.player.insert{name="uranium-235", count=100}
Uranium-238
/c game.player.insert{name="uranium-238", count=100}
Uranium Fuel Cell
/c game.player.insert{name="uranium-fuel-cell", count=50}
Used Up Uranium Fuel Cell
/c game.player.insert{name="used-up-uranium-fuel-cell", count=50}
==========================================================================
Science Packs
Icon
Item
Code
Automation Science Pack
/c game.player.insert{name="automation-science-pack", count=200}
Logistic Science Pack
/c game.player.insert{name="logistic-science-pack", count=200}
Chemical Science Pack
/c game.player.insert{name="chemical-science-pack", count=200}
Military Science Pack
/c game.player.insert{name="military-science-pack", count=200}
Production Science Pack
/c game.player.insert{name="production-science-pack", count=200}
Utility Science Pack
/c game.player.insert{name="utility-science-pack", count=200}
Space Science Pack
/c game.player.insert{name="space-science-pack", count=2000}
Combat


Weapons
Icon
Item
Code
Pistol
/c game.player.insert{name="pistol", count=5}
Submachine Gun
/c game.player.insert{name="submachine-gun", count=5}
Shotgun
/c game.player.insert{name="shotgun", count=5}
Combat Shotgun
/c game.player.insert{name="combat-shotgun", count=5}
Rocket Launcher
/c game.player.insert{name="rocket-launcher", count=5}
Flamethrower
/c game.player.insert{name="flamethrower", count=5}
Land Mine
/c game.player.insert{name="land-mine", count=100}
==========================================================================
Ammo
Icon
Item
Code
Firearm Magazine
/c game.player.insert{name="firearm-magazine", count=200}
Piercing Rounds Magazine
/c game.player.insert{name="piercing-rounds-magazine", count=200}
Uranium Rounds Magazine
/c game.player.insert{name="uranium-rounds-magazine", count=200}
Shotgun Shells
/c game.player.insert{name="shotgun-shell", count=200}
Piercing Shotgun Shells
/c game.player.insert{name="piercing-shotgun-shell", count=200}
Cannon Shell
/c game.player.insert{name="cannon-shell", count=200}
Explosive Cannon Shell
/c game.player.insert{name="explosive-cannon-shell", count=200}
Uranium Cannon Shell
/c game.player.insert{name="uranium-cannon-shell", count=200}
Explosive Uranium Cannon Shell
/c game.player.insert{name="explosive-uranium-cannon-shell", count=200}
Artillery Shell
/c game.player.insert{name="artillery-shell", count=1}
Rocket
/c game.player.insert{name="rocket", count=200}
Explosive Rocket
/c game.player.insert{name="explosive-rocket", count=200}
Atomic Bomb
/c game.player.insert{name="atomic-bomb", count=10}
Flamethrower Ammo
/c game.player.insert{name="flamethrower-ammo", count=100}
==========================================================================
Capsules
Icon
Item
Code
Grenade
/c game.player.insert{name="grenade", count=100}
Cluster Grenade
/c game.player.insert{name="cluster-grenade", count=100}
Poison Capsule
/c game.player.insert{name="poison-capsule", count=100}
Slowdown Capsule
/c game.player.insert{name="slowdown-capsule", count=100}
Defender Capsule
/c game.player.insert{name="defender", count=100}
Distractor Capsule
/c game.player.insert{name="distractor", count=100}
Destroyer capsule
/c game.player.insert{name="destroyer", count=100}
==========================================================================
Armor
Icon
Item
Code
Light Armor
/c game.player.insert{name="light-armor", count=1}
Heavy Armor
/c game.player.insert{name="heavy-armor", count=1}
Modular Armor
/c game.player.insert{name="modular-armor", count=1}
Power Armor
/c game.player.insert{name="power-armor", count=1}
Power Armor MK2
/c game.player.insert{name="power-armor-mk2", count=1}
Combat (Continued)


Armor Modules
Icon
Item
Code
Portable Solar Panel
/c game.player.insert{name="solar-panel-equipment", count=20}
Portable Fusion Reactor
/c game.player.insert{name="fusion-reactor-equipment", count=20}
Energy Shield
/c game.player.insert{name="energy-shield-equipment", count=20}
Energy Shield MK2
/c game.player.insert{name="energy-shield-mk2-equipment", count=20}
Personal Battery
/c game.player.insert{name="battery-equipment", count=20}
Personal Battery MK2
/c game.player.insert{name="battery-mk2-equipment", count=20}
Personal Laser Defense
/c game.player.insert{name="personal-laser-defense-equipment", count=20}
Discharge Defense
/c game.player.insert{name="discharge-defense-equipment", count=20}
Exoskeleton
/c game.player.insert{name="exoskeleton-equipment", count=20}
Personal Roboport
/c game.player.insert{name="personal-roboport-equipment", count=20}
Personal Roboport MK2
/c game.player.insert{name="personal-roboport-mk2-equipment", count=20}
Nightvision
/c game.player.insert{name="night-vision-equipment", count=20}
==========================================================================
Defense
Icon
Item
Code
Wall
/c game.player.insert{name="stone-wall", count=100}
Gate
/c game.player.insert{name="gate", count=50}
Gun Turret
/c game.player.insert{name="gun-turret", count=50}
Laser Turret
/c game.player.insert{name="laser-turret", count=50}
Flamethrower Turret
/c game.player.insert{name="flamethrower-turret", count=50}
Artillery Turret
/c game.player.insert{name="artillery-turret", count=10}
Radar
/c game.player.insert{name="radar", count=50}
Rocket Silo
/c game.player.insert{name="rocket-silo", count=1}
8 Kommentare
{null} 4. Dez. 2022 um 18:17 
What about researching specific techs, but not others?
Fungui 17. Juni 2022 um 18:10 
can i find my exchange string
Darth Porgus 28. Dez. 2019 um 10:16 
can you spawn in pollution and can you create a bitter nest?
DUMBHA 15. Juni 2019 um 16:08 
For infinity chests, use this command
/c game.player.insert"infinity-chest"
Crazy_Human 6. Apr. 2019 um 9:53 
what about the infinte chest command? which add a chest with unlimited of each item
Blaze  [Autor] 27. März 2019 um 14:17 
Not that I'm aware of.
Sgitch 26. März 2019 um 15:48 
is there any fly mode cheat?
Blaze  [Autor] 3. März 2019 um 6:34 
All Updated to Factorio Version 0.17