Post your modding questions here
-
- Member
- Posts: 818
- Joined: Tue Apr 14, 2015 01:59
- GitHub: raymoo
- IRC: Hijiri
- In-game: Raymoo + Clownpiece
Re: Post your modding questions here
No, they are not the same. forceload_block will load a block until it is freed (transient forceloads are freed when the server shuts down, as well as if they are manually freed with forceload_free_block).
You might want to describe what specifically you are trying to do though, because loading an area to get timers to run seems like a hacky way to do things.
You might want to describe what specifically you are trying to do though, because loading an area to get timers to run seems like a hacky way to do things.
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 Byakuren. I admit it is a bit hacky. Here's my current challenge:
Sokomine's mg_villages mod spawns villages during mapgen time.. during which i can 'hook in' and spawn my own villagers via a convenient api function provided by mg_villages.
My villager entities spawn to the map just fine for those villages that generate at a position within the active range of the player.. like around 40m. But, mg_villages mod will also generate villages like 100m and much farther away, for which my villager entities do not seem to spawn correctly.. though my lua debug output shows the entity is created and add_entity seems to not throw any errors. But then, when player arrives at the distant village, the (spawned?) villager does not seem to load or execute the on_activate and on_staticdata functions.
In addition, my villager spawning algorithm also needs node metadata access at the position of each village when it generates. I found that for villages that are far away from the player, minetest throws errors that it cannot access the node metadata.. i suspect because those positions are still not loaded and node are the 'ignore' type.
So far I have experimented with executing emerge_area at the position of these distance villages as they generate. This seems to fix my node metadata access, and I don't get those errors anymore. This also seems to help (but not solve) my villagers spawning.. as now my debug output shows the on_activate and on_staticdata functions executing on the villager spawn attempts. But, when a player arrives that the village, the villager entity does not load -- on_activate does not seem to run.
My next experimentation is to use nodetimers that are tied to each villager spawn position and to periodically check for player distance to these spawn positions. When player is within say 30m distance, the nodetimer will detect this on its next cycle and spawn the villager for reals. Hehe. Is there a more elegant method?
Sokomine's mg_villages mod spawns villages during mapgen time.. during which i can 'hook in' and spawn my own villagers via a convenient api function provided by mg_villages.
My villager entities spawn to the map just fine for those villages that generate at a position within the active range of the player.. like around 40m. But, mg_villages mod will also generate villages like 100m and much farther away, for which my villager entities do not seem to spawn correctly.. though my lua debug output shows the entity is created and add_entity seems to not throw any errors. But then, when player arrives at the distant village, the (spawned?) villager does not seem to load or execute the on_activate and on_staticdata functions.
In addition, my villager spawning algorithm also needs node metadata access at the position of each village when it generates. I found that for villages that are far away from the player, minetest throws errors that it cannot access the node metadata.. i suspect because those positions are still not loaded and node are the 'ignore' type.
So far I have experimented with executing emerge_area at the position of these distance villages as they generate. This seems to fix my node metadata access, and I don't get those errors anymore. This also seems to help (but not solve) my villagers spawning.. as now my debug output shows the on_activate and on_staticdata functions executing on the villager spawn attempts. But, when a player arrives that the village, the villager entity does not load -- on_activate does not seem to run.
My next experimentation is to use nodetimers that are tied to each villager spawn position and to periodically check for player distance to these spawn positions. When player is within say 30m distance, the nodetimer will detect this on its next cycle and spawn the villager for reals. Hehe. Is there a more elegant method?
Last edited by ErrorNull on Mon Jul 17, 2017 07:15, edited 1 time in total.
- 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
You could use an run_on/at_every_load LBM for your spawner node, which immediately removes the node and spawns the villager as soon as the block is loaded.
- ErrorNull
- Member
- Posts: 274
- Joined: Thu Mar 03, 2016 00:43
- GitHub: ErrorNull0
Re: Post your modding questions here
I'll look into LBMs further. haven't used them before, but might as well try them! i remember sokomine also mentioned LBMs with regard to how the mob spawn nodes were designed. maybe i should've tried LBMs sooner! thanks.
- christoferlevich
- Member
- Posts: 325
- Joined: Thu Dec 01, 2016 23:44
- GitHub: ChristoferL
- Location: Athol, Massachusetts
Re: Post your modding questions here
I was sniffing code in the Bank Accounts Mod (viewtopic.php?t=16271) counts the bills (1, 5, 10) (in teller computer for deposits) as individual dollar amounts - looking to figure this one out as I think I can easily adapt it right down to the pennies if I adjust the multiplier (in their code) properly.Gerald wrote:My solution is the following:
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)
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
n/m
Last edited by christoferlevich on Mon Jul 17, 2017 20:40, edited 1 time in total.
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
So I managed to register an alias and the shop (in currency mod) accepts a nickle as 5 pennies (set the shop for 6 pennies but paid with a nickle and a penny which it didn't do before the alias) but now, when I make the exchange, the alias doesn't disapear with the penny (as payment). That includes if I stack the nickels. Nothing leaves the nickel (alias for penny 5)
Any one know what might clear an 'alias' in the formspec when making an exchange? If I can get by this hurdle I have just about everything I need for the educational US Currency mod I am working on. Still researching and tweaking, but now I might finally be stuck.
-it gets worse... I deleted the alias register but its still functioning. UG - where is it stored?
Any one know what might clear an 'alias' in the formspec when making an exchange? If I can get by this hurdle I have just about everything I need for the educational US Currency mod I am working on. Still researching and tweaking, but now I might finally be stuck.
-it gets worse... I deleted the alias register but its still functioning. UG - where is it stored?
Last edited by christoferlevich on Mon Jul 17, 2017 23:08, edited 1 time in total.
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
Im trying... everything I've tried seems to fail... going through tutorials, mods, and anything else I can find to learn. LOL - I simply couldn't figure out how to do what you stated, exactly. Least, not yet.Gerald wrote:My solution is the following:
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)
everything can be a learning experience...
-
- Member
- Posts: 35
- Joined: Sun Jul 23, 2017 12:53
- In-game: Owlondrugs
Re: Post your modding questions here
I created the ore.But it is generated only in minimal Development world...Why?
- Wuzzy
- Member
- Posts: 4803
- Joined: Mon Sep 24, 2012 15:01
- GitHub: Wuzzy2
- IRC: Wuzzy
- In-game: Wuzzy
- Contact:
Hardware coloring
A really dumb question:
Why is it called “hardware colouring”?
What does this have to do with hardware?
Why is it called “hardware colouring”?
What does this have to do with hardware?
Re: Hardware coloring
There are no new textures created, the hardware is just told to modify the existing texture in a certain (colorful) way?Wuzzy wrote:A really dumb question:
Why is it called “hardware colouring”?
What does this have to do with hardware?
- v-rob
- Developer
- Posts: 971
- Joined: Thu Mar 24, 2016 03:19
- GitHub: v-rob
- IRC: v-rob
- Location: Right behind you.
Re: Post your modding questions here
I have a question: I want to make a block that plays a sound and repeats it if it has power from mesecons, but when the power turns off, the sound stops. I can get the sound to play, but not stop at the right time or repeat.
- Napiophelios
- Member
- Posts: 1035
- Joined: Mon Jul 07, 2014 01:14
- GitHub: Napiophelios
- IRC: Nappi
- In-game: Nappi
Re: Post your modding questions here
I had a similar problem;v-rob wrote:I have a question: I want to make a block that plays a sound and repeats it if it has power from mesecons, but when the power turns off, the sound stops. I can get the sound to play, but not stop at the right time or repeat.
viewtopic.php?p=248170#p248170
check few replies after mine for some suggestions
- v-rob
- Developer
- Posts: 971
- Joined: Thu Mar 24, 2016 03:19
- GitHub: v-rob
- IRC: v-rob
- Location: Right behind you.
Re: Post your modding questions here
Thanks! Problem solved immediately.
-
- New member
- Posts: 1
- Joined: Fri Jul 28, 2017 19:44
- In-game: Tactical_Slime
Re: Post your modding questions here
topic : How do i make a ui?
reason : i want to make a generator that uses fuel
more info : i couldent find any tutorials about making a ui
reason : i want to make a generator that uses fuel
more info : i couldent find any tutorials about making a ui
- TumeniNodes
- Member
- Posts: 2943
- Joined: Fri Feb 26, 2016 19:49
- GitHub: TumeniNodes
- IRC: tumeninodes
- In-game: TumeniNodes
- Location: in the dark recesses of the mind
- Contact:
Re: Post your modding questions here
https://rubenwardy.com/minetest_modding ... specs.htmlTactical Slime wrote:topic : How do i make a ui?
reason : i want to make a generator that uses fuel
more info : i couldent find any tutorials about making a ui
A Wonderful World
Re: Post your modding questions here
How is that different from just using gold-ingots ?christoferlevich wrote:I am attempting to modify the old currency mod to work with US Currency ..
I want to base the entire currency on pennies,
* Links to currency & shop-mods you are using ?alias system .. dollar bill is 100 pennies .. separate inv image .. develop shops
* Other mods you tried, and reasons they don't fit your goal ?
* You already have item-definitions/graphics for pennies. nickels, dollars etc. ?
* Use robots & BMs :)
On the old robots-server, I had written a program simple shop, and some variants...
Eg, a snack-shop that sells different goods (coffee, donuts, etc., each good with
its own price) depending on the button that was pressed to activate the shop,
or a shop that accepts as payment 1 gold as well as 3 steel (or copper etc.).
Last edited by hajo on Sat Aug 12, 2017 14:15, edited 1 time in total.
'My' wiki-pages: Build-a-home - basic-robot - basic_robot_csm - basic-machines - digtron - xdecor -
Map-Database
Map-Database
Re: Post your modding questions here
Topic: Displaying skins
Reason: On a map/server/game I'm making I want to display available skins like you would display armor in Minecraft. Is there any mod that does that?
Reason: On a map/server/game I'm making I want to display available skins like you would display armor in Minecraft. Is there any mod that does that?
Check out my emerald mod: viewtopic.php?f=11&t=15485
- Lone_Wolf
- Member
- Posts: 2578
- Joined: Sun Apr 09, 2017 05:50
- GitHub: LoneWolfHT
- IRC: LandarVargan
- In-game: LandarVargan
Re: Post your modding questions here
There is no mod/clientmod that does that yet. There is a poll though.CC10 wrote:Topic: Displaying skins
Reason: On a map/server/game I'm making I want to display available skins like you would display armor in Minecraft. Is there any mod that does that?
-
- New member
- Posts: 9
- Joined: Fri Aug 04, 2017 07:59
- GitHub: mezantrop
- Location: Brno, CZ
- Contact:
Re: Post your modding questions here
topic: set_attach usage help.
reason: I want to attach and move two nodes together.
more info: Sorry for a dumb question, I'm newbie to minetest game as well as minetest development. Now trying to create two entities and make the second to repeat all moves of the first one. Have stuck at the early beginning with attaching the second entity to the first:
Couldn't someone explain me how to use it properly, as obviously, I'm doing it wrong.
P.S. what is the "bone" - the second argument of set_attach?
Thank you in advance.
reason: I want to attach and move two nodes together.
more info: Sorry for a dumb question, I'm newbie to minetest game as well as minetest development. Now trying to create two entities and make the second to repeat all moves of the first one. Have stuck at the early beginning with attaching the second entity to the first:
Code: Select all
second = minetest.add_entity(pos_behind_first, "my_mod:second")
second:set_attach(self.object, "", {x=0,y=0,z=0}, {x=0,y=0,z=0})
P.S. what is the "bone" - the second argument of set_attach?
Thank you in advance.
Re: Post your modding questions here
Each object needs a model which has bones.mezantrop wrote: P.S. what is the "bone" - the second argument of set_attach?
Can your read this?
- Desour
- Member
- Posts: 1472
- Joined: Thu Jun 19, 2014 19:49
- GitHub: Desour
- IRC: Desour
- In-game: DS
- Location: I'm scared that if this is too exact, I will be unable to use my keyboard.
Re: Post your modding questions here
No they don't need bones, but mesh entities can have bones for animations and bone position setting. "" is good at attaching since attaching to a bone is currently bad, the objects don't stick together correctly.cx384 wrote:Each object needs a model which has bones.mezantrop wrote: P.S. what is the "bone" - the second argument of set_attach?
If pos_behind_first is a valid pos and there's a registered entity called "my_mod:second" and self.object is an object, I don't see any problems with your code. Maybe it's not your fault, I have some problems with attaching, too. I guess you do this in "my_mod:second"'s on_activate. Sorry, but I think, I can't help you with this.
he/him; Codeberg; GitHub; ContentDB; public personal TODO list; "DS" is preferred (but often too short)
-
- New member
- Posts: 9
- Joined: Fri Aug 04, 2017 07:59
- GitHub: mezantrop
- Location: Brno, CZ
- Contact:
Re: Post your modding questions here
Yes, pos_behind_first is a position just "behind" the first node. It's valid.DS-minetest wrote: If pos_behind_first is a valid pos and there's a registered entity called "my_mod:second" and self.object is an object, I don't see any problems with your code. Maybe it's not your fault, I have some problems with attaching, too. I guess you do this in "my_mod:second"'s on_activate. Sorry, but I think, I can't help you with this.
self.object should be the object reference to the first node (hope I'm right with it), as I call it from on_activate() of the first node. And you gave me the clue, I should do it from on_activate() of the second node, because the second node might not be created at the moment of set_attach() in the first node. Thank you very much for that!
- Desour
- Member
- Posts: 1472
- Joined: Thu Jun 19, 2014 19:49
- GitHub: Desour
- IRC: Desour
- In-game: DS
- Location: I'm scared that if this is too exact, I will be unable to use my keyboard.
Re: Post your modding questions here
Don't confuse nodes with objects. Nodes are the things that normally are cubes. (Also don't confuse nodes with blocks, blocks are mapblocks (16^3 nodes). And don't confuse mapblocks with chunks, chunks are mapgen chunks.)mezantrop wrote:Yes, pos_behind_first is a position just "behind" the first node. It's valid.DS-minetest wrote: If pos_behind_first is a valid pos and there's a registered entity called "my_mod:second" and self.object is an object, I don't see any problems with your code. Maybe it's not your fault, I have some problems with attaching, too. I guess you do this in "my_mod:second"'s on_activate. Sorry, but I think, I can't help you with this.
self.object should be the object reference to the first node (hope I'm right with it), as I call it from on_activate() of the first node. And you gave me the clue, I should do it from on_activate() of the second node, because the second node might not be created at the moment of set_attach() in the first node. Thank you very much for that!
Actually I meant the on_activate of the first entity. But it's great and good to know if it works good to attach in the attached on_activate!
he/him; Codeberg; GitHub; ContentDB; public personal TODO list; "DS" is preferred (but often too short)
-
- New member
- Posts: 9
- Joined: Fri Aug 04, 2017 07:59
- GitHub: mezantrop
- Location: Brno, CZ
- Contact:
Re: Post your modding questions here
Thank you for clarification, because, I do confuse :) Finally I have got attachment to work, calling set_attach() from first entity, attaching the second one like:DS-minetest wrote: Don't confuse nodes with objects. Nodes are the things that normally are cubes. (Also don't confuse nodes with blocks, blocks are mapblocks (16^3 nodes). And don't confuse mapblocks with chunks, chunks are mapgen chunks.)
Actually I meant the on_activate of the first entity. But it's great and good to know if it works good to attach in the attached on_activate!
Code: Select all
second:set_attach(self.object, "", {x=0,y=0,z=-10}, {x=0,y=0,z=0})
Who is online
Users browsing this forum: No registered users and 5 guests