mirror of
https://github.com/Xevion/project-cybersyn.git
synced 2025-12-09 14:08:15 -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
|
||||
- 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 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 enabling the manager on an existing save - contributed by freyacodes
|
||||
Translation:
|
||||
|
||||
@@ -287,6 +287,12 @@ local function tick_dispatch(map_data, mod_settings)
|
||||
goto continue
|
||||
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 prior = station.priority
|
||||
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
|
||||
end
|
||||
|
||||
--prioritize by last delivery time if priorities are equal
|
||||
if prior == best_r_prior and station.last_delivery_tick > best_timestamp then
|
||||
goto continue
|
||||
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_threshold = threshold
|
||||
best_r_prior = prior
|
||||
@@ -362,6 +363,12 @@ local function tick_dispatch(map_data, mod_settings)
|
||||
goto p_continue
|
||||
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)
|
||||
r_flag = get_network_mask(r_station, network_name)
|
||||
netand = band(p_flag, r_flag)
|
||||
@@ -489,12 +496,6 @@ local function tick_dispatch(map_data, mod_settings)
|
||||
goto p_continue
|
||||
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
|
||||
best_train_id = best_p_train_id
|
||||
best_p_prior = p_prior
|
||||
@@ -510,14 +511,16 @@ local function tick_dispatch(map_data, mod_settings)
|
||||
create_delivery(map_data, r_station_id, p_station_id, best_train_id, manifest)
|
||||
return false
|
||||
else
|
||||
if correctness == 1 then
|
||||
send_alert_missing_train(r_station.entity_stop, closest_to_correct_p_station.entity_stop)
|
||||
elseif correctness == 2 then
|
||||
send_alert_no_train_has_capacity(r_station.entity_stop, closest_to_correct_p_station.entity_stop)
|
||||
elseif correctness == 3 then
|
||||
send_alert_no_train_matches_r_layout(r_station.entity_stop, closest_to_correct_p_station.entity_stop)
|
||||
elseif correctness == 4 then
|
||||
send_alert_no_train_matches_p_layout(r_station.entity_stop, closest_to_correct_p_station.entity_stop)
|
||||
if closest_to_correct_p_station then
|
||||
if correctness == 1 then
|
||||
send_alert_missing_train(r_station.entity_stop, closest_to_correct_p_station.entity_stop)
|
||||
elseif correctness == 2 then
|
||||
send_alert_no_train_has_capacity(r_station.entity_stop, closest_to_correct_p_station.entity_stop)
|
||||
elseif correctness == 3 then
|
||||
send_alert_no_train_matches_r_layout(r_station.entity_stop, closest_to_correct_p_station.entity_stop)
|
||||
elseif correctness == 4 then
|
||||
send_alert_no_train_matches_p_layout(r_station.entity_stop, closest_to_correct_p_station.entity_stop)
|
||||
end
|
||||
end
|
||||
if band(r_station.display_state, 2) == 0 then
|
||||
r_station.display_state = r_station.display_state + 2
|
||||
|
||||
@@ -131,6 +131,7 @@
|
||||
---@field public react_to_train_early_to_depot boolean --interface setting
|
||||
---@field public enable_manager boolean
|
||||
---@field public manager_ups double
|
||||
---@field public manager_enabled boolean
|
||||
|
||||
--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
|
||||
local inv = carriage.get_inventory(defines.inventory.cargo_wagon)
|
||||
if inv then
|
||||
---@type ConstantCombinatorParameters
|
||||
---@type ConstantCombinatorParameters[]
|
||||
local signals = {}
|
||||
|
||||
local inv_filter_i = 1
|
||||
|
||||
@@ -115,7 +115,7 @@ end
|
||||
---@param map_data MapData
|
||||
---@param stop LuaEntity
|
||||
---@param comb1 LuaEntity
|
||||
---@param comb2 LuaEntity
|
||||
---@param comb2 LuaEntity?
|
||||
local function on_station_built(map_data, stop, comb1, comb2)
|
||||
--NOTE: only place where new Station
|
||||
local station = {
|
||||
@@ -412,7 +412,7 @@ function combinator_update(map_data, comb, reset_display)
|
||||
local params = control.parameters
|
||||
local old_params = map_data.to_comb_params[unit_number]
|
||||
local has_changed = false
|
||||
local type, id, entity = nil, nil, nil
|
||||
local type, id, entity = nil, 0, nil
|
||||
|
||||
local op = params.operation
|
||||
local is_mode_primary_io = op == MODE_PRIMARY_IO
|
||||
|
||||
Reference in New Issue
Block a user