From 4b4e10ff1d4f1bde96c47331738e4af27bec6142 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Thu, 7 Nov 2013 22:16:37 -0500 Subject: Rewrite slightly to use the new 6d facedir prediction code in builtin. Keeps the old behavior of sneak == force wall (rather than invert). Add protection/ownership checking. Can be phased out later after protection mods start taking advantage of the engine's built-in ownershi-checking functions. Got rid of the /st command, since it didn't work anyway. Minor re-arrangement of init.lua to put the mod's title block at the top where it belongs :-) --- stairsplus/slabs.lua | 48 ++++++++---------------------------------------- 1 file changed, 8 insertions(+), 40 deletions(-) (limited to 'stairsplus/slabs.lua') diff --git a/stairsplus/slabs.lua b/stairsplus/slabs.lua index a7ebe43..1e251a5 100644 --- a/stairsplus/slabs.lua +++ b/stairsplus/slabs.lua @@ -31,11 +31,7 @@ function register_slab(modname, subname, recipeitem, groups, images, description fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, }, sounds = default.node_sound_stone_defaults(), - on_place = function(itemstack, placer, pointed_thing) - local keys=placer:get_player_control() - stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) - return itemstack - end + on_place = stairsplus_rotate_and_place }) minetest.register_node(":stairs:slab_" .. subname, { @@ -56,11 +52,7 @@ function register_slab(modname, subname, recipeitem, groups, images, description fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, }, sounds = default.node_sound_stone_defaults(), - on_place = function(itemstack, placer, pointed_thing) - local keys=placer:get_player_control() - stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) - return itemstack - end + on_place = stairsplus_rotate_and_place }) minetest.register_node(":"..modname .. ":slab_" .. subname .. "_quarter", { @@ -82,11 +74,7 @@ function register_slab(modname, subname, recipeitem, groups, images, description fixed = {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, }, sounds = default.node_sound_stone_defaults(), - on_place = function(itemstack, placer, pointed_thing) - local keys=placer:get_player_control() - stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) - return itemstack - end + on_place = stairsplus_rotate_and_place }) minetest.register_node(":"..modname .. ":slab_" .. subname .. "_three_quarter", { @@ -108,11 +96,7 @@ function register_slab(modname, subname, recipeitem, groups, images, description fixed = {-0.5, -0.5, -0.5, 0.5, 0.25, 0.5}, }, sounds = default.node_sound_stone_defaults(), - on_place = function(itemstack, placer, pointed_thing) - local keys=placer:get_player_control() - stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) - return itemstack - end + on_place = stairsplus_rotate_and_place }) minetest.register_node(":"..modname .. ":slab_" .. subname .. "_1", { @@ -134,11 +118,7 @@ function register_slab(modname, subname, recipeitem, groups, images, description fixed = {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}, }, sounds = default.node_sound_stone_defaults(), - on_place = function(itemstack, placer, pointed_thing) - local keys=placer:get_player_control() - stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) - return itemstack - end + on_place = stairsplus_rotate_and_place }) minetest.register_node(":"..modname .. ":slab_" .. subname .. "_2", { @@ -160,11 +140,7 @@ function register_slab(modname, subname, recipeitem, groups, images, description fixed = {-0.5, -0.5, -0.5, 0.5, -0.375, 0.5}, }, sounds = default.node_sound_stone_defaults(), - on_place = function(itemstack, placer, pointed_thing) - local keys=placer:get_player_control() - stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) - return itemstack - end + on_place = stairsplus_rotate_and_place }) minetest.register_node(":"..modname .. ":slab_" .. subname .. "_14", { @@ -186,11 +162,7 @@ function register_slab(modname, subname, recipeitem, groups, images, description fixed = {-0.5, -0.5, -0.5, 0.5, 0.375, 0.5}, }, sounds = default.node_sound_stone_defaults(), - on_place = function(itemstack, placer, pointed_thing) - local keys=placer:get_player_control() - stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) - return itemstack - end + on_place = stairsplus_rotate_and_place }) minetest.register_node(":"..modname .. ":slab_" .. subname .. "_15", { @@ -212,11 +184,7 @@ function register_slab(modname, subname, recipeitem, groups, images, description fixed = {-0.5, -0.5, -0.5, 0.5, 0.4375, 0.5}, }, sounds = default.node_sound_stone_defaults(), - on_place = function(itemstack, placer, pointed_thing) - local keys=placer:get_player_control() - stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) - return itemstack - end + on_place = stairsplus_rotate_and_place }) -- Unregister default recipes, optional, see _config.txt -- cgit v1.2.3