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

Place to get help with not working mods / modding interface.
sparr
Smart Inserter
Smart Inserter
Posts: 1521
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

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

Post 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?
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

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

Post 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.
sparr
Smart Inserter
Smart Inserter
Posts: 1521
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

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

Post by sparr »

Unfortunately game.player.selected isn't populated for un-selectable entities like cliffs.
sparr
Smart Inserter
Smart Inserter
Posts: 1521
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

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

Post 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.
Post Reply

Return to “Modding help”