forked from Ekdohibs/itest
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconsumers.lua
More file actions
66 lines (56 loc) · 1.68 KB
/
consumers.lua
File metadata and controls
66 lines (56 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
consumers={}
consumers.tube = {
insert_object=function(pos,node,stack,direction)
local meta=minetest.env:get_meta(pos)
local inv=meta:get_inventory()
return inv:add_item("src",stack)
end,
can_insert=function(pos,node,stack,direction)
local meta=minetest.env:get_meta(pos)
local inv=meta:get_inventory()
local cooking_method = minetest.registered_nodes[node.name]["cooking_method"]
local produced
if cooking_method then
produced = voltbuild.get_craft_result({method = cooking_method,
width = 1, items = {stack}})
end
if produced.items then
return inv:room_for_item("src",stack)
end
end,
connect_sides={left=1, right=1, back=1, bottom=1, top=1, front=1},
connects = function (param2)
return true
end,
input_inventory="dst",
}
consumers.discharge = voltbuild.discharge_item
function consumers.get_progressbar(v,mv,bg,fg)
local percent = v/mv*100
local bar="image[3,2;2,1;"..bg.."^[lowpart:"..
percent..":"..fg.."^[transformR270"
return bar
end
function consumers.on_construct(pos)
local meta = minetest.env:get_meta(pos)
local inv = meta:get_inventory()
inv:set_size("discharge", 1)
voltbuild.on_construct(pos)
end
consumers.can_dig = voltbuild.can_dig
consumers.inventory = voltbuild.inventory
function consumers.get_formspec(pos)
formspec = voltbuild.common_spec..
voltbuild.discharge_spec..
voltbuild.vertical_chargebar_spec(pos)..
voltbuild.stressbar_spec(pos)
return formspec
end
dofile(modpath.."/electric_furnace.lua")
dofile(modpath.."/macerator.lua")
dofile(modpath.."/extractor.lua")
dofile(modpath.."/compressor.lua")
dofile(modpath.."/recycler.lua")
dofile(modpath.."/hospital.lua")
dofile(modpath.."/scuba.lua")
dofile(modpath.."/miner.lua")