begun work on 1.2.1

This commit is contained in:
mamoniot
2022-12-24 20:13:22 -05:00
parent 0312fbe752
commit 0af27a5225
6 changed files with 47 additions and 15 deletions

View File

@@ -93,8 +93,11 @@ function remove_train(map_data, train_id, train)
if count <= 1 then
global.layout_train_count[layout_id] = nil
global.layouts[layout_id] = nil
for _, station in pairs(global.stations) do
station.accepted_layouts[layout_id] = nil
for _, stop in pairs(global.stations) do
stop.accepted_layouts[layout_id] = nil
end
for _, stop in pairs(global.refuelers) do
stop.accepted_layouts[layout_id] = nil
end
else
global.layout_train_count[layout_id] = count - 1
@@ -147,9 +150,14 @@ function set_train_layout(map_data, train)
map_data.layouts[layout_id] = layout
map_data.layout_train_count[layout_id] = 1
for _, station in pairs(map_data.stations) do
if station.layout_pattern then
station.accepted_layouts[layout_id] = is_layout_accepted(station.layout_pattern, layout) or nil
for _, stop in pairs(map_data.stations) do
if stop.layout_pattern then
stop.accepted_layouts[layout_id] = is_layout_accepted(stop.layout_pattern, layout) or nil
end
end
for _, stop in pairs(map_data.refuelers) do
if stop.layout_pattern then
stop.accepted_layouts[layout_id] = is_refuel_layout_accepted(stop.layout_pattern, layout) or nil
end
end
else

View File

@@ -591,6 +591,14 @@ local function on_built(event)
update_stop_from_pump(global, entity)
elseif entity.type == "straight-rail" then
update_stop_from_rail(global, entity)
elseif entity.type == "arithmetic-combinator" then
local control = get_comb_control(entity)
local params = control.parameters
params.first_constant = 12345
params.second_constant = 67890
params.first_signal = NETWORK_SIGNAL_DEFAULT
params.second_signal = {name = NETWORK_EACH, type = "virtual"}
control.parameters = params
end
end
local function on_broken(event)
@@ -788,6 +796,7 @@ local filter_built = {
{filter = "type", type = "inserter"},
{filter = "type", type = "pump"},
{filter = "type", type = "straight-rail"},
{filter = "type", type = "arithmetic-combinator"},
}
local filter_broken = {
{filter = "name", name = "train-stop"},

View File

@@ -198,8 +198,11 @@ function interface.update_train_layout(train_id)
if count <= 1 then
global.layout_train_count[old_layout_id] = nil
global.layouts[old_layout_id] = nil
for station_id, station in pairs(global.stations) do
station.accepted_layouts[old_layout_id] = nil
for _, stop in pairs(global.stations) do
stop.accepted_layouts[old_layout_id] = nil
end
for _, stop in pairs(global.refuelers) do
stop.accepted_layouts[old_layout_id] = nil
end
else
global.layout_train_count[old_layout_id] = count - 1