Page 152 of 169

Re: Post your modding questions here

PostPosted: Sun Apr 23, 2017 15:19
by burli
How can I use the mod database storage again? I can't find it

Re: Post your modding questions here

PostPosted: Sun Apr 23, 2017 21:57
by sofar
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.

Re: Post your modding questions here

PostPosted: Mon Apr 24, 2017 02:17
by kaeza
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).

Re: Post your modding questions here

PostPosted: Mon Apr 24, 2017 05:35
by burli
Thanks, sofar answered this before, but the answer is lost in the noise of this thread

Re: Post your modding questions here

PostPosted: Mon Apr 24, 2017 12:25
by burli
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?

Re: Post your modding questions here

PostPosted: Mon Apr 24, 2017 13:12
by Linuxdirk
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?

Re: Post your modding questions here

PostPosted: Mon Apr 24, 2017 18:55
by sofar
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.

Re: Post your modding questions here

PostPosted: Mon Apr 24, 2017 19:41
by Linuxdirk
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.)

Re: Post your modding questions here

PostPosted: Mon Apr 24, 2017 20:47
by sofar
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.

Re: Post your modding questions here

PostPosted: Tue Apr 25, 2017 09:01
by Linuxdirk
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.

Re: Post your modding questions here

PostPosted: Tue Apr 25, 2017 15:38
by rubenwardy
Note that the exports NBE makes will be just as unoptimised as a plain node box

Re: Post your modding questions here

PostPosted: Wed Apr 26, 2017 18:20
by burli
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?

Re: Post your modding questions here

PostPosted: Thu Apr 27, 2017 09:39
by christoferlevich
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...

Re: Post your modding questions here

PostPosted: Thu Apr 27, 2017 14:36
by orwell
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.

Re: Post your modding questions here

PostPosted: Thu Apr 27, 2017 14:42
by orwell
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,
}

Re: Post your modding questions here

PostPosted: Fri Apr 28, 2017 05:30
by Lone_Wolf
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...

Re: Post your modding questions here

PostPosted: Fri Apr 28, 2017 17:57
by Byakuren
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.

Re: Post your modding questions here

PostPosted: Sun Apr 30, 2017 08:57
by christoferlevich
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.

Re: Post your modding questions here

PostPosted: Sun Apr 30, 2017 18:58
by Casimir
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.

Re: Post your modding questions here

PostPosted: Mon May 01, 2017 11:08
by orwell
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.

Re: Post your modding questions here

PostPosted: Mon May 01, 2017 12:59
by stu
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.

Re: Post your modding questions here

PostPosted: Mon May 01, 2017 15:07
by burli
Is it possible to roll/pitch entities? I only can find the set_yaw() function

Re: Post your modding questions here

PostPosted: Mon May 01, 2017 15:32
by azekill_DIABLO
i think no. not without an animation

Re: Post your modding questions here

PostPosted: Mon May 01, 2017 15:58
by stu
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.

Re: Post your modding questions here

PostPosted: Tue May 02, 2017 09:30
by christoferlevich
I am not sure how to implement the code you shared Orwell, but I am trying... LOL

EDIT - Got it!