Post your modding questions here

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

by kaeza » Thu Jun 20, 2013 16:19

bdjnk wrote:
kaeza wrote:
bdjnk wrote:
I've got some code I'd like to execute whenever a certain type of node is added to the world, including when starting / playing / connecting to the game. Node definitions have lua functions for when hooking to events, for instance on_construct which seemed to most likely candidate, but that doesn't work. Is there some way to do this?



on_construct is only called when the node is placed. Unfortunately, what you require is not so easy (if even practical) to implement.

Edit: I assume you mean the code is run *only* once after connecting. Am I mistaken?



I wasn't very clear, sorry. Yeah, I want it to run once, but probably just when the game / server starts. I don't think I need it for all connecting / joining. I would've thought there'd be some kind of mapping / node creation process that occurred which I'd be able to link into...

Still, I gonna try and use register_on_joinplayer or register_on_newplayer and a find_nodes_in_area. I don't think it's the "right" answer, but it might work.

Oh, on that note, what is the difference between register_on_joinplayer and register_on_newplayer? The wiki isn't very clear about it.

on_join gets called every time a player joins. on_new is only called every time a *new* player joins your server (i.e. a player that never joined your server before).
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
Dan Duncombe
Member
 
Posts: 904
Joined: Thu May 09, 2013 21:11

by Dan Duncombe » Sun Jun 23, 2013 19:02

How do I make a node that plays a certain sound for a certain range upon receiving mesecon signal? Also, how do I change the range? The sound needs to loop as long as a current is being received.
EDIT: Also, with custom nodebox shapes, are the first 3 numbers the box shape, the second 3 the location of the box relative to the node centre?
Last edited by Dan Duncombe on Sun Jun 23, 2013 22:42, edited 1 time in total.
Some Mods: Castles Prefab Camouflage
My Games: Nostalgia Realtest Revamped
Servers: See above games.
 

1244
Member
 
Posts: 45
Joined: Fri Jul 13, 2012 16:40

by 1244 » Sun Jun 23, 2013 21:20

It is possible to write mod in c++?
 

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 Jun 24, 2013 00:18

1244 wrote:It is possible to write mod in c++?

A .dll or .so that can directly interface with the engine, nope.
Only way to "mod" in C/C++ is by writing patches for the engine.
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 Jun 24, 2013 00:20

Dan Duncombe wrote:How do I make a node that plays a certain sound for a certain range upon receiving mesecon signal? Also, how do I change the range? The sound needs to loop as long as a current is being received.
EDIT: Also, with custom nodebox shapes, are the first 3 numbers the box shape, the second 3 the location of the box relative to the node centre?

the first three ones are one corner of the box, and the other three are the other corner.

All positions are relative to the *center* of the node, so -0.5 and 0.5 means the edge. Of course, you can use boxes bigger than a node, but the collision is buggy.
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
Mossmanikin
Member
 
Posts: 599
Joined: Sun May 19, 2013 16:26

by Mossmanikin » Mon Jun 24, 2013 02:03

Dan Duncombe wrote:EDIT: Also, with custom nodebox shapes, are the first 3 numbers the box shape, the second 3 the location of the box relative to the node centre?


The dimensions of a standard node:

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
--              { left  , bottom , front  ,  right ,  top   ,  back  }

local cube =    {-0.5   , -0.5   , -0.5   ,  0.5   ,  0.5   ,  0.5   }

Noob 4 life!
My stuff
 

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

by Dan Duncombe » Mon Jun 24, 2013 06:28

So...The first 3 are one half of the block, the other three are the other half of the block?
Some Mods: Castles Prefab Camouflage
My Games: Nostalgia Realtest Revamped
Servers: See above games.
 

User avatar
Mossmanikin
Member
 
Posts: 599
Joined: Sun May 19, 2013 16:26

by Mossmanikin » Mon Jun 24, 2013 07:23

Dan Duncombe wrote:So...The first 3 are one half of the block, the other three are the other half of the block?


Sort of, yes. But you still need 6 coordinates to draw a "half block". ;)

EDIT: Have you seen this post? VanessaE explains quite well how a nodebox works there.
Last edited by Mossmanikin on Mon Jun 24, 2013 07:41, edited 1 time in total.

Noob 4 life!
My stuff
 

yohanes828
Member
 
Posts: 67
Joined: Sat Jun 01, 2013 01:05

by yohanes828 » Mon Jun 24, 2013 08:26

i have edit blocks
 

zoropig
Member
 
Posts: 50
Joined: Fri May 03, 2013 13:18

by zoropig » Tue Jun 25, 2013 15:55

ok so im making a squid mod but everytime i try to start a minetest game i says that it faild. help plz
i'm new too all this still but i will try to make mods and textures check out my map too!
 

zoropig
Member
 
Posts: 50
Joined: Fri May 03, 2013 13:18

by zoropig » Tue Jun 25, 2013 16:11

how do i make it so that then there will be a boss health at the top of the screen?
i'm new too all this still but i will try to make mods and textures check out my map too!
 

Thermal_Shock
Member
 
Posts: 76
Joined: Mon Jun 24, 2013 09:10

by Thermal_Shock » Wed Jun 26, 2013 11:42

I have a couple of issues at the moment that are hampering me. Most likely entirely because of my limited experience with coding.

The first is that my modded blocks don't seem to work properly when adding them to the stairs mod from the Minetest game. The new node blocks were defined within the default folder in the nodes.lua file just like the Minetest game. These are my block definitions in the stairs mod.

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
--
--This one works fine. The Limestone block uses the default stone ID.
--
stairs.register_stair_and_slab("Limestone", "default:stone",
        {cracky=3},
        {"hg_gls.png"},
        "Limestone Stair",
        "Limestone Slab",
        default.node_sound_stone_defaults())

--
--This one and any other new blocks won't work.
--

stairs.register_stair_and_slab("Red Sandstone", "default:red_sandstone",
        {cracky=3},
        {"hg_rss.png"},
        "Red Sandstone Stair",
        "Red Sandstone Slab",
        default.node_sound_stone_defaults())


My second question is, how do I go about adding a new furnace block that only accepts certain blocks for fuel?
 

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

by PilzAdam » Wed Jun 26, 2013 11:50

Thermal_Shock wrote:I have a couple of issues at the moment that are hampering me. Most likely entirely because of my limited experience with coding.

The first is that my modded blocks don't seem to work properly when adding them to the stairs mod from the Minetest game. The new node blocks were defined within the default folder in the nodes.lua file just like the Minetest game. These are my block definitions in the stairs mod.

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
--
--This one works fine. The Limestone block uses the default stone ID.
--
stairs.register_stair_and_slab("Limestone", "default:stone",
        {cracky=3},
        {"hg_gls.png"},
        "Limestone Stair",
        "Limestone Slab",
        default.node_sound_stone_defaults())

--
--This one and any other new blocks won't work.
--

stairs.register_stair_and_slab("Red Sandstone", "default:red_sandstone",
        {cracky=3},
        {"hg_rss.png"},
        "Red Sandstone Stair",
        "Red Sandstone Slab",
        default.node_sound_stone_defaults())

There is no node called "default:red_sandstoe" in the default mod, so the recipes wont work.
 

Thermal_Shock
Member
 
Posts: 76
Joined: Mon Jun 24, 2013 09:10

by Thermal_Shock » Wed Jun 26, 2013 11:54

PilzAdam wrote:There is no node called "default:red_sandstoe" in the default mod, so the recipes wont work.

Oh. You misunderstand. My new node's are added to the node.lua file.

Edit:

Well this is interesting. It seems removing the space in "Red Sandstone" to "RedSandstone" fixed the issue and now it works as intended.
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
stairs.register_stair_and_slab("RedSandstone", "default:red_sandstone",
        {cracky=3},
        {"hg_rss.png"},
        "Red Sandstone Stair",
        "Red Sandstone Slab",
        default.node_sound_stone_defaults())


What exactly is that first part for then?
Last edited by Thermal_Shock on Wed Jun 26, 2013 21:18, edited 1 time in total.
 

User avatar
ch98
Member
 
Posts: 463
Joined: Wed Jan 02, 2013 06:14

by ch98 » Sat Jun 29, 2013 23:53

My concrete 2.2 mod seems to shut server down when you dig the concrete.
Code causing the problem most likely is...
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
minetest.register_node("concrete:concrete", {
    description = "Concrete",
    tiles = {"concrete_concrete.png"},
    is_ground_content = true,
    groups = {cracky=1},
    drop = "concrete:gravel_mound",
    after_destruct = function(pos)
        minetest.env:set_node(pos, "concrete:concrete4")
    end,
})

minetest.register_node("concrete:concrete1", {
    tiles = {"concrete_concrete.png"},
    is_ground_content = true,
    groups = {cracky=1},
    drop = "concrete:gravel_mound",
    after_destruct = function(pos)
        minetest.env:set_node(pos, "concrete:concrete2")
    end,
})

minetest.register_node("concrete:concrete2", {
    tiles = {"concrete_concrete.png"},
    is_ground_content = true,
    groups = {cracky=1},
    drop = "concrete:gravel_mound",
    after_destruct = function(pos)
        minetest.env:set_node(pos, "concrete:concrete3")
    end,
})

minetest.register_node("concrete:concrete3", {
    tiles = {"concrete_concrete.png"},
    is_ground_content = true,
    groups = {cracky=1},
    drop = "concrete:gravel_mound",
    after_destruct = function(pos)
        minetest.env:set_node(pos, "concrete:concrete")
    end,
})

minetest.register_node("concrete:concrete4", {
    tiles = {"concrete_concrete.png"},
    is_ground_content = true,
    groups = {cracky=1},
    drop = "concrete:gravel_mound",
    after_destruct = function(pos)
        minetest.env:set_node(pos, "concrete:concrete5")
    end,
})

minetest.register_node("concrete:concrete5", {
    tiles = {"concrete_concrete.png"},
    is_ground_content = true,
    groups = {cracky=1},
    drop = "concrete:gravel_mound",
    after_destruct = function(pos)
        minetest.env:set_node(pos, "concrete:concrete6")
    end,
})

minetest.register_node("concrete:concrete6", {
    tiles = {"concrete_concrete.png"},
    is_ground_content = true,
    groups = {cracky=1},
    drop = "concrete:gravel_mound",
})

minetest.register_node("concrete:reinforced_concrete", {
    description = "Reinforced Concerte",
    tiles = {"concrete_concrete.png"},
    is_ground_content = true,
    groups = {cracky=1},
    drop = "concrete:gravel_mound",
    after_destruct = function(pos)
        minetest.env:set_node(pos, "concrete:concrete1")
    end,
})

can you find the problem?
Mudslide mod Click Here
 

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

by Evergreen » Wed Jul 03, 2013 15:13

How do I go about creating "groups" of nodes? Like wood, stone, wool, etc.
"Help! I searched for a mod but I couldn't find it!"
http://krock-works.16mb.com/MTstuff/modSearch.php
 

1244
Member
 
Posts: 45
Joined: Fri Jul 13, 2012 16:40

by 1244 » Wed Jul 03, 2013 17:56

Is possible to load chunk in given position?
 

Nore
Member
 
Posts: 468
Joined: Wed Nov 28, 2012 11:35
GitHub: Ekdohibs

by Nore » Wed Jul 03, 2013 18:00

I saw in IRC that it was possible with VoxelManipulator... However, I have no idea how to do it.
 

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

by PilzAdam » Wed Jul 03, 2013 20:05

1244 wrote:Is possible to load chunk in given position?

Just call read() of a VocelManipulator in the block.
Last edited by PilzAdam on Wed Jul 03, 2013 20:06, edited 1 time in total.
 

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

by Evergreen » Fri Jul 05, 2013 15:36

How would I go about detecting whether fancy trees are enabled or not? (fyi, it doesn't have to be entirely in lua)
"Help! I searched for a mod but I couldn't find it!"
http://krock-works.16mb.com/MTstuff/modSearch.php
 

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

by kaeza » Sat Jul 06, 2013 03:43

Evergreen wrote:How would I go about detecting whether fancy trees are enabled or not? (fyi, it doesn't have to be entirely in 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
if minetest.setting_getbool("new_style_leaves") then
  -- Do something here
end
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
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Sat Jul 06, 2013 10:56

Evergreen wrote:How would I go about detecting whether fancy trees are enabled or not? (fyi, it doesn't have to be entirely in lua)

The drawtype "allfaces_optional" is only drawn as "allfaces" if fancy leaves are enabled, otherwise its drawn as a solid node.
 

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

by Evergreen » Sat Jul 06, 2013 11:04

PilzAdam wrote:
Evergreen wrote:How would I go about detecting whether fancy trees are enabled or not? (fyi, it doesn't have to be entirely in lua)

The drawtype "allfaces_optional" is only drawn as "allfaces" if fancy leaves are enabled, otherwise its drawn as a solid node.
How would I detect that though? I'm planning on making different textures for when fancy trees are turned off.
Last edited by Evergreen on Sat Jul 06, 2013 11:05, 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
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Sat Jul 06, 2013 11:19

Evergreen wrote:
PilzAdam wrote:
Evergreen wrote:How would I go about detecting whether fancy trees are enabled or not? (fyi, it doesn't have to be entirely in lua)

The drawtype "allfaces_optional" is only drawn as "allfaces" if fancy leaves are enabled, otherwise its drawn as a solid node.
How would I detect that though? I'm planning on making different textures for when fancy trees are turned off.

kaeza wrote:
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
if minetest.setting_getbool("new_style_leaves") then
  -- Do something here
end
 

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

by Evergreen » Sat Jul 06, 2013 12:12

Ah, I was looking at the minetest.conf, and changed fancy trees on and off, but nothing seemed to change in the conf file. I actually knew the code for getting a setting from the conf file, I was just confused that the new_style_leaves setting wasn't changing. Thanks though. :P
"Help! I searched for a mod but I couldn't find it!"
http://krock-works.16mb.com/MTstuff/modSearch.php
 

6r1d
New member
 
Posts: 1
Joined: Sun Jul 07, 2013 03:38

by 6r1d » Sun Jul 07, 2013 03:46

How do I delete nodes around moving object? For example, I want to program this object to remove coalblocks and cobblestones I've dropped.
I'm using "on_step" function.
 

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

by fairiestoy » Sun Jul 07, 2013 11:38

Hey guys.

Im playing minetest a few weeks now and was interested in learning a bit Lua and the minetest Lua API. But the starts also shows me an End for which i have a question for. Maybe im wrong, but for what i've read up to now, all Lua code is executed on server-side and the results are send to the connected client. I only wanted to make a little HUD element that only needs the local data of the client. Is it somehow possible that i am wrong and mods that only take local used data are also executed only local?

As explanation:
I want to make some kind of compass which shows up as a image in the HUD. It has to turn around according to the current YAW value of the user. The only data that is needed from the server once, is the position of possible 'important points' which will be shown as colored dots on the compass with the fitting direction of that destination. I came up with this idea since i saw very much especially new players who are not able of finding specific spots in the world. They just start running and end up in the big nowhere.
Im aware of the fact that i need more data from the server for the user location, but how should i refresh the compass without to heavy load on the server with globalstep?

Any help would be nice.

Greetings ... fairiestoy
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 » Sun Jul 07, 2013 11:44

6r1d wrote:[fullqoute]

This might help:
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 objects = minetest.env:get_objects_inside_radius(pos, 0.5)
    for _, v in ipairs(objects) do
        if v:get_entity_name() == "gemalde:"..number.."" then
            v:remove()
        end
    end
 

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

by PilzAdam » Sun Jul 07, 2013 11:48

fairiestoy wrote:Hey guys.

Im playing minetest a few weeks now and was interested in learning a bit Lua and the minetest Lua API. But the starts also shows me an End for which i have a question for. Maybe im wrong, but for what i've read up to now, all Lua code is executed on server-side and the results are send to the connected client. I only wanted to make a little HUD element that only needs the local data of the client. Is it somehow possible that i am wrong and mods that only take local used data are also executed only local?

As explanation:
I want to make some kind of compass which shows up as a image in the HUD. It has to turn around according to the current YAW value of the user. The only data that is needed from the server once, is the position of possible 'important points' which will be shown as colored dots on the compass with the fitting direction of that destination. I came up with this idea since i saw very much especially new players who are not able of finding specific spots in the world. They just start running and end up in the big nowhere.
Im aware of the fact that i need more data from the server for the user location, but how should i refresh the compass without to heavy load on the server with globalstep?

Any help would be nice.

Greetings ... fairiestoy

Lua code always runs on the server, no chance to get it in the client.
 

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

by Chinchow » Sat Jul 13, 2013 06:16

I have a question about overlaying textures.
I'm aware you can overlay one texture with another such as stone and iron but is it possible to layer another animated texture over both of the previous ones I'm aware I could test this myself but I am away from my computer for a few weeks and I am programming on my phone.
Last edited by Chinchow on Sat Jul 13, 2013 06:49, edited 1 time in total.
Sometimes, it's harder to think up a mod than it is to create it.
Mods: Orichalcum Stonebricks Extra Chests
 

PreviousNext

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 2 guests