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 not play close sound when a different gui is opened
do hardcore testing do hardcore testing
models & art models & art
move signal subgroup
add miniloader compat
space elevator compat space elevator compat
railloader compat

View File

@@ -6,6 +6,7 @@
"factorio_version": "1.1", "factorio_version": "1.1",
"dependencies": [ "dependencies": [
"base", "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) function update_station_from_inserter(map_data, inserter, forbidden_entity)
local surface = inserter.surface local surface = inserter.surface
local rail = surface.find_entity("straight-rail", inserter.pickup_position) --NOTE: we don't use find_entity solely for miniloader compat
if rail then local rails = surface.find_entities_filtered({
update_station_from_rail(map_data, rail, forbidden_entity) type = "straight-rail",
position = inserter.pickup_position,
radius = 1,
})
if rails[1] then
update_station_from_rail(map_data, rails[1], forbidden_entity)
end end
rail = surface.find_entity("straight-rail", inserter.drop_position) rails = surface.find_entities_filtered({
if rail then type = "straight-rail",
update_station_from_rail(map_data, rail, forbidden_entity) position = inserter.drop_position,
radius = 1,
})
if rails[1] then
update_station_from_rail(map_data, rails[1], forbidden_entity)
end end
end end

View File

@@ -195,7 +195,7 @@ local function on_combinator_built(map_data, comb)
if cur_entity.name == "train-stop" then if cur_entity.name == "train-stop" then
--NOTE: if there are multiple stops we take the later one --NOTE: if there are multiple stops we take the later one
stop = cur_entity stop = cur_entity
elseif cur_entity.name == "straight-rail" then elseif cur_entity.type == "straight-rail" then
rail = cur_entity rail = cur_entity
end end
end end
@@ -719,23 +719,20 @@ end
local filter_built = { local filter_built = {
{filter = "type", type = "train-stop"}, {filter = "name", name = "train-stop"},
{filter = "type", type = "arithmetic-combinator"}, {filter = "name", name = COMBINATOR_NAME},
{filter = "type", type = "inserter"}, {filter = "type", type = "inserter"},
{filter = "type", type = "pump"}, {filter = "type", type = "pump"},
{filter = "type", type = "straight-rail"}, {filter = "type", type = "straight-rail"},
} }
local filter_broken = { local filter_broken = {
{filter = "type", type = "train-stop"}, {filter = "name", name = "train-stop"},
{filter = "type", type = "arithmetic-combinator"}, {filter = "name", name = COMBINATOR_NAME},
{filter = "type", type = "inserter"}, {filter = "type", type = "inserter"},
{filter = "type", type = "pump"}, {filter = "type", type = "pump"},
{filter = "type", type = "straight-rail"}, {filter = "type", type = "straight-rail"},
{filter = "rolling-stock"}, {filter = "rolling-stock"},
} }
local filter_comb = {
{filter = "type", type = "arithmetic-combinator"},
}
local function main() local function main()
mod_settings.tps = settings.global["cybersyn-ticks-per-second"].value --[[@as int]] mod_settings.tps = settings.global["cybersyn-ticks-per-second"].value --[[@as int]]
mod_settings.r_threshold = settings.global["cybersyn-request-threshold"].value--[[@as int]] mod_settings.r_threshold = settings.global["cybersyn-request-threshold"].value--[[@as int]]