Empty (black) surface, but with minimap?

Place to get help with not working mods / modding interface.
Post Reply
Wisq
Manual Inserter
Manual Inserter
Posts: 1
Joined: Fri Nov 18, 2016 3:39 am
Contact:

Empty (black) surface, but with minimap?

Post by Wisq »

So I've been doing some tweaking to the Factorissimo mod, putting all the factories of a given type onto a single surface rather than creating a separate surface for each factory (and eventually hitting the 256 surface limit).

To create the interior of the factory, the old code basically did this:
  • create a 2x2 surface when you put down a factory
  • request a 1-radius chunk generation at {0,0}
  • wait for the first 4 chunks to generate, indicating it's safe to start replacing tiles
  • slap down some tiles (overwriting the 2x2 space from before) and some entities
The new code only creates the surface (and requests generation, and waits for generation) when you put down the first factory. Subsequent factories are just moved to a different X/Y offset, outside the map bounds (width/height) — for example, the second factory shows up centered around x=256, y=0.

Perhaps surprisingly (to me), this actually works! I can be waaay outside the 2x2 map bounds and it seems perfectly fine with me setting tiles, creating entities, managing pollution, etc. I kinda expected the game to eventually get upset with me, but it hasn't so far. :)

Now, when I do this, the first factory interior shows up fine in both the minimap and the full-screen map:
image
… but the second (and subsequent) factory interiors don't show up on either map. I just see this:
image
… even though the interior is there, is working perfectly fine, etc. (You can see the first factory interior way off to the left, but not the one I'm in.)

So I'm guessing the issue is that Factorio won't generate a map outside the surface bounds. Fair enough, right?

However, if I leave the surface unbounded (width & height unset), I seem to be stuck with the default world generator — I can't find a way to turn it off and just leave the tiles alone. So I get ground and water and rocks and trees and etc, none of which I actually want. And even if I set up an "on_chunk_generated" event listener to just immediately delete all tiles and entities in the newly-generated chunks — and wait for all the chunks to generate before I put my own factory tiles and entities down (bit of a hassle) — I can't seem to clear the chunks fast enough that the player doesn't see them being generated, because they generate in several steps and I only get notified at the end.

So I guess what I'm wondering is, any combination of the following:
  • Is there a way to generate minimap data outside the official world bounds?
  • Can I turn off the map generator so I just get a black ("out-of-map") map?
  • Can I make it think a chunk is generated even when it's not, thus pre-empting the map generator? (I've tried messing with "set_chunk_generated_status", to no avail.)
  • Is there a way to speed up generation — e.g. tell it to skip as many steps as possible — so I can quickly get my "on_chunk_generated" event and nuke the tiles?
TIA!

Daid
Fast Inserter
Fast Inserter
Posts: 163
Joined: Sun Jul 03, 2016 7:42 am
Contact:

Re: Empty (black) surface, but with minimap?

Post by Daid »

You're most likely trying to set the tiles before the chunk is actually generated. You can look at the code of my space platform mod:
https://mods.factorio.com/mods/daid/space-platform

This generates an unlimited sized surface, and modifies the chunks when they are generated. You'll have to attach to the on_chunk_generated event and filter for your surface.

You'll most likey have to use:
http://lua-api.factorio.com/latest/LuaS ... _generated
and:
http://lua-api.factorio.com/latest/LuaS ... ate_chunks

To make sure the chunk is actually there before you modify it.

Post Reply

Return to “Modding help”