diff --git a/TODO b/TODO index 13befd8..cc20c47 100644 --- a/TODO +++ b/TODO @@ -2,6 +2,5 @@ close gui when the combinator is destroyed do not play close sound when a different gui is opened do hardcore testing models & art -move signal subgroup -add miniloader compat space elevator compat +railloader compat diff --git a/cybersyn/info.json b/cybersyn/info.json index f74152d..e61ffda 100644 --- a/cybersyn/info.json +++ b/cybersyn/info.json @@ -6,6 +6,7 @@ "factorio_version": "1.1", "dependencies": [ "base", - "flib >= 0.6.0" + "flib >= 0.6.0", + "? miniloader" ] } diff --git a/cybersyn/scripts/layout.lua b/cybersyn/scripts/layout.lua index 51b070e..d9f3dba 100644 --- a/cybersyn/scripts/layout.lua +++ b/cybersyn/scripts/layout.lua @@ -507,12 +507,21 @@ end function update_station_from_inserter(map_data, inserter, forbidden_entity) local surface = inserter.surface - local rail = surface.find_entity("straight-rail", inserter.pickup_position) - if rail then - update_station_from_rail(map_data, rail, forbidden_entity) + --NOTE: we don't use find_entity solely for miniloader compat + local rails = surface.find_entities_filtered({ + type = "straight-rail", + position = inserter.pickup_position, + radius = 1, + }) + if rails[1] then + update_station_from_rail(map_data, rails[1], forbidden_entity) end - rail = surface.find_entity("straight-rail", inserter.drop_position) - if rail then - update_station_from_rail(map_data, rail, forbidden_entity) + rails = surface.find_entities_filtered({ + type = "straight-rail", + position = inserter.drop_position, + radius = 1, + }) + if rails[1] then + update_station_from_rail(map_data, rails[1], forbidden_entity) end end diff --git a/cybersyn/scripts/main.lua b/cybersyn/scripts/main.lua index df6d9c9..0a0c9f8 100644 --- a/cybersyn/scripts/main.lua +++ b/cybersyn/scripts/main.lua @@ -195,7 +195,7 @@ local function on_combinator_built(map_data, comb) if cur_entity.name == "train-stop" then --NOTE: if there are multiple stops we take the later one stop = cur_entity - elseif cur_entity.name == "straight-rail" then + elseif cur_entity.type == "straight-rail" then rail = cur_entity end end @@ -719,23 +719,20 @@ end local filter_built = { - {filter = "type", type = "train-stop"}, - {filter = "type", type = "arithmetic-combinator"}, + {filter = "name", name = "train-stop"}, + {filter = "name", name = COMBINATOR_NAME}, {filter = "type", type = "inserter"}, {filter = "type", type = "pump"}, {filter = "type", type = "straight-rail"}, } local filter_broken = { - {filter = "type", type = "train-stop"}, - {filter = "type", type = "arithmetic-combinator"}, + {filter = "name", name = "train-stop"}, + {filter = "name", name = COMBINATOR_NAME}, {filter = "type", type = "inserter"}, {filter = "type", type = "pump"}, {filter = "type", type = "straight-rail"}, {filter = "rolling-stock"}, } -local filter_comb = { - {filter = "type", type = "arithmetic-combinator"}, -} local function main() mod_settings.tps = settings.global["cybersyn-ticks-per-second"].value --[[@as int]] mod_settings.r_threshold = settings.global["cybersyn-request-threshold"].value--[[@as int]]