mirror of
https://github.com/Refactorio/RedMew.git
synced 2024-12-14 10:13:13 +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
|
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 = {}
|
global.stress_map_storage = {}
|
||||||
local stress_map_storage = global.stress_map_storage
|
local stress_map_storage = global.stress_map_storage
|
||||||
|
|
||||||
@ -297,6 +300,20 @@ function DiggyCaveCollapse.register(cfg)
|
|||||||
end
|
end
|
||||||
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
|
enable_stress_grid = config.enable_stress_grid
|
||||||
|
|
||||||
on_surface_created({surface_index = 1})
|
on_surface_created({surface_index = 1})
|
||||||
@ -305,9 +322,8 @@ function DiggyCaveCollapse.register(cfg)
|
|||||||
if (config.enable_mask_debug) then
|
if (config.enable_mask_debug) then
|
||||||
local surface = game.surfaces.nauvis
|
local surface = game.surfaces.nauvis
|
||||||
mask_disc_blur(0, 0, 10, function(x, y, fraction)
|
mask_disc_blur(0, 0, 10, function(x, y, fraction)
|
||||||
Debug.print_grid_value(fraction, surface, {x = x, y = y})
|
Debug.print_grid_value(fraction, surface, {x = x, y = y})
|
||||||
end
|
end)
|
||||||
)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user