Post your modding questions here
- rubenwardy
- Moderator
- Posts: 6978
- Joined: Tue Jun 12, 2012 18:11
- GitHub: rubenwardy
- IRC: rubenwardy
- In-game: rubenwardy
- Location: Bristol, United Kingdom
- Contact:
Re: Post your modding questions here
What does chunksize do?
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
Re: Post your modding questions here
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.
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
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.
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
A list of my mods can be found here
- Hybrid Dog
- Member
- Posts: 2834
- Joined: Thu Nov 01, 2012 12:46
- GitHub: HybridDog
Re: Post your modding questions here
https://github.com/minetest/minetest/bl ... .txt#L1825Don 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.
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
Thank you.Hybrid Dog wrote:https://github.com/minetest/minetest/bl ... .txt#L1825Don 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.
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)
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
A list of my mods can be found here
Re: Post your modding questions here
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?
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
A list of my mods can be found here
Re: Post your modding questions here
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
Thank you. It is working right now.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.)
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
A list of my mods can be found here
Re: Post your modding questions here
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.
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
A list of my mods can be found here
Re: Post your modding questions here
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
A list of my mods can be found here
- eduardomezencio
- Member
- Posts: 73
- Joined: Tue Sep 08, 2015 17:48
- GitHub: eduardomezencio
Re: Post your modding questions here
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?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.
-
- Member
- Posts: 58
- Joined: Fri Feb 13, 2015 21:31
Re: Post your modding questions here
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', ''},
{'', '', ''},
{'', '', ''},
} })
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', ''},
{'', '', ''},
{'', '', ''},
} })
- Krock
- Developer
- Posts: 4650
- Joined: Thu Oct 03, 2013 07:48
- GitHub: SmallJoker
- Location: Switzerland
- Contact:
Re: Post your modding questions here
Use the function stairs.register_stair (or .register_slab) to register your node as a stair (or slab).minetestcr wrote:<snip>
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>
-
- Member
- Posts: 58
- Joined: Fri Feb 13, 2015 21:31
Re: Post your modding questions here
Thanks a lot Krock, that did it.Krock wrote:Use the function stairs.register_stair (or .register_slab) to register your node as a stair (or slab).minetestcr wrote:<snip>
Here's how it could look like: (don't forget to add "default" and "stairs" to your depends.txt file)
- Hybrid Dog
- Member
- Posts: 2834
- Joined: Thu Nov 01, 2012 12:46
- GitHub: HybridDog
Re: Post your modding questions here
l'm not sure, but l think there's a table minetest.luaentities, which contains all active objects.Don wrote:Is there a way to get objects inside a defined area similar to get objects inside radius?
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
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.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?
- Hybrid Dog
- Member
- Posts: 2834
- Joined: Thu Nov 01, 2012 12:46
- GitHub: HybridDog
Re: Post your modding questions here
l don't believe you, you can place water on nodes by pointing them with the water bucket and right clicking.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.
Re: Post your modding questions here
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).Hybrid Dog wrote:l don't believe you, you can place water on nodes by pointing them with the water bucket and right clicking.
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.
- Hybrid Dog
- Member
- Posts: 2834
- Joined: Thu Nov 01, 2012 12:46
- GitHub: HybridDog
Re: Post your modding questions here
l guess you could do it similar to the way it's done for the sounds: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.
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
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.Hybrid Dog wrote:l guess you could do it similar to the way it's done for the sounds: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.
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.
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
A list of my mods can be found here
- Hybrid Dog
- Member
- Posts: 2834
- Joined: Thu Nov 01, 2012 12:46
- GitHub: HybridDog
Re: Post your modding questions here
you could change a little bit the source code that it's not shown on nodes with glasslike and framed glasslikeDon wrote: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.Hybrid Dog wrote:l guess you could do it similar to the way it's done for the sounds: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.
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.
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.
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
I have no idea how that would be done. I will have to dig into the code for them.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)
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
A list of my mods can be found here
- Hybrid Dog
- Member
- Posts: 2834
- Joined: Thu Nov 01, 2012 12:46
- GitHub: HybridDog
Re: Post your modding questions here
l mean implementing it in source code
Re: Post your modding questions here
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
A list of my mods can be found here
-
- New member
- Posts: 2
- Joined: Sun Oct 11, 2015 16:02
Re: Post your modding questions here
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) ?
Who is online
Users browsing this forum: No registered users and 3 guests