mirror of
https://github.com/Refactorio/RedMew.git
synced 2024-12-12 10:04:40 +02:00
Show a popup on the first mine explaining cave-ins
This commit is contained in:
parent
93794d1591
commit
764a0fab99
@ -40,6 +40,9 @@ local on_surface_created = nil
|
||||
|
||||
local stress_threshold_causing_collapse = 0.9
|
||||
|
||||
global.deconstruction_alert_message_shown = {}
|
||||
local deconstruction_alert_message_shown = global.deconstruction_alert_message_shown
|
||||
|
||||
global.stress_map_storage = {}
|
||||
local stress_map_storage = global.stress_map_storage
|
||||
|
||||
@ -297,6 +300,20 @@ function DiggyCaveCollapse.register(cfg)
|
||||
end
|
||||
end)
|
||||
|
||||
Event.add(defines.events.on_pre_player_mined_item, function(event)
|
||||
if (nil ~= deconstruction_alert_message_shown[event.player_index]) then
|
||||
return
|
||||
end
|
||||
|
||||
if (nil ~= support_beam_entities[event.entity.name]) then
|
||||
require 'popup'.player(
|
||||
game.players[event.player_index],
|
||||
'Mining entities such as walls, stone paths, concrete and rocks, can cause a cave-in, be careful miner!'
|
||||
)
|
||||
deconstruction_alert_message_shown[event.player_index] = true
|
||||
end
|
||||
end)
|
||||
|
||||
enable_stress_grid = config.enable_stress_grid
|
||||
|
||||
on_surface_created({surface_index = 1})
|
||||
@ -306,8 +323,7 @@ function DiggyCaveCollapse.register(cfg)
|
||||
local surface = game.surfaces.nauvis
|
||||
mask_disc_blur(0, 0, 10, function(x, y, fraction)
|
||||
Debug.print_grid_value(fraction, surface, {x = x, y = y})
|
||||
end
|
||||
)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user