Page 90 of 169

Re: Post your modding questions here

Posted: Sat Oct 03, 2015 19:23
by rubenwardy
What does chunksize do?

Re: Post your modding questions here

Posted: Sat Oct 03, 2015 21:33
by paramat
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.

Re: Post your modding questions here

Posted: Sun Oct 04, 2015 04:25
by Don
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.

Re: Post your modding questions here

Posted: Sun Oct 04, 2015 07:24
by Hybrid Dog
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)

Re: Post your modding questions here

Posted: Sun Oct 04, 2015 11:15
by Don
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.

Re: Post your modding questions here

Posted: Sun Oct 04, 2015 12:33
by Don
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?

Re: Post your modding questions here

Posted: Sun Oct 04, 2015 12:37
by Amaz
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.)

Re: Post your modding questions here

Posted: Sun Oct 04, 2015 13:50
by Don
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.

Re: Post your modding questions here

Posted: Sun Oct 04, 2015 14:25
by Don
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.

Re: Post your modding questions here

Posted: Sun Oct 04, 2015 20:02
by Don
Is there a way to get objects inside a defined area similar to get objects inside radius?

Re: Post your modding questions here

Posted: Sun Oct 04, 2015 22:45
by eduardomezencio
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?

Re: Post your modding questions here

Posted: Mon Oct 05, 2015 14:40
by minetestcr
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', ''},
{'', '', ''},
{'', '', ''},
} })

Re: Post your modding questions here

Posted: Mon Oct 05, 2015 14:56
by Krock
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()
)

Re: Post your modding questions here

Posted: Mon Oct 05, 2015 15:43
by minetestcr
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.

Re: Post your modding questions here

Posted: Mon Oct 05, 2015 17:14
by Hybrid Dog
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

Re: Post your modding questions here

Posted: Mon Oct 05, 2015 17:22
by LionsDen
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.

Re: Post your modding questions here

Posted: Mon Oct 05, 2015 17:26
by Hybrid Dog
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.

Re: Post your modding questions here

Posted: Mon Oct 05, 2015 17:55
by Ferk
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.

Re: Post your modding questions here

Posted: Tue Oct 06, 2015 16:55
by Hybrid Dog
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

Re: Post your modding questions here

Posted: Tue Oct 06, 2015 17:01
by Don
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.

Re: Post your modding questions here

Posted: Tue Oct 06, 2015 17:53
by Hybrid Dog
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)

Re: Post your modding questions here

Posted: Tue Oct 06, 2015 18:08
by Don
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.

Re: Post your modding questions here

Posted: Wed Oct 07, 2015 15:47
by Hybrid Dog
l mean implementing it in source code

Re: Post your modding questions here

Posted: Fri Oct 09, 2015 15:04
by Don
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.

Re: Post your modding questions here

Posted: Sun Oct 11, 2015 16:11
by thisrandomer
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) ?