I tried outputting the contents of some on_player_mine events, specifically on_player_mined_tile, and the surface_index is coming back as 0, which isn't a real surface. At first I thought this was because I had made water minable and was mining it off the map, but it was also true of stone paths.
Is this an intended behavior? Is this a bug in the API returning an incorrect index?
I have attached the test mod in question in case it's relevant. It's a very simple test mod adding a single item and recipe and making water minable, and altering the properties of fish; mostly it broadcasts a lot of information about mining events. I'm running with just this test mod and basemod. (Note: you need to be holding a stone brick in order to mine water because that's how tile mining works)
[API bug?] surface_index of event is 0
[API bug?] surface_index of event is 0
- Attachments
-
- test_0.0.2.zip
- Mod file
- (1.95 KiB) Downloaded 96 times
Re: [API bug?] surface_index of event is 0
This is fixed for .16, It affects on_player_built_tile and on_player_mined_tile events, For now just add 1 to the surface index or get the surface from the player game.players[event.player_index].surface