Page 1 of 1

Mirrored cliffs almost work, need code or in-game debug help

Posted: Mon Mar 26, 2018 12:41 am
by sparr
I am making mirror images of groups of cliffs, for my World Mirror mod, the purpose of which is symmetric multiplayer maps.

Here's the relevant code, which I got from 10% working to 99% working today: https://github.com/sparr/factorio-mod-w ... #L110-L123

Here is a screenshot of some left/right mirrored cliffs: Image

My problem is that last 1%. There are seemingly arbitrary/random glitches where a cliff will have a gap, or the end of a cliff will turn in the wrong direction. This might be a problem with my code, or something weird with correct_tiles at chunk boundaries (which has caused problems for me in the past with deep water transitions), or something else? Is there any way I can easily/quickly get info about entities in game by pointing at them?

Re: Mirrored cliffs almost work, need code or in-game debug help

Posted: Mon Mar 26, 2018 12:21 pm
by eradicator
sparr wrote:Is there any way I can easily/quickly get info about entities in game by pointing at them?
The entity you're pointing at is referenced as LuaPlayer.selected, or game.player.selected when using /c. You'll have to print the info you're interested in yourself though.

Re: Mirrored cliffs almost work, need code or in-game debug help

Posted: Mon Mar 26, 2018 6:28 pm
by sparr
Unfortunately game.player.selected isn't populated for un-selectable entities like cliffs.

Re: Mirrored cliffs almost work, need code or in-game debug help

Posted: Mon Mar 26, 2018 6:41 pm
by sparr

Code: Select all

/c game.player.print(game.player.surface.find_entity("cliff",game.player.position).cliff_orientation)
Taped a crosshair to the center of my screen so I could just center the screen on an entity in creative mode to query it :)

Now I'm perplexed... I'm looking at a glitchy copied cliff, and the copy is definitely the wrong orientation. I have copied a west-to-south and ended up with a none-to-east. All of its neighbors are correct. Nothing in my code should be able to turn "west-to-south" into "none-to-east". I go in-game and destroy the bad cliff, then manually recreate it with game.player.surface.create_entity from the console, the "south-to-east" cliff I'm trying to create shows up just fine.