added bugfix to train blacklisting

This commit is contained in:
Monica Moniot
2022-11-20 09:19:51 -05:00
parent 3a8e91b11d
commit 99201beee8
6 changed files with 23 additions and 8 deletions

View File

@@ -419,9 +419,9 @@ function on_combinator_updated(map_data, comb, new_params)
local is_pr_state = floor(bits/2)%3
station.is_p = is_pr_state == 0 or is_pr_state == 1
station.is_r = is_pr_state == 0 or is_pr_state == 2
local allow_all_trains = bits%2 == 1
if station.allow_all_trains ~= allow_all_trains then
station.allow_all_trains = allow_all_trains
local allows_all_trains = bits%2 == 1
if station.allows_all_trains ~= allows_all_trains then
station.allows_all_trains = allows_all_trains
update_station_if_auto(map_data, station)
end
end
@@ -862,8 +862,8 @@ local function main()
flib_event.register({defines.events.on_pre_surface_deleted, defines.events.on_pre_surface_cleared}, on_surface_removed)
flib_event.register(defines.events.on_entity_settings_pasted, on_paste)
flib_event.register(defines.events.on_player_cursor_stack_changed, on_cursor_stack_changed)
--flib_event.register(defines.events.on_entity_settings_pasted, on_paste)
--flib_event.register(defines.events.on_player_cursor_stack_changed, on_cursor_stack_changed)
local nth_tick = math.ceil(60/mod_settings.tps);
flib_event.on_nth_tick(nth_tick, function()

View File

@@ -40,6 +40,15 @@ local migrations_table = {
map_data.to_comb_params[id] = get_comb_params(comb)
end
end,
["0.4.1"] = function()
---@type MapData
local map_data = global
map_data.tick_state = STATE_INIT
for id, station in pairs(map_data.stations) do
station.allows_all_trains = station.allow_all_trains or station.allows_all_trains
station.allow_all_trains = nil
end
end,
}
---@param data ConfigurationChangedData