Post your modding questions here

Byakuren
Member
Posts: 818
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: Post your modding questions here

by Byakuren » Post

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.
Every time a mod API is left undocumented, a koala dies.

User avatar
ErrorNull
Member
Posts: 271
Joined: Thu Mar 03, 2016 00:43
GitHub: ErrorNull0

Re: Post your modding questions here

by ErrorNull » Post

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?
Last edited by ErrorNull on Mon Jul 17, 2017 07:15, edited 1 time in total.

User avatar
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

by orwell » Post

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.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

User avatar
ErrorNull
Member
Posts: 271
Joined: Thu Mar 03, 2016 00:43
GitHub: ErrorNull0

Re: Post your modding questions here

by ErrorNull » Post

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.

User avatar
christoferlevich
Member
Posts: 325
Joined: Thu Dec 01, 2016 23:44
GitHub: ChristoferL
Location: Athol, Massachusetts

Re: Post your modding questions here

by christoferlevich » Post

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)
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.
everything can be a learning experience...

User avatar
christoferlevich
Member
Posts: 325
Joined: Thu Dec 01, 2016 23:44
GitHub: ChristoferL
Location: Athol, Massachusetts

Re: Post your modding questions here

by christoferlevich » Post

n/m
Last edited by christoferlevich on Mon Jul 17, 2017 20:40, edited 1 time in total.
everything can be a learning experience...

User avatar
christoferlevich
Member
Posts: 325
Joined: Thu Dec 01, 2016 23:44
GitHub: ChristoferL
Location: Athol, Massachusetts

Re: Post your modding questions here

by christoferlevich » Post

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?
Last edited by christoferlevich on Mon Jul 17, 2017 23:08, edited 1 time in total.
everything can be a learning experience...

User avatar
christoferlevich
Member
Posts: 325
Joined: Thu Dec 01, 2016 23:44
GitHub: ChristoferL
Location: Athol, Massachusetts

Re: Post your modding questions here

by christoferlevich » Post

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)
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.
everything can be a learning experience...

owlondrugs
Member
Posts: 35
Joined: Sun Jul 23, 2017 12:53
In-game: Owlondrugs

Re: Post your modding questions here

by owlondrugs » Post

I created the ore.But it is generated only in minimal Development world...Why?

User avatar
Wuzzy
Member
Posts: 4786
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Hardware coloring

by Wuzzy » Post

A really dumb question:

Why is it called “hardware colouring”?

What does this have to do with hardware?

sofar
Developer
Posts: 2146
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Hardware coloring

by sofar » Post

Wuzzy wrote:A really dumb question:

Why is it called “hardware colouring”?

What does this have to do with hardware?
There are no new textures created, the hardware is just told to modify the existing texture in a certain (colorful) way?

User avatar
v-rob
Developer
Posts: 970
Joined: Thu Mar 24, 2016 03:19
GitHub: v-rob
IRC: v-rob
Location: Right behind you.

Re: Post your modding questions here

by v-rob » Post

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.
Core Developer | My Best Mods: Bridger - Slats - Stained Glass

User avatar
Napiophelios
Member
Posts: 1035
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

Re: Post your modding questions here

by Napiophelios » Post

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.
I had a similar problem;
viewtopic.php?p=248170#p248170
check few replies after mine for some suggestions

User avatar
v-rob
Developer
Posts: 970
Joined: Thu Mar 24, 2016 03:19
GitHub: v-rob
IRC: v-rob
Location: Right behind you.

Re: Post your modding questions here

by v-rob » Post

Thanks! Problem solved immediately.
Core Developer | My Best Mods: Bridger - Slats - Stained Glass

Tactical Slime
New member
Posts: 1
Joined: Fri Jul 28, 2017 19:44
In-game: Tactical_Slime

Re: Post your modding questions here

by Tactical Slime » Post

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

User avatar
TumeniNodes
Member
Posts: 2941
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

by TumeniNodes » Post

Tactical 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
https://rubenwardy.com/minetest_modding ... specs.html
A Wonderful World

hajo
Member
Posts: 606
Joined: Thu Oct 13, 2016 10:45
Location: DE
Contact:

Re: Post your modding questions here

by hajo » Post

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,
How is that different from just using gold-ingots ?
alias system .. dollar bill is 100 pennies .. separate inv image .. develop shops
* Links to currency & shop-mods you are using ?
* 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.

CC10
Member
Posts: 19
Joined: Sun Aug 28, 2016 21:25
GitHub: CC10MAGIC
In-game: CC10

Re: Post your modding questions here

by CC10 » Post

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?
Check out my emerald mod: viewtopic.php?f=11&t=15485

User avatar
Lone_Wolf
Member
Posts: 2576
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: LandarVargan
In-game: LandarVargan

Re: Post your modding questions here

by Lone_Wolf » Post

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?
There is no mod/clientmod that does that yet. There is a poll though.
My ContentDB -|- Working on CaptureTheFlag -|- Minetest Forums Dark Theme!! (You need it)

mezantrop
New member
Posts: 9
Joined: Fri Aug 04, 2017 07:59
GitHub: mezantrop
Location: Brno, CZ
Contact:

Re: Post your modding questions here

by mezantrop » Post

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:

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})
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.

User avatar
cx384
Member
Posts: 653
Joined: Wed Apr 23, 2014 09:38
GitHub: cx384
IRC: cx384

Re: Post your modding questions here

by cx384 » Post

mezantrop wrote: P.S. what is the "bone" - the second argument of set_attach?
Each object needs a model which has bones.
Can your read this?

User avatar
Desour
Member
Posts: 1469
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

by Desour » Post

cx384 wrote:
mezantrop wrote: P.S. what is the "bone" - the second argument of set_attach?
Each object needs a model which has bones.
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.

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)

mezantrop
New member
Posts: 9
Joined: Fri Aug 04, 2017 07:59
GitHub: mezantrop
Location: Brno, CZ
Contact:

Re: Post your modding questions here

by mezantrop » Post

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.
Yes, pos_behind_first is a position just "behind" the first node. It's valid.
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!

User avatar
Desour
Member
Posts: 1469
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

by Desour » Post

mezantrop wrote:
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.
Yes, pos_behind_first is a position just "behind" the first node. It's valid.
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!
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!
he/him; Codeberg; GitHub; ContentDB; public personal TODO list; "DS" is preferred (but often too short)

mezantrop
New member
Posts: 9
Joined: Fri Aug 04, 2017 07:59
GitHub: mezantrop
Location: Brno, CZ
Contact:

Re: Post your modding questions here

by mezantrop » Post

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!
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:

Code: Select all

second:set_attach(self.object, "", {x=0,y=0,z=-10}, {x=0,y=0,z=0})

Locked

Who is online

Users browsing this forum: No registered users and 4 guests