Turning off electric-grid overlay in map view for selected entities
Posted: Wed Apr 08, 2020 1:01 pm
I'd like to be able to turn off the electric-grid overlay in map view for individual entities.
Use case: It's about Bio Industries. The mod provides so-called musk-floor, which basically is a ground tile with a hidden electric pole and a hidden solar panel placed on top of it. The hidden power poles have wire_reach set to 1, so adjoining tiles are connected. However, in map view this can result in huge areas of blue because all hidden poles are connected to their neighbors, and there has been a bug report about it.
This is what my testing setup looks in normal view: This is what people expect to see in map view: This is what they now get: Actually, the current behavior is not a bug, but the normal thing in a normal game. It is perceived as a bug, however, because it worked differently for so long. Musk floor is created by placing a tile. If the script sees that the correct tile has been created, it does this:
The bug was that the variable "force" used to be assigned outside of the scope of this block. So, "force = force" didn't amount to "force = event.player.force", but to "force = nil" -- and if "force = nil" is used with create_entity, it will default to "force = 'enemy'". In effect, people didn't get to see the electric overlay in map view because the musk floor didn't belong to them!
I probably could declare the original bug a feature and use create_entity with "force = 'enemy'" again, but I imagine this could be problematic if there are players with player.force = "enemy" because they would get to see the power grids of all players (including their own) in map view. So, unless you can guarantee that no human player will ever be able to be part of the force "enemy" (or any other new force I could make up), I'd like to be able to set a flag or option that turns off the electric overlay in map view for just selected entities. Would that be possible?
Use case: It's about Bio Industries. The mod provides so-called musk-floor, which basically is a ground tile with a hidden electric pole and a hidden solar panel placed on top of it. The hidden power poles have wire_reach set to 1, so adjoining tiles are connected. However, in map view this can result in huge areas of blue because all hidden poles are connected to their neighbors, and there has been a bug report about it.
This is what my testing setup looks in normal view: This is what people expect to see in map view: This is what they now get: Actually, the current behavior is not a bug, but the normal thing in a normal game. It is perceived as a bug, however, because it worked differently for so long. Musk floor is created by placing a tile. If the script sees that the correct tile has been created, it does this:
Code: Select all
local solar_mat = surface.get_tile(position.x, position.y)
local sm_pole_name = "bi-musk-mat-pole"
local sm_panel_name = "bi-musk-mat-solar-panel"
local create_sm_pole = surface.create_entity({
name = sm_pole_name,
position = {position.x + 0.5, position.y + 0.5},
force = force
})
local create_sm_panel = surface.create_entity({
name = sm_panel_name,
position = {position.x + 0.5, position.y + 0.5},
force = force
})
I probably could declare the original bug a feature and use create_entity with "force = 'enemy'" again, but I imagine this could be problematic if there are players with player.force = "enemy" because they would get to see the power grids of all players (including their own) in map view. So, unless you can guarantee that no human player will ever be able to be part of the force "enemy" (or any other new force I could make up), I'd like to be able to set a flag or option that turns off the electric overlay in map view for just selected entities. Would that be possible?