Page 1 of 1
Commands to change all tiles to lab tiles
Posted: Thu Jan 30, 2020 8:35 pm
by Impatient
What are the commands to
a) change all tiles in exiting chunks to lab tiles
b) make newly charted chunks only contain lab tiles (also excluding deco, trees, cliffs, resources, biters, ...)
I want to turn an existing world into a lab world.
Re: Commands to change all tiles to lab tiles
Posted: Fri Jan 31, 2020 6:47 am
by darkfrei
by all surfaces
by all chunks
get chunk area
go x from 0 to 31
go y from 0 to 31
for every x and y as position in this chunk run the function
Code: Select all
function replace_floor_with (position, surface)
if ((position.x + position.y)%2 == 0) then
return "lab-dark-1"
else
return "lab-dark-2"
end
end
add them to the table
Code: Select all
new_tiles[#new_tiles+1] = {name = replace_floor_with (position, surface), position = position}
See also
https://mods.factorio.com/mod/lab-floor
Re: Commands to change all tiles to lab tiles
Posted: Fri Jan 31, 2020 8:09 am
by Optera
Convert existing worlds into labs:
1) open /editor
2) go into surfaces, select the surface and click "fill with lab tiles"
don't forget also checking "generate new chunks with lab tiles"
Sadly the editor doesn't come with buttons to remove cliffs, grass, rocks and trees.
Removing all of those at once including modded versions get a bit involved but this will work in console:
Code: Select all
/c
local surface = game.surfaces["nauvis"]
surface.destroy_decoratives{}
for _, entity in pairs(surface.find_entities_filtered{type = "cliff"} ) do
entity.destroy()
end
local tree_names = {}
for name, prototype in pairs(game.entity_prototypes) do
local autoplace = prototype.autoplace_specification
if autoplace and autoplace.peaks then
for _, peak in pairs(autoplace.peaks) do
if peak.noise_layer == "rocks" or peak.noise_layer == "trees" then
tree_names[#tree_names+1] = name
break
end
end
end
end
for _, entity in pairs(surface.find_entities_filtered{name = tree_names} ) do
entity.destroy()
end
Re: Commands to change all tiles to lab tiles
Posted: Sat Feb 01, 2020 4:25 am
by Impatient
Thanks!