Skip to content

Commit 14be5bc

Browse files
committed
Added boiler and pipe support
1 parent e200794 commit 14be5bc

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

changelog.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1+
##0.1.1##
2+
+Added support for boilers pipes and underground pipes
3+
14
##0.1.0##
25
+ Initial release

control.lua

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
local refresh_rate = 60
22

3+
local types = {
4+
["storage-tank"] = true,
5+
["boiler"] = true,
6+
["pipe"] = true,
7+
["pipe-to-ground"] = true
8+
}
9+
310
local look_offset = 0.5
411
local look_distance = 1
512
local tank_surroundings_check_distance = 2
@@ -19,7 +26,9 @@ local function get_tank(entity)
1926
area = {{position.x + look_distance - 0.1, position.y - look_offset}, {position.x + look_distance + 0.1, position.y + look_offset}}
2027
end
2128

22-
return entity.surface.find_entities_filtered{area = area, type = "storage-tank"}[1]
29+
for i, v in pairs(entity.surface.find_entities(area)) do
30+
if types[v.type] then return v end
31+
end
2332
end
2433

2534
local function find_in_global(combinator)
@@ -45,7 +54,7 @@ local function on_built(event)
4554
entity.rotatable = true
4655
table.insert(global.combinators[ei], {entity = entity, tank = get_tank(entity)})
4756
end
48-
if entity.type == "storage-tank" then
57+
if types[entity.type] then
4958
local area = {
5059
{entity.position.x - tank_surroundings_check_distance, entity.position.y - tank_surroundings_check_distance},
5160
{entity.position.x + tank_surroundings_check_distance, entity.position.y + tank_surroundings_check_distance}
@@ -96,7 +105,7 @@ local function on_destroyed(event)
96105
end
97106
end
98107
end
99-
if entity.type == "storage-tank" then
108+
if types[entity.type] then
100109
local area = {
101110
{entity.position.x - tank_surroundings_check_distance, entity.position.y - tank_surroundings_check_distance},
102111
{entity.position.x + tank_surroundings_check_distance, entity.position.y + tank_surroundings_check_distance}

info.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "fluid-temperature-combinator",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"factorio_version": "0.14",
55
"title": "Fluid Temperature Combinator",
66
"author": "theRustyKnife",
7-
"description": "A combinator that can read the temperature of a fluid in adjacent tank.",
7+
"description": "A combinator that can read the temperature of fluid in an adjacent tank, boiler or pipe.",
88
"homepage": "https://mods.factorio.com/mods/theRustyKnife/fluid-temperature-combinator",
99
"date": "25.10.2016",
1010
"dependencies": []

0 commit comments

Comments
 (0)