summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorh-v-smacker <hans-von-smacker+github@gmail.com>2018-10-09 04:04:39 +0300
committerh-v-smacker <hans-von-smacker+github@gmail.com>2018-10-09 04:04:39 +0300
commite7d6f7bdeb4760a82e2fd9e5ca1719cf55fc05ab (patch)
tree4920c71c5ecf19b54d1854dd7500a3de52b35461
parentcf145140d32ef26804dc97505404c7ac8130f415 (diff)
protected shelves
-rw-r--r--depends.txt1
-rw-r--r--doors.lua12
-rw-r--r--init.lua4
-rw-r--r--sandstone_cobble.lua12
-rw-r--r--shelves.lua73
-rw-r--r--textures/minetest_errata_door_wood_solid.pngbin0 -> 1434 bytes
-rw-r--r--textures/minetest_errata_door_wood_solid_item.pngbin0 -> 198 bytes
-rw-r--r--textures/minetest_errata_shelf_door_frame.pngbin0 -> 196 bytes
-rw-r--r--textures/minetest_errata_shelf_door_mask.pngbin0 -> 165 bytes
9 files changed, 95 insertions, 7 deletions
diff --git a/depends.txt b/depends.txt
index 5d0a6df..61602af 100644
--- a/depends.txt
+++ b/depends.txt
@@ -6,3 +6,4 @@ stairs
moreblocks?
glass_stained?
pkarcs?
+vessels?
diff --git a/doors.lua b/doors.lua
index 2bb1c3e..ee0ccf0 100644
--- a/doors.lua
+++ b/doors.lua
@@ -1,5 +1,17 @@
+doors.register("door_wood_solid", {
+ tiles = {{ name = "minetest_errata_door_wood_solid.png", backface_culling = true }},
+ description = "Solid Wooden Door",
+ inventory_image = "minetest_errata_door_wood_solid_item.png",
+ groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
+ recipe = {
+ {"group:wood", "group:wood"},
+ {"group:wood", "group:wood"},
+ {"group:wood", "group:wood"},
+ }
+})
+
doors.register("door_wood_bar", {
tiles = {{ name = "minetest_errata_door_wood_bar.png", backface_culling = true }},
description = "Wooden Bar Door",
diff --git a/init.lua b/init.lua
index ae9910b..1248338 100644
--- a/init.lua
+++ b/init.lua
@@ -15,4 +15,6 @@ dofile(modpath.."/xpanes.lua")
dofile(modpath.."/glass_panes.lua")
-dofile(modpath.."/mossy_blocks.lua") \ No newline at end of file
+dofile(modpath.."/mossy_blocks.lua")
+
+dofile(modpath.."/shelves.lua") \ No newline at end of file
diff --git a/sandstone_cobble.lua b/sandstone_cobble.lua
index 62098f9..0640772 100644
--- a/sandstone_cobble.lua
+++ b/sandstone_cobble.lua
@@ -7,7 +7,7 @@ local cobble_table = {
for _,node in ipairs(cobble_table) do
minetest.register_node("minetest_errata:" .. node.name .. "_cobble", {
- description = node.desc,
+ description = node.desc .. " Cobble",
tiles = {"minetest_errata_" .. node.name .. "_cobble.png"},
groups = {cracky = 3, [minetest_errata.prefix .. "sandstone"] = 1},
is_ground_content = false,
@@ -32,14 +32,14 @@ for _,node in ipairs(cobble_table) do
stairs.register_all(node.name .. "_cobble", "minetest_errata:" .. node.name .. "_cobble",
{cracky = 3},
{"minetest_errata_" .. node.name .. "_cobble.png"},
- node.desc .. " Stair",
- node.desc .. " Slab",
+ node.desc .. " Cobble Stair",
+ node.desc .. " Cobble Slab",
default.node_sound_wood_defaults())
elseif minetest.global_exists("stairsplus") then
stairsplus:register_all("minetest_errata", node.name .. "_cobble", "minetest_errata:" .. node.name .. "_cobble", {
- description = node.desc,
+ description = node.desc .. " Cobble",
tiles = {"minetest_errata_" .. node.name .. "_cobble.png"},
groups = {cracky = 3},
sounds = default.node_sound_wood_defaults(),
@@ -50,8 +50,8 @@ for _,node in ipairs(cobble_table) do
stairs.register_stair_and_slab(node.name .. "_cobble", "minetest_errata:" .. node.name .. "_cobble",
{cracky = 3},
{"minetest_errata_" .. node.name .. "_cobble.png"},
- node.desc .. " Stair",
- node.desc .. " Slab",
+ node.desc .. " Cobble Stair",
+ node.desc .. " Cobble Slab",
default.node_sound_wood_defaults())
end
diff --git a/shelves.lua b/shelves.lua
new file mode 100644
index 0000000..98c6545
--- /dev/null
+++ b/shelves.lua
@@ -0,0 +1,73 @@
+-- Default shelves are not protected in the slightest.
+-- This change introduces a protected shelf variety which respects the same
+-- rules as the area it is in (acts like storage drawers).
+-- the upgrade/downgrade is free
+
+local nodes = {
+ { name = "default:bookshelf", group = "book"}
+}
+
+if minetest.get_modpath("vessels") then
+ table.insert(nodes, { name = "vessels:shelf", group = "vessel"} )
+end
+
+
+
+for _,node in ipairs(nodes) do
+
+ local entity = {}
+ for name,value in pairs(minetest.registered_nodes[node.name]) do
+ entity[name] = value
+ end
+
+
+ entity.description = "Protected " .. entity.description
+
+ entity.tiles[5] = entity.tiles[5] .. "^minetest_errata_shelf_door_mask.png^default_glass.png^minetest_errata_shelf_door_frame.png"
+ entity.tiles[6] = entity.tiles[6] .. "^minetest_errata_shelf_door_mask.png^default_glass.png^minetest_errata_shelf_door_frame.png"
+
+
+
+ entity.allow_metadata_inventory_put = function(pos, listname, index, stack, player)
+ if minetest.is_protected(pos, player:get_player_name()) then
+ return 0
+ end
+ if minetest.get_item_group(stack:get_name(), node.group) ~= 0 then
+ return stack:get_count()
+ end
+ return 0
+ end
+
+ entity.allow_metadata_inventory_take = function(pos, listname, index, stack, player)
+ if minetest.is_protected(pos, player:get_player_name()) then
+ return 0
+ end
+ if minetest.get_item_group(stack:get_name(), node.group) ~= 0 then
+ return stack:get_count()
+ end
+ return 0
+ end
+
+ entity.allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
+ if minetest.is_protected(pos, player:get_player_name()) then
+ return 0
+ end
+ return count
+ end
+
+ minetest.register_node(":" .. node.name .. "_protected", entity)
+
+
+ minetest.register_craft({
+ output = node.name .. "_protected",
+ type = "shapeless",
+ recipe = {node.name},
+ })
+
+ minetest.register_craft({
+ output = node.name,
+ type = "shapeless",
+ recipe = {node.name .. "_protected"},
+ })
+
+end \ No newline at end of file
diff --git a/textures/minetest_errata_door_wood_solid.png b/textures/minetest_errata_door_wood_solid.png
new file mode 100644
index 0000000..7c48332
--- /dev/null
+++ b/textures/minetest_errata_door_wood_solid.png
Binary files differ
diff --git a/textures/minetest_errata_door_wood_solid_item.png b/textures/minetest_errata_door_wood_solid_item.png
new file mode 100644
index 0000000..4e2ced2
--- /dev/null
+++ b/textures/minetest_errata_door_wood_solid_item.png
Binary files differ
diff --git a/textures/minetest_errata_shelf_door_frame.png b/textures/minetest_errata_shelf_door_frame.png
new file mode 100644
index 0000000..4df0fa4
--- /dev/null
+++ b/textures/minetest_errata_shelf_door_frame.png
Binary files differ
diff --git a/textures/minetest_errata_shelf_door_mask.png b/textures/minetest_errata_shelf_door_mask.png
new file mode 100644
index 0000000..e443386
--- /dev/null
+++ b/textures/minetest_errata_shelf_door_mask.png
Binary files differ