added fixes

This commit is contained in:
Monica Moniot
2022-11-11 22:13:33 -05:00
parent 52f6088904
commit 7f44dae0ec
7 changed files with 29 additions and 20 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "cybersyn",
"version": "0.2.0",
"version": "0.2.1",
"title": "Project Cybersyn",
"author": "Mami",
"factorio_version": "1.1",

View File

@@ -5,15 +5,6 @@ subgroup_signal = {
group = "signals",
order = "f"
}
priority_signal = {
type = "virtual-signal",
name = SIGNAL_PRIORITY,
icon = "__cybersyn__/graphics/icons/priority.png",
icon_size = 64,
icon_mipmaps = 4,
subgroup = "cybersyn-signal",
order = "a"
}
r_threshold_signal = {
type = "virtual-signal",
name = REQUEST_THRESHOLD,
@@ -21,7 +12,16 @@ r_threshold_signal = {
icon_size = 64,
icon_mipmaps = 4,
subgroup = "cybersyn-signal",
order = "c"
order = "a"
}
priority_signal = {
type = "virtual-signal",
name = SIGNAL_PRIORITY,
icon = "__cybersyn__/graphics/icons/priority.png",
icon_size = 64,
icon_mipmaps = 4,
subgroup = "cybersyn-signal",
order = "b"
}
locked_slots_signal = {
type = "virtual-signal",
@@ -30,5 +30,5 @@ locked_slots_signal = {
icon_size = 64,
icon_mipmaps = 4,
subgroup = "cybersyn-signal",
order = "d"
order = "c"
}

View File

@@ -32,6 +32,9 @@ function remove_manifest(map_data, station, manifest, sign)
end
set_comb2(map_data, station)
station.deliveries_total = station.deliveries_total - 1
if station.deliveries_total == 0 and station.entity_comb1.valid then
set_combinator_operation(station.entity_comb1, OPERATION_PRIMARY_IO)
end
end
---@param map_data MapData
@@ -448,8 +451,8 @@ local function tick_dispatch(map_data, mod_settings)
highest_prior = prior
can_be_serviced = true
elseif d < INF then
can_be_serviced = true
best = j
can_be_serviced = true
end
end
end

View File

@@ -45,9 +45,10 @@ function create_inactivity_order(depot_name)
return {station = depot_name, wait_conditions = create_inactivity_order_condition}
end
local create_direct_to_station_order_condition = {{type = "time", compare_type = "and", ticks = 1}}
---@param stop LuaEntity
local function create_direct_to_station_order(stop)
return {rail = stop.connected_rail, rail_direction = stop.connected_rail_direction}
return {rail = stop.connected_rail, rail_direction = stop.connected_rail_direction,wait_conditions = create_direct_to_station_order_condition}
end
---@param depot_name string

View File

@@ -220,10 +220,10 @@ function register_gui_actions()
local comb = global.to_comb[msg[2]]
if not comb or not comb.valid then return end
local a = comb.get_or_create_control_behavior()--[[@as LuaArithmeticCombinatorControlBehavior]]
local control = comb.get_or_create_control_behavior()--[[@as LuaArithmeticCombinatorControlBehavior]]
local allows_all_trains = not element.state
set_comb_allows_all_trains(a, allows_all_trains)
set_comb_allows_all_trains(control, allows_all_trains)
local stop = global.to_stop[comb.unit_number]
if stop then

View File

@@ -16,9 +16,6 @@ local function set_comb1(map_data, station, manifest, sign)
end
set_combinator_output(map_data, comb, signals)
else
if station.deliveries_total == 0 then
set_combinator_operation(comb, OPERATION_PRIMARY_IO)
end
set_combinator_output(map_data, comb, nil)
end
end
@@ -131,7 +128,6 @@ local function on_station_built(map_data, stop, comb1, comb2)
last_delivery_tick = 0,
priority = 0,
r_threshold = 0,
p_threshold = 0,
locked_slots = 0,
--network_name = param.first_signal and param.first_signal.name or nil,
network_flag = 0,
@@ -570,6 +566,8 @@ local function on_train_arrives_buffer(map_data, stop, train)
set_comb1(map_data, station, train.manifest, -1)
set_r_wagon_combs(map_data, station, train)
end
elseif train.status == STATUS_P and train.p_station_id == station_id then
elseif train.status == STATUS_R and train.r_station_id == station_id then
else
on_failed_delivery(map_data, train)
remove_train(map_data, train, train.entity.id)

View File

@@ -16,6 +16,13 @@ local migrations_table = {
map_data.all_station_ids[#map_data.all_station_ids + 1] = id
end
end,
["0.2.1"] = function()
---@type MapData
local map_data = global
for id, station in pairs(map_data.stations) do
station.p_threshold = nil
end
end,
}
---@param data ConfigurationChangedData