Post your modding questions here

Locked
User avatar
wcwyes
Member
Posts: 145
Joined: Wed Jul 31, 2013 22:42

by wcwyes » Post

I found the spawn command on our server

Code: Select all

-- Suicide command

minetest.register_chatcommand("spawn",
{
    params = "",
    description = "Causes you to die and respawn",
    func = function(name, param)
        minetest.env:get_player_by_name(name):set_hp(0);
    end
})

how would I get the static spawn instead of set_hp(0)?

User avatar
fairiestoy
Member
Posts: 191
Joined: Sun Jun 09, 2013 19:25
Location: Germany

by fairiestoy » Post

I suggest you dig through this here:
Multispawn
Use this mod as it is, or just extract the spawn/teleport part of it
Interesting about new things is, to figure out how it works ...

User avatar
wcwyes
Member
Posts: 145
Joined: Wed Jul 31, 2013 22:42

by wcwyes » Post

None of these appear to refer to the static spawn.
fairiestoy wrote:I suggest you dig through this here:
Multispawn
Use this mod as it is, or just extract the spawn/teleport part of it

User avatar
paramat
Developer
Posts: 3699
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

by paramat » Post

paramat wrote:Once i get my mits on 0.4.8 stable how do i make "air" nodes drownable, for my space mods, is it even possible?
The answer it seems is yes, "air" can be redefined in lua and made drownable.
"air" is a node defined in 'builtin/misc_register.lua' https://github.com/minetest/minetest/bl ... r.lua#L276
I rely on donations for basic income. PayPal viewtopic.php?f=3&t=14935 Patreon https://www.patreon.com/paramat

User avatar
fairiestoy
Member
Posts: 191
Joined: Sun Jun 09, 2013 19:25
Location: Germany

by fairiestoy » Post

wcwyes wrote:None of these appear to refer to the static spawn.
fairiestoy wrote:I suggest you dig through this here:
Multispawn
Use this mod as it is, or just extract the spawn/teleport part of it
And again i suggest to use google. If you google 'minetest static spawn', you get enough answers ( i prefer the second link, is more up to date ). Question is: Are you talking about the spawn set in config: Use minetest.setting_get ( or so ) from the API to get the value and let the user spawn there. Otherwise use the mod i linked as reference to set your own spawn point.
Interesting about new things is, to figure out how it works ...

User avatar
wcwyes
Member
Posts: 145
Joined: Wed Jul 31, 2013 22:42

by wcwyes » Post

fairiestoy wrote:
wcwyes wrote:None of these appear to refer to the static spawn.
fairiestoy wrote:I suggest you dig through this here:
Multispawn
Use this mod as it is, or just extract the spawn/teleport part of it
And again i suggest to use google. If you google 'minetest static spawn', you get enough answers ( i prefer the second link, is more up to date ). Question is: Are you talking about the spawn set in config: Use minetest.setting_get ( or so ) from the API to get the value and let the user spawn there. Otherwise use the mod i linked as reference to set your own spawn point.
It says setpos expects a table. not a string

Code: Select all

minetest.register_chatcommand("spawn",
{
    params = "",
    description = "Causes you to die and respawn",
    func = function(name, pos)
        local spawn_point = minetest.setting_get("static_spawnpoint")
        local player = minetest.env:get_player_by_name(name)
        player:setpos(spawn_point);
    end
})
Last edited by wcwyes on Sat Nov 09, 2013 07:40, edited 1 time in total.

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

by kaeza » Post

Code: Select all

minetest.register_chatcommand("spawn", {
    params = "",
    description = "Return to spawn",
    func = function(name)
        local spawn_point = minetest.string_to_pos(minetest.setting_get("static_spawnpoint") or "0,0,0")
        local player = minetest.get_player_by_name(name)
        player:setpos(spawn_point);
    end
})
Last edited by kaeza on Sat Nov 09, 2013 07:30, edited 1 time in total.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

User avatar
wcwyes
Member
Posts: 145
Joined: Wed Jul 31, 2013 22:42

by wcwyes » Post

kaeza wrote:

Code: Select all

minetest.register_chatcommand("spawn", {
    params = "",
    description = "Return to spawn",
    func = function(name)
        local spawn_point = minetest.string_to_pos(minetest.setting_get("static_spawnpoint") or "0,0,0")
        local player = minetest.get_player_by_name(name)
        player:setpos(spawn_point);
    end
})
thanks

User avatar
Neon
Member
Posts: 126
Joined: Thu Aug 15, 2013 02:03
In-game: Neon

by Neon » Post

There has got to be a faster way to substitute one node for another on a massive scale during mapgen..

Code: Select all

locations = minetest.find_nodes_in_area(minp, maxp, sand_nodes)
for k,v in ipairs(locations) do
minetest.set_node( v, {name=sand_replacement_node} )
end
This slows mapgen waaaay down. is there a better way to do this?

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

by Casimir » Post

LuaVoxelManipulator?

User avatar
wcwyes
Member
Posts: 145
Joined: Wed Jul 31, 2013 22:42

by wcwyes » Post

How do I check for hostile mobs around me?

User avatar
mectus11
Member
Posts: 14
Joined: Tue Nov 12, 2013 21:32
Location: Tunisia
Contact:

by mectus11 » Post

How do I form a tree that contains my wood block and my leaf block?
Last edited by mectus11 on Fri Nov 15, 2013 12:12, edited 1 time in total.
Sup, I'm Fadi and you're reading this.
Main project
My mod

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

by Topywo » Post

mectus11 wrote:How do I form a tree that contains my wood block and my leaf block?
Search for tree in your minetest/doc/lua_api.txt fot the use of L-system trees.


Edit: Typo.
Last edited by Topywo on Fri Nov 15, 2013 14:01, edited 1 time in total.

User avatar
mectus11
Member
Posts: 14
Joined: Tue Nov 12, 2013 21:32
Location: Tunisia
Contact:

by mectus11 » Post

Topywo wrote:
mectus11 wrote:How do I form a tree that contains my wood block and my leaf block?
Search for tree in your minetest/doc/lua_api.txt fot the use of L-system trees.


Edit: Typo.
Thank you, I was told this before by kaeza but he didn't really what to put in the tree definition before but I searched more and found it so thanks again, well I never asked him further more about it lol anyway ye thanks
Last edited by mectus11 on Fri Nov 15, 2013 15:14, edited 1 time in total.
Sup, I'm Fadi and you're reading this.
Main project
My mod

User avatar
mectus11
Member
Posts: 14
Joined: Tue Nov 12, 2013 21:32
Location: Tunisia
Contact:

by mectus11 » Post

Can I put dibs on a mod idea?
I'm working on this great project and it would go to waste if someone finishes theirs that turns out to be the same concept as mine :/
Sup, I'm Fadi and you're reading this.
Main project
My mod

User avatar
paramat
Developer
Posts: 3699
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

by paramat » Post

No you can't :) make it anyway and if in the unlikely event someone else makes something similar just make yours better.
I rely on donations for basic income. PayPal viewtopic.php?f=3&t=14935 Patreon https://www.patreon.com/paramat

User avatar
Gambit
Member
Posts: 453
Joined: Sat Oct 29, 2011 19:31
Location: United States

by Gambit » Post

What's a good way to generate cocoa in jungle trees? I've thought of generating them using the ore structure I'm not to sure that's the best option to choose. I need the cocoa to generate even if the tree was grown through sapling.

Also, what would be the best method for generating pumpkins at well?
Current Projects: MineToon | PixelBOX
Gambit's Checkmate Server - 43.65.296.232 - port: 30001

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

Gambit wrote:What's a good way to generate cocoa in jungle trees? I've thought of generating them using the ore structure I'm not to sure that's the best option to choose. I need the cocoa to generate even if the tree was grown through sapling.

Also, what would be the best method for generating pumpkins at well?
I'm not sure about the tree, but you can look at the grass spawning code for use in the pumpkins: https://github.com/minetest/minetest_ga ... mapgen.lua
Last edited by Evergreen on Fri Nov 15, 2013 22:05, edited 1 time in total.
Back from the dead!

User avatar
Chinchow
Member
Posts: 684
Joined: Tue Sep 18, 2012 21:37

by Chinchow » Post

For some reason the plant for one of the new biomes won't grow and I can't figure out why. Could anyone more experienced tell me?

Code: Select all

local function place_seed(itemstack, placer, pointed_thing, plantname)
    local pt = pointed_thing
    -- check if pointing at a node
    if not pt then
        return
    end
    if pt.type ~= "node" then
        return
    end
    
    local under = minetest.get_node(pt.under)
    local above = minetest.get_node(pt.above)
    
    -- return if any of the nodes is not registered
    if not minetest.registered_nodes[under.name] then
        return
    end
    if not minetest.registered_nodes[above.name] then
        return
    end
    
    -- check if pointing at the top of the node
    if pt.above.y ~= pt.under.y+1 then
        return
    end
    
    -- check if you can replace the node above the pointed node
    if not minetest.registered_nodes[above.name].buildable_to then
        return
    end

-- check if pointing at soil
    if minetest.get_item_group(under.name, "soil") <= 1 then
        return
    end

minetest.add_node(pt.above, {name=plantname})
    if not minetest.setting_getbool("creative_mode") then
        itemstack:take_item()
    end
    return itemstack
end


minetest.register_craftitem("ethereal:mushroom_craftingitem", {
    description = "Mushroom",
    groups = {not_in_creative_inventory=1},
    inventory_image = "mushroom.png",
    on_place = function(itemstack, placer, pointed_thing)
        return place_seed(itemstack, placer, pointed_thing, "ethereal:mushroom_garden_1")
    end,
})


for i=1,4 do
    local drop = {
        items = {
            {items = {'ethereal:mushroom'},rarity=9-i},
            {items = {'ethereal:mushroom 9'},rarity=18-i*2},
                    }
    }
minetest.register_node("ethereal:mushroom_garden_"..i, {
        drawtype = "plantlike",
        tiles = {"ethereal_mushroom_garden_"..i..".png"},
        paramtype = "light",
        walkable = false,
        drop = drop,
        buildable_to = true,
        is_ground_content = true,
        drop = drop,
        selection_box = {
            type = "fixed",
            fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
        },
        groups = {snappy=3,flammable=2,plant=1,mushroom=i,attached_node=1},
        sounds = default.node_sound_leaves_defaults(),
    })
end

minetest.register_abm({
    nodenames = {"group:mushroom"},
    neighbors = {"group:soil"},
    interval = 1,
    chance = 10000,
    action = function(pos, node)
        -- return if already full grown
        if minetest.get_item_group(node.name, "mushroom") == 4 then
            return
        end
        
        -- check if on wet soil
        pos.y = pos.y-1
        local n = minetest.get_node(pos)
        if minetest.get_item_group(n.name, "soil") < 3 then
            return
        end
        pos.y = pos.y+1
        
        -- check light
        if not minetest.get_node_light(pos) then
            return
        end
        if minetest.get_node_light(pos) < 13 then
            return
        end
        
        -- grow
        local height = minetest.get_item_group(node.name, "mushroom") + 1
        minetest.set_node(pos, {name="ethereal:mushroom_garden_"..height})
    end
})
Sometimes, it's harder to think up a mod than it is to create it.
Mods: Orichalcum Stonebricks Extra Chests

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

by Topywo » Post

Chinchow wrote:For some reason the plant for one of the new biomes won't grow and I can't figure out why.

chance = 10000,
Did you try it with a chance = 1 or 2?

User avatar
Chinchow
Member
Posts: 684
Joined: Tue Sep 18, 2012 21:37

by Chinchow » Post

Topywo wrote:
Chinchow wrote:For some reason the plant for one of the new biomes won't grow and I can't figure out why.

chance = 10000,
Did you try it with a chance = 1 or 2?
Oops I forgot chances were inverted thank you.
Sometimes, it's harder to think up a mod than it is to create it.
Mods: Orichalcum Stonebricks Extra Chests

User avatar
TenPlus1
Member
Posts: 2880
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

by TenPlus1 » Post

How about a person protection block that when placed creates a 5x5 area around it where you cannot be hit, attacked or hurt (ideal for spawn areas until your game loads, or homes)... Of course make them hard to craft, maybe 8 diamond blocks and a mithril block in the centre, otherwise people's whole house will be filled with them...

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

by Casimir » Post

Can you somehow get pointed_thing for a given player? I don't mean "function(pointed_thing)", more like "pointed_thing = player.get_pointed_thing".

User avatar
Enke
Member
Posts: 469
Joined: Fri Nov 15, 2013 02:56
GitHub: NANOsoldierEnke
IRC: Enke
In-game: Enke
Location: The internet

by Enke » Post

I realise this sounds derpy, but here goes.

I am trying to make my first mod. It is very simple, only adds two blocks. This is my code:

Code: Select all

minetest.register_node("troll:troll", {
    tiles = {"troll:troll.png"},
    groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
})
minetest.register_node("troll:derp", {
    tiles = {"troll:derp.png"},
    groups = {snappy=1,choppy=3,oddly_breakable_by_han=2,flmmable=1},
})
When I try to test it in my world, I get the following error:

Code: Select all

22:03:08: ERROR[main]: generateImage(): Could not load image "troll:troll.png" while building texture
22:03:08: ERROR[main]: generateImage(): Creating a dummy image for "troll:troll.png"
22:03:08: ERROR[main]: generateImage(): Could not load image "troll:derp.png" while building texture
22:03:08: ERROR[main]: generateImage(): Creating a dummy image for "troll:derp.png"
I have the mod enabled and textures created for both blocks, and have them named "troll_troll" and "troll_derp". Could someone help me with this?

(P.S., this mod will not be released, just a little test to see if I can even make mods.)
Lush8
ExtraVars for Red Eclipse

<Anarchid> my turn was still the most awesome, yielding all the cripples, two captured paranormals, and death rate of about 30%
<ORCACommander> Anarchid: you need to work harder
<ORCACommander> I am hereby putting you under review until you can increase the casualty rate

User avatar
paramat
Developer
Posts: 3699
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

by paramat » Post

tiles should be "troll_troll.png" not "troll:troll.png" etc :)
Last edited by paramat on Tue Nov 19, 2013 06:41, edited 1 time in total.
I rely on donations for basic income. PayPal viewtopic.php?f=3&t=14935 Patreon https://www.patreon.com/paramat

Locked

Who is online

Users browsing this forum: Andrey01, Baidu [Spider] and 3 guests