mirror of
https://github.com/minetest/minetest_game.git
synced 2024-12-22 23:10:17 +01:00
Sort items into correct categories (#2612)
This commit is contained in:
parent
8863527bb6
commit
05fad37b3c
@ -103,6 +103,13 @@ The contents of `creative.formspec_add` is appended to every creative inventory
|
||||
page. Mods can use it to add additional formspec elements onto the default
|
||||
creative inventory formspec to be drawn after each update.
|
||||
|
||||
Group overrides can be used for any registered item, node or tool. Use one of
|
||||
the groups stated below to pick which category it will appear in.
|
||||
|
||||
node = 1 -- Appears in the Nodes category
|
||||
tool = 1 -- Appears in the Tools category
|
||||
craftitem = 1 -- Appears in the Items category
|
||||
|
||||
|
||||
Chests API
|
||||
----------
|
||||
|
@ -199,10 +199,29 @@ function creative.register_tab(name, title, items)
|
||||
})
|
||||
end
|
||||
|
||||
-- Sort registered items
|
||||
local registered_nodes = {}
|
||||
local registered_tools = {}
|
||||
local registered_craftitems = {}
|
||||
|
||||
minetest.register_on_mods_loaded(function()
|
||||
for name, def in pairs(minetest.registered_items) do
|
||||
local group = def.groups or {}
|
||||
|
||||
if group.node or minetest.registered_nodes[name] then
|
||||
registered_nodes[name] = def
|
||||
elseif group.tool or minetest.registered_tools[name] then
|
||||
registered_tools[name] = def
|
||||
elseif group.craftitem or minetest.registered_craftitems[name] then
|
||||
registered_craftitems[name] = def
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
creative.register_tab("all", S("All"), minetest.registered_items)
|
||||
creative.register_tab("nodes", S("Nodes"), minetest.registered_nodes)
|
||||
creative.register_tab("tools", S("Tools"), minetest.registered_tools)
|
||||
creative.register_tab("craftitems", S("Items"), minetest.registered_craftitems)
|
||||
creative.register_tab("nodes", S("Nodes"), registered_nodes)
|
||||
creative.register_tab("tools", S("Tools"), registered_tools)
|
||||
creative.register_tab("craftitems", S("Items"), registered_craftitems)
|
||||
|
||||
local old_homepage_name = sfinv.get_homepage_name
|
||||
function sfinv.get_homepage_name(player)
|
||||
|
@ -457,7 +457,7 @@ doors.register("door_wood", {
|
||||
tiles = {{ name = "doors_door_wood.png", backface_culling = true }},
|
||||
description = S("Wooden Door"),
|
||||
inventory_image = "doors_item_wood.png",
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
|
||||
groups = {node = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
|
||||
recipe = {
|
||||
{"group:wood", "group:wood"},
|
||||
{"group:wood", "group:wood"},
|
||||
@ -470,7 +470,7 @@ doors.register("door_steel", {
|
||||
description = S("Steel Door"),
|
||||
inventory_image = "doors_item_steel.png",
|
||||
protected = true,
|
||||
groups = {cracky = 1, level = 2},
|
||||
groups = {node = 1, cracky = 1, level = 2},
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
sound_open = "doors_steel_door_open",
|
||||
sound_close = "doors_steel_door_close",
|
||||
@ -485,7 +485,7 @@ doors.register("door_glass", {
|
||||
tiles = {"doors_door_glass.png"},
|
||||
description = S("Glass Door"),
|
||||
inventory_image = "doors_item_glass.png",
|
||||
groups = {cracky=3, oddly_breakable_by_hand=3},
|
||||
groups = {node = 1, cracky=3, oddly_breakable_by_hand=3},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
sound_open = "doors_glass_door_open",
|
||||
sound_close = "doors_glass_door_close",
|
||||
@ -500,7 +500,7 @@ doors.register("door_obsidian_glass", {
|
||||
tiles = {"doors_door_obsidian_glass.png"},
|
||||
description = S("Obsidian Glass Door"),
|
||||
inventory_image = "doors_item_obsidian_glass.png",
|
||||
groups = {cracky=3},
|
||||
groups = {node = 1, cracky=3},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
sound_open = "doors_glass_door_open",
|
||||
sound_close = "doors_glass_door_close",
|
||||
|
@ -223,7 +223,7 @@ if minetest.get_modpath("doors") then
|
||||
description = S("Steel Bar Door"),
|
||||
inventory_image = "xpanes_item_steel_bar.png",
|
||||
protected = true,
|
||||
groups = {cracky = 1, level = 2},
|
||||
groups = {node = 1, cracky = 1, level = 2},
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
sound_open = "xpanes_steel_bar_door_open",
|
||||
sound_close = "xpanes_steel_bar_door_close",
|
||||
@ -241,7 +241,7 @@ if minetest.get_modpath("doors") then
|
||||
tile_front = "xpanes_trapdoor_steel_bar.png",
|
||||
tile_side = "xpanes_trapdoor_steel_bar_side.png",
|
||||
protected = true,
|
||||
groups = {cracky = 1, level = 2, door = 1},
|
||||
groups = {node = 1, cracky = 1, level = 2, door = 1},
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
sound_open = "xpanes_steel_bar_door_open",
|
||||
sound_close = "xpanes_steel_bar_door_close",
|
||||
|
Loading…
Reference in New Issue
Block a user