added miniloader compat

This commit is contained in:
Monica Moniot
2022-11-06 00:54:36 -04:00
parent aa80fd304e
commit 2dff20756e
4 changed files with 23 additions and 17 deletions

3
TODO
View File

@@ -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

View File

@@ -6,6 +6,7 @@
"factorio_version": "1.1",
"dependencies": [
"base",
"flib >= 0.6.0"
"flib >= 0.6.0",
"? miniloader"
]
}

View File

@@ -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

View File

@@ -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]]