Page 1 of 1

How to update the map after modifying the terrain?

Posted: Sat Sep 13, 2014 9:28 pm
by VBMeireles
I've used lua commands in-game to change a bunch of tiles from water to grass but the maps (the minimap and the "M" overview map) do not reflect the changes. I've tried saving the game, restarting Factorio and loading the game but it still doesn't refresh the maps.

Is it possible?

Re: How to update the map after modifying the terrain?

Posted: Sat Sep 13, 2014 9:33 pm
by FreeER
I'd think that game.player.force.chart(boundingbox_to_chart) would work (though I haven't had to do this myself), see Wiki Lua/Force, well the wiki doesn't actually have much more to say for that command but...

Re: How to update the map after modifying the terrain?

Posted: Sat Sep 13, 2014 9:44 pm
by VBMeireles
Thanks. I'll test it ASAP and see if it does work.

Re: How to update the map after modifying the terrain?

Posted: Mon Sep 15, 2014 12:50 am
by VBMeireles
It doesn't work. :( Console says "chart" expected a table but got nil instead.

Re: How to update the map after modifying the terrain?

Posted: Mon Sep 15, 2014 12:54 am
by n9103
Did you give it a bounding box?
I imagine it's looking for something like [s](-500, 500, -500, 500);[/s] a table of coordinates.

E: I should bother learning lua at some point.

Re: How to update the map after modifying the terrain?

Posted: Mon Sep 15, 2014 1:03 am
by FreeER
VBMeireles wrote:It doesn't work. :( Console says "chart" expected a table but got nil instead.
chart would need to be called with a valid bounding box (nil means it got something with a value equivalent to "no real value here"), I used boundingbox_to_chart as a placeholder (sorry for not making that obvious). I usually use a function like this

Code: Select all

function getbb(position, radius) return {{position.x-radius, position.y-radius}, {position.x+radius, position.y+radius}} end 
to generate a bounding box, so copy/paste that function into Factorio's console and then use game.player.force.chart(getbb(game.player.position, 10))
to chart a box 20 wide by 20 tall (10 in each direction) centered around the player. Or you could manually create the bounding box as {{game.player.position.x-10, game.player.position.y-10},{game.player.position.x+10, game.player.position.y+10}} but... that's very annoying in my opinion especially if I need more than one bounding box :).

Re: How to update the map after modifying the terrain?

Posted: Mon Sep 15, 2014 11:08 pm
by VBMeireles
Awesome. I'll try it with the proper input next time.