1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-01-18 03:21:47 +02:00

Fixed noise used map desync and refresh GUI

This commit is contained in:
Lynn 2018-10-12 19:37:16 +02:00
parent 029a2b38fd
commit 0d4ed60d5b
3 changed files with 38 additions and 32 deletions

View File

@ -76,7 +76,7 @@ local Config = {
enabled = true,
-- value between 0 and 1, higher value means stronger variance between coordinates
noise_variance = 0.089,
noise_variance = 0.066,
-- adds per tile what the current noise is
enable_noise_grid = false,
@ -84,10 +84,8 @@ local Config = {
-- minimum distance and noise range required for water to spawn
room_noise_minimum_distance = 9,
room_noise_ranges = {
{name = 'water', min = -1, max = -0.52},
{name = 'dirt', min = -0.51, max = -0.33},
{name = 'water', min = 0.52, max = 1},
{name = 'dirt', min = 0.33, max = 0.51},
{name = 'water', min = 0.54, max = 1},
{name = 'dirt', min = 0.39, max = 0.53},
},
},
ScatteredResources = {
@ -186,8 +184,8 @@ local Config = {
{stone = 450, type = 'buff', prototype = {name = 'mining_speed', value = 5}},
{stone = 450, type = 'buff', prototype = {name = 'inventory_slot', value = 2}},
{stone = 450, type = 'market', prototype = {price = 1000, name = 'submachine-gun'}},
{stone = 450, type = 'market', prototype = {price = 100, name = 'firearm-magazine'}},
{stone = 450, type = 'market', prototype = {price = 850, name = 'submachine-gun'}},
{stone = 450, type = 'market', prototype = {price = 50, name = 'firearm-magazine'}},
{stone = 450, type = 'market', prototype = {price = 500, name = 'light-armor'}},
{stone = 750, type = 'buff', prototype = {name = 'mining_speed', value = 5}},
@ -207,7 +205,7 @@ local Config = {
{stone = 10000, type = 'buff', prototype = {name = 'mining_speed', value = 5}},
{stone = 10000, type = 'buff', prototype = {name = 'inventory_slot', value = 1}},
{stone = 10000, type = 'market', prototype = {price = 175, name = 'piercing-rounds-magazine'}},
{stone = 10000, type = 'market', prototype = {price = 100, name = 'piercing-rounds-magazine'}},
{stone = 10000, type = 'market', prototype = {price = 750, name = 'heavy-armor'}},
{stone = 15000, type = 'buff', prototype = {name = 'mining_speed', value = 5}},

View File

@ -125,29 +125,6 @@ local function on_research_finished(event)
update_mining_speed(force)
end
local function on_market_item_purchased(event)
if (1 ~= event.offer_index) then
return
end
stone_tracker.previous_stone_sent_to_surface = stone_tracker.stone_sent_to_surface
stone_tracker.stone_sent_to_surface = stone_tracker.stone_sent_to_surface + (config.stone_to_surface_amount * event.count)
update_market_contents(event.market)
end
local function on_placed_entity(event)
if ('market' ~= event.entity.name) then
return
end
update_market_contents(event.entity)
end
function MarketExchange.get_extra_map_info(config)
return 'Market Exchange, trade your stone or send it to the surface'
end
local function redraw_title(data)
data.frame.caption = stone_tracker.stone_sent_to_surface .. ' stone sent to the surface'
end
@ -181,6 +158,37 @@ local function redraw_list(data)
end
end
local function on_market_item_purchased(event)
if (1 ~= event.offer_index) then
return
end
stone_tracker.previous_stone_sent_to_surface = stone_tracker.stone_sent_to_surface
stone_tracker.stone_sent_to_surface = stone_tracker.stone_sent_to_surface + (config.stone_to_surface_amount * event.count)
update_market_contents(event.market)
local frame = game.players[event.player_index].gui.center['Diggy.MarketExchange.Frame']
if frame and frame.valid then
local data = Gui.get_data(frame)
redraw_title(data)
redraw_list(data)
end
end
local function on_placed_entity(event)
if ('market' ~= event.entity.name) then
return
end
update_market_contents(event.entity)
end
function MarketExchange.get_extra_map_info(config)
return 'Market Exchange, trade your stone or send it to the surface'
end
local function toggle(event)
local player = event.player
local center = player.gui.center

View File

@ -17,7 +17,7 @@ local SimpleRoomGenerator = {}
local noise_used_map = {}
Global.register({
noise_used_map_map = noise_used_map,
noise_used_map = noise_used_map,
}, function(tbl)
noise_used_map = tbl.noise_used_map
end)