From 2de34ba69dcdc739887be4825cbe12e5654a98af Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 8 Feb 2017 00:34:30 +0100 Subject: [PATCH] Add double stone slab, extend stairs API --- mods/stairs/init.lua | 33 +++++++++++++++--- .../textures/stairs_stone_slab_side.png | Bin 0 -> 433 bytes .../stairs/textures/stairs_stone_slab_top.png | Bin 0 -> 401 bytes 3 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 mods/stairs/textures/stairs_stone_slab_side.png create mode 100644 mods/stairs/textures/stairs_stone_slab_top.png diff --git a/mods/stairs/init.lua b/mods/stairs/init.lua index b6007c91d2..d56deaa5ee 100644 --- a/mods/stairs/init.lua +++ b/mods/stairs/init.lua @@ -99,7 +99,8 @@ local slab_trans_dir_place = {[0] = 0, 20, 12, 16, 4, 8} -- Register slabs. -- Node will be called stairs:slab_ -function stairs.register_slab(subname, recipeitem, groups, images, description, sounds) +-- double_description: NEW argument, not supported in Minetest Game +function stairs.register_slab(subname, recipeitem, groups, images, description, sounds, double_description) groups.slab = 1 groups.building_block = 1 minetest.register_node(":stairs:slab_" .. subname, { @@ -138,7 +139,13 @@ function stairs.register_slab(subname, recipeitem, groups, images, description, player_name) return end - minetest.set_node(pointed_thing.under, {name = recipeitem, param2 = p2}) + local newnode + if double_description then + newnode = "stairs:slab_"..subname.."_double" + else + newnode = recipeitem + end + minetest.set_node(pointed_thing.under, {name = newnode, param2 = p2}) if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end @@ -174,6 +181,21 @@ function stairs.register_slab(subname, recipeitem, groups, images, description, end, }) + -- Double slab node + local dgroups = table.copy(groups) + dgroups.not_in_creative_inventory = 1 + if double_description then + minetest.register_node(":stairs:slab_" .. subname .. "_double", { + description = double_description, + paramtype2 = "facedir", + tiles = images, + is_ground_content = false, + groups = dgroups, + sounds = sounds, + drop = "stairs:slab_"..subname.." 2", + }) + end + if recipeitem then minetest.register_craft({ output = 'stairs:slab_' .. subname .. ' 6', @@ -190,7 +212,8 @@ end -- Nodes will be called stairs:{stair,slab}_ function stairs.register_stair_and_slab(subname, recipeitem, - groups, images, desc_stair, desc_slab, sounds) + groups, images, desc_stair, desc_slab, sounds, + double_slab_node) stairs.register_stair(subname, recipeitem, groups, images, desc_stair, sounds) stairs.register_slab(subname, recipeitem, groups, images, desc_slab, sounds) end @@ -265,9 +288,9 @@ stairs.register_slab("oakwood", "mcl_core:darkwood", stairs.register_slab("stone", "mcl_core:stone", {cracky=3}, - {"default_stone.png"}, + {"stairs_stone_slab_top.png", "stairs_stone_slab_top.png", "stairs_stone_slab_side.png"}, "Stone Slab", - mcl_core.node_sound_stone_defaults()) + mcl_core.node_sound_stone_defaults(), "Double Stone Slab") stairs.register_stair_and_slab("cobble", "mcl_core:cobble", {cracky=3}, diff --git a/mods/stairs/textures/stairs_stone_slab_side.png b/mods/stairs/textures/stairs_stone_slab_side.png new file mode 100644 index 0000000000000000000000000000000000000000..89a1f13d55b6a31f59f97ea6b6557e7d36c4db63 GIT binary patch literal 433 zcmV;i0Z#sjP)T`Qch zj!))HOknUJRMr`D(pyQVuM>lJ_o>uzsuCE4Owg+u>QX;9K7#Z1(JS~j;b9~t+=tfq zSsqtmM@k~{KJvJDYE!lNlXH0&4d+n)H0w1_Y4ffZE8=cDZBj%-=Uotjj1Xf`YypU} z;2nPjehlE_KVQ_m!i^M24tlpxSOIA4I$}`Dc}gT|EfxzP%LxZ;OzV-!UaTVHFzek# zbYZsC+~k#{<@$_;5x{_HDNQpNgsY%0M6V95PD!JLFjcK~!Wt6^H-CBkcnb|ge<>;y zB#B(FNIFfIEx-^IEwn;e>pUJ}(U11be-ek{?8A#|Le=bWce(K?%SFHt6Yn^l6_dRFkGv15NWesoE(msXD|vHvk(ereKQB5B7wwD=R|=S z0LA%q&dW2ko7kSRNQ#Ob@MfJZ!i7|cZgSqFtYKe^06?H=M7tRb;BHX9*5OdrqDCpO zRi&M1O;mwyetP}(Hl6%IOeml}%_uC}U5<7@kQp_+2FZE$LgMNJVE*UEA-R1xkf@MT vWQn)in!Vf+(MLRJ1tRp-dsL78_)GZ%0_%dW$+8JZ00000NkvXXu0mjf6YI1; literal 0 HcmV?d00001