Post your modding questions here

playzooki
Member
 
Posts: 232
Joined: Wed Oct 24, 2012 18:58

by playzooki » Sun Sep 01, 2013 20:01

i put it into default... ill try it.
bad signature is bad
 

playzooki
Member
 
Posts: 232
Joined: Wed Oct 24, 2012 18:58

by playzooki » Sun Sep 01, 2013 20:12

how do i add custom sounds?
bad signature is bad
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

by kaeza » Sun Sep 01, 2013 21:09

playzooki wrote:how do i add custom sounds?

https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L188

Edit: Also here: http://dev.minetest.net/register_node#Node_definition (search for "sounds")
Last edited by kaeza on Sun Sep 01, 2013 21:11, 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 | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

playzooki
Member
 
Posts: 232
Joined: Wed Oct 24, 2012 18:58

by playzooki » Mon Sep 02, 2013 19:12

Thanks!

EDIT: I still cant get it to work :s
Last edited by playzooki on Mon Sep 02, 2013 19:23, edited 1 time in total.
bad signature is bad
 

derpswa99
Member
 
Posts: 78
Joined: Sun Mar 24, 2013 21:26

by derpswa99 » Mon Sep 02, 2013 19:18

Simple code to spawn a tree anyone?
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

by kaeza » Mon Sep 02, 2013 20:49

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 | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

by kaeza » Mon Sep 02, 2013 20:50

playzooki wrote:Thanks!

EDIT: I still cant get it to work :s

What is the issue?
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 | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

playzooki
Member
 
Posts: 232
Joined: Wed Oct 24, 2012 18:58

by playzooki » Mon Sep 02, 2013 20:54

i dunno, just plays normal sounds, not what was intended
bad signature is bad
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

by kaeza » Mon Sep 02, 2013 21:16

playzooki wrote:i dunno, just plays normal sounds, not what was intended

can you paste the relevant section of code?
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 | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

super_tnt
Member
 
Posts: 22
Joined: Mon Sep 02, 2013 17:56

by super_tnt » Mon Sep 02, 2013 22:30

Ok I'm pretty new to the whole modding scene and so far it looks amazing. I want to create a mod like technic (I know it's a big thing for a newbie but I've always learnt like that) and I'm looking at inventory management. I've looked at the chest lua file and I can understand that formspec is like the GUI library, correct? But I can't get my head around this little bit for the location: list[current_name;main;0,0;8,4;]

What is "current_name", I've seen it used in the furnace also but I just don't know what it is so I can't play with it.

Next question is irrelevant to the previous. I want to create multiblock structure and I'm unsure how multiple blocks can share inventory/information, do the same actions when a person activates it and what not. I think I should be looking at detatched inventory but yet again I'm unsure what it is.
 

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

by PilzAdam » Mon Sep 02, 2013 22:32

super_tnt wrote:Ok I'm pretty new to the whole modding scene and so far it looks amazing. I want to create a mod like technic (I know it's a big thing for a newbie but I've always learnt like that) and I'm looking at inventory management. I've looked at the chest lua file and I can understand that formspec is like the GUI library, correct? But I can't get my head around this little bit for the location: list[current_name;main;0,0;8,4;]

What is "current_name", I've seen it used in the furnace also but I just don't know what it is so I can't play with it.

https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L1020
 

super_tnt
Member
 
Posts: 22
Joined: Mon Sep 02, 2013 17:56

by super_tnt » Mon Sep 02, 2013 22:43


ah, ok, I new I should have looked further down, sorry about that. So anyway, current_name is just saying use the metadata from this node? This also clears up detached inventory, with detached inventory I could create an ender chest or something similar, right?

Thank you for showing me that.

Edit: Just created the ender chest, just created a detached inventory and made the chest code look here instead of metadata.
Last edited by super_tnt on Mon Sep 02, 2013 23:21, edited 1 time in total.
 

User avatar
CraigyDavi
Member
 
Posts: 565
Joined: Sat Aug 10, 2013 13:08
GitHub: davisonio
IRC: davisonio or CraigyDavi
In-game: davisonio or CraigyDavi

by CraigyDavi » Tue Sep 03, 2013 08:51

If there a mod which can stop people from placing buckets?I still want to be able to pick up water and lava but not place it.
And then if people on the server want to place water or lava they can ask me and i will type /giveme water_source and place it where they want it.

If there a mod to disable placing of buckets, or a simple way to remove bits of code?
 

super_tnt
Member
 
Posts: 22
Joined: Mon Sep 02, 2013 17:56

by super_tnt » Tue Sep 03, 2013 14:04

CraigyDavi wrote:If there a mod which can stop people from placing buckets?I still want to be able to pick up water and lava but not place it.
And then if people on the server want to place water or lava they can ask me and i will type /giveme water_source and place it where they want it.

If there a mod to disable placing of buckets, or a simple way to remove bits of code?



I think I can, let me have a look through the code, if anything it will be in the bucket's lua file.
 

playzooki
Member
 
Posts: 232
Joined: Wed Oct 24, 2012 18:58

by playzooki » Tue Sep 03, 2013 18:41

kaeza wrote:
playzooki wrote:i dunno, just plays normal sounds, not what was intended

can you paste the relevant section of code?

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
function default.node_sound_rick_defaults(table)
    table = table or {}
    table.footstep = table.footstep or
            {name="rickroll", gain=1.0}
    table.dug = table.dug or
            {name="rickroll", gain=1.0}
    default.node_sound_defaults(table)
    return table
end


minetest.register_node("rickroll:rickroll", {
    description = "You just got Rickrolled!",
    tiles = {"rickroll.png"},
    is_ground_content = true,
    groups = {hot=3, cracky=2},
    drop = 'rickroll:rickroll',
    legacy_mineral = true,
    sounds = default.node_sound_rick_defaults(),
    damage_per_second = 8*2,
})
bad signature is bad
 

User avatar
Dan Duncombe
Member
 
Posts: 904
Joined: Thu May 09, 2013 21:11

by Dan Duncombe » Tue Sep 03, 2013 20:23

Pretty much, I need help doing everything on this mod's todo list:
https://forum.minetest.net/viewtopic.php?id=7126
Some Mods: Castles Prefab Camouflage
My Games: Nostalgia Realtest Revamped
Servers: See above games.
 

super_tnt
Member
 
Posts: 22
Joined: Mon Sep 02, 2013 17:56

by super_tnt » Wed Sep 04, 2013 12:42

Another question: If I change a node using setnode, is its ondig function called, if not can I call it myself?

Edit: ignore, I found out
Last edited by super_tnt on Wed Sep 04, 2013 16:59, edited 1 time in total.
 

User avatar
stu
Member
 
Posts: 737
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11

by stu » Thu Sep 05, 2013 18:48

Is there any way to load a minetest schematic file directly into a VoxelManip object? ie without actually placing the schematic.
Last edited by stu on Thu Sep 05, 2013 18:56, edited 1 time in total.
 

User avatar
Gambit
Member
 
Posts: 452
Joined: Sat Oct 29, 2011 19:31

by Gambit » Thu Sep 05, 2013 19:33

I was wondering if anyone can give an understandable guide on creating a Brewing Screen. I had a plan to make a Cauldron mod with a brewing system that requires 4 items, 1 item is a bottle of water and the other 3 are various items as recipes.

This is the kind of screen I was hoping to build.
Image

Also, I barely understand the lingo the lua guide tells me.
Current Projects: MineToon | PixelBOX
Gambit's Checkmate Server - 43.65.296.232 - port: 30001
 

User avatar
Evergreen
Member
 
Posts: 2131
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

by Evergreen » Thu Sep 05, 2013 19:48

Gambit wrote:I was wondering if anyone can give an understandable guide on creating a Brewing Screen. I had a plan to make a Cauldron mod with a brewing system that requires 4 items, 1 item is a bottle of water and the other 3 are various items as recipes.

This is the kind of screen I was hoping to build.
http://ubuntuone.com/28mwR0cKIFUlTX87iOOSN2

Also, I barely understand the lingo the lua guide tells me.
It is pretty easy to make the formspec, but making it functional is another thing entirely. You would need to make an api for making potion recipes, and the potions themselves, as well as making the brewing actually work.
Last edited by Evergreen on Thu Sep 05, 2013 19:48, edited 1 time in total.
"Help! I searched for a mod but I couldn't find it!"
http://krock-works.16mb.com/MTstuff/modSearch.php
 

User avatar
Gambit
Member
 
Posts: 452
Joined: Sat Oct 29, 2011 19:31

by Gambit » Thu Sep 05, 2013 19:57

Evergreen wrote:
Gambit wrote:I was wondering if anyone can give an understandable guide on creating a Brewing Screen. I had a plan to make a Cauldron mod with a brewing system that requires 4 items, 1 item is a bottle of water and the other 3 are various items as recipes.

This is the kind of screen I was hoping to build.
http://ubuntuone.com/28mwR0cKIFUlTX87iOOSN2

Also, I barely understand the lingo the lua guide tells me.
It is pretty easy to make the formspec, but making it functional is another thing entirely. You would need to make an api for making potion recipes, and the potions themselves, as well as making the brewing actually work.


That's what I was worried about. Thanks for feedback though. Perhaps in a future build of Minetest when development needs a new challenge we might see something like this come along.
Current Projects: MineToon | PixelBOX
Gambit's Checkmate Server - 43.65.296.232 - port: 30001
 

User avatar
Evergreen
Member
 
Posts: 2131
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

by Evergreen » Thu Sep 05, 2013 20:12

Gambit wrote:
Evergreen wrote:
Gambit wrote:I was wondering if anyone can give an understandable guide on creating a Brewing Screen. I had a plan to make a Cauldron mod with a brewing system that requires 4 items, 1 item is a bottle of water and the other 3 are various items as recipes.

This is the kind of screen I was hoping to build.
http://ubuntuone.com/28mwR0cKIFUlTX87iOOSN2

Also, I barely understand the lingo the lua guide tells me.
It is pretty easy to make the formspec, but making it functional is another thing entirely. You would need to make an api for making potion recipes, and the potions themselves, as well as making the brewing actually work.


That's what I was worried about. Thanks for feedback though. Perhaps in a future build of Minetest when development needs a new challenge we might see something like this come along.
A good place to look for code is the code for the furnace. Brewing works in a very similar fashion, so it might be helpful.
"Help! I searched for a mod but I couldn't find it!"
http://krock-works.16mb.com/MTstuff/modSearch.php
 

User avatar
Gambit
Member
 
Posts: 452
Joined: Sat Oct 29, 2011 19:31

by Gambit » Thu Sep 05, 2013 20:15

Evergreen wrote:
Gambit wrote:
Evergreen wrote:It is pretty easy to make the formspec, but making it functional is another thing entirely. You would need to make an api for making potion recipes, and the potions themselves, as well as making the brewing actually work.


That's what I was worried about. Thanks for feedback though. Perhaps in a future build of Minetest when development needs a new challenge we might see something like this come along.
A good place to look for code is the code for the furnace. Brewing works in a very similar fashion, so it might be helpful.


Thanks, I'll try to breaking it down from there. I may not be able to make the brewing cauldron that I really want, but I have to start somewhere.
Current Projects: MineToon | PixelBOX
Gambit's Checkmate Server - 43.65.296.232 - port: 30001
 

User avatar
Dan Duncombe
Member
 
Posts: 904
Joined: Thu May 09, 2013 21:11

by Dan Duncombe » Thu Sep 05, 2013 20:18

Gambit wrote:
Evergreen wrote:
Gambit wrote:
That's what I was worried about. Thanks for feedback though. Perhaps in a future build of Minetest when development needs a new challenge we might see something like this come along.
A good place to look for code is the code for the furnace. Brewing works in a very similar fashion, so it might be helpful.


Thanks, I'll try to breaking it down from there. I may not be able to make the brewing cauldron that I really want, but I have to start somewhere.

Also try looking at the formspec for my Factory in the industry pack, and the code related to that too,it is in the Modding Generalk section right now.
Some Mods: Castles Prefab Camouflage
My Games: Nostalgia Realtest Revamped
Servers: See above games.
 

derpswa99
Member
 
Posts: 78
Joined: Sun Mar 24, 2013 21:26

by derpswa99 » Sat Sep 07, 2013 17:41

Easy way to animate tool textures while youre holding them in your hand and inventory? Perhaps a really short code of some kind? Will be highly appreciated.
 

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

by PilzAdam » Sat Sep 07, 2013 17:48

derpswa99 wrote:Easy way to animate tool textures while youre holding them in your hand and inventory? Perhaps a really short code of some kind? Will be highly appreciated.

Not possible.
 

derpswa99
Member
 
Posts: 78
Joined: Sun Mar 24, 2013 21:26

by derpswa99 » Sat Sep 07, 2013 19:44

PilzAdam wrote:
derpswa99 wrote:Easy way to animate tool textures while youre holding them in your hand and inventory? Perhaps a really short code of some kind? Will be highly appreciated.

Not possible.


Ohh, dissapointing :(
 

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

by fairiestoy » Tue Sep 10, 2013 10:26

Hello guys,

i found the following lines within the /builtin/misc.lua:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
function minetest.get_connected_players()
    -- This could be optimized a bit, but leave that for later
    local list = {}
    for _, obj in pairs(minetest.get_objects_inside_radius({x=0,y=0,z=0}, 1000000)) do
        if obj:is_player() then
            table.insert(list, obj)
        end
    end
    return list
end


Wouldn't it be a bit better according to performance if one replaces it with this:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local player_list = {}

mintest.register_on_joinplayer( function( player_ref )
    table.insert( player_list, player_ref )
end

minetest.register_on_leaveplayer( function( player_ref )
    for index, value in pairs( player_list ) do
        if player_ref:get_player_name() == value:get_player_name() then
            table.remove( player_list, index )
        end
    end
end

function minetest.get_connected_players()
    return player_list
end


It needs two more registrations and a seperate table, but we don't force the engine to first collect
all objects within the given distance and then iterate through all these collected objects just to check
if its a player or not. Its possible that im wrong somehow, but i came up with this when i woke up,
so the code is not tested up to now.
Interesting about new things is, to figure out how it works ...
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

by Casimir » Tue Sep 10, 2013 19:31

You had some typos but it works for me.
And when you consider a server with thousands of saplings on the ground the old method is ridiculous.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local player_list = {}

minetest.register_on_joinplayer( function( player_ref )
    table.insert( player_list, player_ref )
end)

minetest.register_on_leaveplayer( function( player_ref )
    for index, value in pairs( player_list ) do
        if player_ref:get_player_name() == value:get_player_name() then
            table.remove( player_list, index )
        end
    end
end)

function minetest.get_connected_players()
    return player_list
end
 

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

by fairiestoy » Tue Sep 10, 2013 20:47

Casimir wrote:You had some typos but it works for me.
And when you consider a server with thousands of saplings on the ground the old method is ridiculous.


Thanks for correcting the code. I needed a bit before i saw them.
Interesting about new things is, to figure out how it works ...
 

PreviousNext

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 5 guests

cron