add in basic bottles mod, limit shelfs to there respective items
11
mods/fl_bottles/README
Normal file
@ -0,0 +1,11 @@
|
||||
wsor(aka wsor4035)(CC BY-SA 3.0)
|
||||
dervived from Thomas-S under same license
|
||||
farlands_bottle_empty.png
|
||||
|
||||
wsor(aka wsor4035)(CC BY-SA 3.0)
|
||||
derived from D00Med under same license who
|
||||
derived from Thomas-S under same license
|
||||
all other farlands_bottle_*.png
|
||||
|
||||
D00Med(CC BY-SA 3.0)
|
||||
farlands_bubble*.png
|
48
mods/fl_bottles/init.lua
Normal file
@ -0,0 +1,48 @@
|
||||
minetest.register_craftitem("fl_bottles:water", {
|
||||
description = "bottle with water",
|
||||
inventory_image = "farlands_bottle_blue.png",
|
||||
groups = {bottle = 1, vessel = 1},
|
||||
})
|
||||
|
||||
minetest.register_craftitem("fl_bottles:river_water", {
|
||||
description = "bottle with river water",
|
||||
inventory_image = "farlands_bottle_aqua.png",
|
||||
groups = {bottle = 1, vessel = 1},
|
||||
})
|
||||
|
||||
minetest.register_craftitem("fl_bottles:bottle", {
|
||||
description = "empty bottle",
|
||||
inventory_image = "farlands_bottle_empty.png",
|
||||
liquids_pointable = true,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then return end
|
||||
|
||||
local node = minetest.get_node(pointed_thing.under)
|
||||
local node_def = minetest.registered_nodes[node.name]
|
||||
|
||||
if user and not user:get_player_control().sneak then
|
||||
if node_def.on_rightclick then
|
||||
return node_def.on_rightclick(pointed_thing.under, node, user, itemstack)
|
||||
end
|
||||
end
|
||||
|
||||
if node_def._bottle_item == nil then
|
||||
return itemstack
|
||||
else
|
||||
if user:get_wielded_item():get_count() > 1 then
|
||||
local inv = user:get_inventory()
|
||||
if inv:room_for_item("main", {name=node_def._bottle_item}) then
|
||||
inv:add_item("main", node_def._bottle_item)
|
||||
else
|
||||
local pos = user:get_pos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
minetest.add_item(pos, node_def._bottle_item)
|
||||
end
|
||||
itemstack:take_item()
|
||||
return itemstack
|
||||
end
|
||||
return ItemStack(node_def._bottle_item)
|
||||
end
|
||||
end,
|
||||
groups = {bottle = 1, vessel = 1},
|
||||
})
|
BIN
mods/fl_bottles/textures/farlands_bottle_aqua.png
Normal file
After Width: | Height: | Size: 722 B |
BIN
mods/fl_bottles/textures/farlands_bottle_blue.png
Normal file
After Width: | Height: | Size: 715 B |
BIN
mods/fl_bottles/textures/farlands_bottle_brown.png
Normal file
After Width: | Height: | Size: 715 B |
BIN
mods/fl_bottles/textures/farlands_bottle_cyan.png
Normal file
After Width: | Height: | Size: 722 B |
BIN
mods/fl_bottles/textures/farlands_bottle_darkpurple.png
Normal file
After Width: | Height: | Size: 717 B |
BIN
mods/fl_bottles/textures/farlands_bottle_empty.png
Normal file
After Width: | Height: | Size: 643 B |
BIN
mods/fl_bottles/textures/farlands_bottle_gcyan.png
Normal file
After Width: | Height: | Size: 757 B |
BIN
mods/fl_bottles/textures/farlands_bottle_ggreen.png
Normal file
After Width: | Height: | Size: 755 B |
BIN
mods/fl_bottles/textures/farlands_bottle_gold.png
Normal file
After Width: | Height: | Size: 751 B |
BIN
mods/fl_bottles/textures/farlands_bottle_gpurple.png
Normal file
After Width: | Height: | Size: 763 B |
BIN
mods/fl_bottles/textures/farlands_bottle_gred.png
Normal file
After Width: | Height: | Size: 755 B |
BIN
mods/fl_bottles/textures/farlands_bottle_green.png
Normal file
After Width: | Height: | Size: 715 B |
BIN
mods/fl_bottles/textures/farlands_bottle_grey.png
Normal file
After Width: | Height: | Size: 707 B |
BIN
mods/fl_bottles/textures/farlands_bottle_lightblue.png
Normal file
After Width: | Height: | Size: 717 B |
BIN
mods/fl_bottles/textures/farlands_bottle_limegreen.png
Normal file
After Width: | Height: | Size: 715 B |
BIN
mods/fl_bottles/textures/farlands_bottle_magenta.png
Normal file
After Width: | Height: | Size: 720 B |
BIN
mods/fl_bottles/textures/farlands_bottle_orange.png
Normal file
After Width: | Height: | Size: 717 B |
BIN
mods/fl_bottles/textures/farlands_bottle_purple.png
Normal file
After Width: | Height: | Size: 720 B |
BIN
mods/fl_bottles/textures/farlands_bottle_red.png
Normal file
After Width: | Height: | Size: 713 B |
BIN
mods/fl_bottles/textures/farlands_bottle_redbrown.png
Normal file
After Width: | Height: | Size: 714 B |
BIN
mods/fl_bottles/textures/farlands_bottle_silver.png
Normal file
After Width: | Height: | Size: 748 B |
BIN
mods/fl_bottles/textures/farlands_bottle_yellow.png
Normal file
After Width: | Height: | Size: 719 B |
BIN
mods/fl_bottles/textures/farlands_bottle_yellowgreen.png
Normal file
After Width: | Height: | Size: 720 B |
BIN
mods/fl_bottles/textures/farlands_bubble_green.png
Normal file
After Width: | Height: | Size: 124 B |
BIN
mods/fl_bottles/textures/farlands_bubbles_pink.png
Normal file
After Width: | Height: | Size: 142 B |
BIN
mods/fl_bottles/textures/farlands_bubbles_white.png
Normal file
After Width: | Height: | Size: 142 B |
@ -51,6 +51,7 @@ minetest.register_node(":fl_terrain:water_source", {
|
||||
liquid_viscosity = 1,
|
||||
post_effect_color = {a = 103, r = 30, g = 60, b = 90},
|
||||
groups = {water = 3, liquid = 3, cools_lava = 1},
|
||||
_bottle_item = "fl_bottles:water",
|
||||
})
|
||||
|
||||
minetest.register_node(":fl_terrain:water_flowing", {
|
||||
@ -144,6 +145,7 @@ minetest.register_node(":fl_terrain:river_water_source", {
|
||||
liquid_range = 2,
|
||||
post_effect_color = {a = 103, r = 30, g = 76, b = 90},
|
||||
groups = {water = 3, liquid = 3, cools_lava = 1},
|
||||
_bottle_item = "fl_bottles:river_water",
|
||||
})
|
||||
|
||||
minetest.register_node(":fl_terrain:river_water_flowing", {
|
||||
|
@ -95,8 +95,6 @@ minetest.register_node("fl_storage:wood_chest", {
|
||||
end,
|
||||
})
|
||||
|
||||
--add allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
-- to limit for vessels and books type shelfs
|
||||
local function shelf_nodes(name)
|
||||
local overlays = {"book", "empty", "multi", "vessel"}
|
||||
|
||||
@ -184,6 +182,15 @@ local function shelf_nodes(name)
|
||||
local shelf_formspec = table.concat(formspec, "")
|
||||
minetest.show_formspec(clicker:get_player_name(), "fl_wildlife:trader_formspec", shelf_formspec)
|
||||
end,
|
||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
if overlay == "vessel" or overlay == "book" then
|
||||
if minetest.get_item_group(stack:get_name(), overlay) ~= 0 then
|
||||
return stack:get_count()
|
||||
end
|
||||
return 0
|
||||
end
|
||||
return stack:get_count()
|
||||
end,
|
||||
on_dig = function(pos, node, digger)
|
||||
local inv = minetest.get_inventory({type="node", pos=pos})
|
||||
for _, item in ipairs(inv:get_list("main")) do
|
||||
|