diff --git a/connections/belt.lua b/connections/belt.lua index cedf622..6e68143 100644 --- a/connections/belt.lua +++ b/connections/belt.lua @@ -3,9 +3,18 @@ Belt = {} Belt.color = {r = 0, g = 183/255, b = 0} Belt.entity_types = {"transport-belt", "underground-belt"} Belt.unlocked = function(force) return true end - Belt.indicator_settings = {"d0"} +local INSERT_POS = { + ["transport-belt"] = 0.75, -- 1 - 8/32 + ["underground-belt"] = 0.25 -- 0.5 - 8/32 +} + +if (mods or script.active_mods)["deadlock-beltboxes-loaders"] then + table.insert(Belt.entity_types, "loader-1x1") + table.insert(INSERT_POS, {["loader-1x1"] = 0.75}) -- 1 - 8/32 +end + local function calc_delays(speed1, speed2) -- Belt connections will transfer a maximum of 1 item per tick per lane local speed = math.min(8, math.min(speed1, speed2)) @@ -17,12 +26,6 @@ local function calc_delays(speed1, speed2) return delays end -local INSERT_POS = { - ["transport-belt"] = 0.75, -- 1 - 8/32 - ["underground-belt"] = 0.25, -- 0.5 - 8/32 -} - - local opposite = { [defines.direction.north] = defines.direction.south, [defines.direction.south] = defines.direction.north, [defines.direction.east] = defines.direction.west, [defines.direction.west] = defines.direction.east, @@ -30,6 +33,7 @@ local opposite = { local function get_conn_facing(outside_entity, inside_entity, direction_out, direction_in) local outside_dir, inside_dir, ot, it = 0, 0, outside_entity.type, inside_entity.type + if ot == "transport-belt" then outside_dir = outside_entity.direction elseif ot == "underground-belt" then @@ -40,6 +44,7 @@ local function get_conn_facing(outside_entity, inside_entity, direction_out, dir if direction_in ~= outside_dir then return nil end end end + if it == "transport-belt" then inside_dir = inside_entity.direction elseif it == "underground-belt" then @@ -50,6 +55,17 @@ local function get_conn_facing(outside_entity, inside_entity, direction_out, dir if direction_out ~= inside_dir then return nil end end end + + if (mods or script.active_mods)["deadlock-beltboxes-loaders"] then + if ot == "loader-1x1" then + outside_dir = outside_entity.direction + end + + if it == "loader-1x1" then + inside_dir = inside_entity.direction + end + end + if outside_dir ~= inside_dir then return nil end --game.print("Direction: " .. outside_dir) return outside_dir @@ -135,4 +151,4 @@ Belt.tick = function (conn) end Belt.destroy = function (conn) -end \ No newline at end of file +end diff --git a/info.json b/info.json index 9c14032..e7ff2d7 100644 --- a/info.json +++ b/info.json @@ -5,5 +5,5 @@ "author": "MagmaMcFry", "description": "Factorissimo 2 adds factory buildings to Factorio. Place them down, walk in, build your factories inside!", "factorio_version": "1.1", - "dependencies": ["base >= 1.1.0"] + "dependencies": ["base >= 1.1.0", "?deadlock-beltboxes-loaders"] }