2018-08-13 10:25:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
vacuum.air_bottle_image = "vessels_steel_bottle.png^[colorize:#0000FFAA"
|
|
|
|
|
2019-05-08 18:24:52 +02:00
|
|
|
-- space pos checker
|
2018-08-13 10:25:21 +02:00
|
|
|
vacuum.is_pos_in_space = function(pos)
|
2019-05-08 18:24:52 +02:00
|
|
|
return pos.y > vacuum.space_height
|
2018-08-13 10:25:21 +02:00
|
|
|
end
|
|
|
|
|
2019-05-08 18:24:52 +02:00
|
|
|
-- (cheaper) space check, gets called more often than `is_pos_in_space`
|
|
|
|
vacuum.no_vacuum_abm = function(pos)
|
|
|
|
return pos.y > vacuum.space_height - 40 and pos.y < vacuum.space_height + 40
|
|
|
|
end
|
2020-03-30 13:41:36 +02:00
|
|
|
|
|
|
|
-- returns true if the position is near a powered air pump
|
|
|
|
function vacuum.near_powered_airpump(pos)
|
|
|
|
local pos1 = vector.subtract(pos, {x=vacuum.air_pump_range, y=vacuum.air_pump_range, z=vacuum.air_pump_range})
|
|
|
|
local pos2 = vector.add(pos, {x=vacuum.air_pump_range, y=vacuum.air_pump_range, z=vacuum.air_pump_range})
|
|
|
|
|
|
|
|
local nodes = minetest.find_nodes_in_area(pos1, pos2, {"vacuum:airpump"})
|
|
|
|
for _,node in ipairs(nodes) do
|
|
|
|
local meta = minetest.get_meta(node)
|
|
|
|
if vacuum.airpump_active(meta) then
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
return false
|
|
|
|
end
|