[Rseding91] [0.13.17] show_hidden_tile check wrong tile

This subforum contains all the issues which we already resolved.
Neemys
Filter Inserter
Filter Inserter
Posts: 461
Joined: Sat Apr 09, 2016 6:16 pm
Contact:

[Rseding91] [0.13.17] show_hidden_tile check wrong tile

Post by Neemys »

I was playing a bit you the new surface method get_hidden_tile when I saw some weird behavior, after some time investigating, I found that it seek the wrong tile to look under. Step to reproduce :

1) Start a new game or load a savegame.
2) Place a concrete tile one the ground.
3) Stand on the concrete tile and execute the following command

Code: Select all

/c game.player.print(game.player.surface.get_tile(game.player.position.x,game.player.position.y).name);game.player.print(game.player.surface.get_hidden_tile(game.player.position))
This command print the name of the tile the player is on, then print the name of the tile under the tile the player is on.

Expected behavior : The first print should show "concrete", the second one shoud show the tile name of what is under the concrete (in the screenshot, grass-dry).
Actual behavior : The first print show concrete, the second one show "nil".
bug_surface_method.jpg
bug_surface_method.jpg (192.56 KiB) Viewed 2565 times


With a bit of test I manage to find that you get the correct hidden tile when you request the tile position just above the concrete tile.
If you stand on the tile above the concrete and run the previous command, the print will be "name of the tile you are standing on, and the second print will show the name of the tile under the concrete.
bug_surface_method2.jpg
bug_surface_method2.jpg (183.88 KiB) Viewed 2565 times
In this screenshot we see that the first print show us the tile we are on (dirt) and the second print (hidden_tile) return the tile that is under the concrete (grass-dry)

Using numeric position instead of player position have the same result.

Edit : Changed factorio version to 0.13.17.
Last edited by Neemys on Wed Aug 17, 2016 11:04 pm, edited 2 times in total.
Want more space restriction ? Or maybe you want to be forced to use train for other thing than ore and oil ? Try Building Platform Mod !
Rseding91
Factorio Staff
Factorio Staff
Posts: 14343
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.13.16] show_hidden_tile check wrong tile

Post by Rseding91 »

This is a result of C++ and how it converts floating point numbers to ints (round towards 0) so a position of {-5.5, 10} ends up at: {-5, 10} which isn't the same tile that collides with the original position.

If you give it tile positions as its expecting you'll get the values back you're expecting.

I'll see if I can make the function auto-convert non tile positions to tile positions correctly.
If you want to get ahold of me I'm almost always on Discord.
Neemys
Filter Inserter
Filter Inserter
Posts: 461
Joined: Sat Apr 09, 2016 6:16 pm
Contact:

Re: [Rseding91] [0.13.16] show_hidden_tile check wrong tile

Post by Neemys »

You are right, it only occur with negative value as rounding toward zero in negative jump to the other tile. If I do the exact thing as I do in the first post in an area with only positive position the bug does not occur. Why show_tile method does not have this problem ?

As a temporary workaround I remove 1 if the x or y is negative in my mod, no problem so far. But I will not release the feature until this bug is fix.

Thanks for your hard work.
Want more space restriction ? Or maybe you want to be forced to use train for other thing than ore and oil ? Try Building Platform Mod !
Rseding91
Factorio Staff
Factorio Staff
Posts: 14343
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [Rseding91] [0.13.17] show_hidden_tile check wrong tile

Post by Rseding91 »

Fixed for 0.13.18.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Resolved Problems and Bugs”