mirror of
https://github.com/minetest-mods/craftguide.git
synced 2025-01-05 18:10:19 +01:00
Add wall-mounted sign
This commit is contained in:
parent
109116143b
commit
6e4624a0d7
69
init.lua
69
init.lua
@ -378,31 +378,57 @@ mt.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
function craftguide:on_use(itemstack, user)
|
||||||
|
if not datas.init_items then
|
||||||
|
craftguide:get_init_items()
|
||||||
|
end
|
||||||
|
|
||||||
|
local player_name = user:get_player_name()
|
||||||
|
local data = datas[player_name]
|
||||||
|
|
||||||
|
if progressive_mode or not data then
|
||||||
|
datas[player_name] = {filter="", pagenum=1, iX=9}
|
||||||
|
if progressive_mode then
|
||||||
|
craftguide:get_filter_items(
|
||||||
|
datas[player_name], user)
|
||||||
|
end
|
||||||
|
craftguide:get_formspec(player_name)
|
||||||
|
else
|
||||||
|
show_formspec(player_name, "craftguide", data.formspec)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
mt.register_craftitem("craftguide:book", {
|
mt.register_craftitem("craftguide:book", {
|
||||||
description = "Crafting Guide",
|
description = "Crafting Guide",
|
||||||
inventory_image = "craftguide_book.png",
|
inventory_image = "craftguide_book.png",
|
||||||
wield_image = "craftguide_book.png",
|
wield_image = "craftguide_book.png",
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
groups = {book=1},
|
groups = {book=1},
|
||||||
on_use = function(itemstack, user)
|
on_use = function(itemstack, user) craftguide:on_use(itemstack, user) end
|
||||||
if not datas.init_items then
|
})
|
||||||
craftguide:get_init_items()
|
|
||||||
end
|
|
||||||
|
|
||||||
local player_name = user:get_player_name()
|
mt.register_node("craftguide:sign", {
|
||||||
local data = datas[player_name]
|
description = "Crafting Guide Sign",
|
||||||
|
drawtype = "nodebox",
|
||||||
if progressive_mode or not data then
|
tiles = {"craftguide_sign.png"},
|
||||||
datas[player_name] = {filter="", pagenum=1, iX=9}
|
inventory_image = "craftguide_sign_inventory.png",
|
||||||
if progressive_mode then
|
wield_image = "craftguide_sign_inventory.png",
|
||||||
craftguide:get_filter_items(
|
stack_max = 1,
|
||||||
datas[player_name], user)
|
paramtype = "light",
|
||||||
end
|
paramtype2 = "wallmounted",
|
||||||
craftguide:get_formspec(player_name)
|
sunlight_propagates = true,
|
||||||
else
|
walkable = false,
|
||||||
show_formspec(player_name, "craftguide", data.formspec)
|
groups = {wood = 1, oddly_breakable_by_hand = 1, flammable = 3},
|
||||||
end
|
legacy_wallmounted = true,
|
||||||
end
|
node_box = {
|
||||||
|
type = "wallmounted",
|
||||||
|
wall_top = {-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125},
|
||||||
|
wall_bottom = {-0.4375, -0.5, -0.3125, 0.4375, -0.4375, 0.3125},
|
||||||
|
wall_side = {-0.5, -0.3125, -0.4375, -0.4375, 0.3125, 0.4375},
|
||||||
|
},
|
||||||
|
on_rightclick = function(pos, node, user, itemstack, pointed_thing)
|
||||||
|
craftguide:on_use(itemstack, user)
|
||||||
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
mt.register_craft({
|
mt.register_craft({
|
||||||
@ -417,5 +443,12 @@ mt.register_craft({
|
|||||||
burntime = 3
|
burntime = 3
|
||||||
})
|
})
|
||||||
|
|
||||||
|
mt.register_craft({
|
||||||
|
output = "craftguide:sign",
|
||||||
|
type = "shapeless",
|
||||||
|
recipe = {"default:sign_wall_wood"}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
mt.register_alias("xdecor:crafting_guide", "craftguide:book")
|
mt.register_alias("xdecor:crafting_guide", "craftguide:book")
|
||||||
|
|
||||||
|
BIN
textures/craftguide_sign.png
Normal file
BIN
textures/craftguide_sign.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
BIN
textures/craftguide_sign_inventory.png
Normal file
BIN
textures/craftguide_sign_inventory.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
Loading…
Reference in New Issue
Block a user