Post your modding questions here

User avatar
Topywo
Member
Posts: 1721
Joined: Fri May 18, 2012 20:27

by Topywo » Post

pandaro wrote:someone has already done an anvil? I find in that mod?
sda97:

http://forum.minetest.net/viewtopic.php ... 981#p35981

User avatar
Casimir
Member
Posts: 1187
Joined: Fri Aug 03, 2012 16:59
GitHub: CasimirKaPazi

by Casimir » Post

Can you make an entity emit light?

User avatar
Likwid H-Craft
Member
Posts: 1113
Joined: Sun Jan 06, 2013 14:20
Location: Lost in Crypt

by Likwid H-Craft » Post

How do I change the sun, and the moon? since I am building a texture pack.
My Domain's/others:
http://likwidtest.hj.cx/ (Not Done)

User avatar
VanessaE
Moderator
Posts: 4551
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

by VanessaE » Post

You can't. Those are not currently texturable.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

User avatar
lkjoel
Member
Posts: 779
Joined: Wed Feb 29, 2012 19:27
Location: Gallifrey
Contact:

by lkjoel » Post

VanessaE wrote:You can't. Those are not currently texturable.
Wouldn't it be about time to send a pull request then?
My mods: The Nether | Doctor Who (WIP)

I have quit minetest ... again. I am heavily unimpressed by both the game and the community.

User avatar
Likwid H-Craft
Member
Posts: 1113
Joined: Sun Jan 06, 2013 14:20
Location: Lost in Crypt

by Likwid H-Craft » Post

Oh why they not then how come, they box looking but texture zero.
Yeah what have a pull request.
My Domain's/others:
http://likwidtest.hj.cx/ (Not Done)

User avatar
lkjoel
Member
Posts: 779
Joined: Wed Feb 29, 2012 19:27
Location: Gallifrey
Contact:

by lkjoel » Post

Likwid H-Craft wrote:Oh why they not then how come, they box looking but texture zero.
Yeah what have a pull request.
I'm not sure what you are talking about, but if you are wondering how minetest does it, it's a hardcoded rendering.
My mods: The Nether | Doctor Who (WIP)

I have quit minetest ... again. I am heavily unimpressed by both the game and the community.

User avatar
Likwid H-Craft
Member
Posts: 1113
Joined: Sun Jan 06, 2013 14:20
Location: Lost in Crypt

by Likwid H-Craft » Post

Well, I hope on 0.4.5 we have the rights to change the moon and, sun and have add something minecraft don't have.
My Domain's/others:
http://likwidtest.hj.cx/ (Not Done)

User avatar
lkjoel
Member
Posts: 779
Joined: Wed Feb 29, 2012 19:27
Location: Gallifrey
Contact:

by lkjoel » Post

Likwid H-Craft wrote:Well, I hope on 0.4.5 we have the rights to change the moon and, sun and have add something minecraft don't have.
Maybe you could file an issue (under the "enhancement" tag) to the minetest github page?
My mods: The Nether | Doctor Who (WIP)

I have quit minetest ... again. I am heavily unimpressed by both the game and the community.

User avatar
Likwid H-Craft
Member
Posts: 1113
Joined: Sun Jan 06, 2013 14:20
Location: Lost in Crypt

by Likwid H-Craft » Post

My Domain's/others:
http://likwidtest.hj.cx/ (Not Done)

User avatar
VanessaE
Moderator
Posts: 4551
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

by VanessaE » Post

A texturable sun/moon would be nice, and has been discussed before. The result of that discussion was that it would be somewhat non-trivial to do, namely because of the color-shifting that would need to be applied to the two as they rise/set.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

User avatar
pandaro
Member
Posts: 322
Joined: Sun Jan 08, 2012 21:34
GitHub: pandaro
Location: behind

by pandaro » Post

I can understand the other functions but not this:
on_blast = func(pos, intensity),
^ intensity: 1.0 = mid range of regular TNT
^ If defined, called when an explosion touches the node, instead of
removing the node
--how to a block NOT explode?
-how to calibrate the power of a explosion
I use TNT PilzAdam, I would like:
-a block does not explode,
-one explode if the explosion occurs at a short distance (1)
-and another block if the distance is greater, however, explodes (2 blocks away)

when I call this function what it does exactly?
where it needs to be made for it to work properly?
sorry for bad english
Linux debian 7 wheezy 64
kde

User avatar
pandaro
Member
Posts: 322
Joined: Sun Jan 08, 2012 21:34
GitHub: pandaro
Location: behind

by pandaro » Post

Code: Select all

local print_hello=function()
  print("hello")
end
local dtime=10.0
minetest.register_globalstep(function(dtime)
  hello()
end)
Seeking a way to update a formspec.
I will not clog up the engine by calling a function every 0.5sec or less.
Is there a way to enlarge dtime? what I posted does not seem to run.
sorry for bad english
Linux debian 7 wheezy 64
kde

User avatar
Casimir
Member
Posts: 1187
Joined: Fri Aug 03, 2012 16:59
GitHub: CasimirKaPazi

by Casimir » Post

Just a guess, there might be a better solution.

Code: Select all

minetest.register_globalstep(function(dtime)
   ifnot time then time = dtime end
   if time >= 10 then
      hello()
      time = 0
   end
   time = time + dtime
end
Last edited by Casimir on Thu Feb 14, 2013 15:43, edited 1 time in total.

User avatar
pandaro
Member
Posts: 322
Joined: Sun Jan 08, 2012 21:34
GitHub: pandaro
Location: behind

by pandaro » Post

Casimir wrote:Just a guess, there might be a better solution.

Code: Select all

minetest.register_globalstep(function(dtime)
   ifnot time then time = dtime end
   if time >= 10 then
      hello()
      time = 0
   end
   time = time + dtime
end
it works, thanks
sorry for bad english
Linux debian 7 wheezy 64
kde

User avatar
Evergreen
Member
Posts: 2135
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen
Location: A forest in the midwest
Contact:

by Evergreen » Post

I have a question about stairs and slabs. I'm making a birch tree mod, and I need to make stairs and slabs from it. Here is the code I used to add stairs and slabs:

Code: Select all

stairs.register_stair_and_slab("birch", "birch:wood",
        {cracky=3},
        {"birch_wood.png"},
        "Birch Wood stair",
        "Birch Wood slab")
But I get a run error. How do I fix?
Back from the dead!

User avatar
0gb.us
Member
Posts: 841
Joined: Sun Sep 16, 2012 01:55
Location: 0gb.us:30000
Contact:

by 0gb.us » Post

Evergreen wrote:I have a question about stairs and slabs. I'm making a birch tree mod, and I need to make stairs and slabs from it. Here is the code I used to add stairs and slabs:

Code: Select all

stairs.register_stair_and_slab("birch", "birch:wood",
        {cracky=3},
        {"birch_wood.png"},
        "Birch Wood stair",
        "Birch Wood slab")
But I get a run error. How do I fix?
The error is caused by a bug in the stable version of stairs. Copy the code in stars and change the prefix "Stairs:" to the prefix for your plugin.

User avatar
Evergreen
Member
Posts: 2135
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen
Location: A forest in the midwest
Contact:

by Evergreen » Post

0gb.us wrote:
Evergreen wrote:I have a question about stairs and slabs. I'm making a birch tree mod, and I need to make stairs and slabs from it. Here is the code I used to add stairs and slabs:

Code: Select all

stairs.register_stair_and_slab("birch", "birch:wood",
        {cracky=3},
        {"birch_wood.png"},
        "Birch Wood stair",
        "Birch Wood slab")
But I get a run error. How do I fix?
The error is caused by a bug in the stable version of stairs. Copy the code in stars and change the prefix "Stairs:" to the prefix for your plugin.
Thanks 0gb.us! :D
Last edited by Evergreen on Fri Feb 15, 2013 12:38, edited 1 time in total.
Back from the dead!

User avatar
Evergreen
Member
Posts: 2135
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen
Location: A forest in the midwest
Contact:

by Evergreen » Post

Still get a ModError.

I stuck this code inside the same init.lua

Code: Select all

stairs = {}

function birch.register_stair(subname, recipeitem, groups, images, description)
    minetest.register_node("stairs:stair_" .. subname, {
        description = description,
        drawtype = "nodebox",
        tiles = images,
        paramtype = "light",
        paramtype2 = "facedir",
        is_ground_content = true,
        groups = groups,
        node_box = {
            type = "fixed",
            fixed = {
                {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
                {-0.5, 0, 0, 0.5, 0.5, 0.5},
            },
        },
    })

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

    -- Flipped recipe for the silly minecrafters
    minetest.register_craft({
        output = 'stairs:stair_' .. subname .. ' 4',
        recipe = {
            {"", "", recipeitem},
            {"", recipeitem, recipeitem},
            {recipeitem, recipeitem, recipeitem},
        },
    })
end

-- Node will be called stairs:slab_<subname>
function birch.register_slab(subname, recipeitem, groups, images, description)
    minetest.register_node("stairs:slab_" .. subname, {
        description = description,
        drawtype = "nodebox",
        tiles = images,
        paramtype = "light",
        is_ground_content = true,
        groups = groups,
        node_box = {
            type = "fixed",
            fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
        },
        selection_box = {
            type = "fixed",
            fixed = {-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

            -- 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.env:get_node(p0)
            if n0.name == "stairs:slab_" .. subname and
                    p0.y+1 == p1.y then
                slabpos = p0
                slabnode = n0
            end
            if slabpos then
                -- Remove the slab at slabpos
                minetest.env:remove_node(slabpos)
                -- Make a fake stack of a single item and try to place it
                local fakestack = ItemStack(recipeitem)
                pointed_thing.above = slabpos
                fakestack = minetest.item_place(fakestack, placer, pointed_thing)
                -- If the item was taken from the fake stack, decrement original
                if not fakestack or fakestack:is_empty() then
                    itemstack:take_item(1)
                -- Else put old node back
                else
                    minetest.env:set_node(slabpos, slabnode)
                end
                return itemstack
            end
            
            -- Otherwise place regularly
            return minetest.item_place(itemstack, placer, pointed_thing)
        end,
    })

    minetest.register_craft({
        output = 'stairs:slab_' .. subname .. ' 3',
        recipe = {
            {recipeitem, recipeitem, recipeitem},
        },
    })
end

-- Nodes will be called stairs:{stair,slab}_<subname>
function birch.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab)
    birch.register_stair(subname, recipeitem, groups, images, desc_stair)
    birch.register_slab(subname, recipeitem, groups, images, desc_slab)
end

birch.register_stair_and_slab("birch", "birch:wood",
        {snappy=2,choppy=2,oddly_breakable_by_hand=2},
        {"birch_wood.png"},
        "Birch Wood stair",
        "Birch Wood slab")
What am I doing wrong?
Last edited by Evergreen on Fri Feb 15, 2013 13:53, edited 1 time in total.
Back from the dead!

User avatar
pandaro
Member
Posts: 322
Joined: Sun Jan 08, 2012 21:34
GitHub: pandaro
Location: behind

by pandaro » Post

there a way(automatic) to update (refresh) an opened formspec?(without pressing buttons)
Last edited by pandaro on Fri Feb 15, 2013 20:49, edited 1 time in total.
sorry for bad english
Linux debian 7 wheezy 64
kde

User avatar
stu
Member
Posts: 923
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11
Location: United Kingdom

by stu » Post

Is there any way to catch when a player takes a hit, either from an entity or from another player?

Something like: entity.on_punch = function(self, puncher) ... but for players.
Last edited by stu on Fri Feb 15, 2013 21:09, edited 1 time in total.

User avatar
Evergreen
Member
Posts: 2135
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen
Location: A forest in the midwest
Contact:

by Evergreen » Post

Evergreen wrote:Still get a ModError.

I stuck this code inside the same init.lua

Code: Select all

stairs = {}

function birch.register_stair(subname, recipeitem, groups, images, description)
    minetest.register_node("stairs:stair_" .. subname, {
        description = description,
        drawtype = "nodebox",
        tiles = images,
        paramtype = "light",
        paramtype2 = "facedir",
        is_ground_content = true,
        groups = groups,
        node_box = {
            type = "fixed",
            fixed = {
                {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
                {-0.5, 0, 0, 0.5, 0.5, 0.5},
            },
        },
    })

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

    -- Flipped recipe for the silly minecrafters
    minetest.register_craft({
        output = 'stairs:stair_' .. subname .. ' 4',
        recipe = {
            {"", "", recipeitem},
            {"", recipeitem, recipeitem},
            {recipeitem, recipeitem, recipeitem},
        },
    })
end

-- Node will be called stairs:slab_<subname>
function birch.register_slab(subname, recipeitem, groups, images, description)
    minetest.register_node("stairs:slab_" .. subname, {
        description = description,
        drawtype = "nodebox",
        tiles = images,
        paramtype = "light",
        is_ground_content = true,
        groups = groups,
        node_box = {
            type = "fixed",
            fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
        },
        selection_box = {
            type = "fixed",
            fixed = {-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

            -- 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.env:get_node(p0)
            if n0.name == "stairs:slab_" .. subname and
                    p0.y+1 == p1.y then
                slabpos = p0
                slabnode = n0
            end
            if slabpos then
                -- Remove the slab at slabpos
                minetest.env:remove_node(slabpos)
                -- Make a fake stack of a single item and try to place it
                local fakestack = ItemStack(recipeitem)
                pointed_thing.above = slabpos
                fakestack = minetest.item_place(fakestack, placer, pointed_thing)
                -- If the item was taken from the fake stack, decrement original
                if not fakestack or fakestack:is_empty() then
                    itemstack:take_item(1)
                -- Else put old node back
                else
                    minetest.env:set_node(slabpos, slabnode)
                end
                return itemstack
            end
            
            -- Otherwise place regularly
            return minetest.item_place(itemstack, placer, pointed_thing)
        end,
    })

    minetest.register_craft({
        output = 'stairs:slab_' .. subname .. ' 3',
        recipe = {
            {recipeitem, recipeitem, recipeitem},
        },
    })
end

-- Nodes will be called stairs:{stair,slab}_<subname>
function birch.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab)
    birch.register_stair(subname, recipeitem, groups, images, desc_stair)
    birch.register_slab(subname, recipeitem, groups, images, desc_slab)
end

birch.register_stair_and_slab("birch", "birch:wood",
        {snappy=2,choppy=2,oddly_breakable_by_hand=2},
        {"birch_wood.png"},
        "Birch Wood stair",
        "Birch Wood slab")
What am I doing wrong?
Nvm, I fixed it.
Back from the dead!

User avatar
Evergreen
Member
Posts: 2135
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen
Location: A forest in the midwest
Contact:

by Evergreen » Post

Now I have another question. Is the function math.random part of minetest?
Back from the dead!

User avatar
PilzAdam
Member
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam
Location: Germany

by PilzAdam » Post

Evergreen wrote:Now I have another question. Is the function math.random part of minetest?
No, its part of Lua.

User avatar
Evergreen
Member
Posts: 2135
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen
Location: A forest in the midwest
Contact:

by Evergreen » Post

PilzAdam wrote:
Evergreen wrote:Now I have another question. Is the function math.random part of minetest?
No, its part of Lua.
Thanks
Back from the dead!

Locked

Who is online

Users browsing this forum: Google [Bot] and 2 guests