rezecib Posted October 19, 2014 Share Posted October 19, 2014 So I've figured out how to convert world tiles to other types by looking at terraformer.lua, but one thing I've been trying to figure out is if I convert a non-land tile (tile type ID 1) into a land tile, how can I get the world to recalculate the borders (or "islands") without reloading the game? Currently this is the function I'm using to change the tile at the cursor:function c_setTile(newType) local pos = TheInput:GetWorldPosition() local x, y = TheWorld.Map:GetTileCoordsAtPoint(pos.x, pos.y, pos.z) local oldType = TheWorld.Map:GetTileAtPoint(pos.x, pos.y, pos.z) TheWorld.Map:SetTile(x, y, newType) TheWorld.Map:RebuildLayer(oldType, x, y) TheWorld.Map:RebuildLayer(newType, x, y) TheWorld.minimap.MiniMap:RebuildLayer(oldType, x, y) TheWorld.minimap.MiniMap:RebuildLayer(newType, x, y)end When I use this on a water tile to make it into a land one, however, it doesn't change the land border beneath it, and using TheWorld.Map:GetIslandAtPoint(point) still gives 127, which is NO_ISLAND, or water. Reloading the game seems to fix this, but I've been unable to find a way to do it without that (the reason I'd like to be able to do so is to use it with Don't Starve Together, having the host be able to dynamically change the land). I haven't found anywhere you can set the island of a point or force a rebuild or anything of that sort. Edit: I wanted to also note that I looked around and found this thread about changing turf and this thread about an out-of-game world editor, but neither of these seem to do exactly what I'm trying to do. Link to comment Share on other sites More sharing options...
_Q_ Posted October 20, 2014 Share Posted October 20, 2014 There is something like ground undergound, its checked for on many ocassions in things that spawn some prefabs. ground underground is on the edges of the island, you can check that by removing tiles from the edge. Link to comment Share on other sites More sharing options...
rezecib Posted October 20, 2014 Author Share Posted October 20, 2014 Yeah, I was noticing that (I called it the "land borders" in my post), but the little edges of dirty ground that you can see below the edge. Changing the tile doesn't update that, but reloading the game does seem to, which suggests there's a point in the saving/reloading process where it does update the ground, but I haven't been able to find it... Link to comment Share on other sites More sharing options...
_Q_ Posted October 20, 2014 Share Posted October 20, 2014 Yeah, I was noticing that (I called it the "land borders" in my post), but the little edges of dirty ground that you can see below the edge. Changing the tile doesn't update that, but reloading the game does seem to, which suggests there's a point in the saving/reloading process where it does update the ground, but I haven't been able to find it... When I was checking for it, it was something in playercontroller.lua component. But it all go to complicated to make simple bridge so I never finished that. Link to comment Share on other sites More sharing options...
rezecib Posted October 20, 2014 Author Share Posted October 20, 2014 I've looked in playercontroller and just about every else in the lua code. From what I can tell this is being handled in the C code, and that's not something I can really look at. Any Klei help? Link to comment Share on other sites More sharing options...
_Q_ Posted October 20, 2014 Share Posted October 20, 2014 I've looked in playercontroller and just about every else in the lua code. From what I can tell this is being handled in the C code, and that's not something I can really look at. Any Klei help? I couldn't find solution for this problem back then, it would be nice to get some help on that matter. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.