[SOLVED] A strange issue with my slabs mod

User avatar
TumeniNodes
Member
 
Posts: 1335
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes

[SOLVED] A strange issue with my slabs mod

by TumeniNodes » Sat Jun 25, 2016 16:55

On 2 occasions now, I have attempted to remove the bottom slabs from my stackslabs mod, because the top slabs work fine with the slabs provided by the stairs mod.
But each time I remove all text related to the bottom slabs, the mod loads fine, is enabled, yet it disappears..., no items in inventory, anywhere?
I cannot figure it out, it seems to be a very odd issue. All I can figure is that maybe the bottom and top slabs are somehow spiritually linked?:P I can provide the NBE files if anyone thinks that might help to take a look at.
I would really appreciate some help to figure this out. I think it is senseless to have extra code in use when one part of this mod works fine with the existing slabs from the stairs mod. I can also provide the original code if needed to compare.
Here is the code with only the top slabs

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
-- [MOD] Stack Slabs [1.0] [stackslabs] by TumeniNodes 06-24-2016

stackslabs = {}

-- Register stackslabs.
-- Node will be called stackslabs:top_slab_<subname>

function stackslabs.register_top_slab(subname, recipeitem, groups, images, description, sounds)
   groups.topslab = 1
minetest.register_node(":stackslabs:top_slab" .. subname, {
   description = description,
   drawtype = "nodebox",
   tiles = images,
   paramtype = "light",
   sunlight_propogates = true,
   paramtype2 = "facedir",
   is_ground_content = false,
   groups = groups,
   sounds = sounds,
   node_box = {
      type = "fixed",
      fixed = {
         {-0.5, -1, -0.5, 0.5, -0.5, 0.5},
      }
   }
})
end

-- top slab registration function.
-- Nodes will be called stackslabs:{top_slab}_<subname>

function stackslabs.register_top_slab(subname, recipeitem, groups, images, desc_top_slab, sounds)
end

-- Register top slab

stackslabs.register_top_slab("wood", "default:wood",
      {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
      {"default_wood.png"},
      "Wooden Top Slab",
      default.node_sound_wood_defaults())

stackslabs.register_top_slab("junglewood", "default:junglewood",
      {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
      {"default_junglewood.png"},
      "Junglewood Top Slab",
      default.node_sound_wood_defaults())

stackslabs.register_top_slab("pine_wood", "default:pine_wood",
      {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
      {"default_pine_wood.png"},
      "Pine Wood Top Slab",
      default.node_sound_wood_defaults())

stackslabs.register_top_slab("acacia_wood", "default:acacia_wood",
      {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
      {"default_acacia_wood.png"},
      "Acacia Wood Top Slab",
      default.node_sound_wood_defaults())

stackslabs.register_top_slab("aspen_wood", "default:aspen_wood",
      {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
      {"default_aspen_wood.png"},
      "Aspen Wood Top Slab",
      default.node_sound_wood_defaults())

stackslabs.register_top_slab("stone", "default:stone",
      {cracky = 3},
      {"default_stone.png"},
      "Stone Top Slab",
      default.node_sound_stone_defaults())

stackslabs.register_top_slab("cobble", "default:cobble",
      {cracky = 3},
      {"default_cobble.png"},
      "Cobblestone Top Slab",
      default.node_sound_stone_defaults())

stackslabs.register_top_slab("stonebrick", "default:stonebrick",
      {cracky = 3},
      {"default_stone_brick.png"},
      "Stone Brick Top Slab",
      default.node_sound_stone_defaults())

stackslabs.register_top_slab("desert_stone", "default:desert_stone",
      {cracky = 3},
      {"default_desert_stone.png"},
      "Desertstone Top Slab",
      default.node_sound_stone_defaults())

stackslabs.register_top_slab("desert_cobble", "default:desert_cobble",
      {cracky = 3},
      {"default_desert_cobble.png"},
      "Desert Cobblestone Top Slab",
      default.node_sound_stone_defaults())

stackslabs.register_top_slab("desert_stonebrick", "default:desert_stonebrick",
      {cracky = 3},
      {"default_desert_stone_brick.png"},
      "Desert Stone Brick Top Slab",
      default.node_sound_stone_defaults())

stackslabs.register_top_slab("sandstone", "default:sandstone",
      {crumbly = 1, cracky = 3},
      {"default_sandstone.png"},
      "Sandstone Top Slab",
      default.node_sound_stone_defaults())
      
stackslabs.register_top_slab("sandstonebrick", "default:sandstonebrick",
      {cracky = 2},
      {"default_sandstone_brick.png"},
      "Sandstone Brick Top Slab",
      default.node_sound_stone_defaults())

stackslabs.register_top_slab("obsidian", "default:obsidian",
      {cracky = 1, level = 2},
      {"default_obsidian.png"},
      "Obsidian Top Slab",
      default.node_sound_stone_defaults())

stackslabs.register_top_slab("obsidianbrick", "default:obsidianbrick",
      {cracky = 1, level = 2},
      {"default_obsidian_brick.png"},
      "Obsidian Brick Top Slab",
      default.node_sound_stone_defaults())

stackslabs.register_top_slab("brick", "default:brick",
      {cracky = 3},
      {"default_brick.png"},
      "Brick Top Slab",
      default.node_sound_stone_defaults())

stackslabs.register_top_slab("steelblock", "default:steelblock",
      {cracky = 1, level = 2},
      {"default_steel_block.png"},
      "Steel Block Top Slab",
      default.node_sound_stone_defaults())

stackslabs.register_top_slab("copperblock", "default:copperblock",
      {cracky = 1, level = 2},
      {"default_copper_block.png"},
      "Copper Block Top Slab",
      default.node_sound_stone_defaults())

stackslabs.register_top_slab("bronzeblock", "default:bronzeblock",
      {cracky = 1, level = 2},
      {"default_bronze_block.png"},
      "Bronze Block Top Slab",
      default.node_sound_stone_defaults())

stackslabs.register_top_slab("goldblock", "default:goldblock",
      {cracky = 1},
      {"default_gold_block.png"},
      "Gold Block Top Slab",
      default.node_sound_stone_defaults())
Last edited by TumeniNodes on Sun Jun 26, 2016 19:34, edited 1 time in total.
Flick?... Flick who?
 

blert2112
Member
 
Posts: 244
Joined: Sat Apr 25, 2015 04:05
GitHub: blert2112

Re: A strange issue with my slabs mod

by blert2112 » Sat Jun 25, 2016 22:18

At first glance, it looks like you are defining the registration function twice. The first definition does what you want it to, the second definition defines the function as nothing. Since the function is ultimately defined as doing nothing then that is what will happen. Could be wrong though as I am looking at this on my phone.
 

User avatar
TumeniNodes
Member
 
Posts: 1335
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes

Re: A strange issue with my slabs mod

by TumeniNodes » Sat Jun 25, 2016 23:15

blert2112 wrote:At first glance, it looks like you are defining the registration function twice. The first definition does what you want it to, the second definition defines the function as nothing. Since the function is ultimately defined as doing nothing then that is what will happen. Could be wrong though as I am looking at this on my phone.


That's interesting, as when I add all of the lines for the bottom slabs back in, it works fine using the 2 function calls.
I will try removing the second function call and see what happens.
Thanks for the observation.
Flick?... Flick who?
 

blert2112
Member
 
Posts: 244
Joined: Sat Apr 25, 2015 04:05
GitHub: blert2112

Re: A strange issue with my slabs mod

by blert2112 » Sat Jun 25, 2016 23:58

Just tested it and that's the problem. There is another issue though... Place a normal slab, place a top-slab, now place something on top of that.
 

User avatar
TumeniNodes
Member
 
Posts: 1335
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes

Re: A strange issue with my slabs mod

by TumeniNodes » Sun Jun 26, 2016 00:13

blert2112 wrote:Just tested it and that's the problem. There is another issue though... Place a normal slab, place a top-slab, now place something on top of that.


Cool, thanks! I had not had time to make the changes yet.
Haha, that's not an issue..., it's a feature :P These "top slabs" are just meant to be able to sit atop existing slabs, but not to stack any more than that. Although, if you use the screwdriver and turn those two slabs on their sides, you can place another node, full or slab atop them. I have a pic of that in the original post
https://forum.minetest.net/viewtopic.php?f=9&t=15008
I am not opposed to anyone <subliminal hint> who may be able to figure out how to get multiple slabs stacked atop one another, adding those changes..., in fact I'm sure there are many users who would love to see that ability :D
Flick?... Flick who?
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 6 guests

cron