[0.15.37] Incomplete landfill placement,on_player_built_tiie

This subforum contains all the issues which we already resolved.
Post Reply
Trainwreck
Fast Inserter
Fast Inserter
Posts: 110
Joined: Wed Apr 05, 2017 2:17 am
Contact:

[0.15.37] Incomplete landfill placement,on_player_built_tiie

Post by Trainwreck »

I'm seeing a strange issue with GotLag's Explosive Excavation mod. This mod allows placing of water tiles, and adds an on_player_built_tile event handler that creates explosions when a water tile is placed.

When this mod is installed, sometimes random explosions are spawned when placing landfill (not water).
Image
In these screenshots I had just clicked to place a large block of landfill. For some reason, factorio decided not to fill in the bottom row of the landfill brush. Apparently it still passed those coordinates to the on_player_built_tile handler, which, seeing water, spawned the explosions.

Since no landfill was placed in that bottom row, I would not expect the coordinates to be passed to the on_player_built_tile handler.

(I'd previously posted this bug in the Explosive Excavation forum thread here, reposting as a factorio bug report at authors request).

Loewchen
Global Moderator
Global Moderator
Posts: 8308
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: [0.15.37] Incomplete landfill placement,on_player_built_tiie

Post by Loewchen »

Generally the idea is that the mod author makes the bug report if he assumes an issue with factorio itself.

complete control.lua:

Code: Select all

function placedTiles(entity, positions)
  local surface = entity.surface
  for i,pos in pairs(positions) do
    if surface.get_tile(pos.x, pos.y).name == "water" then
      local victim = surface.create_entity({name = "fish", position = {pos.x+0.5, pos.y+0.5}})
      surface.create_entity({name = "blasting-projectile", force = entity.force, speed = 0, target = victim, position = victim.position})
      victim.destroy()
    end
  end
end

script.on_event(defines.events.on_player_built_tile, function(event)
  placedTiles(game.players[event.player_index], event.positions)
end)

script.on_event(defines.events.on_robot_built_tile, function(event)
  placedTiles(event.robot, event.positions)
end)

GotLag
Filter Inserter
Filter Inserter
Posts: 532
Joined: Sat May 03, 2014 3:32 pm
Contact:

Re: [0.15.37] Incomplete landfill placement,on_player_built_tiie

Post by GotLag »

It's a tile placement event triggered when the player is placing landfill tiles, but the set of positions returned apparently includes water tiles. I have not been able to reproduce it, but perhaps it depends on the geometry of the placed tiles.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.15.37] Incomplete landfill placement,on_player_built_tiie

Post by Rseding91 »

I haven't looked into it but if I had to guess tile correction logic would be what I blame.
If you want to get ahold of me I'm almost always on Discord.

Trainwreck
Fast Inserter
Fast Inserter
Posts: 110
Joined: Wed Apr 05, 2017 2:17 am
Contact:

Re: [0.15.37] Incomplete landfill placement,on_player_built_tiie

Post by Trainwreck »

GotLag wrote:It's a tile placement event triggered when the player is placing landfill tiles, but the set of positions returned apparently includes water tiles. I have not been able to reproduce it, but perhaps it depends on the geometry of the placed tiles.
I can reproduce it reliably, following the setup in the above screenshots exactly should work.
1. Place a large block of landfill at with one click. Don't run around holding the mouse button down.
2. Place the landfill over deep water.
3. Place the landfill south(down) from existing land.

GotLag
Filter Inserter
Filter Inserter
Posts: 532
Joined: Sat May 03, 2014 3:32 pm
Contact:

Re: [0.15.37] Incomplete landfill placement,on_player_built_tiie

Post by GotLag »

You're right, successfully reproduced it. Triggers reliably in all directions except when building to the west (left), but even then it still shows up at the upper/lower edges of the player's buildable range.

For testing I disabled all mods that modify tiles or hook into on_player_built_tile except for Explosive Excavation, so I don't think it's any weird mod interaction.

Edit: to be really clear, this only occurs on deep water tiles - is this due to the correction logic enforcing the presence of water between deep water and grass?

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.15.37] Incomplete landfill placement,on_player_built_tiie

Post by Rseding91 »

GotLag wrote:You're right, successfully reproduced it. Triggers reliably in all directions except when building to the west (left), but even then it still shows up at the upper/lower edges of the player's buildable range.

For testing I disabled all mods that modify tiles or hook into on_player_built_tile except for Explosive Excavation, so I don't think it's any weird mod interaction.

Edit: to be really clear, this only occurs on deep water tiles - is this due to the correction logic enforcing the presence of water between deep water and grass?
Most likely.
If you want to get ahold of me I'm almost always on Discord.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [0.15.37] Incomplete landfill placement,on_player_built_tiie

Post by Klonan »

So in essence, the tile correction is messing things up

Since we want to remove the tile correction, this will probably be fixed when its removed

Until then, it isn't a bug, as the code for tile correction is probably doing just exactly what it is meant to in the situation, and isn't worth investigating

GotLag
Filter Inserter
Filter Inserter
Posts: 532
Joined: Sat May 03, 2014 3:32 pm
Contact:

Re: [0.15.37] Incomplete landfill placement,on_player_built_tiie

Post by GotLag »

Fair enough, it's not exactly a pressing issue.

Post Reply

Return to “Resolved Problems and Bugs”