mirror of
https://github.com/Xevion/project-cybersyn.git
synced 2025-12-10 16:08:13 -06:00
fix issue 106 and bump version
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cybersyn",
|
||||
"version": "1.2.16",
|
||||
"version": "1.2.17",
|
||||
"title": "Project Cybersyn",
|
||||
"author": "Mami",
|
||||
"factorio_version": "1.1",
|
||||
|
||||
@@ -33,6 +33,7 @@ function is_refuel_layout_accepted(layout_pattern, layout)
|
||||
end
|
||||
return valid
|
||||
end
|
||||
|
||||
---@param layout_pattern (0|1|2|3)[]
|
||||
---@param layout (0|1|2)[]
|
||||
function is_layout_accepted(layout_pattern, layout)
|
||||
@@ -83,7 +84,6 @@ function remove_train(map_data, train_id, train)
|
||||
interface_raise_train_removed(train_id, train)
|
||||
end
|
||||
|
||||
|
||||
---@param map_data MapData
|
||||
---@param train Train
|
||||
function set_train_layout(map_data, train)
|
||||
@@ -228,7 +228,11 @@ function set_p_wagon_combs(map_data, station, train)
|
||||
local count_to_fill = min(item_slots_capacity * stack_size, item_count)
|
||||
local slots_to_fill = ceil(count_to_fill / stack_size)
|
||||
|
||||
signals[i] = {index = i, signal = {type = item.type, name = item.name}, count = sign*count_to_fill}
|
||||
signals[i] = {
|
||||
index = i,
|
||||
signal = { type = item.type, name = item.name },
|
||||
count = sign * count_to_fill
|
||||
}
|
||||
item_count = item_count - count_to_fill
|
||||
item_slots_capacity = item_slots_capacity - slots_to_fill
|
||||
if comb then
|
||||
@@ -270,7 +274,11 @@ function set_p_wagon_combs(map_data, station, train)
|
||||
if fluid.type == "fluid" then
|
||||
local count_to_fill = min(fluid_count, fluid_capacity)
|
||||
|
||||
signals[1] = {index = 1, signal = {type = fluid.type, name = fluid.name}, count = sign*count_to_fill}
|
||||
signals[1] = {
|
||||
index = 1,
|
||||
signal = { type = fluid.type, name = fluid.name },
|
||||
count = sign * count_to_fill
|
||||
}
|
||||
fluid_count = fluid_count - count_to_fill
|
||||
fluid_capacity = 0
|
||||
do_inc = fluid_count == 0
|
||||
@@ -323,7 +331,12 @@ function set_r_wagon_combs(map_data, station, train)
|
||||
local stack = inv[stack_i]
|
||||
if stack.valid_for_read then
|
||||
local i = #signals + 1
|
||||
signals[i] = {index = i, signal = {type = "item", name = stack.name}, count = sign*stack.count}
|
||||
signals[i] = {
|
||||
index = i,
|
||||
signal = { type = "item", name = stack.name },
|
||||
count = sign *
|
||||
stack.count
|
||||
}
|
||||
end
|
||||
end
|
||||
set_combinator_output(map_data, comb, signals)
|
||||
@@ -341,7 +354,6 @@ function set_r_wagon_combs(map_data, station, train)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
---@param map_data MapData
|
||||
---@param refueler Refueler
|
||||
---@param train Train
|
||||
@@ -388,7 +400,11 @@ function set_refueler_combs(map_data, refueler, train)
|
||||
if stack.valid_for_read then
|
||||
if comb then
|
||||
local i = #wagon_signals + 1
|
||||
wagon_signals[i] = {index = i, signal = {type = "item", name = stack.name}, count = stack.count}
|
||||
wagon_signals[i] = {
|
||||
index = i,
|
||||
signal = { type = "item", name = stack.name },
|
||||
count = stack.count
|
||||
}
|
||||
end
|
||||
local j = #signals + 1
|
||||
signals[j] = { index = j, signal = { type = "item", name = stack.name }, count = stack.count }
|
||||
@@ -403,7 +419,6 @@ function set_refueler_combs(map_data, refueler, train)
|
||||
set_combinator_output(map_data, refueler.entity_comb, signals)
|
||||
end
|
||||
|
||||
|
||||
---@param map_data MapData
|
||||
---@param stop Station|Refueler
|
||||
function unset_wagon_combs(map_data, stop)
|
||||
@@ -421,7 +436,7 @@ function unset_wagon_combs(map_data, stop)
|
||||
end
|
||||
end
|
||||
|
||||
local type_filter = {"inserter", "pump", "arithmetic-combinator", "loader-1x1"}
|
||||
local type_filter = { "inserter", "pump", "arithmetic-combinator", "loader-1x1", "loader" }
|
||||
---@param map_data MapData
|
||||
---@param stop Station|Refueler
|
||||
---@param is_station_or_refueler boolean
|
||||
@@ -475,7 +490,8 @@ function reset_stop_layout(map_data, stop, is_station_or_refueler, forbidden_ent
|
||||
local wagon_number = 0
|
||||
for i = 1, 112 do
|
||||
if pre_rail then
|
||||
local rail, rail_direction, rail_connection_direction = pre_rail.get_connected_rail({rail_direction = rail_direction_from_stop, rail_connection_direction = defines_straight})
|
||||
local rail, rail_direction, rail_connection_direction = pre_rail.get_connected_rail({
|
||||
rail_direction = rail_direction_from_stop, rail_connection_direction = defines_straight })
|
||||
if not rail or rail_connection_direction ~= defines_straight then
|
||||
-- There is a curved rail or break in the tracks at this point
|
||||
-- We are assuming it's a curved rail, maybe that's a bad assumption
|
||||
@@ -543,7 +559,7 @@ function reset_stop_layout(map_data, stop, is_station_or_refueler, forbidden_ent
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif entity.type == "loader-1x1" then
|
||||
elseif entity.type == "loader-1x1" or entity.type == "loader" then
|
||||
if not supports_cargo then
|
||||
local direction = entity.direction
|
||||
if is_ver then
|
||||
@@ -661,7 +677,10 @@ function update_stop_from_rail(map_data, rail, forbidden_entity, force)
|
||||
resolve_update_stop_from_rail(map_data, entity, forbidden_entity, force)
|
||||
return
|
||||
end
|
||||
rail_back = rail_back.get_connected_rail({rail_direction = defines_back, rail_connection_direction = defines_straight})
|
||||
rail_back = rail_back.get_connected_rail({
|
||||
rail_direction = defines_back,
|
||||
rail_connection_direction = defines_straight
|
||||
})
|
||||
end
|
||||
if rail_front then
|
||||
local entity = rail_front.get_rail_segment_entity(defines_front, false)
|
||||
@@ -669,7 +688,10 @@ function update_stop_from_rail(map_data, rail, forbidden_entity, force)
|
||||
resolve_update_stop_from_rail(map_data, entity, forbidden_entity, force)
|
||||
return
|
||||
end
|
||||
rail_front = rail_front.get_connected_rail({rail_direction = defines_front, rail_connection_direction = defines_straight})
|
||||
rail_front = rail_front.get_connected_rail({
|
||||
rail_direction = defines_front,
|
||||
rail_connection_direction = defines_straight
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -682,6 +704,7 @@ function update_stop_from_pump(map_data, pump, forbidden_entity)
|
||||
update_stop_from_rail(map_data, pump.pump_rail_target, forbidden_entity)
|
||||
end
|
||||
end
|
||||
|
||||
---@param map_data MapData
|
||||
---@param inserter LuaEntity
|
||||
---@param forbidden_entity LuaEntity?
|
||||
@@ -732,6 +755,7 @@ function update_stop_from_inserter(map_data, inserter, forbidden_entity)
|
||||
update_stop_from_rail(map_data, rails[1], forbidden_entity)
|
||||
end
|
||||
end
|
||||
|
||||
---@param map_data MapData
|
||||
---@param loader LuaEntity
|
||||
---@param forbidden_entity LuaEntity?
|
||||
|
||||
Reference in New Issue
Block a user