Scenario: Reveal map at start?

Place to get help with not working mods / modding interface.
Post Reply
SilverB1rd
Inserter
Inserter
Posts: 47
Joined: Fri Mar 17, 2017 9:19 pm
Contact:

Scenario: Reveal map at start?

Post by SilverB1rd »

I'm working on a modified version of the wave defense scenario. I would like show the map the start of the game. I was trying different variants of the chart functions and the only one I was able to get working was

Code: Select all

script.on_init(function()
 ...
 game.forces["player"].chart(game.surfaces[1], {{-1024,-1024},{1024,1024}})
end)
Is there a cleaner way to reveal the map? I would have rather used something more generic like chart_all() but it did not seem have any effect during the on_init.

Klonan, any suggestions?

User avatar
Narc
Filter Inserter
Filter Inserter
Posts: 278
Joined: Mon Feb 11, 2013 7:25 am
Contact:

Re: Scenario: Reveal map at start?

Post by Narc »

In what way cleaner? LuaForce.chart_all will chart all generated chunks, like it says in the spec. It shouldn't cause the generation of chunks -- the game map can be very large and prohibitively expensive to generate entirely (or to retain on disk or in memory).

If your scenario map is fixed size, you already know what area to chart to reveal the whole thing, and doing it in on_init makes the most sense. This will also guarantee the entire map is generated on start (not that I've ever noticed Factorio worldgen speed).

Post Reply

Return to “Modding help”