mirror of
https://github.com/Xevion/project-cybersyn.git
synced 2025-12-12 18:12:37 -06:00
made minor improvements
This commit is contained in:
@@ -11,6 +11,7 @@ Date: 2023-10-10
|
|||||||
- Stations with provider item thresholds can no longer generate empty train orders - contributed by svr8450
|
- Stations with provider item thresholds can no longer generate empty train orders - contributed by svr8450
|
||||||
- Added missing loader entity type to the automatic allow-list - contributed by gillett-hernandez
|
- Added missing loader entity type to the automatic allow-list - contributed by gillett-hernandez
|
||||||
- Fixed a case where combinator changes not being applied for depots and refuelers - contributed by jagoly
|
- Fixed a case where combinator changes not being applied for depots and refuelers - contributed by jagoly
|
||||||
|
- Fixed provide/request orders for the same item getting generated simultaneously - contributed by jagoly
|
||||||
- Fixed a crash when opening the manager when adding cybersyn to an existing save - contributed by Mjonir
|
- Fixed a crash when opening the manager when adding cybersyn to an existing save - contributed by Mjonir
|
||||||
- Fixed a crash when enabling the manager on an existing save - contributed by freyacodes
|
- Fixed a crash when enabling the manager on an existing save - contributed by freyacodes
|
||||||
Translation:
|
Translation:
|
||||||
|
|||||||
@@ -287,6 +287,12 @@ local function tick_dispatch(map_data, mod_settings)
|
|||||||
goto continue
|
goto continue
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--don't request when already providing
|
||||||
|
local item_deliveries = station.deliveries[item_name]
|
||||||
|
if item_deliveries and item_deliveries < 0 then
|
||||||
|
goto continue
|
||||||
|
end
|
||||||
|
|
||||||
local threshold = station.r_threshold
|
local threshold = station.r_threshold
|
||||||
local prior = station.priority
|
local prior = station.priority
|
||||||
local item_threshold = station.item_thresholds and station.item_thresholds[item_name] or nil
|
local item_threshold = station.item_thresholds and station.item_thresholds[item_name] or nil
|
||||||
@@ -300,16 +306,11 @@ local function tick_dispatch(map_data, mod_settings)
|
|||||||
goto continue
|
goto continue
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--prioritize by last delivery time if priorities are equal
|
||||||
if prior == best_r_prior and station.last_delivery_tick > best_timestamp then
|
if prior == best_r_prior and station.last_delivery_tick > best_timestamp then
|
||||||
goto continue
|
goto continue
|
||||||
end
|
end
|
||||||
|
|
||||||
--don't request when already providing
|
|
||||||
local item_deliveries = station.deliveries[item_name]
|
|
||||||
if item_deliveries and item_deliveries < 0 then
|
|
||||||
goto continue
|
|
||||||
end
|
|
||||||
|
|
||||||
r_station_i = i
|
r_station_i = i
|
||||||
r_threshold = threshold
|
r_threshold = threshold
|
||||||
best_r_prior = prior
|
best_r_prior = prior
|
||||||
@@ -362,6 +363,12 @@ local function tick_dispatch(map_data, mod_settings)
|
|||||||
goto p_continue
|
goto p_continue
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--don't provide when already requesting
|
||||||
|
item_deliveries = p_station.deliveries[item_name]
|
||||||
|
if item_deliveries and item_deliveries > 0 then
|
||||||
|
goto p_continue
|
||||||
|
end
|
||||||
|
|
||||||
p_flag = get_network_mask(p_station, network_name)
|
p_flag = get_network_mask(p_station, network_name)
|
||||||
r_flag = get_network_mask(r_station, network_name)
|
r_flag = get_network_mask(r_station, network_name)
|
||||||
netand = band(p_flag, r_flag)
|
netand = band(p_flag, r_flag)
|
||||||
@@ -489,12 +496,6 @@ local function tick_dispatch(map_data, mod_settings)
|
|||||||
goto p_continue
|
goto p_continue
|
||||||
end
|
end
|
||||||
|
|
||||||
--don't provide when already requesting
|
|
||||||
item_deliveries = p_station.deliveries[item_name]
|
|
||||||
if item_deliveries and item_deliveries > 0 then
|
|
||||||
goto p_continue
|
|
||||||
end
|
|
||||||
|
|
||||||
p_station_i = j
|
p_station_i = j
|
||||||
best_train_id = best_p_train_id
|
best_train_id = best_p_train_id
|
||||||
best_p_prior = p_prior
|
best_p_prior = p_prior
|
||||||
@@ -510,6 +511,7 @@ local function tick_dispatch(map_data, mod_settings)
|
|||||||
create_delivery(map_data, r_station_id, p_station_id, best_train_id, manifest)
|
create_delivery(map_data, r_station_id, p_station_id, best_train_id, manifest)
|
||||||
return false
|
return false
|
||||||
else
|
else
|
||||||
|
if closest_to_correct_p_station then
|
||||||
if correctness == 1 then
|
if correctness == 1 then
|
||||||
send_alert_missing_train(r_station.entity_stop, closest_to_correct_p_station.entity_stop)
|
send_alert_missing_train(r_station.entity_stop, closest_to_correct_p_station.entity_stop)
|
||||||
elseif correctness == 2 then
|
elseif correctness == 2 then
|
||||||
@@ -519,6 +521,7 @@ local function tick_dispatch(map_data, mod_settings)
|
|||||||
elseif correctness == 4 then
|
elseif correctness == 4 then
|
||||||
send_alert_no_train_matches_p_layout(r_station.entity_stop, closest_to_correct_p_station.entity_stop)
|
send_alert_no_train_matches_p_layout(r_station.entity_stop, closest_to_correct_p_station.entity_stop)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
if band(r_station.display_state, 2) == 0 then
|
if band(r_station.display_state, 2) == 0 then
|
||||||
r_station.display_state = r_station.display_state + 2
|
r_station.display_state = r_station.display_state + 2
|
||||||
update_display(map_data, r_station)
|
update_display(map_data, r_station)
|
||||||
|
|||||||
@@ -131,6 +131,7 @@
|
|||||||
---@field public react_to_train_early_to_depot boolean --interface setting
|
---@field public react_to_train_early_to_depot boolean --interface setting
|
||||||
---@field public enable_manager boolean
|
---@field public enable_manager boolean
|
||||||
---@field public manager_ups double
|
---@field public manager_ups double
|
||||||
|
---@field public manager_enabled boolean
|
||||||
|
|
||||||
--if this is uncommented it means there are migrations to write
|
--if this is uncommented it means there are migrations to write
|
||||||
|
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ function set_p_wagon_combs(map_data, station, train)
|
|||||||
if carriage.type == "cargo-wagon" then
|
if carriage.type == "cargo-wagon" then
|
||||||
local inv = carriage.get_inventory(defines.inventory.cargo_wagon)
|
local inv = carriage.get_inventory(defines.inventory.cargo_wagon)
|
||||||
if inv then
|
if inv then
|
||||||
---@type ConstantCombinatorParameters
|
---@type ConstantCombinatorParameters[]
|
||||||
local signals = {}
|
local signals = {}
|
||||||
|
|
||||||
local inv_filter_i = 1
|
local inv_filter_i = 1
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ end
|
|||||||
---@param map_data MapData
|
---@param map_data MapData
|
||||||
---@param stop LuaEntity
|
---@param stop LuaEntity
|
||||||
---@param comb1 LuaEntity
|
---@param comb1 LuaEntity
|
||||||
---@param comb2 LuaEntity
|
---@param comb2 LuaEntity?
|
||||||
local function on_station_built(map_data, stop, comb1, comb2)
|
local function on_station_built(map_data, stop, comb1, comb2)
|
||||||
--NOTE: only place where new Station
|
--NOTE: only place where new Station
|
||||||
local station = {
|
local station = {
|
||||||
@@ -412,7 +412,7 @@ function combinator_update(map_data, comb, reset_display)
|
|||||||
local params = control.parameters
|
local params = control.parameters
|
||||||
local old_params = map_data.to_comb_params[unit_number]
|
local old_params = map_data.to_comb_params[unit_number]
|
||||||
local has_changed = false
|
local has_changed = false
|
||||||
local type, id, entity = nil, nil, nil
|
local type, id, entity = nil, 0, nil
|
||||||
|
|
||||||
local op = params.operation
|
local op = params.operation
|
||||||
local is_mode_primary_io = op == MODE_PRIMARY_IO
|
local is_mode_primary_io = op == MODE_PRIMARY_IO
|
||||||
|
|||||||
Reference in New Issue
Block a user