biogasmachines: freezer early version created.
Simple freezer node created to test pipeworks water supply. Node has temporary textures, no formspecs and no inventories. When punched node shows if water is flowing into it via pipes. Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
This commit is contained in:
parent
ad0c65e7e0
commit
6eafa51477
2
TODO
2
TODO
@ -9,6 +9,8 @@ moderntables:
|
|||||||
|
|
||||||
biogasmachines:
|
biogasmachines:
|
||||||
* Coal Gasifier, Biogas Smelter - behaviour based on Quarry and Grinder
|
* Coal Gasifier, Biogas Smelter - behaviour based on Quarry and Grinder
|
||||||
|
* Freezer - machine to produce ice cubes from water (either in buckets
|
||||||
|
or provided via pipeworks)
|
||||||
* Coal Gasifier - convert coal block to Biogas stack, do not use Biogas
|
* Coal Gasifier - convert coal block to Biogas stack, do not use Biogas
|
||||||
("electric") as it would create split loop complications in automated
|
("electric") as it would create split loop complications in automated
|
||||||
processing; leftover is gravel? dirt? none?
|
processing; leftover is gravel? dirt? none?
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
default
|
default
|
||||||
tubelib
|
tubelib
|
||||||
tubelib_addons1
|
tubelib_addons1
|
||||||
|
pipeworks?
|
||||||
unified_inventory?
|
unified_inventory?
|
||||||
moreores?
|
moreores?
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
Expands Tubelib (and TechPack) with various machines that use Biogas
|
Expands Tubelib (and TechPack) with various machines that use Biogas
|
||||||
either as a product or a power source. ONLY A STUB NOW!
|
either as a product or a power source. CAUTION: WORK IN PROGRESS!
|
||||||
|
82
biogasmachines/freezer.lua
Normal file
82
biogasmachines/freezer.lua
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
--[[
|
||||||
|
|
||||||
|
=======================================================================
|
||||||
|
Tubelib Biogas Machines Mod
|
||||||
|
by Micu (c) 2018
|
||||||
|
|
||||||
|
Copyright (C) 2018 Michal Cieslakiewicz
|
||||||
|
|
||||||
|
Freezer - Biogas-powered machine that converts water to ice
|
||||||
|
(technically Biogas is a coolant here, not fuel, however it
|
||||||
|
is 'used' in the same way). Device changes water in bucket
|
||||||
|
to ice and empty bucket. If pipeworks mod is installed and pipe
|
||||||
|
with water is connected to device, in absence of water buckets
|
||||||
|
it produces ice from water supplied via pipes.
|
||||||
|
Device automatically shuts off when there is nothing to freeze,
|
||||||
|
so Biogas is not wasted.
|
||||||
|
|
||||||
|
Note: due to pipeworks being WIP, the only valid water connections
|
||||||
|
for now are from top and bottom (see waterpipes.lua).
|
||||||
|
|
||||||
|
License: LGPLv2.1+
|
||||||
|
=======================================================================
|
||||||
|
|
||||||
|
]]--
|
||||||
|
|
||||||
|
minetest.register_node("biogasmachines:freezer", {
|
||||||
|
description = "Tubelib Biogas Freezer",
|
||||||
|
tiles = {
|
||||||
|
-- up, down, right, left, back, front
|
||||||
|
"tubelib_front.png",
|
||||||
|
"tubelib_front.png",
|
||||||
|
"tubelib_front.png",
|
||||||
|
"tubelib_front.png",
|
||||||
|
"tubelib_front.png",
|
||||||
|
"default_ice.png",
|
||||||
|
},
|
||||||
|
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {choppy = 2, cracky = 2, crumbly = 2},
|
||||||
|
is_ground_content = false,
|
||||||
|
sounds = default.node_sound_metal_defaults(),
|
||||||
|
|
||||||
|
pipe_connections = { top = 1, bottom = 1 },
|
||||||
|
|
||||||
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local number = tubelib.add_node(pos, "biogasmachines:freezer")
|
||||||
|
meta:set_string("number", number)
|
||||||
|
meta:set_string("infotext", "Tubelib Biogas Freezer " .. number)
|
||||||
|
meta:set_string("owner", placer:get_player_name())
|
||||||
|
if minetest.get_modpath("pipeworks") then
|
||||||
|
pipeworks.scan_for_pipe_objects(pos)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||||
|
tubelib.remove_node(pos)
|
||||||
|
if minetest.get_modpath("pipeworks") then
|
||||||
|
pipeworks.scan_for_pipe_objects(pos)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_rotate = screwdriver.disallow,
|
||||||
|
|
||||||
|
on_punch = function(pos, node, puncher, pointed_thing)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local player_name = puncher:get_player_name()
|
||||||
|
if meta:get_string("owner") ~= player_name then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
minetest.chat_send_player(player_name,
|
||||||
|
minetest.colorize("#FFFF00", "[BiogasFreezer:" ..
|
||||||
|
meta:get_string("number") .. "] ") ..
|
||||||
|
(biogasmachines.is_pipe_with_water(pos, node)
|
||||||
|
and "Water flows" or "No water"))
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
|
||||||
|
})
|
||||||
|
|
@ -1,17 +1,23 @@
|
|||||||
--[[
|
--[[
|
||||||
|
|
||||||
Tubelib Biogas Burners Mod
|
=======================================================================
|
||||||
==========================
|
Tubelib Biogas Machines Mod
|
||||||
|
by Micu (c) 2018
|
||||||
|
|
||||||
Biogas machines for TechPack by Joachim Stolberg
|
Copyright (C) 2018 Michal Cieslakiewicz
|
||||||
|
|
||||||
Copyright (C) 2018 Michal Cieslakiewicz
|
|
||||||
|
|
||||||
LGPLv2.1+
|
|
||||||
See LICENSE.txt for more information
|
|
||||||
|
|
||||||
|
License: LGPLv2.1+
|
||||||
|
Media: CC BY-SA
|
||||||
|
=======================================================================
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
biogasmachines = {}
|
||||||
|
|
||||||
|
-- helper functions
|
||||||
|
dofile(minetest.get_modpath("biogasmachines").."/waterpipes.lua")
|
||||||
|
|
||||||
|
-- machines
|
||||||
|
dofile(minetest.get_modpath("biogasmachines").."/freezer.lua")
|
||||||
dofile(minetest.get_modpath("biogasmachines").."/gasifier.lua")
|
dofile(minetest.get_modpath("biogasmachines").."/gasifier.lua")
|
||||||
dofile(minetest.get_modpath("biogasmachines").."/smelter.lua")
|
dofile(minetest.get_modpath("biogasmachines").."/smelter.lua")
|
||||||
|
|
||||||
|
68
biogasmachines/waterpipes.lua
Normal file
68
biogasmachines/waterpipes.lua
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
--[[
|
||||||
|
|
||||||
|
=======================================================================
|
||||||
|
Tubelib Biogas Machines Mod
|
||||||
|
by Micu (c) 2018
|
||||||
|
|
||||||
|
Copyright (C) 2018 Michal Cieslakiewicz
|
||||||
|
|
||||||
|
Helper file for all machines that accept water through pipes from
|
||||||
|
'pipeworks' mod.
|
||||||
|
|
||||||
|
Note: due to pipeworks being WIP, the only valid water connection
|
||||||
|
for now is from top or bottom - machine face orientation is apparently
|
||||||
|
ignored by pipe logic, 'back' for pipes means always param2 = 0 (z+).
|
||||||
|
|
||||||
|
License: LGPLv2.1+
|
||||||
|
=======================================================================
|
||||||
|
|
||||||
|
]]--
|
||||||
|
|
||||||
|
-- Check if machine is connected to pipe network and water flows into machine
|
||||||
|
-- Parameters: node position, node object (optional)
|
||||||
|
-- Returns: true if water is flowing into device node
|
||||||
|
function biogasmachines.is_pipe_with_water(pos, opt_node)
|
||||||
|
if not minetest.get_modpath("pipeworks") then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
local node = opt_node
|
||||||
|
if not node then
|
||||||
|
node = minetest.get_node_or_nil(pos)
|
||||||
|
if not node then return false end
|
||||||
|
end
|
||||||
|
local node_def = minetest.registered_nodes[node.name]
|
||||||
|
if not node_def then return false end
|
||||||
|
local pipe_con = node_def.pipe_connections
|
||||||
|
if not pipe_con then return false end
|
||||||
|
local above = nil
|
||||||
|
local below = nil
|
||||||
|
if pipe_con.top then
|
||||||
|
above = minetest.get_node_or_nil(
|
||||||
|
vector.add(pos, { x = 0, y = 1, z = 0 }))
|
||||||
|
end
|
||||||
|
if pipe_con.bottom then
|
||||||
|
below = minetest.get_node_or_nil(
|
||||||
|
vector.add(pos, { x = 0, y = -1, z = 0 }))
|
||||||
|
end
|
||||||
|
-- try to detect connected pipes, valves etc. with water:
|
||||||
|
-- 0. normal pipes at top or bottom (they will attach automatically)
|
||||||
|
if (above and string.match(above.name, "^pipeworks:pipe_.*_loaded")) or
|
||||||
|
(below and string.match(below.name, "^pipeworks:pipe_.*_loaded")) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
-- 1. straight vertical pipes, valves and sensors
|
||||||
|
if (above and above.param2 == 17 and
|
||||||
|
(above.name == "pipeworks:straight_pipe_loaded" or
|
||||||
|
above.name == "pipeworks:entry_panel_loaded" or
|
||||||
|
above.name == "pipeworks:valve_on_loaded" or
|
||||||
|
above.name == "pipeworks:flow_sensor_loaded")) or
|
||||||
|
(below and below.param2 == 17 and
|
||||||
|
(below.name == "pipeworks:straight_pipe_loaded" or
|
||||||
|
below.name == "pipeworks:entry_panel_loaded" or
|
||||||
|
below.name == "pipeworks:valve_on_loaded" or
|
||||||
|
below.name == "pipeworks:flow_sensor_loaded")) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user