123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
-
- local oil_drum_max_load = 55
- bitumen.containers = {}
- bitumen.containers.max_fill = {
- {oil_drum = 200},
- {gas_can = 20},
- }
- minetest.register_tool("bitumen:gas_can", {
- description = "Gas Can",
- inventory_image = "bitumen_gas_can.png",
- stack_max = 1,
-
- on_use = function(itemstack, user, pointed_thing)
-
- if pointed_thing.type ~= "node" then
- return end
- n = minetest.env:get_node(pointed_thing)
-
-
- if n.group.oilpipe_give ~= 1 then
- return end
-
- item=itemstack:to_table()
- local fill=nil
- if item["metadata"]=="" then fill=0
- else fill=tonumber(item["metadata"])
- end
-
-
- if fill <= 0 then return end
-
- item=itemstack:to_table()
- if load==0 then return end
-
- if n.name == "default:water_flowing" then
- minetest.env:add_node(pointed_thing.under, {name="default:water_source"})
- load=load-1;
- item["metadata"]=tostring(load)
- technic.set_RE_wear(item,load,water_can_max_load)
- itemstack:replace(item)
- return itemstack
- end
- n = minetest.env:get_node(pointed_thing.above)
- if n.name == "air" then
- minetest.env:add_node(pointed_thing.above, {name="default:water_source"})
- load=load-1;
- item["metadata"]=tostring(load)
- technic.set_RE_wear(item,load,water_can_max_load)
- itemstack:replace(item)
- return itemstack
- end
- end,
- })
- minetest.register_node(":bitumen:oil_drum", {
- description = "Oil Drum",
- tiles = {"bitumen_drum_top.png", "bitumen_drum_bottom.png", "bitumen_drum_side.png",
- "bitumen_drum_side.png", "bitumen_drum_side.png", "bitumen_drum_side.png"},
- paramtype2 = "facedir",
-
- groups = {
- cracky=2,
- oddly_breakable_by_hand=2,
- oilpipe=1,
- oilpipe_receive=1,
- oil_container = 1
- },
- paramtype = "light",
- drawtype = "nodebox",
- node_box = {
- type = "fixed",
- fixed = {
-
- {-0.49, -0.5, -0.10, 0.49, 0.5, 0.10},
- {-0.10, -0.5, -0.49, 0.10, 0.5, 0.49},
-
- {-0.46, -0.5, -0.19, 0.46, 0.5, 0.19},
- {-0.19, -0.5, -0.46, 0.19, 0.5, 0.46},
-
- {-0.416, -0.5, -0.28, 0.416, 0.5, 0.28},
- {-0.28, -0.5, -0.416, 0.28, 0.5, 0.416},
-
- {-0.35, -0.5, -0.35, 0.35, 0.5, 0.35},
- },
- },
- selection_box = {
- type = "fixed",
- fixed = {
- {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
- },
- },
-
-
-
- sounds = default.node_sound_wood_defaults(),
-
- on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
- meta:set_string("infotext", "Oil Drum (Empty)")
- meta:set_string("oiltype", "Empty")
- meta:set_int("filllevel", "0")
-
- local inv = meta:get_inventory()
- inv:set_size("main", 10*4)
- end,
- can_dig = function(pos, player)
- local meta = minetest.env:get_meta(pos)
- if meta:get_int('filllevel') > 0 then
- return false
- end
- return true
- end,
- })
|