mirror of
https://github.com/minetest-mods/hopper.git
synced 2025-01-03 02:57:29 +01:00
merge recent tenplus1 changes
This commit is contained in:
commit
f16b51efe1
@ -19,5 +19,6 @@ Change log:
|
|||||||
- 1.1 - Hoppers now work with new node timer Furnaces. Reduced Abm's and tidied code.
|
- 1.1 - Hoppers now work with new node timer Furnaces. Reduced Abm's and tidied code.
|
||||||
- 1.2 - Added simple API so that hoppers can work with other containers.
|
- 1.2 - Added simple API so that hoppers can work with other containers.
|
||||||
- 1.3 - Hoppers now call on_metadata_inventory_put and on_metadata_inventory_take, triggering furnace timers via their standard callbacks. Updated side hopper rotation handling to allow it to function in any orientation. Added settings options to use 16-pixel or 32-pixel textures. Added settings option to allow explicit crafting of standard/side hoppers or to allow crafting of a single item that selects which type to use on place. Added in-game documentation via optional "doc" mod dependency
|
- 1.3 - Hoppers now call on_metadata_inventory_put and on_metadata_inventory_take, triggering furnace timers via their standard callbacks. Updated side hopper rotation handling to allow it to function in any orientation. Added settings options to use 16-pixel or 32-pixel textures. Added settings option to allow explicit crafting of standard/side hoppers or to allow crafting of a single item that selects which type to use on place. Added in-game documentation via optional "doc" mod dependency
|
||||||
|
- 1.4 - Added intllib support
|
||||||
|
|
||||||
Lucky Blocks: 2
|
Lucky Blocks: 2
|
||||||
|
9
api.txt
9
api.txt
@ -14,8 +14,9 @@ Make sure any mods using this function has 'hopper' in the depends.txt file.
|
|||||||
hopper:add_container({ {"where_from", "node_name", "inventory_name"} })
|
hopper:add_container({ {"where_from", "node_name", "inventory_name"} })
|
||||||
|
|
||||||
'where_from' is a string telling the api that items are coming from either
|
'where_from' is a string telling the api that items are coming from either
|
||||||
the 'top' node into a hopper, going into the 'bottom' node from a
|
the 'top' node into a hopper below, going into the 'bottom' node
|
||||||
hopper or coming from a 'side' hopper into a container.
|
from the hopper above or coming from a 'side' hopper into the
|
||||||
|
node next door.
|
||||||
|
|
||||||
'node_name" is the name of the container itself (e.g. "default:chest")
|
'node_name" is the name of the container itself (e.g. "default:chest")
|
||||||
|
|
||||||
@ -24,8 +25,8 @@ hopper:add_container({ {"where_from", "node_name", "inventory_name"} })
|
|||||||
e.g.
|
e.g.
|
||||||
|
|
||||||
hopper:add_container({
|
hopper:add_container({
|
||||||
{"top", "default:furnace", "dst"}, -- take cooked items from above into hopper
|
{"top", "default:furnace", "dst"}, -- take cooked items from above into hopper below
|
||||||
{"bottom", "default:furnace", "src"}, -- insert items below to be cooked from hopper
|
{"bottom", "default:furnace", "src"}, -- insert items below to be cooked from hopper above
|
||||||
{"side", "default:furnace", "fuel"}, -- replenish furnace fuel from hopper at side
|
{"side", "default:furnace", "fuel"}, -- replenish furnace fuel from hopper at side
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
default
|
default
|
||||||
lucky_block?
|
lucky_block?
|
||||||
doc?
|
doc?
|
||||||
|
intllib?
|
||||||
|
67
init.lua
67
init.lua
@ -42,6 +42,19 @@ function hopper:add_container(list)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local S
|
||||||
|
|
||||||
|
if minetest.get_modpath("intllib") then
|
||||||
|
S = intllib.Getter()
|
||||||
|
else
|
||||||
|
S = function(s, a, ...) a = {a, ...}
|
||||||
|
return s:gsub("@(%d+)", function(n)
|
||||||
|
return a[tonumber(n)]
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
-- default containers ( from position [into hopper], from node, into node inventory )
|
-- default containers ( from position [into hopper], from node, into node inventory )
|
||||||
hopper:add_container({
|
hopper:add_container({
|
||||||
{"top", "hopper:hopper", "main"},
|
{"top", "hopper:hopper", "main"},
|
||||||
@ -76,7 +89,6 @@ if minetest.get_modpath("protector") then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- wine mod support
|
-- wine mod support
|
||||||
if minetest.get_modpath("wine") then
|
if minetest.get_modpath("wine") then
|
||||||
|
|
||||||
@ -87,7 +99,6 @@ if minetest.get_modpath("wine") then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- formspec
|
-- formspec
|
||||||
local function get_hopper_formspec(pos)
|
local function get_hopper_formspec(pos)
|
||||||
|
|
||||||
@ -144,10 +155,10 @@ end
|
|||||||
-- hopper
|
-- hopper
|
||||||
minetest.register_node("hopper:hopper", {
|
minetest.register_node("hopper:hopper", {
|
||||||
drop = "hopper:hopper",
|
drop = "hopper:hopper",
|
||||||
description = "Hopper",
|
description = S("Hopper"),
|
||||||
_doc_items_longdesc = hopper_long_desc,
|
_doc_items_longdesc = hopper_long_desc,
|
||||||
_doc_items_usagehelp = hopper_usage,
|
_doc_items_usagehelp = hopper_usage,
|
||||||
groups = {cracky=3},
|
groups = {cracky = 3},
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
tiles = {"hopper_top_" .. texture_resolution .. ".png", "hopper_top_" .. texture_resolution .. ".png", "hopper_front_" .. texture_resolution .. ".png"},
|
tiles = {"hopper_top_" .. texture_resolution .. ".png", "hopper_top_" .. texture_resolution .. ".png", "hopper_front_" .. texture_resolution .. ".png"},
|
||||||
@ -200,21 +211,18 @@ minetest.register_node("hopper:hopper", {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||||
minetest.log("action", player:get_player_name()
|
minetest.log("action", S("@1 moves stuff in hopper at @2",
|
||||||
.." moves stuff in hopper at "
|
player:get_player_name(), minetest.pos_to_string(pos)))
|
||||||
..minetest.pos_to_string(pos))
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
minetest.log("action", player:get_player_name()
|
minetest.log("action", S("@1 moves stuff to hopper at @2",
|
||||||
.." moves stuff to hopper at "
|
player:get_player_name(), minetest.pos_to_string(pos)))
|
||||||
..minetest.pos_to_string(pos))
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||||
minetest.log("action", player:get_player_name()
|
minetest.log("action", S("@1 moves stuff from hopper at @2",
|
||||||
.." takes stuff from hopper at "
|
player:get_player_name(), minetest.pos_to_string(pos)))
|
||||||
..minetest.pos_to_string(pos))
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -229,7 +237,7 @@ else
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("hopper:hopper_side", {
|
minetest.register_node("hopper:hopper_side", {
|
||||||
description = "Side Hopper",
|
description = S("Side Hopper"),
|
||||||
_doc_items_longdesc = hopper_long_desc,
|
_doc_items_longdesc = hopper_long_desc,
|
||||||
_doc_items_usagehelp = hopper_usage,
|
_doc_items_usagehelp = hopper_usage,
|
||||||
drop = hopper_side_drop,
|
drop = hopper_side_drop,
|
||||||
@ -291,21 +299,18 @@ minetest.register_node("hopper:hopper_side", {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||||
minetest.log("action", player:get_player_name()
|
minetest.log("action", S("@1 moves stuff in hopper at @2",
|
||||||
.." moves stuff in hopper at "
|
player:get_player_name(), minetest.pos_to_string(pos)))
|
||||||
..minetest.pos_to_string(pos))
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
minetest.log("action", player:get_player_name()
|
minetest.log("action", S("@1 moves stuff to hopper at @2",
|
||||||
.." moves stuff to hopper at "
|
player:get_player_name(), minetest.pos_to_string(pos)))
|
||||||
..minetest.pos_to_string(pos))
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||||
minetest.log("action", player:get_player_name()
|
minetest.log("action", S("@1 moves stuff from hopper at @2",
|
||||||
.." takes stuff from hopper at "
|
player:get_player_name(), minetest.pos_to_string(pos)))
|
||||||
..minetest.pos_to_string(pos))
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -452,12 +457,14 @@ local directions = {
|
|||||||
|
|
||||||
-- hopper workings
|
-- hopper workings
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
|
label = "Hopper suction and transfer",
|
||||||
nodenames = {"hopper:hopper", "hopper:hopper_side"},
|
nodenames = {"hopper:hopper", "hopper:hopper_side"},
|
||||||
neighbors = neighbors,
|
neighbors = neighbors,
|
||||||
interval = 1.0,
|
interval = 1.0,
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
catch_up = false,
|
||||||
|
|
||||||
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
local source_pos, destination_pos
|
local source_pos, destination_pos
|
||||||
if node.name == "hopper:hopper_side" then
|
if node.name == "hopper:hopper_side" then
|
||||||
source_pos = vector.add(pos, directions[node.param2].src)
|
source_pos = vector.add(pos, directions[node.param2].src)
|
||||||
@ -526,7 +533,6 @@ if not single_craftable_item then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- add lucky blocks
|
-- add lucky blocks
|
||||||
if minetest.get_modpath("lucky_block") then
|
if minetest.get_modpath("lucky_block") then
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -535,5 +541,4 @@ if minetest.get_modpath("lucky_block") then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
print (S("[MOD] Hopper loaded"))
|
||||||
print ("[MOD] Hopper loaded")
|
|
||||||
|
11
locale/de.txt
Normal file
11
locale/de.txt
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Template for translations of hopper mod
|
||||||
|
# German translation by Xanthin
|
||||||
|
# last update: 1st February 2017
|
||||||
|
|
||||||
|
#init.lua
|
||||||
|
[MOD] Hopper loaded = [MOD] Trichter geladen
|
||||||
|
Hopper = Trichter
|
||||||
|
Side Hopper = Seitentrichter
|
||||||
|
@1 moves stuff in hopper at @2 = @1 bewegt Dinge in einem Trichter bei @2
|
||||||
|
@1 moves stuff to hopper at @2 = @1 verlagert Dinge in einen Trichter bei @2
|
||||||
|
@1 moves stuff from hopper at @2 = @1 nimmt Dinge aus einem Trichter bei @2
|
10
locale/template.txt
Normal file
10
locale/template.txt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# Template for translations of hopper mod
|
||||||
|
# last update: 1st February 2017
|
||||||
|
|
||||||
|
#init.lua
|
||||||
|
[MOD] Hopper loaded =
|
||||||
|
Hopper (Place onto sides for side-hopper) =
|
||||||
|
Side Hopper (Place into crafting to return normal Hopper) =
|
||||||
|
@1 moves stuff in hopper at @2
|
||||||
|
@1 moves stuff to hopper at @2
|
||||||
|
@1 moves stuff from hopper at @2
|
BIN
textures/hopper_side_inv.png
Normal file
BIN
textures/hopper_side_inv.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 233 B |
Loading…
Reference in New Issue
Block a user