Cheats
The command line in the player log runs Lua in the game's script state. This page lists the lines that skip quests, move the player, produce items, place and remove deposits and control the weather.
Command line
Two input slots open the same field. Console opens it in command mode, where the leading / is implied. Chat opens it as chat, and a line starting with / is still run as a command. Both slots are rebindable. Arrow keys recall previous lines.
| Command | Effect |
|---|---|
/help [command] |
Lists the commands, or prints the usage of one |
/time |
Prints the day and the world clock, with (frozen) while the day phase is held
|
/pos |
Prints the block cell the player stands in |
/weather |
Posts the weather card for the current conditions |
/lua <code> |
Runs Lua. Everything below is run through it |
The line is compiled as return <code> first, so an expression prints its value. A line that does not compile that way is run as a chunk, so statements and loops work. print writes to the console, the first 20 lines of it.
/lua 2 + 2
/lua for i = 1, 3 do print(i) end
The lines below reach the surface the player is on through dim. Set it once after loading a game, and again after travelling to another surface:
/lua dim = Player.get():surface()
Quests
Complete every quest that is active:
/lua for _, q in ipairs(quests:get_active_quests()) do quests:complete_quest(q) end
Single quests, chapters and objectives:
/lua quests:complete_quest(StaticQuest.get("Welcome"))
/lua quests:unlock_quest(StaticQuest.get("GatherCopperOre"))
/lua quests:unlock_chapter(StaticChapter.get("Automation"))
/lua StaticQuest.get("Welcome"):set_objective_complete_by_id("open_questbook", true)
/lua StaticQuest.get("GatherCopperOre"):set_objective_progress(0, 25, 25, true)
complete_quest takes a quest that is active. unlock_quest takes a locked one whose chapter is open and whose required quests are done, unlock_chapter a chapter whose required chapters are done. Each returns false when it changed nothing. Objectives exist while their quest is active, and are counted from 0.
quests:get_all_quests() and quests:get_all_chapters() list every quest and chapter. quests:is_quest_active(q) and quests:is_quest_completed(q) test one.
A quest that waits for a gameplay event completes when the event is emitted:
/lua EventSystem.get():emmit(defines.events.on_player_crafted, { item = StaticItem.get("StoneFurnace"), count = 1 })
Teleport
/lua dim:teleport(Vec3i.new(0, 0, 80))
/lua dim:teleport(Player.get():spawn_point())
/lua dim:teleport(Vec3i.new(4000, -1200, dim:sample_height(4000, -1200) + 3))
Blocks
/lua dim:place(Vec3i.new(10, 10, 60), StaticBlock.get("CopperChest"))
/lua dim:dig(Vec3i.new(10, 10, 60))
/lua dim:clear_props(Vec3i.new(10, 10, 60), 5)
/lua dim:get_cell(Vec3i.new(10, 10, 60)).name
place and dig build and break the way a tool in hand does, in a column that is streamed in. clear_props takes every prop within a radius of the cell, at any height. dim:get_block(bpos) returns the block placed in a cell, which the sections below use to reach a chest or a machine. Positions are Vec3i.new(x, y, z) in block cells. cs.w2bp and cs.bp2w convert between world units and cells.
Deposits
A deposit is two things: the source that drills mine and the map shows, and the rock that stands over it. Each has its own line, so placing a deposit takes two and removing one takes two.
Place a deposit under the player and stand its rock there:
/lua local c = Player.get():cell(); print(dim:add_deposit(StaticItem.get("ChalcopyriteOre"), Vec2i.new(c.x, c.y), 5000), dim:place_prop(StaticProp.get("ChalcopyriteCluster"), c))
The number is the total yield. The item has to be one of the surface's deposit ores. Terrain generated before the deposit gets no ore from it, only terrain generated after it does.
| Item | Rock |
|---|---|
ChalcopyriteOre |
ChalcopyriteCluster
|
CoalOre |
CoalCluster
|
PyriteOre |
PyriteCluster
|
MagnetiteOre |
MagnetiteCluster
|
MalachiteOre |
MalachiteCluster
|
CinnabarOre |
CinnabarCluster
|
BauxiteOre |
BauxiteCluster
|
RubyOre |
RubyCluster
|
ThorianiteOre |
ThorianiteCluster
|
PyroplatiteOre |
PyroplatiteCluster
|
RawOil |
OilCluster
|
Remove the deposits within 20 cells of the player, then the props around them:
/lua local c = Player.get():cell(); print(dim:remove_deposit(c, 20), dim:clear_props(c, 20))
remove_deposit takes the deposits whose centre lies within the radius and prints how many it took. The map stops showing them, and drills standing on them switch to the nearest deposit left or to the ground. clear_props takes every prop within the radius at any height: the rock with its shards and rubble, but also trees and grass. Nothing is dropped. The ore already in the terrain stays.
Items
Items are added to a container. Place a chest, read its cell with /pos, then fill it:
/lua StorageBlockLogic.cast(dim:get_block(Vec3i.new(10, 10, 60))).storage_access:add(StaticItem.get("IronPlate"), 1000)
:sub(item, count) removes them again. Machine inventories take items the same way:
/lua AbstractCrafter.cast(dim:get_block(Vec3i.new(10, 10, 60))).crafter_input_container:get_access(0):add(StaticItem.get("PyriteOre"), 100)
Machines
/lua AbstractCrafter.cast(dim:get_block(Vec3i.new(10, 10, 60))).energy_input_inventory:add_resource(100000)
/lua AbstractCrafter.cast(dim:get_block(Vec3i.new(10, 10, 60))).productivity = 500
/lua AbstractCrafter.cast(dim:get_block(Vec3i.new(10, 10, 60))).speed = 10
add_resource fills an energy, heat or fluid slot directly. The Admin Electric Generator block produces unlimited power and can be placed like any other block.
Recipes
/lua RecipeDictionary.get("ArcSmelterRecipeDictionary"):recipe("SteelPlate").locked = false
A recipe is reached through the dictionary of the machines that run it, :recipes() lists them. Its productivity is set only while a mod loads, from init.
Weather
| Line | Effect |
|---|---|
weather.set("Rain") |
Transitions to a weather preset |
weather.snap("Rain") |
Switches to it at once |
weather.clear() |
Returns weather control to the biome |
weather.wind(20) |
Holds the wind speed, up to the planet maximum of 20 m/s |
weather.wind_clear() |
Releases the wind |
Presets
weather.set and weather.snap take one of these names.
- Clear sky:
Clear,SlightlyCloudy,PartlyCloudy,Overcast - Rain:
LightRain,Rain,Storm - Snow:
Snowfall,Blizzard - Dust:
DustHaze,SandStorm - Fog:
LightLowFog,DenseLowFog,Foggy,ExtremeFoggy