summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Sohler <spam@0x7be.de>2017-01-30 05:24:03 +0100
committerJPG <jeanpatrick.guerrero@gmail.com>2017-01-30 05:27:23 +0100
commit9c8f3fb0d9d700aecffd650c941e2ea343750154 (patch)
tree4835ac13d7f320958735206e2c474f4112d5e977
parent109116143b57a20c872faa751153ce549c1167fa (diff)
Add wall-mounted sign
-rw-r--r--init.lua73
-rw-r--r--textures/craftguide_sign.pngbin0 -> 685 bytes
-rw-r--r--textures/craftguide_sign_inv.pngbin0 -> 685 bytes
3 files changed, 57 insertions, 16 deletions
diff --git a/init.lua b/init.lua
index 548c460..5922098 100644
--- a/init.lua
+++ b/init.lua
@@ -378,6 +378,26 @@ mt.register_on_player_receive_fields(function(player, formname, fields)
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", {
description = "Crafting Guide",
inventory_image = "craftguide_book.png",
@@ -385,23 +405,32 @@ mt.register_craftitem("craftguide:book", {
stack_max = 1,
groups = {book=1},
on_use = function(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]
+ craftguide:on_use(itemstack, user)
+ end
+})
- 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
+mt.register_node("craftguide:sign", {
+ description = "Crafting Guide Sign",
+ drawtype = "nodebox",
+ tiles = {"craftguide_sign.png"},
+ inventory_image = "craftguide_sign_inv.png",
+ wield_image = "craftguide_sign_inv.png",
+ paramtype = "light",
+ paramtype2 = "wallmounted",
+ sunlight_propagates = true,
+ groups = {wood=1, oddly_breakable_by_hand=1, flammable=3},
+ 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_construct = function(pos)
+ local meta = minetest.get_meta(pos)
+ meta:set_string("infotext", "Crafting Guide Sign")
+ end,
+ on_rightclick = function(pos, node, user, itemstack)
+ craftguide:on_use(itemstack, user)
end
})
@@ -417,5 +446,17 @@ mt.register_craft({
burntime = 3
})
+mt.register_craft({
+ output = "craftguide:sign",
+ type = "shapeless",
+ recipe = {"default:sign_wall_wood"}
+})
+
+mt.register_craft({
+ type = "fuel",
+ recipe = "craftguide:sign",
+ burntime = 10
+})
+
mt.register_alias("xdecor:crafting_guide", "craftguide:book")
diff --git a/textures/craftguide_sign.png b/textures/craftguide_sign.png
new file mode 100644
index 0000000..f64b5ab
--- /dev/null
+++ b/textures/craftguide_sign.png
Binary files differ
diff --git a/textures/craftguide_sign_inv.png b/textures/craftguide_sign_inv.png
new file mode 100644
index 0000000..6137234
--- /dev/null
+++ b/textures/craftguide_sign_inv.png
Binary files differ