Post your modding questions here
- ExeterDad
- Member
- Posts: 1717
- Joined: Sun Jun 01, 2014 20:00
- In-game: ExeterDad
- Location: New Hampshire U.S.A
Re: Post your modding questions here
I somehow missed the "regardless of rotation" part. Sorry to of jumped in there too quickly. :)
HOMETOWN -Our little server. Keep the HOMETOWN chatter @ http://hometownserver.com - Our server map: http://media.hometownserver.com
Re: Post your modding questions here
Aw, too bad... will have to register a top and bottom end then... Thanks!texmex wrote:Textures being independent of its node's rotation can't be done in the Minetest engine currently. See issue #5222KzoneDD wrote:Hi all,
Trying to figure out how to keep a node's texture the same regardless of rotation. I'm working on something that has top, bottom and middle parts, so I'd like to use only one registered node for top and bottom, but keep the textures direction the same so they keep matching... any ideas?
-
- Member
- Posts: 3015
- Joined: Sun Jan 18, 2015 13:02
- GitHub: ABJ-MV
- In-game: ABJ
- Location: In Earth orbit, with a perigee of 1048 km and an apogee of 1337 km and an inclination of 69 degrees.
Re: Post your modding questions here
How do I check for a specific property of a node at a known position?
-
- Member
- Posts: 3015
- Joined: Sun Jan 18, 2015 13:02
- GitHub: ABJ-MV
- In-game: ABJ
- Location: In Earth orbit, with a perigee of 1048 km and an apogee of 1337 km and an inclination of 69 degrees.
Re: Post your modding questions here
Code: Select all
minetest.register_abm({
nodenames = {"default:wood"},
interval = 10.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local node = minetest.get_node({x = pos.x, y = pos.y + 1, z = pos.z})
local nodedef = minetest.registered_nodes[node]
if nodedef.walkable == true then
minetest.set_node({x = pos.x, y = pos.y, z = pos.z}, {name = "air"})
end
})
What am I doing wrong?
- Linuxdirk
- Member
- Posts: 3219
- Joined: Wed Sep 17, 2014 11:21
- In-game: Linuxdirk
- Location: Germany
- Contact:
Re: Post your modding questions here
Yep because none of the devs actually cares this won't be fixed within reasonable time. Just register what you need. I had to do the same because the rotated textures just look ugly.KzoneDD wrote:Aw, too bad... will have to register a top and bottom end then... Thanks!
- ExeterDad
- Member
- Posts: 1717
- Joined: Sun Jun 01, 2014 20:00
- In-game: ExeterDad
- Location: New Hampshire U.S.A
Re: Post your modding questions here
How about adding one more "end" to close the "action" function? (not tested)ABJ wrote:It says that there is an unexpected symbol near the } on line 11.Code: Select all
minetest.register_abm({ nodenames = {"default:wood"}, interval = 10.0, chance = 1, action = function(pos, node, active_object_count, active_object_count_wider) local node = minetest.get_node({x = pos.x, y = pos.y + 1, z = pos.z}) local nodedef = minetest.registered_nodes[node] if nodedef.walkable == true then minetest.set_node({x = pos.x, y = pos.y, z = pos.z}, {name = "air"}) end })
What am I doing wrong?
Code: Select all
minetest.register_abm({
nodenames = {"default:wood"},
interval = 10.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local node = minetest.get_node({x = pos.x, y = pos.y + 1, z = pos.z})
local nodedef = minetest.registered_nodes[node]
if nodedef.walkable == true then
minetest.set_node({x = pos.x, y = pos.y, z = pos.z}, {name = "air"})
end
end
})
HOMETOWN -Our little server. Keep the HOMETOWN chatter @ http://hometownserver.com - Our server map: http://media.hometownserver.com
-
- Member
- Posts: 3015
- Joined: Sun Jan 18, 2015 13:02
- GitHub: ABJ-MV
- In-game: ABJ
- Location: In Earth orbit, with a perigee of 1048 km and an apogee of 1337 km and an inclination of 69 degrees.
Re: Post your modding questions here
Code: Select all
minetest.register_abm({
nodenames = {"default:wood"},
interval = 10.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local node = minetest.get_node({x = pos.x, y = pos.y + 1, z = pos.z})
local nodedef = minetest.registered_nodes[node]
if nodedef.walkable == true then
minetest.set_node({x = pos.x, y = pos.y, z = pos.z}, {name = "air"})
end
end
})
-
- Member
- Posts: 818
- Joined: Tue Apr 14, 2015 01:59
- GitHub: raymoo
- IRC: Hijiri
- In-game: Raymoo + Clownpiece
Re: Post your modding questions here
Your index (node) is a table. minetest.registered_nodes is indexed by node names.ABJ wrote:Thanks it worked! Until the game crashed saying that nodedef was nil. You see, I was trying to check if the node at the specified position was walkable or not. What am I doing wrong here?Code: Select all
minetest.register_abm({ nodenames = {"default:wood"}, interval = 10.0, chance = 1, action = function(pos, node, active_object_count, active_object_count_wider) local node = minetest.get_node({x = pos.x, y = pos.y + 1, z = pos.z}) local nodedef = minetest.registered_nodes[node] if nodedef.walkable == true then minetest.set_node({x = pos.x, y = pos.y, z = pos.z}, {name = "air"}) end end })
Every time a mod API is left undocumented, a koala dies.
Re: Post your modding questions here
Byakuren wrote:Your index (node) is a table. minetest.registered_nodes is indexed by node names.ABJ wrote:Code: Select all
minetest.register_abm({ nodenames = {"default:wood"}, interval = 10.0, chance = 1, action = function(pos, node, active_object_count, active_object_count_wider) local node = minetest.get_node({x = pos.x, y = pos.y + 1, z = pos.z}) local nodedef = minetest.registered_nodes[node] if nodedef.walkable == true then minetest.set_node({x = pos.x, y = pos.y, z = pos.z}, {name = "air"}) end end })
Thanks it worked! Until the game crashed saying that nodedef was nil. You see, I was trying to check if the node at the specified position was walkable or not. What am I doing wrong here?
specifically, replace:
Code: Select all
local nodedef = minetest.registered_nodes[node]
Code: Select all
local nodedef = minetest.registered_nodes[node.name]
Code: Select all
minetest.set_node(pos, {name = "air"})
Code: Select all
minetest.remove_node(pos)
Re: Post your modding questions here
Another big improvement:ABJ wrote:Code: Select all
minetest.register_abm({ nodenames = {"default:wood"}, interval = 10.0, chance = 1, action = function(pos, node, active_object_count, active_object_count_wider) local node = minetest.get_node({x = pos.x, y = pos.y + 1, z = pos.z}) local nodedef = minetest.registered_nodes[node] if nodedef.walkable == true then minetest.set_node({x = pos.x, y = pos.y, z = pos.z}, {name = "air"}) end end })
The definition of a node does [almost certainly] not change. Therefore you can check only once:
Code: Select all
if minetest.registered_nodes["default:wood"].walkable then
minetest.register_abm({
nodenames = {"default:wood"},
interval = 10,
chance = 1,
action = minetest.remove_node
})
end
Re: Post your modding questions here
Is there any way to let players automaticly respawning using a serverside mod?
- christoferlevich
- Member
- Posts: 325
- Joined: Thu Dec 01, 2016 23:44
- GitHub: ChristoferL
- Location: Athol, Massachusetts
Re: Post your modding questions here
I am attempting to modify the old currency mod to work with US Currency for educational purposes. I have a functional method that sort of works, but IDEALLY, I have an angle I am not sure is doable, so I turn to you, my fellow minetesters...
I want to base the entire currency on pennies, and create some sort of auto-alias system that will understand that a dollar bill is 100 pennies while being represented by a separate inv image so the player will see a dollar bill but the program will see 100 pennies.
In this way, I hope to develop shops that can ask for two quarters as payment but accept 5 dimes, or 50 pennies, or two dimes and 6 nickles - ect...
I am trying to modify the currency mod, and it works with like node placement (if I put two quarters as payment using the example above) but, of course, will reject 5 dimes... even though their values are both 50 pennies.
Does this seem doable to those in the know or am I chasing rainbows? LOL
I want to base the entire currency on pennies, and create some sort of auto-alias system that will understand that a dollar bill is 100 pennies while being represented by a separate inv image so the player will see a dollar bill but the program will see 100 pennies.
In this way, I hope to develop shops that can ask for two quarters as payment but accept 5 dimes, or 50 pennies, or two dimes and 6 nickles - ect...
I am trying to modify the currency mod, and it works with like node placement (if I put two quarters as payment using the example above) but, of course, will reject 5 dimes... even though their values are both 50 pennies.
Does this seem doable to those in the know or am I chasing rainbows? LOL
everything can be a learning experience...
- azekill_DIABLO
- Member
- Posts: 7507
- Joined: Wed Oct 29, 2014 20:05
- GitHub: azekillDIABLO
- In-game: azekill_DIABLO
- Location: OMICRON
- Contact:
Re: Post your modding questions here
Code: Select all
core.register_alias dollar = 50penny
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!
DMs are always open if you want to get in touch!
- christoferlevich
- Member
- Posts: 325
- Joined: Thu Dec 01, 2016 23:44
- GitHub: ChristoferL
- Location: Athol, Massachusetts
Re: Post your modding questions here
Ahhhhh! It's a place to start. Core_register...azekill_DIABLO wrote:???? something like that?Code: Select all
core.register_alias dollar = 50penny
everything can be a learning experience...
- azekill_DIABLO
- Member
- Posts: 7507
- Joined: Wed Oct 29, 2014 20:05
- GitHub: azekillDIABLO
- In-game: azekill_DIABLO
- Location: OMICRON
- Contact:
Re: Post your modding questions here
don't follow my syntax though :)
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!
DMs are always open if you want to get in touch!
Re: Post your modding questions here
Can you provide a link to the currency mod you use? There are many mods of this kind.christoferlevich wrote:I am attempting to modify the old currency mod to work with US Currency for educational purposes. I have a functional method that sort of works, but IDEALLY, I have an angle I am not sure is doable, so I turn to you, my fellow minetesters...
I think the place to integrate this feature is mainly the code of the shops.christoferlevich wrote: I want to base the entire currency on pennies, and create some sort of auto-alias system that will understand that a dollar bill is 100 pennies while being represented by a separate inv image so the player will see a dollar bill but the program will see 100 pennies.
In this way, I hope to develop shops that can ask for two quarters as payment but accept 5 dimes, or 50 pennies, or two dimes and 6 nickles - ect...
I am trying to modify the currency mod, and it works with like node placement (if I put two quarters as payment using the example above) but, of course, will reject 5 dimes... even though their values are both 50 pennies.
Does this seem doable to those in the know or am I chasing rainbows? LOL
- christoferlevich
- Member
- Posts: 325
- Joined: Thu Dec 01, 2016 23:44
- GitHub: ChristoferL
- Location: Athol, Massachusetts
Re: Post your modding questions here
No... But the keywords to look for are golden.azekill_DIABLO wrote:don't follow my syntax though :)
everything can be a learning experience...
- christoferlevich
- Member
- Posts: 325
- Joined: Thu Dec 01, 2016 23:44
- GitHub: ChristoferL
- Location: Athol, Massachusetts
Re: Post your modding questions here
I am guessing at remedies and will try either way. This would be huge for the 'teachers' if it had this functionality.Gerald wrote: Can you provide a link to the currency mod you use? There are many mods of this kind.
The forum post appears to be deleted for the mod but it appears to be this one:
https://github.com/minetest-mods/currencyGerald wrote:I think the place to integrate this feature is mainly the code of the shops.
everything can be a learning experience...
Re: Post your modding questions here
My solution is the following:
modify currency/shop.lua
modify currency/shop.lua
- Add a table e.g. "default.shop.replacements" to register replacements.
- Add two inventories to the shop (see line 111) "owner_wants_adjusted" and "customers_gave_adjusted"
- While trading go through the "owner_wants" and "cotumer_gave" inventories and copy everything to the adjusted versions if there is no replacement and replace if there is one.
- Check for accord in the adjusted inventories. (see line 191)
- exchange using the adjusted inventories (this is strange because everything is replaced even if it fits perfectly; The shopowner only gets pennys but there is no other simple solution) (see line 197)
- orwell
- Member
- Posts: 958
- Joined: Wed Jun 24, 2015 18:45
- GitHub: orwell96
- IRC: orwell96_mt
- In-game: orwell
- Location: Raxacoricofallapatorius
Re: Post your modding questions here
Not exactly. It's the generation chunk size, which is 48^3 ( if i remember right)cx384 wrote:It is called mapgen_limit.Lone_Wolf wrote:Question1:
Where is the setting to make my map smaller and does the map side have to be divisible by 16*16*16?
https://github.com/minetest/minetest/bl ... mple#L1194
mapgen_limit haven't to be divisible by 16, but "only mapchunks completely within the mapgen limit are generated".
(one mapchunks ≙ 16*16*16 nodes)
-
- Member
- Posts: 818
- Joined: Tue Apr 14, 2015 01:59
- GitHub: raymoo
- IRC: Hijiri
- In-game: Raymoo + Clownpiece
Re: Post your modding questions here
It's 80^3
Every time a mod API is left undocumented, a koala dies.
- ErrorNull
- Member
- Posts: 274
- Joined: Thu Mar 03, 2016 00:43
- GitHub: ErrorNull0
Re: Post your modding questions here
Hello, i'm going to try using nodetimers for the first time and have a few quick and basic questions. Here is an example:
question #1. The timer will loop indefinitely and this will print 'hello' every 10 seconds.. is that correct?
question #2. If player walks away from 'some_position' and the mapchunk unloads, the nodetimer will stop execution and 'pause' until the mapchunk is loaded again.. is that right?
I also have a question about minetest.emerge_area(pos1, pos2) that is related:
question #3. When I call this function, the distanct mapchunk located at pos1 and pos2 will be force-loaded, therefor I can access things like node metadata and have nodetimers behave like normal. Is that right?
question #4. How long does this far-away mapchunk remain loaded? I'm assuming until server restart, then I will need to call minetest.emerge() again is that correct?
question #5. Is there a way for forcable unload a mapchunk that was loaded via minetest.emerge()?
Thank you for any clarification!
Code: Select all
local nodetimer = minetest.get_node_timer(some_position)
nodetimer:start(10)
[inside node definition at 'some_position']
on_timer = function(pos, elapsed)
print("Hello")
end
question #2. If player walks away from 'some_position' and the mapchunk unloads, the nodetimer will stop execution and 'pause' until the mapchunk is loaded again.. is that right?
I also have a question about minetest.emerge_area(pos1, pos2) that is related:
question #3. When I call this function, the distanct mapchunk located at pos1 and pos2 will be force-loaded, therefor I can access things like node metadata and have nodetimers behave like normal. Is that right?
question #4. How long does this far-away mapchunk remain loaded? I'm assuming until server restart, then I will need to call minetest.emerge() again is that correct?
question #5. Is there a way for forcable unload a mapchunk that was loaded via minetest.emerge()?
Thank you for any clarification!
-
- Member
- Posts: 818
- Joined: Tue Apr 14, 2015 01:59
- GitHub: raymoo
- IRC: Hijiri
- In-game: Raymoo + Clownpiece
Re: Post your modding questions here
1) No. Check the documentation for on_timer: to make the timer restart you need to return true from the callback.
2) Yes
3) Not sure about node timers, but I think you can access metadata even if its block is unloaded. emerge_area however only momentarily loads the area. I'm not how long it stays loaded, my guess would be for one server frame. I would guess that node timers will be run if they are due, but I am not sure, you should test it.
4) Answered in 3; probably only for one server frame, and in any case not forever. If you want to forceload a block then use minetest.forceload_block
5) If you use minetest.forceload_block then using minetest.forceload_free_block will undo the forceload.
Be careful if you use persistent forceloads though. If each forceload isn't matched by a call to forceload_free_block, you will leak forceloaded blocks. The approach I would take is to never use persistent forceloads, and use mod storage to keep track of any persistent forceloading information. That way removing a mod will also remove its forceloads.
2) Yes
3) Not sure about node timers, but I think you can access metadata even if its block is unloaded. emerge_area however only momentarily loads the area. I'm not how long it stays loaded, my guess would be for one server frame. I would guess that node timers will be run if they are due, but I am not sure, you should test it.
4) Answered in 3; probably only for one server frame, and in any case not forever. If you want to forceload a block then use minetest.forceload_block
5) If you use minetest.forceload_block then using minetest.forceload_free_block will undo the forceload.
Be careful if you use persistent forceloads though. If each forceload isn't matched by a call to forceload_free_block, you will leak forceloaded blocks. The approach I would take is to never use persistent forceloads, and use mod storage to keep track of any persistent forceloading information. That way removing a mod will also remove its forceloads.
Every time a mod API is left undocumented, a koala dies.
- ErrorNull
- Member
- Posts: 274
- Joined: Thu Mar 03, 2016 00:43
- GitHub: ErrorNull0
Re: Post your modding questions here
thanks you fir your answers Byakuren! it seems we cannot access node Metadata on nodes that are not loaded - it's one of the reasons why I'm having to explore the emerge_area idea. one server frame sounds like a short duration. does forceload_block do the same as emerge_area? if so it may be a more flexible option as i think I'd like to have distant blocks loaded for say 10 seconds then i can use forceload_free_block.
Who is online
Users browsing this forum: No registered users and 7 guests