[SOLVED] How do I add use of default textures function?

User avatar
TumeniNodes
Member
 
Posts: 2827
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

[SOLVED] How do I add use of default textures function?

by TumeniNodes » Wed Jun 01, 2016 18:18

https://forum.minetest.net/viewtopic.php?f=9&t=14801

I feel pretty stupid because, I cannot figure out how to make the mod use default textures such as default stones, woods, and steel.
I tried copying similar code from a few different mods such as pkarks, columnia, etc.. Made changes several times to try to get it to work but failed each time.
I searched through all the "modding help/questions" and could not find anything. And even tried going through the modding tutorials as well as Lua users wiki and I am stumped.
I realize it is a basic function to execute (which is why I feel like an idiot) but, I just can't seem to figure it out, and each mod which utilizes the function seems to do it a different way?
So, I am here asking for help. So if anyone can help me out, I would greatly appreciate it. Thank you.
Last edited by TumeniNodes on Thu Jun 02, 2016 11:18, edited 1 time in total.
Ich mag keine grünen Eier und Schinken, ich mag sie nicht Sam I Am
 

User avatar
azekill_DIABLO
Member
 
Posts: 7489
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO
 

User avatar
TumeniNodes
Member
 
Posts: 2827
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: How do I add use of default textures function?

by TumeniNodes » Wed Jun 01, 2016 18:39

azekill_DIABLO wrote:depends default <<<!!important!!

and then make the texture = default_whatyouwanthere


I think you may have misunderstood my question? But thank you for taking the time to respond and trying to help.
I already have default set in depends.txt What I am trying to do, is to get the nodes in my mod to use the textures from default woods, stones, and steel.
So that there is a copy of the nodes for each of those textures. I think it is called "strings"?

Example: If you use Peaks, [pkarks] mod..., each node has a copy for each default texture for all the woods, stones
Ich mag keine grünen Eier und Schinken, ich mag sie nicht Sam I Am
 

User avatar
Napiophelios
Member
 
Posts: 982
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

Re: How do I add use of default textures function?

by Napiophelios » Wed Jun 01, 2016 19:05

There are many mods that do this.
From Minetest game check out the walls mod.
its pretty simple and straight forward.

The first line:
walls.register = function(wall_name, wall_desc, wall_texture, wall_mat, wall_sounds)

tells the walls.register what info it needs to register the node:

walls.register("walls:cobble", "Cobblestone Wall", "default_cobble.png","default:cobble", default.node_sound_stone_defaults())

and you do this for each material you want to use.

for the angled stairs mod, having an angled stair and an angled slab;
stairs mod would be a better example to experiment with.
 

User avatar
TumeniNodes
Member
 
Posts: 2827
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: How do I add use of default textures function?

by TumeniNodes » Wed Jun 01, 2016 19:14

Napiophelios wrote:There are many mods that do this.
From Minetest game check out the walls mod.
its pretty simple and straight forward.

The first line:
walls.register = function(wall_name, wall_desc, wall_texture, wall_mat, wall_sounds)

tells the walls.register what info it needs to register the node:

walls.register("walls:cobble", "Cobblestone Wall", "default_cobble.png","default:cobble", default.node_sound_stone_defaults())

I'll give this a try, thanks.
Ahhhh, I didn't think of calling the 2d node a "slab". That is a better idea, I only named it angled_step_two :P

and you do this for each material you want to use.

for the angled stairs mod, having an angled stair and an angled slab;
stairs mod would be a better example to experiment with.
Ich mag keine grünen Eier und Schinken, ich mag sie nicht Sam I Am
 

User avatar
Napiophelios
Member
 
Posts: 982
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

Re: How do I add use of default textures function?

by Napiophelios » Wed Jun 01, 2016 19:48

The stairs mod code works fine for me
but you may want to create a mesh object instead of nodeboxes.
It would look much cleaner.

Image

Code: Select all
-- Minetest 0.4 mod: stairs
-- See README.txt for licensing and other information.


-- Global namespace for functions

angledstairs = {}

-- Register angledstairs.
-- Node will be called angledstairs:stair_<subname>

function angledstairs.register_stair(subname, recipeitem, groups, images, description, sounds)
   groups.stair = 1
   minetest.register_node(":angledstairs:stair_" .. subname, {
      description = description,
      drawtype = "nodebox",
      tiles = images,
      paramtype = "light",
      paramtype2 = "facedir",
      is_ground_content = false,
      groups = groups,
      sounds = sounds,
      node_box = {
         type = "fixed",
         fixed = {
            {-0.5, -0.5, 0, 0.0625, 0.5, 0.5},
         {0.0625, -0.5, 0.0625, 0.125, 0.5, 0.5},
         {0.125, -0.5, 0.125, 0.1875, 0.5, 0.5},
         {0.1875, -0.5, 0.1875, 0.25, 0.5, 0.5},
         {0.25, -0.5, 0.25, 0.3125, 0.5, 0.5},
         {0.3125, -0.5, 0.3125, 0.375, 0.5, 0.5},
         {0.375, -0.5, 0.375, 0.4375, 0.5, 0.5},
         {0.4375, -0.5, 0.4375, 0.5, 0.5, 0.5},
         {-0.5, -0.5, -0.5, -0.4375, 0.5, -0.4375},
         {-0.5, -0.5, -0.4375, -0.375, 0.5, -0.375},
         {-0.5, -0.5, -0.375, -0.3125, 0.5, -0.3125},
         {-0.5, -0.5, -0.3125, -0.25, 0.5, -0.25},
         {-0.5, -0.5, -0.25, -0.1875, 0.5, -0.1875},
         {-0.5, -0.5, -0.1875, -0.125, 0.5, -0.125},
         {-0.5, -0.5, -0.125, -0.0625, 0.5, -0.0625},
         {-0.5, -0.5, -0.0625, 0, 0.5, 0},
         {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
         },
      },
      on_place = function(itemstack, placer, pointed_thing)
         if pointed_thing.type ~= "node" then
            return itemstack
         end

         local p0 = pointed_thing.under
         local p1 = pointed_thing.above
         local param2 = 0

         local placer_pos = placer:getpos()
         if placer_pos then
            local dir = {
               x = p1.x - placer_pos.x,
               y = p1.y - placer_pos.y,
               z = p1.z - placer_pos.z
            }
            param2 = minetest.dir_to_facedir(dir)
         end

         if p0.y - 1 == p1.y then
            param2 = param2 + 20
            if param2 == 21 then
               param2 = 23
            elseif param2 == 23 then
               param2 = 21
            end
         end

         return minetest.item_place(itemstack, placer, pointed_thing, param2)
      end,
   })

   minetest.register_craft({
      output = 'angledstairs:stair_' .. subname .. ' 6',
      recipe = {
         {recipeitem, "", ""},
         {recipeitem, "", ""},
         {recipeitem, recipeitem, recipeitem},
      },
   })

end


-- Register angledslabs.
-- Node will be called angledstairs:slab_<subname>

function angledstairs.register_slab(subname, recipeitem, groups, images, description, sounds)
   groups.slab = 1
   minetest.register_node(":angledstairs:slab_" .. subname, {
      description = description,
      drawtype = "nodebox",
      tiles = images,
      paramtype = "light",
      paramtype2 = "facedir",
      is_ground_content = false,
      groups = groups,
      sounds = sounds,
      node_box = {
      type = "fixed",
      fixed = {
         {-0.5, -0.5, 0, 0.0625, 0, 0.5},
         {0.0625, -0.5, 0.0625, 0.125, 0, 0.5},
         {0.125, -0.5, 0.125, 0.1875, 0, 0.5},
         {0.1875, -0.5, 0.1875, 0.25, 0, 0.5},
         {0.25, -0.5, 0.25, 0.3125, 0, 0.5},
         {0.3125, -0.5, 0.3125, 0.375, 0, 0.5},
         {0.375, -0.5, 0.375, 0.4375, 0, 0.5},
         {0.4375, -0.5, 0.4375, 0.5, 0, 0.5},
         {-0.5, -0.5, -0.5, -0.4375, 0, -0.4375},
         {-0.5, -0.5, -0.4375, -0.375, 0, -0.375},
         {-0.5, -0.5, -0.375, -0.3125, 0, -0.3125},
         {-0.5, -0.5, -0.3125, -0.25, 0, -0.25},
         {-0.5, -0.5, -0.25, -0.1875, 0, -0.1875},
         {-0.5, -0.5, -0.1875, -0.125, 0, -0.125},
         {-0.5, -0.5, -0.125, -0.0625, 0, -0.0625},
         {-0.5, -0.5, -0.0625, 0, 0, 0},
      },
         },
      on_place = function(itemstack, placer, pointed_thing)
         if pointed_thing.type ~= "node" then
            return itemstack
         end

         -- If it's being placed on an another similar one, replace it with
         -- a full block
         local slabpos = nil
         local slabnode = nil
         local p0 = pointed_thing.under
         local p1 = pointed_thing.above
         local n0 = minetest.get_node(p0)
         local n1 = minetest.get_node(p1)
         local param2 = 0

         local n0_is_upside_down = (n0.name == "angledstairs:slab_" .. subname and
               n0.param2 >= 20)

         if n0.name == "angledstairs:slab_" .. subname and not n0_is_upside_down and
               p0.y + 1 == p1.y then
            slabpos = p0
            slabnode = n0
         elseif n1.name == "angledstairs:slab_" .. subname then
            slabpos = p1
            slabnode = n1
         end
         if slabpos then
            -- Remove the slab at slabpos
            minetest.remove_node(slabpos)
            -- Make a fake stack of a single item and try to place it
            local fakestack = ItemStack(recipeitem)
            fakestack:set_count(itemstack:get_count())

            pointed_thing.above = slabpos
            local success
            fakestack, success = minetest.item_place(fakestack, placer,
               pointed_thing)
            -- If the item was taken from the fake stack, decrement original
            if success then
               itemstack:set_count(fakestack:get_count())
            -- Else put old node back
            else
               minetest.set_node(slabpos, slabnode)
            end
            return itemstack
         end

         -- Upside down slabs
         if p0.y - 1 == p1.y then
            -- Turn into full block if pointing at a existing slab
            if n0_is_upside_down  then
               -- Remove the slab at the position of the slab
               minetest.remove_node(p0)
               -- Make a fake stack of a single item and try to place it
               local fakestack = ItemStack(recipeitem)
               fakestack:set_count(itemstack:get_count())

               pointed_thing.above = p0
               local success
               fakestack, success = minetest.item_place(fakestack, placer,
                  pointed_thing)
               -- If the item was taken from the fake stack, decrement original
               if success then
                  itemstack:set_count(fakestack:get_count())
               -- Else put old node back
               else
                  minetest.set_node(p0, n0)
               end
               return itemstack
            end

            -- Place upside down slab
            param2 = 20
         end

         -- If pointing at the side of a upside down slab
         if n0_is_upside_down and p0.y + 1 ~= p1.y then
            param2 = 20
         end

         return minetest.item_place(itemstack, placer, pointed_thing, param2)
      end,
   })

   minetest.register_craft({
      output = 'angledstairs:slab_' .. subname .. ' 6',
      recipe = {
         {recipeitem, recipeitem, recipeitem},
         {recipeitem, "", ""},
         {recipeitem, "", ""},
      },
   })
end

-- Stair/slab registration function.
-- Nodes will be called angledstairs:{stair,slab}_<subname>

function angledstairs.register_stair_and_slab(subname, recipeitem, groups, images,
      desc_stair, desc_slab, sounds)
   angledstairs.register_stair(subname, recipeitem, groups, images, desc_stair, sounds)
   angledstairs.register_slab(subname, recipeitem, groups, images, desc_slab, sounds)
end


-- Register default stairs and slabs

angledstairs.register_stair_and_slab("wood", "default:wood",
      {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
      {"default_wood.png"},
      "Wooden Angled-Stair",
      "Wooden Angled-Slab",
      default.node_sound_wood_defaults())

angledstairs.register_stair_and_slab("junglewood", "default:junglewood",
      {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
      {"default_junglewood.png"},
      "Junglewood Angled-Stair",
      "Junglewood Angled-Slab",
      default.node_sound_wood_defaults())

angledstairs.register_stair_and_slab("pine_wood", "default:pine_wood",
      {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
      {"default_pine_wood.png"},
      "Pine Wood Angled-Stair",
      "Pine Wood Angled-Slab",
      default.node_sound_wood_defaults())

angledstairs.register_stair_and_slab("acacia_wood", "default:acacia_wood",
      {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
      {"default_acacia_wood.png"},
      "Acacia Wood Angled-Stair",
      "Acacia Wood Angled-Slab",
      default.node_sound_wood_defaults())

angledstairs.register_stair_and_slab("aspen_wood", "default:aspen_wood",
      {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
      {"default_aspen_wood.png"},
      "Aspen Wood Angled-Stair",
      "Aspen Wood Angled-Slab",
      default.node_sound_wood_defaults())

angledstairs.register_stair_and_slab("stone", "default:stone",
      {cracky = 3},
      {"default_stone.png"},
      "Stone Angled-Stair",
      "Stone Angled-Slab",
      default.node_sound_stone_defaults())

angledstairs.register_stair_and_slab("cobble", "default:cobble",
      {cracky = 3},
      {"default_cobble.png"},
      "Cobblestone Angled-Stair",
      "Cobblestone Angled-Slab",
      default.node_sound_stone_defaults())

angledstairs.register_stair_and_slab("stonebrick", "default:stonebrick",
      {cracky = 3},
      {"default_stone_brick.png"},
      "Stone Brick Angled-Stair",
      "Stone Brick Angled-Slab",
      default.node_sound_stone_defaults())

angledstairs.register_stair_and_slab("desert_stone", "default:desert_stone",
      {cracky = 3},
      {"default_desert_stone.png"},
      "Desertstone Angled-Stair",
      "Desertstone Angled-Slab",
      default.node_sound_stone_defaults())

angledstairs.register_stair_and_slab("desert_cobble", "default:desert_cobble",
      {cracky = 3},
      {"default_desert_cobble.png"},
      "Desert Cobblestone Angled-Stair",
      "Desert Cobblestone Angled-Slab",
      default.node_sound_stone_defaults())

angledstairs.register_stair_and_slab("desert_stonebrick", "default:desert_stonebrick",
      {cracky = 3},
      {"default_desert_stone_brick.png"},
      "Desert Stone Brick Angled-Stair",
      "Desert Stone Brick Angled-Slab",
      default.node_sound_stone_defaults())

angledstairs.register_stair_and_slab("sandstone", "default:sandstone",
      {crumbly = 1, cracky = 3},
      {"default_sandstone.png"},
      "Sandstone Angled-Stair",
      "Sandstone Angled-Slab",
      default.node_sound_stone_defaults())

angledstairs.register_stair_and_slab("sandstonebrick", "default:sandstonebrick",
      {cracky = 2},
      {"default_sandstone_brick.png"},
      "Sandstone Brick Angled-Stair",
      "Sandstone Brick Angled-Slab",
      default.node_sound_stone_defaults())

angledstairs.register_stair_and_slab("obsidian", "default:obsidian",
      {cracky = 1, level = 2},
      {"default_obsidian.png"},
      "Obsidian Angled-Stair",
      "Obsidian Angled-Slab",
      default.node_sound_stone_defaults())

angledstairs.register_stair_and_slab("obsidianbrick", "default:obsidianbrick",
      {cracky = 1, level = 2},
      {"default_obsidian_brick.png"},
      "Obsidian Brick Angled-Stair",
      "Obsidian Brick Angled-Slab",
      default.node_sound_stone_defaults())

angledstairs.register_stair_and_slab("brick", "default:brick",
      {cracky = 3},
      {"default_brick.png"},
      "Brick Angled-Stair",
      "Brick Angled-Slab",
      default.node_sound_stone_defaults())

angledstairs.register_stair_and_slab("straw", "farming:straw",
      {snappy = 3, flammable = 4},
      {"farming_straw.png"},
      "Straw Angled-Stair",
      "Straw Angled-Slab",
      default.node_sound_leaves_defaults())

angledstairs.register_stair_and_slab("steelblock", "default:steelblock",
      {cracky = 1, level = 2},
      {"default_steel_block.png"},
      "Steel Block Angled-Stair",
      "Steel Block Angled-Slab",
      default.node_sound_stone_defaults())

angledstairs.register_stair_and_slab("copperblock", "default:copperblock",
      {cracky = 1, level = 2},
      {"default_copper_block.png"},
      "Copper Block Angled-Stair",
      "Copper Block Angled-Slab",
      default.node_sound_stone_defaults())

angledstairs.register_stair_and_slab("bronzeblock", "default:bronzeblock",
      {cracky = 1, level = 2},
      {"default_bronze_block.png"},
      "Bronze Block Angled-Stair",
      "Bronze Block Angled-Slab",
      default.node_sound_stone_defaults())

angledstairs.register_stair_and_slab("goldblock", "default:goldblock",
      {cracky = 1},
      {"default_gold_block.png"},
      "Gold Block Angled-Stair",
      "Gold Block Angled-Slab",
      default.node_sound_stone_defaults())


screenshot_20160601_154418.png
(121.21 KiB) Not downloaded yet
 

User avatar
TumeniNodes
Member
 
Posts: 2827
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: How do I add use of default textures function?

by TumeniNodes » Wed Jun 01, 2016 21:19

you poopiehead... you did it much faster than me :P

I finally got it to work but I went about it the looong way around, compared to what you did.

So now, which is best to use.., yours? or mine? Please be extremely honest and let me know
here is the way I did it. In my copy of the code, I renamed literally "everything" from stairs/slabs to angled stairs/slabs... (cuz Ima goof)

Code: Select all
-- [Mod] Angled Stairs [angledstairs] (1.0) by TumeniNodes 05-31-2016

angledstairs = {}

-- Register angledstairs.
-- Node will be called angledstairs:angled_stair_<subname>

function angledstairs.register_angled_stair(subname, recipeitem, groups, images, description, sounds)
   groups.angledstair = 1
minetest.register_node(":angledstairs:angled_stair_" .. subname, {
   description = description,
   tiles = images,
   drawtype = "nodebox",
   paramtype = "light",
   paramtype2 = "facedir",
   groups = groups,
   sounds = sounds,
   node_box = {
      type = "fixed",
      fixed = {
         {-0.5, -0.5, 0, 0.0625, 0.5, 0.5},
         {0.0625, -0.5, 0.0625, 0.125, 0.5, 0.5},
         {0.125, -0.5, 0.125, 0.1875, 0.5, 0.5},
         {0.1875, -0.5, 0.1875, 0.25, 0.5, 0.5},
         {0.25, -0.5, 0.25, 0.3125, 0.5, 0.5},
         {0.3125, -0.5, 0.3125, 0.375, 0.5, 0.5},
         {0.375, -0.5, 0.375, 0.4375, 0.5, 0.5},
         {0.4375, -0.5, 0.4375, 0.5, 0.5, 0.5},
         {-0.5, -0.5, -0.5, -0.4375, 0.5, -0.4375},
         {-0.5, -0.5, -0.4375, -0.375, 0.5, -0.375},
         {-0.5, -0.5, -0.375, -0.3125, 0.5, -0.3125},
         {-0.5, -0.5, -0.3125, -0.25, 0.5, -0.25},
         {-0.5, -0.5, -0.25, -0.1875, 0.5, -0.1875},
         {-0.5, -0.5, -0.1875, -0.125, 0.5, -0.125},
         {-0.5, -0.5, -0.125, -0.0625, 0.5, -0.0625},
         {-0.5, -0.5, -0.0625, 0, 0.5, 0},
         {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
      }
   }
})
end

-- Register angledstairs.
-- Node will be called angledstairs:angled_slab_<subname>

function angledstairs.register_angled_slab(subname, recipeitem, groups, images, description, sounds)
   groups.angledslab = 1
minetest.register_node(":angledstairs:angled_slab_" .. subname, {
   description = description,
   tiles = images,
   drawtype = "nodebox",
   paramtype = "light",
   paramtype2 = "facedir",
   groups = groups,
   sounds = sounds,
   node_box = {
      type = "fixed",
      fixed = {
         {-0.5, -0.5, 0, 0.0625, 0, 0.5},
         {0.0625, -0.5, 0.0625, 0.125, 0, 0.5},
         {0.125, -0.5, 0.125, 0.1875, 0, 0.5},
         {0.1875, -0.5, 0.1875, 0.25, 0, 0.5},
         {0.25, -0.5, 0.25, 0.3125, 0, 0.5},
         {0.3125, -0.5, 0.3125, 0.375, 0, 0.5},
         {0.375, -0.5, 0.375, 0.4375, 0, 0.5},
         {0.4375, -0.5, 0.4375, 0.5, 0, 0.5},
         {-0.5, -0.5, -0.5, -0.4375, 0, -0.4375},
         {-0.5, -0.5, -0.4375, -0.375, 0, -0.375},
         {-0.5, -0.5, -0.375, -0.3125, 0, -0.3125},
         {-0.5, -0.5, -0.3125, -0.25, 0, -0.25},
         {-0.5, -0.5, -0.25, -0.1875, 0, -0.1875},
         {-0.5, -0.5, -0.1875, -0.125, 0, -0.125},
         {-0.5, -0.5, -0.125, -0.0625, 0, -0.0625},
         {-0.5, -0.5, -0.0625, 0, 0, 0},
      }
   }
})
end

-- Angled stair/slab registration function.
-- Nodes will be called angledstairs:{angled_stair,angled_slab}_<subname>

function angledstairs.register_angled_stair_and_angled_slab(subname, recipeitem, groups, images,desc_angled_stair, desc_angled_slab, sounds)
   angledstairs.register_angled_stair(subname, recipeitem, groups, images, desc_angled_stair, sounds)
   angledstairs.register_angled_slab(subname, recipeitem, groups, images, desc_angled_slab, sounds)
end


-- Register angled stairs and slabs

angledstairs.register_angled_stair_and_angled_slab("wood", "default:wood",
      {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
      {"default_wood.png"},
      "Wooden Angled Stair",
      "Wooden Angled Slab",
      default.node_sound_wood_defaults())

angledstairs.register_angled_stair_and_angled_slab("junglewood", "default:junglewood",
      {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
      {"default_junglewood.png"},
      "Junglewood Angled Stair",
      "Junglewood Angled Slab",
      default.node_sound_wood_defaults())

angledstairs.register_angled_stair_and_angled_slab("pine_wood", "default:pine_wood",
      {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
      {"default_pine_wood.png"},
      "Pine Wood Stair",
      "Pine Wood Slab",
      default.node_sound_wood_defaults())

angledstairs.register_angled_stair_and_angled_slab("acacia_wood", "default:acacia_wood",
      {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
      {"default_acacia_wood.png"},
      "Acacia Wood Stair",
      "Acacia Wood Slab",
      default.node_sound_wood_defaults())

angledstairs.register_angled_stair_and_angled_slab("aspen_wood", "default:aspen_wood",
      {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
      {"default_aspen_wood.png"},
      "Aspen Wood Stair",
      "Aspen Wood Slab",
      default.node_sound_wood_defaults())

angledstairs.register_angled_stair_and_angled_slab("stone", "default:stone",
      {cracky = 3},
      {"default_stone.png"},
      "Stone Stair",
      "Stone Slab",
      default.node_sound_stone_defaults())

angledstairs.register_angled_stair_and_angled_slab("cobble", "default:cobble",
      {cracky = 3},
      {"default_cobble.png"},
      "Cobblestone Stair",
      "Cobblestone Slab",
      default.node_sound_stone_defaults())

angledstairs.register_angled_stair_and_angled_slab("stonebrick", "default:stonebrick",
      {cracky = 3},
      {"default_stone_brick.png"},
      "Stone Brick Stair",
      "Stone Brick Slab",
      default.node_sound_stone_defaults())

angledstairs.register_angled_stair_and_angled_slab("desert_stone", "default:desert_stone",
      {cracky = 3},
      {"default_desert_stone.png"},
      "Desertstone Stair",
      "Desertstone Slab",
      default.node_sound_stone_defaults())

angledstairs.register_angled_stair_and_angled_slab("desert_cobble", "default:desert_cobble",
      {cracky = 3},
      {"default_desert_cobble.png"},
      "Desert Cobblestone Stair",
      "Desert Cobblestone Slab",
      default.node_sound_stone_defaults())

angledstairs.register_angled_stair_and_angled_slab("desert_stonebrick", "default:desert_stonebrick",
      {cracky = 3},
      {"default_desert_stone_brick.png"},
      "Desert Stone Brick Stair",
      "Desert Stone Brick Slab",
      default.node_sound_stone_defaults())

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

angledstairs.register_angled_stair_and_angled_slab("obsidian", "default:obsidian",
      {cracky = 1, level = 2},
      {"default_obsidian.png"},
      "Obsidian Stair",
      "Obsidian Slab",
      default.node_sound_stone_defaults())

angledstairs.register_angled_stair_and_angled_slab("obsidianbrick", "default:obsidianbrick",
      {cracky = 1, level = 2},
      {"default_obsidian_brick.png"},
      "Obsidian Brick Stair",
      "Obsidian Brick Slab",
      default.node_sound_stone_defaults())

angledstairs.register_angled_stair_and_angled_slab("brick", "default:brick",
      {cracky = 3},
      {"default_brick.png"},
      "Brick Stair",
      "Brick Slab",
      default.node_sound_stone_defaults())

angledstairs.register_angled_stair_and_angled_slab("steelblock", "default:steelblock",
      {cracky = 1, level = 2},
      {"default_steel_block.png"},
      "Steel Block Stair",
      "Steel Block Slab",
      default.node_sound_stone_defaults())

angledstairs.register_angled_stair_and_angled_slab("copperblock", "default:copperblock",
      {cracky = 1, level = 2},
      {"default_copper_block.png"},
      "Copper Block Stair",
      "Copper Block Slab",
      default.node_sound_stone_defaults())

angledstairs.register_angled_stair_and_angled_slab("bronzeblock", "default:bronzeblock",
      {cracky = 1, level = 2},
      {"default_bronze_block.png"},
      "Bronze Block Stair",
      "Bronze Block Slab",
      default.node_sound_stone_defaults())

angledstairs.register_angled_stair_and_angled_slab("goldblock", "default:goldblock",
      {cracky = 1},
      {"default_gold_block.png"},
      "Gold Block Stair",
      "Gold Block Slab",
      default.node_sound_stone_defaults())


Only issue I face now is a texture issue

Image

I want to fix this so that no matter which angle the node is placed, the textures will align. (is this facedir issue?)
And then.... (heavy sigh)... to push with git. But, I am using gitcola so... hopefully I don't mess stuff up

Also... I agree, had already thought about the nodes issue. And since I used rubenwardy's editor... I saved the obj so I should be able to import them to Blender, although then I am unsure how exactically to turn them all into one group (as you mentioned_
Attachments
angled stairs texture issue.png
(570.51 KiB) Not downloaded yet
Ich mag keine grünen Eier und Schinken, ich mag sie nicht Sam I Am
 

User avatar
Napiophelios
Member
 
Posts: 982
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

Re: How do I add use of default textures function?

by Napiophelios » Wed Jun 01, 2016 21:47

TumeniNodes wrote:Only issue I face now is a texture issue

I want to fix this so that no matter which angle the node is placed, the textures will align. (is this facedir issue?)


you would have to register another node that is a mirror image of the first node's coordinates.
 

User avatar
TumeniNodes
Member
 
Posts: 2827
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: How do I add use of default textures function?

by TumeniNodes » Wed Jun 01, 2016 21:57

Napiophelios wrote:
TumeniNodes wrote:Only issue I face now is a texture issue

I want to fix this so that no matter which angle the node is placed, the textures will align. (is this facedir issue?)


you would have to register another node that is a mirror image of the first node's coordinates.


:{ oh really... is that all?? haha
So simply take the coords and reverse them? I'll try it. If I screw it up, I'll just change them around with the editor :P

Actuallilly... before I go through all that... I should try the "mesh" approach but, I have an appt in a few so will have to play round with this later tonight
Last edited by TumeniNodes on Wed Jun 01, 2016 22:01, edited 1 time in total.
Ich mag keine grünen Eier und Schinken, ich mag sie nicht Sam I Am
 

User avatar
TumeniNodes
Member
 
Posts: 2827
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: How do I add use of default textures function?

by TumeniNodes » Wed Jun 01, 2016 22:00

Somebody REALLY has to create a "justdoitallforme" mod :D
Ich mag keine grünen Eier und Schinken, ich mag sie nicht Sam I Am
 

User avatar
Napiophelios
Member
 
Posts: 982
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

Re: How do I add use of default textures function?

by Napiophelios » Wed Jun 01, 2016 22:03

Actually, that just covers from the front view.
you would need two more that are reverses of those nodes.
So for perfect texture alignment you will need four nodes. :(

hardly worth the effort...but it does look nicer.

Image
screenshot_20160601_190438.png
(162.15 KiB) Not downloaded yet
 

User avatar
TumeniNodes
Member
 
Posts: 2827
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: How do I add use of default textures function?

by TumeniNodes » Thu Jun 02, 2016 11:22

Napiophelios wrote:Actually, that just covers from the front view.
you would need two more that are reverses of those nodes.
So for perfect texture alignment you will need four nodes. :(

hardly worth the effort...but it does look nicer.

Image
screenshot_20160601_190438.png


That does look much better. And if it looks better, then it is well worth the effort : )
So with that, I will add 3 more variations for each node.
Thanks for all your help
Ich mag keine grünen Eier und Schinken, ich mag sie nicht Sam I Am
 

User avatar
TumeniNodes
Member
 
Posts: 2827
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: How do I add use of default textures function?

by TumeniNodes » Thu Jun 02, 2016 23:50

Napiophelios wrote:hardly worth the effort...but it does look nicer.

Image
screenshot_20160601_190438.png


So..., I whimped out and just did the 4... 2 of each (right / left)
Mostly due to the fact, more would look ridiculous in the inventory : /
Ich mag keine grünen Eier und Schinken, ich mag sie nicht Sam I Am
 

User avatar
Napiophelios
Member
 
Posts: 982
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

Re: [SOLVED] How do I add use of default textures function?

by Napiophelios » Fri Jun 03, 2016 20:01

@TumeniNodes :

I found a way to have all your nodes without cluttering up the inventory.

Place a node then punch it with the same type node and it will "rotate"
Keep punching the node till you have it positioned the way you want it.
It works pretty good tho and allows for the texture alignment you were going for.

There will be only one node per material in the inventory,
however to do this I had to go the long way about it with the code.
I am not a coder so this is just more regurgitated code from other mods.

Take a look and maybe you can refine this.

For testing purposes, the code below only registers default wood

Code: Select all
-- Minetest 0.4 mod: stairs
-- See README.txt for licensing and other information.


-- Global namespace for functions

angledstairs = {}

-- Register angledstairs.
-- Node will be called angledstairs:stair_<subname>

function angledstairs.register_stair_alts(subname, recipeitem, groups, images, description, sounds)
   groups.not_in_creative_inventory = 1
   minetest.register_node(":angledstairs:stair_1ne_" .. subname, {
      description = description,
      drawtype = "nodebox",
      tiles = images,
      paramtype = "light",
      paramtype2 = "facedir",
      is_ground_content = false,
      groups = groups,
      sounds = sounds,
      drop = "angledstairs:stair_" .. subname,
      node_box = {
         type = "fixed",
         fixed = {
         {-0.4375, 0, -0.5, -0.375, 0.5, 0.375},
         {-0.375, 0, -0.5, -0.3125, 0.5, 0.3125},
         {-0.3125, 0, -0.5, -0.25, 0.5, 0.25},
         {-0.25, 0, -0.5, -0.1875, 0.5, 0.1875},
         {-0.1875, 0, -0.5, -0.125, 0.5, 0.125},
         {-0.125, 0, -0.5, -0.0625, 0.5, 0.0625},
         {-0.0625, 0, -0.5, -0, 0.5, -0},
         {-0, 0, -0.5, 0.0625, 0.5, -0.0625},
         {0.0625, 0, -0.5, 0.125, 0.5, -0.125},
         {0.125, 0, -0.5, 0.1875, 0.5, -0.1875},
         {0.1875, 0, -0.5, 0.25, 0.5, -0.25},
         {0.25, 0, -0.5, 0.3125, 0.5, -0.3125},
         {0.3125, 0, -0.5, 0.375, 0.5, -0.375},
         {0.375, 0, -0.5, 0.4375, 0.5, -0.4375},
         {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
         {-0.5, 0, -0.5, -0.4375, 0.5, 0.4375},
         },
      },
   on_punch = function(pos, node, puncher)
if node.name == "angledstairs:stair_1ne_" .. subname and
    puncher:get_wielded_item():get_name() == "angledstairs:stair_" .. subname then
    minetest.add_node(pos, {name = "angledstairs:stair_2se_" .. subname, param2 = node.param2})
      end
end,
   })

   minetest.register_node(":angledstairs:stair_2se_" .. subname, {
      description = description,
      drawtype = "nodebox",
      tiles = images,
      paramtype = "light",
      paramtype2 = "facedir",
      is_ground_content = false,
      groups = groups,
      sounds = sounds,
      drop = "angledstairs:stair_" .. subname,
      node_box = {
         type = "fixed",
         fixed = {
         {-0.4375, 0, -0.375, -0.375, 0.5, 0.5},
         {-0.375, 0, -0.3125, -0.3125, 0.5, 0.5},
         {-0.3125, 0, -0.25, -0.25, 0.5, 0.5},
         {-0.25, 0, -0.1875, -0.1875, 0.5, 0.5},
         {-0.1875, 0, -0.125, -0.125, 0.5, 0.5},
         {-0.125, 0, -0.0625, -0.0625, 0.5, 0.5},
         {-0.0625, 0, 0, -0, 0.5, 0.5},
         {-0, 0, 0.0625, 0.0625, 0.5, 0.5},
         {0.0625, 0, 0.125, 0.125, 0.5, 0.5},
         {0.125, 0, 0.1875, 0.1875, 0.5, 0.5},
         {0.1875, 0, 0.25, 0.25, 0.5, 0.5},
         {0.25, 0, 0.3125, 0.3125, 0.5, 0.5},
         {0.3125, 0, 0.375, 0.375, 0.5, 0.5},
         {0.375, 0, 0.4375, 0.4375, 0.5, 0.5},
         {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
         {-0.5, 0, -0.4375, -0.4375, 0.5, 0.5},
         },
      },
      on_punch = function(pos, node, puncher)
  if node.name == "angledstairs:stair_2se_" .. subname and
    puncher:get_wielded_item():get_name() == "angledstairs:stair_" .. subname then
    minetest.add_node(pos, {name = "angledstairs:stair_" .. subname, param2 = node.param2})
      end
end,
   })

   minetest.register_node(":angledstairs:stair_4nw_" .. subname, {
      description = description,
      drawtype = "nodebox",
      tiles = images,
      paramtype = "light",
      paramtype2 = "facedir",
      is_ground_content = false,
      groups = groups,
      sounds = sounds,
      drop = "angledstairs:stair_" .. subname,
      node_box = {
         type = "fixed",
         fixed = {
         {0.375, 0, -0.5, 0.4375, 0.5, 0.375},
         {0.3125, 0, -0.5, 0.375, 0.5, 0.3125},
         {0.25, 0, -0.5, 0.3125, 0.5, 0.25},
         {0.1875, 0, -0.5, 0.25, 0.5, 0.1875},
         {0.125, 0, -0.5, 0.1875, 0.5, 0.125},
         {0.0625, 0, -0.5, 0.125, 0.5, 0.0625},
         {0, 0, -0.5, 0.0625, 0.5, -0},
         {-0.0625, 0, -0.5, 0, 0.5, -0.0625},
         {-0.125, 0, -0.5, -0.0625, 0.5, -0.125},
         {-0.1875, 0, -0.5, -0.125, 0.5, -0.1875},
         {-0.25, 0, -0.5, -0.1875, 0.5, -0.25},
         {-0.3125, 0, -0.5, -0.25, 0.5, -0.3125},
         {-0.375, 0, -0.5, -0.3125, 0.5, -0.375},
         {-0.4375, 0, -0.5, -0.375, 0.5, -0.4375},
         {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
         {0.4375, 0, -0.5, 0.5, 0.5, 0.4375},
         },
      },
      on_punch = function(pos, node, puncher)
if node.name == "angledstairs:stair_4nw_" .. subname and
    puncher:get_wielded_item():get_name() == "angledstairs:stair_" .. subname then
    minetest.add_node(pos, {name = "angledstairs:stair_1ne_" .. subname, param2 = node.param2})
      end
end,
   })

end

function angledstairs.register_stair(subname, recipeitem, groups, images, description, sounds)
groups.stair=1
   minetest.register_node(":angledstairs:stair_" .. subname, {
      description = description,
      drawtype = "nodebox",
      tiles = images,
      paramtype = "light",
      paramtype2 = "facedir",
      is_ground_content = false,
      groups = groups,
      sounds = sounds,
      node_box = {
         type = "fixed",
         fixed = {
         {0.375, 0, -0.375, 0.4375, 0.5, 0.5},
         {0.3125, 0, -0.3125, 0.375, 0.5, 0.5},
         {0.25, 0, -0.25, 0.3125, 0.5, 0.5},
         {0.1875, 0, -0.1875, 0.25, 0.5, 0.5},
         {0.125, 0, -0.125, 0.1875, 0.5, 0.5},
         {0.0625, 0, -0.0625, 0.125, 0.5, 0.5},
         {0, 0, 0, 0.0625, 0.5, 0.5},
         {-0.0625, 0, 0.0625, 0, 0.5, 0.5},
         {-0.125, 0, 0.125, -0.0625, 0.5, 0.5},
         {-0.1875, 0, 0.1875, -0.125, 0.5, 0.5},
         {-0.25, 0, 0.25, -0.1875, 0.5, 0.5},
         {-0.3125, 0, 0.3125, -0.25, 0.5, 0.5},
         {-0.375, 0, 0.375, -0.3125, 0.5, 0.5},
         {-0.4375, 0, 0.4375, -0.375, 0.5, 0.5},
         {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
         {0.4375, 0, -0.4375, 0.5, 0.5, 0.5},
         },
      },
      on_punch = function(pos, node, puncher)
if node.name == "angledstairs:stair_" .. subname and
    puncher:get_wielded_item():get_name() == "angledstairs:stair_" .. subname then
    minetest.add_node(pos, {name = "angledstairs:stair_4nw_" .. subname, param2 = node.param2})
      end
end,
   })

end


-- Register angledslabs.
-- Node will be called angledstairs:slab_<subname>

function angledstairs.register_slab_alts(subname, recipeitem, groups, images, description, sounds)
   groups.not_in_creative_inventory = 1
   minetest.register_node(":angledstairs:slab_1ne_" .. subname, {
      description = description,
      drawtype = "nodebox",
      tiles = images,
      paramtype = "light",
      paramtype2 = "facedir",
      is_ground_content = false,
      groups = groups,
      sounds = sounds,
      drop = "angledstairs:slab_" .. subname,
      node_box = {
         type = "fixed",
         fixed = {
         {-0.5, -0.5, -0.5, 0.5, 0, -0.4375},
         {-0.5, -0.5, -0.4375, 0.4375, 0, -0.375},
         {-0.5, -0.5, -0.375, 0.375, 0, -0.3125},
         {-0.5, -0.5, -0.3125, 0.3125, 0, -0.25},
         {-0.5, -0.5, -0.25, 0.25, 0, -0.1875},
         {-0.5, -0.5, -0.1875, 0.1875, 0, -0.125},
         {-0.5, -0.5, -0.125, 0.125, 0, -0.0625},
         {-0.5, -0.5, -0.0625, 0.0625, 0, -0},
         {-0.5, -0.5, -0, -0, 0, 0.0625},
         {-0.5, -0.5, 0.0625, -0.0625, 0, 0.125},
         {-0.5, -0.5, 0.125, -0.125, 0, 0.1875},
         {-0.5, -0.5, 0.1875, -0.1875, 0, 0.25},
         {-0.5, -0.5, 0.25, -0.25, 0, 0.3125},
         {-0.5, -0.5, 0.3125, -0.3125, 0, 0.375},
         {-0.5, -0.5, 0.375, -0.375, 0, 0.4375},
         {-0.5, -0.5, 0.4375, -0.4375, 0, 0.5},
         },
      },
   on_punch = function(pos, node, puncher)
if node.name == "angledstairs:slab_1ne_" .. subname and
    puncher:get_wielded_item():get_name() == "angledstairs:slab_" .. subname then
    minetest.add_node(pos, {name = "angledstairs:slab_2se_" .. subname, param2 = node.param2})
      end
end,
   })

   minetest.register_node(":angledstairs:slab_2se_" .. subname, {
      description = description,
      drawtype = "nodebox",
      tiles = images,
      paramtype = "light",
      paramtype2 = "facedir",
      is_ground_content = false,
      groups = groups,
      sounds = sounds,
      drop = "angledstairs:slab_" .. subname,
      node_box = {
         type = "fixed",
         fixed = {
         {-0.5, -0.5, 0.4375, 0.5, 0, 0.5},
         {-0.5, -0.5, 0.375, 0.4375, 0, 0.4375},
         {-0.5, -0.5, 0.3125, 0.375, 0, 0.375},
         {-0.5, -0.5, 0.25, 0.3125, 0, 0.3125},
         {-0.5, -0.5, 0.1875, 0.25, 0, 0.25},
         {-0.5, -0.5, 0.125, 0.1875, 0, 0.1875},
         {-0.5, -0.5, 0.0625, 0.125, 0, 0.125},
         {-0.5, -0.5, 0, 0.0625, 0, 0.0625},
         {-0.5, -0.5, -0.0625, -0, 0, 0},
         {-0.5, -0.5, -0.125, -0.0625, 0, -0.0625},
         {-0.5, -0.5, -0.1875, -0.125, 0, -0.125},
         {-0.5, -0.5, -0.25, -0.1875, 0, -0.1875},
         {-0.5, -0.5, -0.3125, -0.25, 0, -0.25},
         {-0.5, -0.5, -0.375, -0.3125, 0, -0.3125},
         {-0.5, -0.5, -0.4375, -0.375, 0, -0.375},
         {-0.5, -0.5, -0.5, -0.4375, 0, -0.4375},
         },
      },
         on_punch = function(pos, node, puncher)
  if node.name == "angledstairs:slab_2se_" .. subname and
    puncher:get_wielded_item():get_name() == "angledstairs:slab_" .. subname then
    minetest.add_node(pos, {name = "angledstairs:slab_" .. subname, param2 = node.param2})
      end
end,
   })

   minetest.register_node(":angledstairs:slab_4nw_" .. subname, {
      description = description,
      drawtype = "nodebox",
      tiles = images,
      paramtype = "light",
      paramtype2 = "facedir",
      is_ground_content = false,
      groups = groups,
      sounds = sounds,
      drop = "angledstairs:slab_" .. subname,
      node_box = {
         type = "fixed",
         fixed = {
         {-0.5, -0.5, -0.5, 0.5, 0, -0.4375},
         {-0.4375, -0.5, -0.4375, 0.5, 0, -0.375},
         {-0.375, -0.5, -0.375, 0.5, 0, -0.3125},
         {-0.3125, -0.5, -0.3125, 0.5, 0, -0.25},
         {-0.25, -0.5, -0.25, 0.5, 0, -0.1875},
         {-0.1875, -0.5, -0.1875, 0.5, 0, -0.125},
         {-0.125, -0.5, -0.125, 0.5, 0, -0.0625},
         {-0.0625, -0.5, -0.0625, 0.5, 0, -0},
         {0, -0.5, -0, 0.5, 0, 0.0625},
         {0.0625, -0.5, 0.0625, 0.5, 0, 0.125},
         {0.125, -0.5, 0.125, 0.5, 0, 0.1875},
         {0.1875, -0.5, 0.1875, 0.5, 0, 0.25},
         {0.25, -0.5, 0.25, 0.5, 0, 0.3125},
         {0.3125, -0.5, 0.3125, 0.5, 0, 0.375},
         {0.375, -0.5, 0.375, 0.5, 0, 0.4375},
         {0.4375, -0.5, 0.4375, 0.5, 0, 0.5},
         },
      },
         on_punch = function(pos, node, puncher)
if node.name == "angledstairs:slab_4nw_" .. subname and
    puncher:get_wielded_item():get_name() == "angledstairs:slab_" .. subname then
    minetest.add_node(pos, {name = "angledstairs:slab_1ne_" .. subname, param2 = node.param2})
      end
end,
   })

end

function angledstairs.register_slab(subname, recipeitem, groups, images, description, sounds)
groups.slab =1
   minetest.register_node(":angledstairs:slab_" .. subname, {
      description = description,
      drawtype = "nodebox",
      tiles = images,
      paramtype = "light",
      paramtype2 = "facedir",
      is_ground_content = false,
      groups = groups,
      sounds = sounds,
      node_box = {
         type = "fixed",
         fixed = {
         {-0.5, -0.5, 0.4375, 0.5, 0, 0.5},
         {-0.4375, -0.5, 0.375, 0.5, 0, 0.4375},
         {-0.375, -0.5, 0.3125, 0.5, 0, 0.375},
         {-0.3125, -0.5, 0.25, 0.5, 0, 0.3125},
         {-0.25, -0.5, 0.1875, 0.5, 0, 0.25},
         {-0.1875, -0.5, 0.125, 0.5, 0, 0.1875},
         {-0.125, -0.5, 0.0625, 0.5, 0, 0.125},
         {-0.0625, -0.5, 0, 0.5, 0, 0.0625},
         {0, -0.5, -0.0625, 0.5, 0, 0},
         {0.0625, -0.5, -0.125, 0.5, 0, -0.0625},
         {0.125, -0.5, -0.1875, 0.5, 0, -0.125},
         {0.1875, -0.5, -0.25, 0.5, 0, -0.1875},
         {0.25, -0.5, -0.3125, 0.5, 0, -0.25},
         {0.3125, -0.5, -0.375, 0.5, 0, -0.3125},
         {0.375, -0.5, -0.4375, 0.5, 0, -0.375},
         {0.4375, -0.5, -0.5, 0.5, 0, -0.4375},
         },
      },
         on_punch = function(pos, node, puncher)
if node.name == "angledstairs:slab_" .. subname and
    puncher:get_wielded_item():get_name() == "angledstairs:slab_" .. subname then
    minetest.add_node(pos, {name = "angledstairs:slab_4nw_" .. subname, param2 = node.param2})
      end
end,
   })

end

-- Stair/slab registration function.
-- Nodes will be called angledstairs:{stair,slab}_<subname>


angledstairs.register_stair("wood", "default:wood",
      {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
      {"default_wood.png"},
      "Wooden Angled-Stair",
      "Wooden Angled-Slab",
      default.node_sound_wood_defaults())

      angledstairs.register_stair_alts("wood", "default:wood",
      {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
      {"default_wood.png"},
      "Wooden Angled-Stair",
      "Wooden Angled-Slab",
      default.node_sound_wood_defaults())

      angledstairs.register_slab("wood", "default:wood",
      {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
      {"default_wood.png"},
      "Wooden Angled-Stair",
      "Wooden Angled-Slab",
      default.node_sound_wood_defaults())

      angledstairs.register_slab_alts("wood", "default:wood",
      {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
      {"default_wood.png"},
      "Wooden Angled-Stair",
      "Wooden Angled-Slab",
      default.node_sound_wood_defaults())

 

User avatar
TumeniNodes
Member
 
Posts: 2827
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: [SOLVED] How do I add use of default textures function?

by TumeniNodes » Fri Jun 03, 2016 22:37

I'll check it out tonight, pretty cool concept. Thanks
Ich mag keine grünen Eier und Schinken, ich mag sie nicht Sam I Am
 

User avatar
TumeniNodes
Member
 
Posts: 2827
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: [SOLVED] How do I add use of default textures function?

by TumeniNodes » Sat Jun 04, 2016 00:00

That seems to be an awful lot of code to have to set per node (even for only two nodes in the mod), although it is a really good idea, and will probably be used if there is no alternative. It adds an entire paragragh of code to each of the deafult textures function at the end.
But it is also a lot of extra work for the user (which they would not even know about unless specifically told, and given they even read any directions haha.
"something" keeps stairs-slabs textures aligned, no matter which direction they are placed from. The texture remains stationary. This is not the same for default planks (by default). the texture changes direction according to which direction it is placed from. (facedir is not executed in these)
And the same with the nodes from angled stairs. I'm looking through the scripts to figure out which section of slabs produces this effect..., because it should be the same for planks, as well as for angled stairs/slabs
The only difference I see in slabs from other wood nodes, refer to upside down placement and replacing two slabs with a full wood block.
The angled stair nodes should work the same as slabs from stairs. I have tried with and without facedir (dumb I know but I'll try anything, regardless of how ridiculous :P)
Just irritated ( a little) why do slabs work this way, and angled stairs do not?
Ich mag keine grünen Eier und Schinken, ich mag sie nicht Sam I Am
 

User avatar
Napiophelios
Member
 
Posts: 982
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi
 

User avatar
azekill_DIABLO
Member
 
Posts: 7489
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO
 

User avatar
TumeniNodes
Member
 
Posts: 2827
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: [SOLVED] How do I add use of default textures function?

by TumeniNodes » Sun Jun 05, 2016 03:51

Napiophelios wrote:@TumeniNodes :

I found a way to have all your nodes without cluttering up the inventory.

Place a node then punch it with the same type node and it will "rotate"
Keep punching the node till you have it positioned the way you want it.
It works pretty good tho and allows for the texture alignment you were going for.

There will be only one node per material in the inventory,
however to do this I had to go the long way about it with the code.
I am not a coder so this is just more regurgitated code from other mods.

Take a look and maybe you can refine this.

For testing purposes, the code below only registers default wood

Code: Select all
-- Minetest 0.4 mod: stairs
-- See README.txt for licensing and other information.


-- Global namespace for functions

angledstairs = {}

-- Register angledstairs.
-- Node will be called angledstairs:stair_<subname>

function angledstairs.register_stair_alts(subname, recipeitem, groups, images, description, sounds)
   groups.not_in_creative_inventory = 1
   minetest.register_node(":angledstairs:stair_1ne_" .. subname, {
      description = description,
      drawtype = "nodebox",
      tiles = images,
      paramtype = "light",
      paramtype2 = "facedir",
      is_ground_content = false,
      groups = groups,
      sounds = sounds,
      drop = "angledstairs:stair_" .. subname,
      node_box = {
         type = "fixed",
         fixed = {
         {-0.4375, 0, -0.5, -0.375, 0.5, 0.375},
         {-0.375, 0, -0.5, -0.3125, 0.5, 0.3125},
         {-0.3125, 0, -0.5, -0.25, 0.5, 0.25},
         {-0.25, 0, -0.5, -0.1875, 0.5, 0.1875},
         {-0.1875, 0, -0.5, -0.125, 0.5, 0.125},
         {-0.125, 0, -0.5, -0.0625, 0.5, 0.0625},
         {-0.0625, 0, -0.5, -0, 0.5, -0},
         {-0, 0, -0.5, 0.0625, 0.5, -0.0625},
         {0.0625, 0, -0.5, 0.125, 0.5, -0.125},
         {0.125, 0, -0.5, 0.1875, 0.5, -0.1875},
         {0.1875, 0, -0.5, 0.25, 0.5, -0.25},
         {0.25, 0, -0.5, 0.3125, 0.5, -0.3125},
         {0.3125, 0, -0.5, 0.375, 0.5, -0.375},
         {0.375, 0, -0.5, 0.4375, 0.5, -0.4375},
         {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
         {-0.5, 0, -0.5, -0.4375, 0.5, 0.4375},
         },
      },
   on_punch = function(pos, node, puncher)
if node.name == "angledstairs:stair_1ne_" .. subname and
    puncher:get_wielded_item():get_name() == "angledstairs:stair_" .. subname then
    minetest.add_node(pos, {name = "angledstairs:stair_2se_" .. subname, param2 = node.param2})
      end
end,
   })

   minetest.register_node(":angledstairs:stair_2se_" .. subname, {
      description = description,
      drawtype = "nodebox",
      tiles = images,
      paramtype = "light",
      paramtype2 = "facedir",
      is_ground_content = false,
      groups = groups,
      sounds = sounds,
      drop = "angledstairs:stair_" .. subname,
      node_box = {
         type = "fixed",
         fixed = {
         {-0.4375, 0, -0.375, -0.375, 0.5, 0.5},
         {-0.375, 0, -0.3125, -0.3125, 0.5, 0.5},
         {-0.3125, 0, -0.25, -0.25, 0.5, 0.5},
         {-0.25, 0, -0.1875, -0.1875, 0.5, 0.5},
         {-0.1875, 0, -0.125, -0.125, 0.5, 0.5},
         {-0.125, 0, -0.0625, -0.0625, 0.5, 0.5},
         {-0.0625, 0, 0, -0, 0.5, 0.5},
         {-0, 0, 0.0625, 0.0625, 0.5, 0.5},
         {0.0625, 0, 0.125, 0.125, 0.5, 0.5},
         {0.125, 0, 0.1875, 0.1875, 0.5, 0.5},
         {0.1875, 0, 0.25, 0.25, 0.5, 0.5},
         {0.25, 0, 0.3125, 0.3125, 0.5, 0.5},
         {0.3125, 0, 0.375, 0.375, 0.5, 0.5},
         {0.375, 0, 0.4375, 0.4375, 0.5, 0.5},
         {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
         {-0.5, 0, -0.4375, -0.4375, 0.5, 0.5},
         },
      },
      on_punch = function(pos, node, puncher)
  if node.name == "angledstairs:stair_2se_" .. subname and
    puncher:get_wielded_item():get_name() == "angledstairs:stair_" .. subname then
    minetest.add_node(pos, {name = "angledstairs:stair_" .. subname, param2 = node.param2})
      end
end,
   })

   minetest.register_node(":angledstairs:stair_4nw_" .. subname, {
      description = description,
      drawtype = "nodebox",
      tiles = images,
      paramtype = "light",
      paramtype2 = "facedir",
      is_ground_content = false,
      groups = groups,
      sounds = sounds,
      drop = "angledstairs:stair_" .. subname,
      node_box = {
         type = "fixed",
         fixed = {
         {0.375, 0, -0.5, 0.4375, 0.5, 0.375},
         {0.3125, 0, -0.5, 0.375, 0.5, 0.3125},
         {0.25, 0, -0.5, 0.3125, 0.5, 0.25},
         {0.1875, 0, -0.5, 0.25, 0.5, 0.1875},
         {0.125, 0, -0.5, 0.1875, 0.5, 0.125},
         {0.0625, 0, -0.5, 0.125, 0.5, 0.0625},
         {0, 0, -0.5, 0.0625, 0.5, -0},
         {-0.0625, 0, -0.5, 0, 0.5, -0.0625},
         {-0.125, 0, -0.5, -0.0625, 0.5, -0.125},
         {-0.1875, 0, -0.5, -0.125, 0.5, -0.1875},
         {-0.25, 0, -0.5, -0.1875, 0.5, -0.25},
         {-0.3125, 0, -0.5, -0.25, 0.5, -0.3125},
         {-0.375, 0, -0.5, -0.3125, 0.5, -0.375},
         {-0.4375, 0, -0.5, -0.375, 0.5, -0.4375},
         {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
         {0.4375, 0, -0.5, 0.5, 0.5, 0.4375},
         },
      },
      on_punch = function(pos, node, puncher)
if node.name == "angledstairs:stair_4nw_" .. subname and
    puncher:get_wielded_item():get_name() == "angledstairs:stair_" .. subname then
    minetest.add_node(pos, {name = "angledstairs:stair_1ne_" .. subname, param2 = node.param2})
      end
end,
   })

end

function angledstairs.register_stair(subname, recipeitem, groups, images, description, sounds)
groups.stair=1
   minetest.register_node(":angledstairs:stair_" .. subname, {
      description = description,
      drawtype = "nodebox",
      tiles = images,
      paramtype = "light",
      paramtype2 = "facedir",
      is_ground_content = false,
      groups = groups,
      sounds = sounds,
      node_box = {
         type = "fixed",
         fixed = {
         {0.375, 0, -0.375, 0.4375, 0.5, 0.5},
         {0.3125, 0, -0.3125, 0.375, 0.5, 0.5},
         {0.25, 0, -0.25, 0.3125, 0.5, 0.5},
         {0.1875, 0, -0.1875, 0.25, 0.5, 0.5},
         {0.125, 0, -0.125, 0.1875, 0.5, 0.5},
         {0.0625, 0, -0.0625, 0.125, 0.5, 0.5},
         {0, 0, 0, 0.0625, 0.5, 0.5},
         {-0.0625, 0, 0.0625, 0, 0.5, 0.5},
         {-0.125, 0, 0.125, -0.0625, 0.5, 0.5},
         {-0.1875, 0, 0.1875, -0.125, 0.5, 0.5},
         {-0.25, 0, 0.25, -0.1875, 0.5, 0.5},
         {-0.3125, 0, 0.3125, -0.25, 0.5, 0.5},
         {-0.375, 0, 0.375, -0.3125, 0.5, 0.5},
         {-0.4375, 0, 0.4375, -0.375, 0.5, 0.5},
         {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
         {0.4375, 0, -0.4375, 0.5, 0.5, 0.5},
         },
      },
      on_punch = function(pos, node, puncher)
if node.name == "angledstairs:stair_" .. subname and
    puncher:get_wielded_item():get_name() == "angledstairs:stair_" .. subname then
    minetest.add_node(pos, {name = "angledstairs:stair_4nw_" .. subname, param2 = node.param2})
      end
end,
   })

end


-- Register angledslabs.
-- Node will be called angledstairs:slab_<subname>

function angledstairs.register_slab_alts(subname, recipeitem, groups, images, description, sounds)
   groups.not_in_creative_inventory = 1
   minetest.register_node(":angledstairs:slab_1ne_" .. subname, {
      description = description,
      drawtype = "nodebox",
      tiles = images,
      paramtype = "light",
      paramtype2 = "facedir",
      is_ground_content = false,
      groups = groups,
      sounds = sounds,
      drop = "angledstairs:slab_" .. subname,
      node_box = {
         type = "fixed",
         fixed = {
         {-0.5, -0.5, -0.5, 0.5, 0, -0.4375},
         {-0.5, -0.5, -0.4375, 0.4375, 0, -0.375},
         {-0.5, -0.5, -0.375, 0.375, 0, -0.3125},
         {-0.5, -0.5, -0.3125, 0.3125, 0, -0.25},
         {-0.5, -0.5, -0.25, 0.25, 0, -0.1875},
         {-0.5, -0.5, -0.1875, 0.1875, 0, -0.125},
         {-0.5, -0.5, -0.125, 0.125, 0, -0.0625},
         {-0.5, -0.5, -0.0625, 0.0625, 0, -0},
         {-0.5, -0.5, -0, -0, 0, 0.0625},
         {-0.5, -0.5, 0.0625, -0.0625, 0, 0.125},
         {-0.5, -0.5, 0.125, -0.125, 0, 0.1875},
         {-0.5, -0.5, 0.1875, -0.1875, 0, 0.25},
         {-0.5, -0.5, 0.25, -0.25, 0, 0.3125},
         {-0.5, -0.5, 0.3125, -0.3125, 0, 0.375},
         {-0.5, -0.5, 0.375, -0.375, 0, 0.4375},
         {-0.5, -0.5, 0.4375, -0.4375, 0, 0.5},
         },
      },
   on_punch = function(pos, node, puncher)
if node.name == "angledstairs:slab_1ne_" .. subname and
    puncher:get_wielded_item():get_name() == "angledstairs:slab_" .. subname then
    minetest.add_node(pos, {name = "angledstairs:slab_2se_" .. subname, param2 = node.param2})
      end
end,
   })

   minetest.register_node(":angledstairs:slab_2se_" .. subname, {
      description = description,
      drawtype = "nodebox",
      tiles = images,
      paramtype = "light",
      paramtype2 = "facedir",
      is_ground_content = false,
      groups = groups,
      sounds = sounds,
      drop = "angledstairs:slab_" .. subname,
      node_box = {
         type = "fixed",
         fixed = {
         {-0.5, -0.5, 0.4375, 0.5, 0, 0.5},
         {-0.5, -0.5, 0.375, 0.4375, 0, 0.4375},
         {-0.5, -0.5, 0.3125, 0.375, 0, 0.375},
         {-0.5, -0.5, 0.25, 0.3125, 0, 0.3125},
         {-0.5, -0.5, 0.1875, 0.25, 0, 0.25},
         {-0.5, -0.5, 0.125, 0.1875, 0, 0.1875},
         {-0.5, -0.5, 0.0625, 0.125, 0, 0.125},
         {-0.5, -0.5, 0, 0.0625, 0, 0.0625},
         {-0.5, -0.5, -0.0625, -0, 0, 0},
         {-0.5, -0.5, -0.125, -0.0625, 0, -0.0625},
         {-0.5, -0.5, -0.1875, -0.125, 0, -0.125},
         {-0.5, -0.5, -0.25, -0.1875, 0, -0.1875},
         {-0.5, -0.5, -0.3125, -0.25, 0, -0.25},
         {-0.5, -0.5, -0.375, -0.3125, 0, -0.3125},
         {-0.5, -0.5, -0.4375, -0.375, 0, -0.375},
         {-0.5, -0.5, -0.5, -0.4375, 0, -0.4375},
         },
      },
         on_punch = function(pos, node, puncher)
  if node.name == "angledstairs:slab_2se_" .. subname and
    puncher:get_wielded_item():get_name() == "angledstairs:slab_" .. subname then
    minetest.add_node(pos, {name = "angledstairs:slab_" .. subname, param2 = node.param2})
      end
end,
   })

   minetest.register_node(":angledstairs:slab_4nw_" .. subname, {
      description = description,
      drawtype = "nodebox",
      tiles = images,
      paramtype = "light",
      paramtype2 = "facedir",
      is_ground_content = false,
      groups = groups,
      sounds = sounds,
      drop = "angledstairs:slab_" .. subname,
      node_box = {
         type = "fixed",
         fixed = {
         {-0.5, -0.5, -0.5, 0.5, 0, -0.4375},
         {-0.4375, -0.5, -0.4375, 0.5, 0, -0.375},
         {-0.375, -0.5, -0.375, 0.5, 0, -0.3125},
         {-0.3125, -0.5, -0.3125, 0.5, 0, -0.25},
         {-0.25, -0.5, -0.25, 0.5, 0, -0.1875},
         {-0.1875, -0.5, -0.1875, 0.5, 0, -0.125},
         {-0.125, -0.5, -0.125, 0.5, 0, -0.0625},
         {-0.0625, -0.5, -0.0625, 0.5, 0, -0},
         {0, -0.5, -0, 0.5, 0, 0.0625},
         {0.0625, -0.5, 0.0625, 0.5, 0, 0.125},
         {0.125, -0.5, 0.125, 0.5, 0, 0.1875},
         {0.1875, -0.5, 0.1875, 0.5, 0, 0.25},
         {0.25, -0.5, 0.25, 0.5, 0, 0.3125},
         {0.3125, -0.5, 0.3125, 0.5, 0, 0.375},
         {0.375, -0.5, 0.375, 0.5, 0, 0.4375},
         {0.4375, -0.5, 0.4375, 0.5, 0, 0.5},
         },
      },
         on_punch = function(pos, node, puncher)
if node.name == "angledstairs:slab_4nw_" .. subname and
    puncher:get_wielded_item():get_name() == "angledstairs:slab_" .. subname then
    minetest.add_node(pos, {name = "angledstairs:slab_1ne_" .. subname, param2 = node.param2})
      end
end,
   })

end

function angledstairs.register_slab(subname, recipeitem, groups, images, description, sounds)
groups.slab =1
   minetest.register_node(":angledstairs:slab_" .. subname, {
      description = description,
      drawtype = "nodebox",
      tiles = images,
      paramtype = "light",
      paramtype2 = "facedir",
      is_ground_content = false,
      groups = groups,
      sounds = sounds,
      node_box = {
         type = "fixed",
         fixed = {
         {-0.5, -0.5, 0.4375, 0.5, 0, 0.5},
         {-0.4375, -0.5, 0.375, 0.5, 0, 0.4375},
         {-0.375, -0.5, 0.3125, 0.5, 0, 0.375},
         {-0.3125, -0.5, 0.25, 0.5, 0, 0.3125},
         {-0.25, -0.5, 0.1875, 0.5, 0, 0.25},
         {-0.1875, -0.5, 0.125, 0.5, 0, 0.1875},
         {-0.125, -0.5, 0.0625, 0.5, 0, 0.125},
         {-0.0625, -0.5, 0, 0.5, 0, 0.0625},
         {0, -0.5, -0.0625, 0.5, 0, 0},
         {0.0625, -0.5, -0.125, 0.5, 0, -0.0625},
         {0.125, -0.5, -0.1875, 0.5, 0, -0.125},
         {0.1875, -0.5, -0.25, 0.5, 0, -0.1875},
         {0.25, -0.5, -0.3125, 0.5, 0, -0.25},
         {0.3125, -0.5, -0.375, 0.5, 0, -0.3125},
         {0.375, -0.5, -0.4375, 0.5, 0, -0.375},
         {0.4375, -0.5, -0.5, 0.5, 0, -0.4375},
         },
      },
         on_punch = function(pos, node, puncher)
if node.name == "angledstairs:slab_" .. subname and
    puncher:get_wielded_item():get_name() == "angledstairs:slab_" .. subname then
    minetest.add_node(pos, {name = "angledstairs:slab_4nw_" .. subname, param2 = node.param2})
      end
end,
   })

end

-- Stair/slab registration function.
-- Nodes will be called angledstairs:{stair,slab}_<subname>


angledstairs.register_stair("wood", "default:wood",
      {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
      {"default_wood.png"},
      "Wooden Angled-Stair",
      "Wooden Angled-Slab",
      default.node_sound_wood_defaults())

      angledstairs.register_stair_alts("wood", "default:wood",
      {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
      {"default_wood.png"},
      "Wooden Angled-Stair",
      "Wooden Angled-Slab",
      default.node_sound_wood_defaults())

      angledstairs.register_slab("wood", "default:wood",
      {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
      {"default_wood.png"},
      "Wooden Angled-Stair",
      "Wooden Angled-Slab",
      default.node_sound_wood_defaults())

      angledstairs.register_slab_alts("wood", "default:wood",
      {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
      {"default_wood.png"},
      "Wooden Angled-Stair",
      "Wooden Angled-Slab",
      default.node_sound_wood_defaults())



I've been thinking on this a bit. I may add your code afterall. It is pretty cool (but I will have to add some explanation in the README file.)
I am also considering adding long and short, angled slopes to the mod. I Think they would be a useful addition.
When I have some time, I will look into the slopes mod, and see how well it might integrate.
I'm not crazy about adding more mod dependencies though.
Ich mag keine grünen Eier und Schinken, ich mag sie nicht Sam I Am
 

User avatar
Napiophelios
Member
 
Posts: 982
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

Re: [SOLVED] How do I add use of default textures function?

by Napiophelios » Sun Jun 05, 2016 04:08

Like I said earlier, I went the long way about it.
The node registration can be condensed a little like so:
Code: Select all
-- Stair/slab registration function.
-- Nodes will be called angledstairs:{stair,slab}_<subname>

function angledstairs.register_stair_slab(subname, recipeitem, groups, images,
      desc_stair, desc_slab, sounds)
   angledstairs.register_stair(subname, recipeitem, groups, images, desc_stair, sounds)
   angledstairs.register_slab(subname, recipeitem, groups, images, desc_slab, sounds)
end

function angledstairs.register_stair_slab_alts(subname, recipeitem, groups, images,
      desc_stair, desc_slab, sounds)
   angledstairs.register_stair_alts(subname, recipeitem, groups, images, desc_stair, sounds)
   angledstairs.register_slab_alts(subname, recipeitem, groups, images, desc_slab, sounds)
end


angledstairs.register_stair_slab("wood", "default:wood",
      {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
      {"default_wood.png"},
      "Wooden Angled-Stair",
      "Wooden Angled-Slab",
      default.node_sound_wood_defaults())

angledstairs.register_stair_slab_alts("wood", "default:wood",
      {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
      {"default_wood.png"},
      "Wooden Angled-Stair",
      "Wooden Angled-Slab",
      default.node_sound_wood_defaults())


And if you can find a way to keep the alternate nodes out of the inventory
without changing the default groups for the materials used;
You can probably condense it even more, this was just a rough idea to begin with.

Good Luck with your mod!! :)
 

User avatar
TumeniNodes
Member
 
Posts: 2827
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: [SOLVED] How do I add use of default textures function?

by TumeniNodes » Sun Jun 05, 2016 04:17

Napiophelios wrote:Like I said earlier, I went the long way about it.
The node registration can be condensed a little like so:
Code: Select all
-- Stair/slab registration function.
-- Nodes will be called angledstairs:{stair,slab}_<subname>

function angledstairs.register_stair_slab(subname, recipeitem, groups, images,
      desc_stair, desc_slab, sounds)
   angledstairs.register_stair(subname, recipeitem, groups, images, desc_stair, sounds)
   angledstairs.register_slab(subname, recipeitem, groups, images, desc_slab, sounds)
end

function angledstairs.register_stair_slab_alts(subname, recipeitem, groups, images,
      desc_stair, desc_slab, sounds)
   angledstairs.register_stair_alts(subname, recipeitem, groups, images, desc_stair, sounds)
   angledstairs.register_slab_alts(subname, recipeitem, groups, images, desc_slab, sounds)
end


angledstairs.register_stair_slab("wood", "default:wood",
      {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
      {"default_wood.png"},
      "Wooden Angled-Stair",
      "Wooden Angled-Slab",
      default.node_sound_wood_defaults())

angledstairs.register_stair_slab_alts("wood", "default:wood",
      {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
      {"default_wood.png"},
      "Wooden Angled-Stair",
      "Wooden Angled-Slab",
      default.node_sound_wood_defaults())


And if you can find a way to keep the alternate nodes out of the inventory
without changing the default groups for the materials used;
You can probably condense it even more, this was just a rough idea to begin with.

Good Luck with your mod!! :)


Nice. You are quick :D
I'll mess around with it over the next week and see what I can do.
Thank you.
Hey..., it's a 50/50 mod at this point, as you've done most of the brainwork (coding) :P
I've been reading up on Lua and slowly getting it.... (very slowly). I have difficulty learning from text, been a curse all my life. I learn far better from fiddling around, and making mistakes, or seeing a finished product first.
Ich mag keine grünen Eier und Schinken, ich mag sie nicht Sam I Am
 


Return to Modding Discussion



Who is online

Users browsing this forum: No registered users and 1 guest