Cheats

From Evospace
Jump to navigation Jump to search

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 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
/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

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("FirstBlocks"))
/lua quests:unlock_quest(StaticQuest.get("DrillingRig"))
/lua quests:unlock_chapter(StaticChapter.get("OreToPower"))
/lua StaticQuest.get("FirstBlocks"):set_objective_complete_by_id("place_smelter", true)
/lua StaticQuest.get("FirstBlocks"):set_objective_progress(0, 10, 10, true)

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("IronIngot"), count = 1 })

Teleport

/lua dim:teleport(Vec3i.new(0, 0, 80))
/lua dim:teleport(dim:spawn_point())
/lua dim:teleport(Vec3i.new(4000, -1200, dim:sample_height(4000, -1200) + 3))

dim:teleport_pending() is true while the target columns compile. dim:streaming_ready() is true when loading and meshing around the player are done.

Blocks

/lua dim:spawn_block_identity(Vec3i.new(10, 10, 60), StaticBlock.get("Chest"))
/lua dim:set_cell(Vec3i.new(10, 10, 60), StaticBlock.get("Air"))
/lua dim:clear_props(Vec3i.new(10, 10, 60))
/lua dim:get_cell(Vec3i.new(10, 10, 60)).name

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.

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("IronIngot"), 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("IronOre"), 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 Recipe.get("SteelIngotRecipe").locked = false
/lua Recipe.get("SteelIngotRecipe").productivity = 100

Weather and time

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
shot.time_of_day(13.5) Holds the sky at a solar hour, 0..24