Post your modding questions here

Locked
User avatar
rubenwardy
Moderator
Posts: 6280
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

What does chunksize do?

User avatar
paramat
Developer
Posts: 3691
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: Post your modding questions here

by paramat » Post

Don't trust the wiki, it''s usually long out of date, go by the docs in the repo.
Setting chunksize needs to be added, fairly easy.
Chunksize is the edge length of a mapchunk (80^3 nodes by default) stated in mapblocks (16^3 nodes), default is 5.
Changing it affects cave, dungeon and maybe decoration density so extreme values give weird results.
5 is near-optimum, anything less might create chunk border glitches in mgv6 (which is why mgv6 terrain doesn't go above y = 47), mgv5/mgv7 are unaffected.

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Post

If I wanted to do a block of code with register on die then where can I put it?
I want to make it so if a certain node is below when the player dies they spawn at a certain position.

I also need to know if there is a way to make a node not highlight when pointed at but still not let the player point through it. If I set pointable = false then the player can point through it. The same goes for if I set selecetion box to 0,0,0,0,0,0.
Thanks to anyone who can help.
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

User avatar
Hybrid Dog
Member
Posts: 2768
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

Re: Post your modding questions here

by Hybrid Dog » Post

Don wrote:If I wanted to do a block of code with register on die then where can I put it?
I want to make it so if a certain node is below when the player dies they spawn at a certain position.
https://github.com/minetest/minetest/bl ... .txt#L1825
l guess this is easy. Put the code in init.lua, not in a function like the abm action.

Code: Select all

minetest.register_on_dieplayer(function(player)
	local pos = vector.round(player:getpos())
	pos.y = pos.y-1
	if minetest.get_node(pos).name ~= […] then
		return
	end
	minetest.after(0, function(name)
		local player = minetest.get_player_by_name(name)
		if not player then
			return
		end
		player:moveto([…])
	end, player:get_player_name())
end)

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Post

Hybrid Dog wrote:
Don wrote:If I wanted to do a block of code with register on die then where can I put it?
I want to make it so if a certain node is below when the player dies they spawn at a certain position.
https://github.com/minetest/minetest/bl ... .txt#L1825
l guess this is easy. Put the code in init.lua, not in a function like the abm action.

Code: Select all

minetest.register_on_dieplayer(function(player)
	local pos = vector.round(player:getpos())
	pos.y = pos.y-1
	if minetest.get_node(pos).name ~= […] then
		return
	end
	minetest.after(0, function(name)
		local player = minetest.get_player_by_name(name)
		if not player then
			return
		end
		player:moveto([…])
	end, player:get_player_name())
end)
Thank you.
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Post

Using the above code I now move to the right location when I die but the respawn button comes up. When I hit respawn I get moved to the spawn location. Tha api says "return true in func to disable regular player placement". I tried that but nothing changed.
How do I disable the regular spawn position?
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

Amaz
Member
Posts: 354
Joined: Wed May 08, 2013 08:26
GitHub: Amaz1
IRC: Amaz
In-game: Amaz

Re: Post your modding questions here

by Amaz » Post

I think that if you change that to register_on_respawnplayer it would work. (That's the one the api says "return true in func to disable regular player placement" about.)

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Post

Amaz wrote:I think that if you change that to register_on_respawnplayer it would work. (That's the one the api says "return true in func to disable regular player placement" about.)
Thank you. It is working right now.
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Post

New issue with this. When you die you are still active in the game until you hit the respawn button.
For example if you fall in lava you will continue to die over and over again until you hit respawn.
I want to get a death count but since you keep dying until you respawn I can not.
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Post

Is there a way to get objects inside a defined area similar to get objects inside radius?
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

User avatar
eduardomezencio
Member
Posts: 73
Joined: Tue Sep 08, 2015 17:48
GitHub: eduardomezencio

Re: Post your modding questions here

by eduardomezencio » Post

Don wrote:I also need to know if there is a way to make a node not highlight when pointed at but still not let the player point through it. If I set pointable = false then the player can point through it. The same goes for if I set selecetion box to 0,0,0,0,0,0.
I also wanted to know about this. And even another related thing: is there a way for a block to be pointable only when using a certain tool?

minetestcr
Member
Posts: 58
Joined: Fri Feb 13, 2015 21:31

Re: Post your modding questions here

by minetestcr » Post

Hello. I created a new node, and now I'm trying to make stairs with this node. Can anyone help me with that? I was looking at the code here https://github.com/minetest/minetest_ga ... s/init.lua but I don't really understand it, so I don't know where to start....


this is the code of my node:

minetest.register_node ("stj:terrazo", {
drawtype = draw,
description = "terrazo del piso",
tile_images = {"terrazo.png"},
inventory_image = {"terrazo.png"},
sunlight_propagates = true,
paramtype = 'light',
walkable = true,
material = minetest.digprop_constanttime(1.0),
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,},
})

minetest.register_craft({
output = '"stj:terrazo" 4',
recipe = {
{'group:sand', 'default:gravel', ''},
{'', '', ''},
{'', '', ''},
} })

User avatar
Krock
Developer
Posts: 4564
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: Post your modding questions here

by Krock » Post

minetestcr wrote:<snip>
Use the function stairs.register_stair (or .register_slab) to register your node as a stair (or slab).
Here's how it could look like: (don't forget to add "default" and "stairs" to your depends.txt file)

Code: Select all

minetest.register_node("stj:terrazo", {
	description = "terrazo del piso",
	tiles = {"terrazo.png"},
	inventory_image = {"terrazo.png"},
	sunlight_propagates = true,
	paramtype = "light",
	walkable = true,
	sounds = default.node_sound_stone_defaults(),
	groups = {snappy=2, cracky=3, oddly_breakable_by_hand=3},
})

minetest.register_craft({
	output = "stj:terrazo 4",
	recipe = {
		{"group:sand", "default:gravel", ""},
		{"", "", ""},
		{"", "", ""},
	}
})

stairs.register_ <stair / slab>(
	"terrazo",
	"stj:terrazo",
	{snappy=2, cracky=3, oddly_breakable_by_hand=3},
	{"terrazo.png"},
	"terrazo del piso <stair / slab>",
	default.node_sound_stone_defaults()
)
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

minetestcr
Member
Posts: 58
Joined: Fri Feb 13, 2015 21:31

Re: Post your modding questions here

by minetestcr » Post

Krock wrote:
minetestcr wrote:<snip>
Use the function stairs.register_stair (or .register_slab) to register your node as a stair (or slab).
Here's how it could look like: (don't forget to add "default" and "stairs" to your depends.txt file)
Thanks a lot Krock, that did it.

User avatar
Hybrid Dog
Member
Posts: 2768
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

Re: Post your modding questions here

by Hybrid Dog » Post

Don wrote:Is there a way to get objects inside a defined area similar to get objects inside radius?
l'm not sure, but l think there's a table minetest.luaentities, which contains all active objects.
get objects inside radius tests for every active object if it's inside the sphere, it is not done in lua l think, so it works faster

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪

User avatar
LionsDen
Member
Posts: 530
Joined: Thu Jun 06, 2013 03:19

Re: Post your modding questions here

by LionsDen » Post

eduardomezencio wrote:I also wanted to know about this. And even another related thing: is there a way for a block to be pointable only when using a certain tool?
Try looking at the code for the default bucket. That allows water and lava to be pointable when they normally aren't. Hope this helps you.

User avatar
Hybrid Dog
Member
Posts: 2768
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

Re: Post your modding questions here

by Hybrid Dog » Post

LionsDen wrote:Try looking at the code for the default bucket. That allows water and lava to be pointable when they normally aren't. Hope this helps you.
l don't believe you, you can place water on nodes by pointing them with the water bucket and right clicking.

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪

User avatar
Ferk
Member
Posts: 337
Joined: Tue Aug 18, 2015 17:18
GitHub: Ferk

Re: Post your modding questions here

by Ferk » Post

Hybrid Dog wrote:l don't believe you, you can place water on nodes by pointing them with the water bucket and right clicking.
He is right, the bucket is one of the items that has the flag that allows pointing liquids enabled. If you point to a liquid with other items you don't see a selection box around the water node you are pointing to (that's what eduardomezencio wants, nodes that are only pointable with a certain tool).

However, it's only a boolean flag specific for liquids, and the behavior is probably implemented in the engine. I don't think that's gonna be useful for him unless he changes the engine, since I guess his node is not a liquid.

Thought maybe there's a chance the feature is done in the lua api level of the engine, so he could have a look at it.. but I doubt it. Liquids are very particular and probably there's a lot of hardcoded stuff around them for the sake of efficiency.
{ ☠ Dungeontest ☠ , ᗧ••myarcade•• }

User avatar
Hybrid Dog
Member
Posts: 2768
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

Re: Post your modding questions here

by Hybrid Dog » Post

Ferk wrote:Thought maybe there's a chance the feature is done in the lua api level of the engine, so he could have a look at it.. but I doubt it. Liquids are very particular and probably there's a lot of hardcoded stuff around them for the sake of efficiency.
l guess you could do it similar to the way it's done for the sounds:
e.g. add a group cracky_pointable = 0 to the tool which makes the cracky group (stone, cobble, etc) not be pointable by it

To completely disallow pointing with a tool, just set it's range to 0.
https://github.com/HybridDog/nuke/blob/ ... t.lua#L740

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Post

Hybrid Dog wrote:
Ferk wrote:Thought maybe there's a chance the feature is done in the lua api level of the engine, so he could have a look at it.. but I doubt it. Liquids are very particular and probably there's a lot of hardcoded stuff around them for the sake of efficiency.
l guess you could do it similar to the way it's done for the sounds:
e.g. add a group cracky_pointable = 0 to the tool which makes the cracky group (stone, cobble, etc) not be pointable by it

To disallow pointing with a tool, just set it's range to 0.
That would work for a tool to be able to point at something. I would like a way to make a node not pointable but still not allow the player to point past the node.
I have suggested that there be an option to make the selection box transparent. This would make it so you can have windows that are pointable but you do not get the selection box. I think it would make them look much better.
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

User avatar
Hybrid Dog
Member
Posts: 2768
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

Re: Post your modding questions here

by Hybrid Dog » Post

Don wrote:
Hybrid Dog wrote:
Ferk wrote:Thought maybe there's a chance the feature is done in the lua api level of the engine, so he could have a look at it.. but I doubt it. Liquids are very particular and probably there's a lot of hardcoded stuff around them for the sake of efficiency.
l guess you could do it similar to the way it's done for the sounds:
e.g. add a group cracky_pointable = 0 to the tool which makes the cracky group (stone, cobble, etc) not be pointable by it

To disallow pointing with a tool, just set it's range to 0.
That would work for a tool to be able to point at something. I would like a way to make a node not pointable but still not allow the player to point past the node.
I have suggested that there be an option to make the selection box transparent. This would make it so you can have windows that are pointable but you do not get the selection box. I think it would make them look much better.
you could change a little bit the source code that it's not shown on nodes with glasslike and framed glasslike

How about hiding the selection box if you're wielding an implacable item which can't dig the pointed node? (e.g. pointing mese with a wood pick would not show it)

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Post

Hybrid Dog wrote:
Don wrote:
Hybrid Dog wrote: How about hiding the selection box if you're wielding an implacable item which can't dig the pointed node? (e.g. pointing mese with a wood pick would not show it)
I have no idea how that would be done. I will have to dig into the code for them.

Edit - I just tried it and the selection box shows on mese if holding wood pick.
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

User avatar
Hybrid Dog
Member
Posts: 2768
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

Re: Post your modding questions here

by Hybrid Dog » Post

l mean implementing it in source code

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Post

When a node has a formspec in it's metadata you right click to show the form. Is there a way of disabling this so I can use on_rightclick? I want to be able to do something before it shows the formspec.
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

thisrandomer
New member
Posts: 2
Joined: Sun Oct 11, 2015 16:02

Re: Post your modding questions here

by thisrandomer » Post

What does it mean when you try to run a mod and it says ServerError: LuaError: error: C:/Minetest\bin\..\mods\mobs/api.lua:1209: attempts to call field 'is_protected' (a nil value) ?

Locked

Who is online

Users browsing this forum: No registered users and 3 guests