mirror of
https://github.com/Xevion/project-cybersyn.git
synced 2025-12-06 05:16:06 -06:00
fixed dispatch bug
This commit is contained in:
@@ -12,7 +12,7 @@ cybersyn-network-flag=The default set of networks a station will service when no
|
||||
cybersyn-combinator=Cybernetic combinator
|
||||
|
||||
[item-description]
|
||||
cybersyn-combinator=Place next to a train stop to add it to the cybersyn train network. This stop can now request or provide items that are reported to it by the circuit network.
|
||||
cybersyn-combinator=Place next to a train stop to add it to the Cybersyn train network. This stop can now request or provide items that are reported to it by the circuit network.
|
||||
|
||||
[entity-name]
|
||||
cybersyn-combinator=Cybernetic combinator
|
||||
@@ -48,7 +48,7 @@ wagon-manifest=Wagon control
|
||||
network=Network
|
||||
network-tooltip=A signal is used to identify which network this combinator is a member of. Trains will only be dispatched from depots to provide and request stations if they are all identified with the same signal.
|
||||
auto-tooltip=When checked trains in the network are automatically blacklisted if they are not able to interact with all of the loading and unloading machines present along the station. When unchecked the blacklist is empty and all trains are allowed.
|
||||
auto-description=Allow automatic train blacklist
|
||||
auto-description=Automatic train blacklist
|
||||
switch-provide=Provide only
|
||||
switch-request=Request only
|
||||
switch-provide-tooltip=Lock this station to only provide items to the network. By default it both requests and provides.
|
||||
|
||||
@@ -97,8 +97,8 @@ end
|
||||
---@param r_station_id uint
|
||||
---@param p_station_id uint
|
||||
---@param item_type string
|
||||
---@param min_amount_to_move int
|
||||
local function get_valid_train(map_data, r_station_id, p_station_id, item_type, min_amount_to_move)
|
||||
---@param min_slots_to_move int
|
||||
local function get_valid_train(map_data, r_station_id, p_station_id, item_type, min_slots_to_move)
|
||||
--NOTE: this code is the critical section for run-time optimization
|
||||
local r_station = map_data.stations[r_station_id]
|
||||
local p_station = map_data.stations[p_station_id]
|
||||
@@ -128,7 +128,7 @@ local function get_valid_train(map_data, r_station_id, p_station_id, item_type,
|
||||
--check layout validity for both stations
|
||||
local capacity = (is_fluid and train.fluid_capacity) or train.item_slot_capacity
|
||||
if
|
||||
capacity > min_amount_to_move and
|
||||
capacity >= min_slots_to_move and
|
||||
btest(netand, depot.network_flag) and
|
||||
(r_station.allows_all_trains or r_station.accepted_layouts[layout_id]) and
|
||||
(p_station.allows_all_trains or p_station.accepted_layouts[layout_id])
|
||||
@@ -488,7 +488,8 @@ local function tick_dispatch(map_data, mod_settings)
|
||||
local p_station = stations[p_station_id]
|
||||
if p_station.p_count_or_r_threshold_per_item[item_name] >= r_threshold then
|
||||
local prior = p_station.priority
|
||||
local depot, d = get_valid_train(map_data, r_station_id, p_station_id, item_type, r_threshold)
|
||||
local slot_threshold = item_type == "fluid" and r_threshold or ceil(r_threshold/game.item_prototypes[item_name].stack_size)
|
||||
local depot, d = get_valid_train(map_data, r_station_id, p_station_id, item_type, slot_threshold)
|
||||
if prior > highest_prior or (prior == highest_prior and d < best_dist) then
|
||||
if depot then
|
||||
best = j
|
||||
|
||||
Reference in New Issue
Block a user