remove unused mod bg_funnel
.
This commit is contained in:
parent
d0a481334a
commit
d9523dc015
8 changed files with 0 additions and 191 deletions
|
@ -1,57 +0,0 @@
|
|||
local function get_inventory (pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
return minetest.deserialize(meta:get_string("inventory"))
|
||||
end
|
||||
|
||||
local function set_inventory (pos, inventory)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("inventory", minetest.serialize(inventory))
|
||||
end
|
||||
|
||||
|
||||
|
||||
local function push (pos, value)
|
||||
local inventory = get_inventory(pos)
|
||||
if not inventory then return false end
|
||||
|
||||
table.insert(inventory, value)
|
||||
set_inventory(pos, inventory)
|
||||
return true
|
||||
end
|
||||
|
||||
local function pop (pos)
|
||||
local inventory = get_inventory(pos)
|
||||
if not inventory then return nil end
|
||||
|
||||
local value = table.remove(inventory, 1)
|
||||
set_inventory(pos, inventory)
|
||||
return value
|
||||
end
|
||||
|
||||
|
||||
|
||||
local function place_funnel (itemstack, placed, pointed)
|
||||
local result = minetest.item_place(itemstack, placer, pointed)
|
||||
|
||||
local pos = pointed.above
|
||||
local meta = minetest.get_meta(pos)
|
||||
set_inventory(pos, {})
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
local function dig_funnel (pos, ...)
|
||||
local result = minetest.node_dig(pos, ...)
|
||||
return result
|
||||
end
|
||||
|
||||
|
||||
|
||||
return {
|
||||
get_inventory = get_inventory,
|
||||
set_inventory = set_inventory,
|
||||
place_funnel = place_funnel,
|
||||
dig_funnel = dig_funnel,
|
||||
push = push,
|
||||
pop = pop,
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
local modname = minetest.get_current_modname()
|
||||
|
||||
local api = load_file("api")
|
||||
|
||||
local function get_meta_table (pos)
|
||||
return minetest.get_meta(pos):to_table()
|
||||
end
|
||||
|
||||
local function set_meta (pos, meta_table)
|
||||
local meta = minetest.get_meta(pos)
|
||||
for key, value in pairs(meta_table) do
|
||||
local fn = nil
|
||||
if type(value) == "string" then fn = "set_string" end
|
||||
if type(value) == "int" then fn = "set_int" end
|
||||
if type(value) == "float" then fn = "set_float" end
|
||||
if fn then
|
||||
meta[fn](key, value)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function attempt_input (pos)
|
||||
-- TODO: add max limit for amount of nodes inside funnel inventory.
|
||||
local above = pos + blockgame.vector.dirs.up
|
||||
if minetest.get_node(above).name == "air" then return false end
|
||||
|
||||
local node = minetest.get_node(above)
|
||||
local meta = get_meta_table(above)
|
||||
local value = {
|
||||
node = node,
|
||||
meta = meta,
|
||||
}
|
||||
|
||||
local success = api.push(pos, value)
|
||||
if not success then return false end
|
||||
minetest.remove_node(above)
|
||||
return true
|
||||
end
|
||||
|
||||
local function attempt_output (pos)
|
||||
local below = pos + blockgame.vector.dirs.down
|
||||
if minetest.get_node(below).name ~= "air" then return false end
|
||||
|
||||
local value = api.pop(pos)
|
||||
if not value then return nil end
|
||||
|
||||
local node = value.node
|
||||
local meta = value.meta
|
||||
minetest.set_node(below, node)
|
||||
set_meta(below, meta)
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
blockgame.register_abm({
|
||||
label = "funnel nodes",
|
||||
nodenames = {modname .. ":funnel"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
catch_up = false,
|
||||
action = function (pos)
|
||||
-- NOTE: metadata storage might not work, and funnels might not be able to pick up other funnels successfully.
|
||||
attempt_input(pos)
|
||||
attempt_output(pos)
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
|
||||
-- NOTE: the documentation says `register_on_placenode` is "not recommended"; what else could be used for this?
|
||||
minetest.register_on_placenode(function (pos)
|
||||
local below = pos + blockgame.vector.dirs.down
|
||||
if minetest.get_node(below).name ~= modname .. ":funnel" then return end
|
||||
attempt_input(below)
|
||||
end)
|
||||
|
||||
-- NOTE: the documentation says `register_on_dignode` is "not recommended"; what else could be used for this?
|
||||
minetest.register_on_dignode(function (pos)
|
||||
local above = pos + blockgame.vector.dirs.up
|
||||
if minetest.get_node(above).name ~= modname .. ":funnel" then return end
|
||||
attempt_output(above)
|
||||
end)
|
|
@ -1,6 +0,0 @@
|
|||
-- this mod is disabled for now.
|
||||
--[[
|
||||
load_file("node")
|
||||
load_file("recipe")
|
||||
load_file("funnel")
|
||||
]]--
|
|
@ -1,3 +0,0 @@
|
|||
name = bg_funnel
|
||||
description = adds a funnel node to blockgame.
|
||||
depends = bg_terrain, bg_api, bg_tree, bg_woodworking
|
|
@ -1,27 +0,0 @@
|
|||
local modname = minetest.get_current_modname()
|
||||
|
||||
local api = load_file("api")
|
||||
|
||||
blockgame.register_node(modname .. ":funnel", {
|
||||
description = "Funnel",
|
||||
tiles = {
|
||||
modname .. "_funnel_top.png",
|
||||
modname .. "_funnel_top.png",
|
||||
modname .. "_funnel.png",
|
||||
},
|
||||
groups = {
|
||||
woody = 1,
|
||||
},
|
||||
on_place = function (...)
|
||||
return api.place_funnel(...)
|
||||
end,
|
||||
on_dig = function (...)
|
||||
return api.dig_funnel(...)
|
||||
end,
|
||||
preserve_metadata = function (pos, node, meta, drops)
|
||||
-- TODO: store funnel contents inside dropped item.
|
||||
end,
|
||||
after_place_node = function (pos, placer, item_stack)
|
||||
-- TODO: recreate funnel contents from placed item.
|
||||
end,
|
||||
})
|
|
@ -1,16 +0,0 @@
|
|||
local modname = minetest.get_current_modname()
|
||||
|
||||
blockgame.crafting.register_pummel_recipe({
|
||||
label = "pummel logs into funnel",
|
||||
used_item = "woodworking:plank",
|
||||
target_node = "bg_tree:log",
|
||||
check = function (pos, used_node, target_node)
|
||||
local below = pos + blockgame.vector.dirs.down
|
||||
return minetest.get_node(below).name == "bg_tree:log"
|
||||
end,
|
||||
on_success = function (pos, used_node, target_node)
|
||||
local below = pos + blockgame.vector.dirs.down
|
||||
minetest.remove_node(pos)
|
||||
minetest.set_node(below, {name = modname .. ":funnel"})
|
||||
end,
|
||||
})
|
Binary file not shown.
Before Width: | Height: | Size: 5.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 766 B |
Loading…
Reference in a new issue