mirror of
https://github.com/Refactorio/RedMew.git
synced 2024-12-12 10:04:40 +02:00
Updates to allow threaded to run faster and fixed dagobah to be threaded
This commit is contained in:
parent
ce54d23d5c
commit
8f2ceaa383
@ -86,6 +86,7 @@ function spawn_market(cmd)
|
||||
market.add_market_item{price={{"raw-fish", 175}}, offer={type="give-item", item="fast-loader"}}
|
||||
market.add_market_item{price={{"raw-fish", 250}}, offer={type="give-item", item="express-loader"}}
|
||||
market.add_market_item{price={{"raw-fish", 1000}}, offer={type="give-item", item="belt-immunity-equipment"}}
|
||||
market.add_market_item{price={{"raw-fish", 100}}, offer={type="give-item", item="night-vision-equipment"}}
|
||||
market.add_market_item{price={{"raw-fish", 200}}, offer={type="give-item", item="modular-armor"}}
|
||||
market.add_market_item{price={{"raw-fish", 500}}, offer={type="give-item", item="power-armor"}}
|
||||
market.add_market_item{price={{"raw-fish", 2000}}, offer={type="give-item", item="power-armor-mk2"}}
|
||||
|
@ -364,7 +364,7 @@ function run_swamp_entities(params)
|
||||
end
|
||||
|
||||
function run_combined_module(event)
|
||||
|
||||
Thread.set_actions_per_tick(10)
|
||||
-- Generate Rivers
|
||||
if not global.perlin_noise_seed then global.perlin_noise_seed = math.random(1000,1000000) end
|
||||
|
||||
@ -398,8 +398,11 @@ function run_combined_module(event)
|
||||
end
|
||||
|
||||
function run_chart_update(params)
|
||||
if game.forces.player.is_chunk_charted(params.surface, params.area) then
|
||||
game.forces.player.chart(params.surface, params.area)
|
||||
local x = params.area.left_top.x / 32
|
||||
local y = params.area.left_top.y / 32
|
||||
if game.forces.player.is_chunk_charted(params.surface, {x,y} ) then
|
||||
-- Don't use full area, otherwise adjacent chunks get charted
|
||||
game.forces.player.chart(params.surface, {{ params.area.left_top.x, params.area.left_top.y}, { params.area.left_top.x+30, params.area.left_top.y+30} } )
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -18,13 +18,15 @@ end
|
||||
|
||||
global.callbacks = {}
|
||||
global.next_async_callback_time = -1
|
||||
|
||||
global.actions_per_tick = 1
|
||||
|
||||
local function on_tick()
|
||||
if global.actions_queue[1] then
|
||||
local callback = global.actions_queue[1]
|
||||
pcall(_G[callback.action], callback.params)
|
||||
table.remove(global.actions_queue, 1)
|
||||
for action = 1, global.actions_per_tick do
|
||||
if global.actions_queue[1] then
|
||||
local callback = global.actions_queue[1]
|
||||
pcall(_G[callback.action], callback.params)
|
||||
table.remove(global.actions_queue, 1)
|
||||
end
|
||||
end
|
||||
if game.tick == global.next_async_callback_time then
|
||||
for index, callback in pairs(global.callbacks) do
|
||||
@ -41,6 +43,10 @@ local function on_tick()
|
||||
end
|
||||
end
|
||||
|
||||
function Thread.set_actions_per_tick(count)
|
||||
global.actions_per_tick = count
|
||||
end
|
||||
|
||||
function Thread.set_timeout_in_ticks(ticks, callback, params)
|
||||
local time = game.tick + ticks
|
||||
if global.next_async_callback_time == -1 or global.next_async_callback_time > time then
|
||||
|
Loading…
Reference in New Issue
Block a user