Post your modding questions here

User avatar
burli
Member
Posts: 1641
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Post

How can I use the mod database storage again? I can't find it

sofar
Developer
Posts: 2132
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Post your modding questions here

by sofar » Post

burli wrote:How can I use the mod database storage again? I can't find it
local my_data = minetest.get_mod_storage()

then use it like it's a `meta`:

my_data:set_string("foo", "bar")
s = my_data:get_string("foo")

https://github.com/minetest/minetest/bl ... .txt#L2700

edit: corrected.

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:

Re: Post your modding questions here

by kaeza » Post

sofar wrote:local my_data = minetest.get_mod_storage()

then use it like it's a `meta`:

my_data.set_string("foo", "bar")
s = my_data.get_string("foo")

https://github.com/minetest/minetest/bl ... .txt#L2700
Just a minor correction: it should be `my_data:blah(...)` (note the colon instead of a period).
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
burli
Member
Posts: 1641
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Post

Thanks, sofar answered this before, but the answer is lost in the noise of this thread

User avatar
burli
Member
Posts: 1641
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Post

what happens with the drops if I use minetest.dig_node()? For example if I dig grass, what happens with the seeds if they drop? Even if I use the item_drop mod nothing is dropped.

How can I get the drops if I use dig_node() or similar?

User avatar
Linuxdirk
Member
Posts: 2645
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: Post your modding questions here

by Linuxdirk » Post

I am currently developing a mod that adds a shit-ton of nodes created from a lot of nodeboxes (not connected nodeboxes just regular ones that visually span over the node edges).

I wonder if it would be more efficient to use meshes instead of nodeboxes. Any real-life experiences with that?

sofar
Developer
Posts: 2132
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Post your modding questions here

by sofar » Post

Linuxdirk wrote:I am currently developing a mod that adds a shit-ton of nodes created from a lot of nodeboxes (not connected nodeboxes just regular ones that visually span over the node edges).

I wonder if it would be more efficient to use meshes instead of nodeboxes. Any real-life experiences with that?
Yes, meshes are more efficient because you can omit surfaces that are never visible, which nodebox nodes can not. So using meshes reduces the complexity of the geometry.

But, the downside is that you need to do all the UV mapping and geometry construction yourself, which means basic blender skills are required.

User avatar
Linuxdirk
Member
Posts: 2645
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: Post your modding questions here

by Linuxdirk » Post

I want to keep it as simple as possible. So, let's say: If I define a mesh, can I use minetest.registered_nodes[node_name].tiles (whre node_name is whatever node's tiles I want to use) for the mesh's texture definition like I can do with nodeboxes or is there another way to use an already defined node's tiles as mesh textures? (All my nodes will only have 90 degrees angles and no curves or whatsoever.)

sofar
Developer
Posts: 2132
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Post your modding questions here

by sofar » Post

Linuxdirk wrote:I want to keep it as simple as possible. So, let's say: If I define a mesh, can I use minetest.registered_nodes[node_name].tiles (whre node_name is whatever node's tiles I want to use) for the mesh's texture definition like I can do with nodeboxes or is there another way to use an already defined node's tiles as mesh textures? (All my nodes will only have 90 degrees angles and no curves or whatsoever.)
Yes, you can easily do that (the stairs mod does this, for instance, for the mesh based stair nodes in minetest_game).

But, please note, that you still need to do UV mapping for your mesh.

If you just need a single mesh node (.obj) made, I'll be happy to make it for you - there are a few others that would happily do so as well.

User avatar
Linuxdirk
Member
Posts: 2645
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: Post your modding questions here

by Linuxdirk » Post

sofar wrote:If you just need a single mesh node (.obj) made, I'll be happy to make it for you - there are a few others that would happily do so as well.
There are plenty of meshes I need. I'll convert them from the currently existing nodebox files.

NodeBoxEditor can export to .obj, too. According to the wiki .obj files can be used for meshes.

I'll give it a try, thanks.

User avatar
rubenwardy
Moderator
Posts: 6281
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: United Kingdom
Contact:

Re: Post your modding questions here

by rubenwardy » Post

Note that the exports NBE makes will be just as unoptimised as a plain node box

User avatar
burli
Member
Posts: 1641
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Post

Is it possible to draw lines or something similar in Minetest?

I need to specify this: Is it possible to draw lines on the map in Lua?

User avatar
christoferlevich
Member
Posts: 324
Joined: Thu Dec 01, 2016 23:44
GitHub: ChristoferL
Location: Athol, Massachusetts

Re: Post your modding questions here

by christoferlevich » Post

So I know how to make a node hurt people when they step on it (walk= false and damage_per_second =) but how do I make that node heal instead? I tried putting a -number in damage per second but that failed. Is there a 'healing per second' line or something I can use?
edit:
I am trying to register an abm but I don't know how to tell the thing to heal a player. Searching for a list of pissible functions now...
everything can be a learning experience...

User avatar
orwell
Member
Posts: 841
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: Post your modding questions here

by orwell » Post

burli wrote:Is it possible to draw lines or something similar in Minetest?

I need to specify this: Is it possible to draw lines on the map in Lua?
Nope. You can't e.g. tell "draw a line from (0,0,0) to (2,2,2)". Although this would be a nice feature... detached rendered objects
You can try to use the trick worldedit uses for the area marking: an object whose visual_scale and position is adjusted so that the ends are at the points you want.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

User avatar
orwell
Member
Posts: 841
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: Post your modding questions here

by orwell » Post

christoferlevich wrote:So I know how to make a node hurt people when they step on it (walk= false and damage_per_second =) but how do I make that node heal instead? I tried putting a -number in damage per second but that failed. Is there a 'healing per second' line or something I can use?
edit:
I am trying to register an abm but I don't know how to tell the thing to heal a player. Searching for a list of pissible functions now...

Code: Select all

{
        nodenames = {"yournode"},
        interval = 1.0, -- Operation interval in seconds
        chance = 1, -- Chance of trigger per-node per-interval is 1.0 / this
        action = function(pos, node, active_object_count, active_object_count_wider)
               pos.y=pos.y+1 --node above
               local objects=minetest.get_objects_inside_radius(pos, 1)
               for _,obj in ipairs(objects) do
                      if obj:is_player() then
                           obj:set_hp(obj:get_hp()+1)
                      end
               end
        end,
}
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

User avatar
Lone_Wolf
Member
Posts: 2391
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: Lone_Wolf or LoneWolfHT
In-game: Lone_Wolf
Location: Not there, THERE!

Re: Post your modding questions here

by Lone_Wolf » Post

christoferlevich wrote:So I know how to make a node hurt people when they step on it (walk= false and damage_per_second =) but how do I make that node heal instead? I tried putting a -number in damage per second but that failed. Is there a 'healing per second' line or something I can use?
edit:
I am trying to register an abm but I don't know how to tell the thing to heal a player. Searching for a list of pissible functions now...
Knowing NOTHING about lua yet I would've suggested the player gets a few loaves of bread shoved down his blocky throat...

Byakuren
Member
Posts: 816
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: Post your modding questions here

by Byakuren » Post

ABM for checking player step is needlessly inefficient. You will do the check on all nodes, even ones that are nowhere near the player. Better to do a global step or minetest.after loop where you periodically loop through players and check what they are stepping on.
Every time a mod API is left undocumented, a koala dies.

User avatar
christoferlevich
Member
Posts: 324
Joined: Thu Dec 01, 2016 23:44
GitHub: ChristoferL
Location: Athol, Massachusetts

Re: Post your modding questions here

by christoferlevich » Post

Byakuren wrote:ABM for checking player step is needlessly inefficient. You will do the check on all nodes, even ones that are nowhere near the player. Better to do a global step or minetest.after loop where you periodically loop through players and check what they are stepping on.
Ahhhh - I should formally apologize to anyone who is modding and really knows what they are doing. I always tend to overshoot my abilities and learn in the fixing of mistakes I make (I wish it wasn't so, but I've learned everything in life backwards.) After 48 years, I've grown used to it, but I bet I read like a wacko to more than a few.

I'd guess by year's end I will be far more competent, but I will tend to ask questions that sound pretty ignorant till then. The good news is I am hooked on Minetest and I am hopeful to help supply some really creative mods to the community, the better news is I am training about 200 kids to play and (hopefully) mod as well.

There is no reason Minetest should not have crushed Minecraft by now in my opinion, short of huge marketing advantages MC has enjoyed.
everything can be a learning experience...

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

Re: Post your modding questions here

by Casimir » Post

Wasn't there a stepheight setting once? For players I mean.

Also is anybody aware of the maxlevel thing in tool definition? I mean, I looked into it, and it's horrible, and I don't think anybody is even aware it exists.

Edit: Didn't we have pixel perfect display of items at some point? The pixels are distorted now, and I seem to remember that it worked.

User avatar
orwell
Member
Posts: 841
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: Post your modding questions here

by orwell » Post

Casimir wrote:Wasn't there a stepheight setting once? For players I mean.

Also is anybody aware of the maxlevel thing in tool definition? I mean, I looked into it, and it's horrible, and I don't think anybody is even aware it exists.
AFAIK this setting is hardcoded, so you can't change it.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

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

Re: Post your modding questions here

by stu » Post

orwell wrote:
Casimir wrote:Wasn't there a stepheight setting once? For players I mean.

Also is anybody aware of the maxlevel thing in tool definition? I mean, I looked into it, and it's horrible, and I don't think anybody is even aware it exists.
AFAIK this setting is hardcoded, so you can't change it.
You can't change the step-height like you can for entities but you can alter the player's jump distance and/or the effects of gravity to achieve much the same result.

User avatar
burli
Member
Posts: 1641
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Post

Is it possible to roll/pitch entities? I only can find the set_yaw() function

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

Re: Post your modding questions here

by azekill_DIABLO » Post

i think no. not without an animation

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

Re: Post your modding questions here

by stu » Post

burli wrote:Is it possible to roll/pitch entities? I only can find the set_yaw() function
With a rigged model it is possible by setting the root bone position, either directly or by way of key frames like the carts mod, for example.

User avatar
christoferlevich
Member
Posts: 324
Joined: Thu Dec 01, 2016 23:44
GitHub: ChristoferL
Location: Athol, Massachusetts

Re: Post your modding questions here

by christoferlevich » Post

I am not sure how to implement the code you shared Orwell, but I am trying... LOL

EDIT - Got it!
everything can be a learning experience...

Locked

Who is online

Users browsing this forum: No registered users and 2 guests