Page 1 of 1

[Request] Screenshot / mapping mod

Posted: Wed Sep 03, 2014 9:43 am
by cube
This mod should add a button to the game that generates a google map in the script output directory. Scripting interface already supports this for some time:
https://forums.factorio.com/wiki/inde ... screenshot
https://forums.factorio.com/wiki/inde ... e#makefile

(I'm too busy / lazy to do this myself :-) )

Re: [Request] Screenshot / mapping mod

Posted: Wed Sep 03, 2014 10:28 am
by drs9999
slpwnd mentioned google map export before. I doubt that it would be too hard to do, but I failed to find any information what it actually is.

Re: [Request] Screenshot / mapping mod

Posted: Wed Sep 03, 2014 10:38 am
by cube
Yeah, I couldn't find too much details about the format too, but imho it will be just multi resolution tiles with some json or xml metadata.

Re: [Request] Screenshot / mapping mod

Posted: Fri Sep 05, 2014 1:32 pm
by jeroon
I've found a way to generate a map with the Google API, and I'm now trying to get the screenshots in. One thing I can't find: is there a way to determine if a tile is generated (to determine the edge of the map)? Something like "ischunkgenerated"? If not, how hard would it be to put it in 0.10.10?
*puppyeyes, and something with sugar on top*
Image

Re: [Request] Screenshot / mapping mod

Posted: Fri Sep 05, 2014 2:11 pm
by cube
I need a break from MP, I'll do it now.

Re: [Request] Screenshot / mapping mod

Posted: Fri Sep 05, 2014 3:24 pm
by Rseding91
cube wrote:I need a break from MP, I'll do it now.
Would these work?

Goes in LuaGameScript:

Code: Select all

int32_t LuaGameScript::luaIsChunkGenerated(lua_State* L)
{
  luaL_argcheck(L, lua_gettop(L) == 2, 0, "Wrong number of arguments.");
  lua_pushboolean(L, !!this->getMap().getTileOptional(RealPosition(luaL_checknumber(L, -2), luaL_checknumber(L, -1))));
  return 1;
}
Goes in LuaPlayer:

Code: Select all

int32_t LuaPlayer::luaIsChunkCharted(lua_State* L)
{
  luaL_argcheck(L, lua_gettop(L) == 2, 0, "Wrong number of arguments.");
  SubChart* subChart = this->map.getForceData(this->player->forceID)->chart->getSubChart(RealPosition(luaL_checknumber(L, -2), luaL_checknumber(L, -1)));
  lua_pushboolean(L, !(subChart == NULL || subChart->videoSprite == NULL));
  return 1;
}

Re: [Request] Screenshot / mapping mod

Posted: Fri Sep 05, 2014 3:33 pm
by cube
Yes, but you wouldn't know boundaries of the area to test, I'm thinking about iterator over generated chunks. Also the charted test should be a part of force, not player.
But something like what you wrote will definitely be there. Will you make a pull request, or should I put it in myself?

Re: [Request] Screenshot / mapping mod

Posted: Fri Sep 05, 2014 3:39 pm
by Rseding91
cube wrote:Yes, but you wouldn't know boundaries of the area to test, I'm thinking about iterator over generated chunks. Also the charted test should be a part of force, not player.
But something like what you wrote will definitely be there. Will you make a pull request, or should I put it in myself?
It's a simple mater to find all generated chunks by starting at chunk 0,0 and searching outwards fractaly. That can be done in LUA without any issues provided the "ischunkgenerated"/"ischunkcharged" function exists. I use a similar method myself to find all connecting water tiles for a given body of water in the Landfill 2 mod.

Regarding the pull request: you can put it in yourself. I'm working on a bunch of other modding interfaces and I'll submit them all at once when they're ready.

Re: [Request] Screenshot / mapping mod

Posted: Sun Sep 07, 2014 4:02 am
by Skellitor301
You do realize you can already make labeled markers in the game right?

Image

Just place a single track and put down a trainstop next to it, then remove the track, and finally rename the stop.

Re: [Request] Screenshot / mapping mod

Posted: Mon Sep 08, 2014 12:16 pm
by cube

Re: [Request] Screenshot / mapping mod

Posted: Mon Sep 15, 2014 3:14 pm
by jeroon
It is done. (Well, a first version is ;) ). https://forums.factorio.com/forum/vie ... =14&t=5812