Post your modding questions here

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

Re: Post your modding questions here

by burli » Sun Apr 23, 2017 15:19

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

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

Re: Post your modding questions here

by sofar » Sun Apr 23, 2017 21:57

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
Location: Montevideo, Uruguay
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

Re: Post your modding questions here

by kaeza » Mon Apr 24, 2017 02:17

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: 1608
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Mon Apr 24, 2017 05:35

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

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

Re: Post your modding questions here

by burli » Mon Apr 24, 2017 12:25

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: 1949
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk

Re: Post your modding questions here

by Linuxdirk » Mon Apr 24, 2017 13:12

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: 2000
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Post your modding questions here

by sofar » Mon Apr 24, 2017 18:55

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: 1949
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk

Re: Post your modding questions here

by Linuxdirk » Mon Apr 24, 2017 19:41

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: 2000
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Post your modding questions here

by sofar » Mon Apr 24, 2017 20:47

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: 1949
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk

Re: Post your modding questions here

by Linuxdirk » Tue Apr 25, 2017 09:01

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: 5689
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: Post your modding questions here

by rubenwardy » Tue Apr 25, 2017 15:38

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

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

Re: Post your modding questions here

by burli » Wed Apr 26, 2017 18:20

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: 323
Joined: Thu Dec 01, 2016 23:44
Location: Athol, Massachusetts
GitHub: ChristoferL

Re: Post your modding questions here

by christoferlevich » Thu Apr 27, 2017 09:39

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: 768
Joined: Wed Jun 24, 2015 18:45
Location: Raxacoricofallapatorius
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell

Re: Post your modding questions here

by orwell » Thu Apr 27, 2017 14:36

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: 768
Joined: Wed Jun 24, 2015 18:45
Location: Raxacoricofallapatorius
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell

Re: Post your modding questions here

by orwell » Thu Apr 27, 2017 14:42

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: 2143
Joined: Sun Apr 09, 2017 05:50
Location: Hopefully very far from yours, snoop :P
GitHub: LoneWolfHT
IRC: Lone_Wolf
In-game: Lone_Wolf

Re: Post your modding questions here

by Lone_Wolf » Fri Apr 28, 2017 05:30

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 » Fri Apr 28, 2017 17:57

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: 323
Joined: Thu Dec 01, 2016 23:44
Location: Athol, Massachusetts
GitHub: ChristoferL

Re: Post your modding questions here

by christoferlevich » Sun Apr 30, 2017 08:57

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: 1161
Joined: Fri Aug 03, 2012 16:59
GitHub: CasimirKaPazi

Re: Post your modding questions here

by Casimir » Sun Apr 30, 2017 18:58

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: 768
Joined: Wed Jun 24, 2015 18:45
Location: Raxacoricofallapatorius
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell

Re: Post your modding questions here

by orwell » Mon May 01, 2017 11:08

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: 922
Joined: Sat Feb 02, 2013 02:51
Location: United Kingdom
GitHub: stujones11

Re: Post your modding questions here

by stu » Mon May 01, 2017 12:59

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: 1608
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Mon May 01, 2017 15:07

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

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

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

Re: Post your modding questions here

by stu » Mon May 01, 2017 15:58

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: 323
Joined: Thu Dec 01, 2016 23:44
Location: Athol, Massachusetts
GitHub: ChristoferL

Re: Post your modding questions here

by christoferlevich » Tue May 02, 2017 09:30

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...
 

PreviousNext

Return to Modding Discussion



Who is online

Users browsing this forum: No registered users and 1 guest