How to update the map after modifying the terrain?

Place to get help with not working mods / modding interface.
Post Reply
VBMeireles
Inserter
Inserter
Posts: 23
Joined: Mon Aug 11, 2014 1:34 pm
Contact:

How to update the map after modifying the terrain?

Post 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?

User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

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

Post 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...

VBMeireles
Inserter
Inserter
Posts: 23
Joined: Mon Aug 11, 2014 1:34 pm
Contact:

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

Post by VBMeireles »

Thanks. I'll test it ASAP and see if it does work.

VBMeireles
Inserter
Inserter
Posts: 23
Joined: Mon Aug 11, 2014 1:34 pm
Contact:

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

Post by VBMeireles »

It doesn't work. :( Console says "chart" expected a table but got nil instead.

n9103
Smart Inserter
Smart Inserter
Posts: 1067
Joined: Wed Feb 20, 2013 12:09 am
Contact:

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

Post 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.
Last edited by n9103 on Mon Sep 15, 2014 1:10 am, edited 2 times in total.
Colonel Failure wrote:You can lose your Ecologist Badge quite quickly once you get to the point of just being able to murder them willy-nilly without a second care in the world.

User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

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

Post 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 :).

VBMeireles
Inserter
Inserter
Posts: 23
Joined: Mon Aug 11, 2014 1:34 pm
Contact:

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

Post by VBMeireles »

Awesome. I'll try it with the proper input next time.

Post Reply

Return to “Modding help”