Refine Creative sorting even more
This commit is contained in:
parent
be8b7f5f5c
commit
f39349004d
@ -28,6 +28,8 @@ These groups are mainly used for a better item sorting in Creative Mode.
|
||||
no inherent direct use.
|
||||
Implied if it was registered with `minetest.register_craftitem`.
|
||||
|
||||
* `creative_decoblock`: Classifies nodes as "decorative node". This is for non-full cubes except slabs and stairs
|
||||
|
||||
### Tools
|
||||
* `axe`: Axe
|
||||
* `shears`: Shears
|
||||
@ -75,6 +77,8 @@ This is the list of all groups used for nodes. Note: If no number/rating is spec
|
||||
* `magnetic`: Node is magnetic and can magnetize stuff (like compass)
|
||||
* `unmagnetic`: Node is "unmagnetic", this means it can de-magnetize stuff
|
||||
* `locked`: Node is considered to be locked
|
||||
* `container`: Node has an inventory to store item(s)
|
||||
* `interactive_node`: Node can be interacted with (excluding pure container nodes)
|
||||
|
||||
### Node categorization
|
||||
|
||||
@ -112,7 +116,7 @@ This is the list of all groups used for nodes. Note: If no number/rating is spec
|
||||
|
||||
* `slab`: Slab (1 = normal slab, 2 = path slab)
|
||||
* `stair`: Stair
|
||||
* `path`: A path node like the Dirt Path
|
||||
* `path`: A path node like the Dirt Path (1 = normal path, 2 = path slab)
|
||||
* `door`: Any door
|
||||
* `door_wood`: Wooden door
|
||||
* `fence`: Fence
|
||||
@ -126,7 +130,9 @@ This is the list of all groups used for nodes. Note: If no number/rating is spec
|
||||
* `wood`: Made out of wood
|
||||
* `tree`: Tree trunks
|
||||
* `stone`: Stone
|
||||
* `ore`: Ore
|
||||
* `sand`: Sand
|
||||
* `gravel`: Gravel
|
||||
* `sandstone`: Sandstone
|
||||
* `glass`: Glass
|
||||
* `fuzzy`: Wool, cotton bale, etc.
|
||||
|
@ -466,7 +466,7 @@ minetest.register_node(
|
||||
inventory_image = "bed_bed_inventory.png",
|
||||
tiles = {"bed_foot.png", "default_wood.png", "bed_side.png"},
|
||||
use_texture_alpha = "clip",
|
||||
groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 1, fall_damage_add_percent = -15 },
|
||||
groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 1, fall_damage_add_percent = -15, creative_decoblock = 1, interactive_node = 1 },
|
||||
is_ground_content = false,
|
||||
sounds = rp_sounds.node_sound_wood_defaults(),
|
||||
node_box = {
|
||||
@ -637,7 +637,7 @@ minetest.register_node(
|
||||
diggable = false,
|
||||
tiles = {"bed_head.png", "default_wood.png", "bed_side.png"},
|
||||
use_texture_alpha = "clip",
|
||||
groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 1, fall_damage_add_percent = -15 },
|
||||
groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 1, fall_damage_add_percent = -15, not_in_creative_inventory = 1 },
|
||||
sounds = rp_sounds.node_sound_wood_defaults(),
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
|
@ -57,13 +57,47 @@ local function create_creative_inventory(player)
|
||||
table.insert(creative_list, name)
|
||||
end
|
||||
end
|
||||
local get_type = function(def)
|
||||
if not def.groups then
|
||||
return "craftitem" -- fallback
|
||||
end
|
||||
if def.groups.craftitem then
|
||||
return "craftitem"
|
||||
elseif def.groups.tool then
|
||||
return "tool"
|
||||
elseif def.groups.node then
|
||||
return "node"
|
||||
end
|
||||
if def.type == "craft" then
|
||||
return "craftitem"
|
||||
elseif def.type == "tool" then
|
||||
return "tool"
|
||||
elseif def.type == "node" then
|
||||
return "node"
|
||||
end
|
||||
return "craftitem" -- fallback
|
||||
end
|
||||
local function creative_sort(item1, item2)
|
||||
local def1 = minetest.registered_items[item1]
|
||||
local def2 = minetest.registered_items[item2]
|
||||
local groups1 = def1.groups or {}
|
||||
local groups2 = def2.groups or {}
|
||||
local type1 = get_type(def1)
|
||||
local type2 = get_type(def2)
|
||||
|
||||
if def1.tool_capabilities and not def2.tool_capabilities then
|
||||
if (type1 == "tool" and type2 ~= "tool") then
|
||||
return true
|
||||
elseif (type1 ~= "tool" and type2 == "tool") then
|
||||
return false
|
||||
elseif (type1 == "craftitem" and type2 ~= "craftitem") then
|
||||
return true
|
||||
elseif (type1 ~= "craftitem" and type2 == "craftitem") then
|
||||
return false
|
||||
elseif (type1 == "node" and type2 ~= "node") then
|
||||
return true
|
||||
elseif (type1 ~= "node" and type2 == "node") then
|
||||
return false
|
||||
elseif def1.tool_capabilities and not def2.tool_capabilities then
|
||||
return true
|
||||
elseif not def1.tool_capabilities and def2.tool_capabilities then
|
||||
return false
|
||||
@ -71,10 +105,6 @@ local function create_creative_inventory(player)
|
||||
return true
|
||||
elseif not groups1.is_armor and groups2.is_armor then
|
||||
return false
|
||||
elseif (def1.type == "tool" or groups1.tool) and (def2.type ~= "tool" and not groups2.tool) then
|
||||
return true
|
||||
elseif (def1.type ~= "tool" and not groups1.tool) and (def2.type == "tool" or groups2.tool) then
|
||||
return false
|
||||
elseif groups1.food and not groups2.food then
|
||||
return true
|
||||
elseif not groups1.food and groups2.food then
|
||||
@ -83,18 +113,66 @@ local function create_creative_inventory(player)
|
||||
return true
|
||||
elseif not groups1.spawn_egg and groups2.spawn_egg then
|
||||
return false
|
||||
elseif (def1.type == "craftitem" or groups1.craftitem) and (def2.type ~= "craftitem" and not groups2.craftitem) then
|
||||
elseif groups1.plant and not groups2.plant then
|
||||
return true
|
||||
elseif (def1.type ~= "craftitem" and not groups1.craftitem) and (def2.type == "craftitem" or groups2.craftitem) then
|
||||
elseif not groups1.plant and groups2.plant then
|
||||
return false
|
||||
elseif (def1.type == "node" or groups1.node) and (def2.type ~= "node" and not groups2.node) then
|
||||
elseif groups1.dirt and not groups2.dirt then
|
||||
return true
|
||||
elseif (def1.type ~= "node" and not groups1.node) and (def2.type == "node" or groups2.node) then
|
||||
elseif not groups1.dirt and groups2.dirt then
|
||||
return false
|
||||
elseif groups1.sand and not groups2.sand then
|
||||
return true
|
||||
elseif not groups1.sand and groups2.sand then
|
||||
return false
|
||||
elseif groups1.sandstone and not groups2.sandstone then
|
||||
return true
|
||||
elseif not groups1.sandstone and groups2.sandstone then
|
||||
return false
|
||||
elseif groups1.gravel and not groups2.gravel then
|
||||
return true
|
||||
elseif not groups1.gravel and groups2.gravel then
|
||||
return false
|
||||
elseif groups1.stone and not groups2.stone then
|
||||
return true
|
||||
elseif not groups1.stone and groups2.stone then
|
||||
return false
|
||||
elseif groups1.ore and not groups2.ore then
|
||||
return true
|
||||
elseif not groups1.ore and groups2.ore then
|
||||
return false
|
||||
elseif groups1.tree and not groups2.tree then
|
||||
return true
|
||||
elseif not groups1.tree and groups2.tree then
|
||||
return false
|
||||
elseif groups1.leaves and not groups2.leaves then
|
||||
return true
|
||||
elseif not groups1.leaves and groups2.leaves then
|
||||
return false
|
||||
elseif groups1.wood and not groups2.wood then
|
||||
return true
|
||||
elseif not groups1.wood and groups2.wood then
|
||||
return false
|
||||
elseif groups1.water and not groups2.water then
|
||||
return true
|
||||
elseif not groups1.water and groups2.water then
|
||||
return false
|
||||
elseif groups1.path and not groups2.path then
|
||||
return true
|
||||
elseif not groups1.path and groups2.path then
|
||||
return false
|
||||
elseif groups1.creative_decoblock and not groups2.creative_decoblock then
|
||||
return true
|
||||
elseif not groups1.creative_decoblock and groups2.creative_decoblock then
|
||||
return false
|
||||
elseif groups1.container and not groups2.container then
|
||||
return true
|
||||
elseif not groups1.container and groups2.container then
|
||||
return false
|
||||
elseif groups1.interactive_node and not groups2.interactive_node then
|
||||
return true
|
||||
elseif not groups1.interactive_node and groups2.interactive_node then
|
||||
return false
|
||||
else
|
||||
return item1 < item2
|
||||
end
|
||||
|
@ -29,7 +29,7 @@ minetest.register_node(
|
||||
tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_sides.png",
|
||||
"default_chest_sides.png", "default_chest_sides.png", "default_chest_front.png"},
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy = 2,choppy = 2,oddly_breakable_by_hand = 2},
|
||||
groups = {snappy = 2,choppy = 2,oddly_breakable_by_hand = 2,container=1},
|
||||
is_ground_content = false,
|
||||
sounds = rp_sounds.node_sound_wood_defaults(),
|
||||
on_construct = function(pos)
|
||||
@ -82,7 +82,7 @@ minetest.register_node(
|
||||
_tt_help = S("Provides 8 inventory slots"),
|
||||
tiles = {"default_wood.png", "default_wood.png", "default_bookshelf.png"},
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy = 2,choppy = 3,oddly_breakable_by_hand = 2},
|
||||
groups = {snappy = 2,choppy = 3,oddly_breakable_by_hand = 2,container=1},
|
||||
is_ground_content = false,
|
||||
sounds = rp_sounds.node_sound_wood_defaults(),
|
||||
on_construct = function(pos)
|
||||
|
@ -46,6 +46,7 @@ local function register_fence(name, def)
|
||||
|
||||
-- Always add to the fence group, even if no group provided
|
||||
def.groups.fence = 1
|
||||
def.groups.creative_decoblock = 1
|
||||
|
||||
def.texture = nil
|
||||
def.material = nil
|
||||
|
@ -107,7 +107,7 @@ minetest.register_node(
|
||||
tiles ={"default_furnace_top.png", "default_furnace_top.png", "default_furnace_sides.png",
|
||||
"default_furnace_sides.png", "default_furnace_sides.png", "default_furnace_front.png"},
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky = 2},
|
||||
groups = {cracky = 2,container=1,interactive_node=1},
|
||||
is_ground_content = false,
|
||||
sounds = rp_sounds.node_sound_stone_defaults(),
|
||||
on_construct = function(pos)
|
||||
@ -147,7 +147,7 @@ minetest.register_node(
|
||||
paramtype2 = "facedir",
|
||||
light_source = 8,
|
||||
drop = "rp_default:furnace",
|
||||
groups = {cracky = 2, not_in_creative_inventory=1},
|
||||
groups = {cracky = 2, container=1,interactive_node=1, not_in_creative_inventory=1},
|
||||
is_ground_content = false,
|
||||
sounds = rp_sounds.node_sound_stone_defaults(),
|
||||
on_construct = function(pos)
|
||||
|
@ -37,7 +37,7 @@ minetest.register_node(
|
||||
{-0.5, -0.5, 0.5, 0.5, 0.5, 0.5-(2/15)}
|
||||
}
|
||||
},
|
||||
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3},
|
||||
groups = {snappy = 2, choppy = 2, creative_decoblock = 1, oddly_breakable_by_hand = 3},
|
||||
is_ground_content = false,
|
||||
sounds = rp_sounds.node_sound_wood_defaults(),
|
||||
})
|
||||
|
@ -12,7 +12,7 @@ minetest.register_node(
|
||||
{
|
||||
description = S("Stone with Sulfur"),
|
||||
tiles = {"default_stone.png^default_mineral_sulfur.png"},
|
||||
groups = {cracky = 2, stone = 1, not_in_craft_guide = 1},
|
||||
groups = {cracky = 2, stone = 1, ore = 1, not_in_craft_guide = 1},
|
||||
drop = "rp_default:lump_sulfur",
|
||||
sounds = rp_sounds.node_sound_stone_defaults(),
|
||||
})
|
||||
@ -22,7 +22,7 @@ minetest.register_node(
|
||||
{
|
||||
description = S("Stone with Graphite"),
|
||||
tiles = {"default_stone.png^default_mineral_graphite.png"},
|
||||
groups = {cracky = 2, stone = 1, not_in_craft_guide = 1},
|
||||
groups = {cracky = 2, stone = 1, ore = 1, not_in_craft_guide = 1},
|
||||
drop = "rp_default:sheet_graphite",
|
||||
sounds = rp_sounds.node_sound_stone_defaults(),
|
||||
})
|
||||
@ -32,7 +32,7 @@ minetest.register_node(
|
||||
{
|
||||
description = S("Stone with Coal"),
|
||||
tiles = {"default_stone.png^default_mineral_coal.png"},
|
||||
groups = {cracky = 2, stone = 1, not_in_craft_guide = 1},
|
||||
groups = {cracky = 2, stone = 1, ore = 1, not_in_craft_guide = 1},
|
||||
drop = "rp_default:lump_coal",
|
||||
sounds = rp_sounds.node_sound_stone_defaults(),
|
||||
})
|
||||
@ -42,7 +42,7 @@ minetest.register_node(
|
||||
{
|
||||
description = S("Stone with Iron"),
|
||||
tiles = {"default_stone.png^default_mineral_iron.png"},
|
||||
groups = {cracky = 2, stone = 1, magnetic = 1, not_in_craft_guide = 1},
|
||||
groups = {cracky = 2, stone = 1, magnetic = 1, ore = 1, not_in_craft_guide = 1},
|
||||
drop = "rp_default:lump_iron",
|
||||
sounds = rp_sounds.node_sound_stone_defaults(),
|
||||
})
|
||||
@ -52,7 +52,7 @@ minetest.register_node(
|
||||
{
|
||||
description = S("Stone with Tin"),
|
||||
tiles = {"default_stone.png^default_mineral_tin.png"},
|
||||
groups = {cracky = 1, stone = 1, not_in_craft_guide = 1},
|
||||
groups = {cracky = 1, stone = 1, ore = 1, not_in_craft_guide = 1},
|
||||
drop = "rp_default:lump_tin",
|
||||
sounds = rp_sounds.node_sound_stone_defaults(),
|
||||
})
|
||||
@ -62,7 +62,7 @@ minetest.register_node(
|
||||
{
|
||||
description = S("Stone with Copper"),
|
||||
tiles = {"default_stone.png^default_mineral_copper.png"},
|
||||
groups = {cracky = 1, stone = 1, not_in_craft_guide = 1},
|
||||
groups = {cracky = 1, stone = 1, ore = 1, not_in_craft_guide = 1},
|
||||
drop = "rp_default:lump_copper",
|
||||
sounds = rp_sounds.node_sound_stone_defaults(),
|
||||
})
|
||||
@ -105,7 +105,7 @@ minetest.register_node(
|
||||
{
|
||||
description = S("Gravel"),
|
||||
tiles = {"default_gravel.png"},
|
||||
groups = {crumbly = 2, falling_node = 1},
|
||||
groups = {crumbly = 2, falling_node = 1, gravel = 1},
|
||||
sounds = rp_sounds.node_sound_dirt_defaults(
|
||||
{
|
||||
footstep = {name = "default_crunch_footstep", gain = 0.45},
|
||||
@ -346,7 +346,7 @@ minetest.register_node(
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -2/16, 0.5}
|
||||
},
|
||||
tiles = {"default_dirt.png"},
|
||||
groups = {crumbly = 3, slab = 2, fall_damage_add_percent = -10},
|
||||
groups = {crumbly = 3, path = 2, slab = 2, creative_decoblock = 1, fall_damage_add_percent = -10},
|
||||
is_ground_content = false,
|
||||
sounds = rp_sounds.node_sound_dirt_defaults(),
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
@ -388,7 +388,7 @@ minetest.register_node(
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 0.5-2/16, 0.5}
|
||||
},
|
||||
tiles = {"default_dirt.png"},
|
||||
groups = {crumbly = 3, path = 1, fall_damage_add_percent = -10},
|
||||
groups = {crumbly = 3, path = 1, creative_decoblock = 1, fall_damage_add_percent = -10},
|
||||
is_ground_content = false,
|
||||
sounds = rp_sounds.node_sound_dirt_defaults(),
|
||||
})
|
||||
@ -748,7 +748,7 @@ minetest.register_node(
|
||||
type = "fixed",
|
||||
fixed = {-1/16, -0.5, -1/16, 1/16, 0.5, 1/16},
|
||||
},
|
||||
groups = {snappy = 3},
|
||||
groups = {snappy = 3, creative_decoblock = 1},
|
||||
is_ground_content = false,
|
||||
sounds = rp_sounds.node_sound_leaves_defaults(),
|
||||
after_dig_node = function(pos, node, metadata, digger)
|
||||
|
@ -57,7 +57,7 @@ local function register_sign(id, def)
|
||||
wall_bottom = {-0.5+(1/16), -0.5, -0.5+(4/16), 0.5-(1/16), -0.5+(1/16), 0.5-(4/16)},
|
||||
wall_side = {-0.5, -0.5+(4/16), -0.5+(1/16), -0.5+(1/16), 0.5-(4/16), 0.5-(1/16)},
|
||||
},
|
||||
groups = {choppy = 2,handy = 2,attached_node = 1, sign=1},
|
||||
groups = {choppy = 2,handy = 2,attached_node = 1, sign=1, creative_decoblock = 1},
|
||||
is_ground_content = false,
|
||||
sounds = def.sounds,
|
||||
on_construct = on_construct,
|
||||
|
@ -32,7 +32,7 @@ local function register_torch(subname, description, tt_help, tiles, overlay_tile
|
||||
wall_bottom = {-2/16, -0.5, -2/16, 2/16, 0, 2/16},
|
||||
wall_side = {-0.5, -8/16, -2/16, -0.5+4/16, 0, 2/16},
|
||||
},
|
||||
groups = {choppy = 2, dig_immediate = 3, attached_node = 1, torch = 1},
|
||||
groups = {choppy = 2, dig_immediate = 3, attached_node = 1, torch = 1, creative_decoblock = 1},
|
||||
is_ground_content = false,
|
||||
sounds = rp_sounds.node_sound_defaults(),
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
|
@ -36,6 +36,8 @@ function door.register_door(name, def)
|
||||
end
|
||||
local groups_craftitem = table.copy(def.groups)
|
||||
groups_craftitem.node = 1
|
||||
groups_craftitem.creative_decoblock = 1
|
||||
groups_craftitem.interactive_node = 1
|
||||
|
||||
minetest.register_craftitem(
|
||||
name, {
|
||||
|
@ -412,7 +412,7 @@ minetest.register_node(
|
||||
{
|
||||
description = S("Stone with Gold"),
|
||||
tiles ={"default_stone.png^gold_mineral_gold.png"},
|
||||
groups = {cracky=1, stone=1},
|
||||
groups = {cracky=1, stone=1, ore=1},
|
||||
drop = "rp_gold:lump_gold",
|
||||
is_ground_content = true,
|
||||
sounds = rp_sounds.node_sound_stone_defaults(),
|
||||
|
@ -292,7 +292,7 @@ minetest.register_node(
|
||||
_tt_help = S("Tools can be upgraded with jewels here"),
|
||||
tiles ={"jewels_bench_top.png", "jewels_bench_bottom.png", "jewels_bench_sides.png"},
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,interactive_node=1},
|
||||
legacy_facedir_simple = true,
|
||||
is_ground_content = false,
|
||||
sounds = rp_sounds.node_sound_wood_defaults(),
|
||||
@ -367,7 +367,7 @@ minetest.register_node(
|
||||
"default_tree_birch.png^jewels_ore.png"
|
||||
},
|
||||
drop = "rp_jewels:jewel",
|
||||
groups = {snappy=1, choppy=1, tree=1},
|
||||
groups = {snappy=1, choppy=1, tree=1, ore=1},
|
||||
sounds = rp_sounds.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
|
@ -223,7 +223,7 @@ minetest.register_node(
|
||||
"locks_chest_front.png"
|
||||
},
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, locked = 1},
|
||||
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, locked = 1, container = 1},
|
||||
is_ground_content = false,
|
||||
sounds = rp_sounds.node_sound_wood_defaults(),
|
||||
on_construct = function(pos)
|
||||
|
@ -98,7 +98,7 @@ minetest.register_node(
|
||||
wall_bottom = {-4/16, -0.5, -4/16, 4/16, -0.5+(4/16), 4/16}
|
||||
},
|
||||
|
||||
groups = {crumbly = 3},
|
||||
groups = {crumbly = 3, creative_decoblock = 1},
|
||||
light_source = 2,
|
||||
sounds = rp_sounds.node_sound_glass_defaults(),
|
||||
})
|
||||
@ -121,7 +121,7 @@ minetest.register_node(
|
||||
{
|
||||
description = S("Stone with Lumien"),
|
||||
tiles = {"default_stone.png^lumien_mineral_lumien.png"},
|
||||
groups = {cracky = 1, stone = 1},
|
||||
groups = {cracky = 1, stone = 1, ore=1},
|
||||
drop = "rp_lumien:block",
|
||||
sounds = rp_sounds.node_sound_stone_defaults(),
|
||||
})
|
||||
|
@ -148,7 +148,7 @@ if minetest.settings:get_bool("music_enable") then
|
||||
music.toggle(pos)
|
||||
end,
|
||||
|
||||
groups = {oddly_breakable_by_hand = 3, attached_node = 1}
|
||||
groups = {oddly_breakable_by_hand = 3, attached_node = 1, creative_decoblock = 1}
|
||||
})
|
||||
|
||||
local function step(dtime)
|
||||
@ -208,7 +208,7 @@ else
|
||||
meta:set_string("infotext", INFOTEXT_DISABLED)
|
||||
end,
|
||||
|
||||
groups = {oddly_breakable_by_hand = 3, attached_node = 1}
|
||||
groups = {oddly_breakable_by_hand = 3, attached_node = 1, interactive_node = 1}
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -300,7 +300,7 @@ minetest.register_node(
|
||||
_tt_help = tt,
|
||||
tiles = {top_tex, "tnt_bottom.png", "tnt_sides.png"},
|
||||
is_ground_content = false,
|
||||
groups = {handy = 2},
|
||||
groups = {handy = 2, interactive_node=1},
|
||||
sounds = rp_sounds.node_sound_wood_defaults(),
|
||||
|
||||
on_punch = function(pos, node, puncher)
|
||||
|
Loading…
x
Reference in New Issue
Block a user