Post your modding questions here

User avatar
DS-minetest
Member
 
Posts: 1123
Joined: Thu Jun 19, 2014 19:49
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.
GitHub: DS-Minetest
In-game: DS

Re: Post your modding questions here

by DS-minetest » Tue Feb 07, 2017 13:14

@BrunoMine: #players doesn't work with such tables. Count the players in the for thing.
Do not call me -minetest.
Call me DS or DS-minetest.
I am German, so you don't have to pm me English if you are also German.
The background is a lie.
 

ABJ
Member
 
Posts: 3015
Joined: Sun Jan 18, 2015 13:02
Location: In Earth orbit, with a perigee of 1048 km and an apogee of 1337 km and an inclination of 69 degrees.
GitHub: ABJ-MV
In-game: ABJ

Re: Post your modding questions here

by ABJ » Tue Feb 07, 2017 14:26

How do I create something that runs as long as a block exists but disappears when it is dug? EG: smoke for fire.
 

User avatar
BrunoMine
Member
 
Posts: 1070
Joined: Thu Apr 25, 2013 17:29
Location: SP-Brasil
GitHub: BrunoMine

Re: Post your modding questions here

by BrunoMine » Tue Feb 07, 2017 15:05

I am not able to use the dsdsds method. minetest.rollback_get_node_actions.
Code: Select all
minetest.register_on_dignode(function(pos, oldnode, digger)
   local rollback = minetest.rollback_get_node_actions(
      pos, -- pos
      10, -- range
      5, -- seconds
      5 -- limit
   ) or {}
   
   minetest.chat_send_all(table.maxn(rollback).." actions")
end)

Results:
Code: Select all
0 actions
0 actions
0 actions
...

What is wrong?

EDIT:
I forgot to enable it in minetest.conf
SOLVED!
Last edited by BrunoMine on Tue Feb 07, 2017 16:29, edited 2 times in total.
 

User avatar
BrunoMine
Member
 
Posts: 1070
Joined: Thu Apr 25, 2013 17:29
Location: SP-Brasil
GitHub: BrunoMine

Re: Post your modding questions here

by BrunoMine » Tue Feb 07, 2017 15:12

ABJ wrote:How do I create something that runs as long as a block exists but disappears when it is dug? EG: smoke for fire.


Have you tried an ABM?
This allows you to execute a function repeatedly while a node is active.
 

User avatar
DS-minetest
Member
 
Posts: 1123
Joined: Thu Jun 19, 2014 19:49
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.
GitHub: DS-Minetest
In-game: DS

Re: Post your modding questions here

by DS-minetest » Tue Feb 07, 2017 16:22

BrunoMine wrote:
ABJ wrote:How do I create something that runs as long as a block exists but disappears when it is dug? EG: smoke for fire.


Have you tried an ABM?
This allows you to execute a function repeatedly while a node is active.

An abm wouldn't make much sense here.
on_construct: Add a particlespawner in a variable (bla = minetest.add_particlespawner(particlespawner definition)) and store this variable somewhere, like in metadata.
on_destruct: Get this variable and remove the particlespawner again.
api:
particlespawner
on_construct and destruct
Do not call me -minetest.
Call me DS or DS-minetest.
I am German, so you don't have to pm me English if you are also German.
The background is a lie.
 

User avatar
burli
Member
 
Posts: 1641
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Tue Feb 07, 2017 16:59

The documentation says, that get_node_timer accepts fractional values. But this code doesn't work. I only get full seconds

Code: Select all
minetest.get_node_timer(leaves_near[i]):start(math.random() * 10.0)


What's wrong? The documentation, the function or I?
 

User avatar
orwell
Member
 
Posts: 805
Joined: Wed Jun 24, 2015 18:45
Location: Raxacoricofallapatorius
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell

Re: Post your modding questions here

by orwell » Wed Feb 08, 2017 09:41

The documentation, I think. Mesecons pressure plates also only work at an 1s interval.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

User avatar
orwell
Member
 
Posts: 805
Joined: Wed Jun 24, 2015 18:45
Location: Raxacoricofallapatorius
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell

Re: Post your modding questions here

by orwell » Wed Feb 08, 2017 09:43

DS-minetest wrote:
BrunoMine wrote:
ABJ wrote:How do I create something that runs as long as a block exists but disappears when it is dug? EG: smoke for fire.


Have you tried an ABM?
This allows you to execute a function repeatedly while a node is active.

An abm wouldn't make much sense here.
on_construct: Add a particlespawner in a variable (bla = minetest.add_particlespawner(particlespawner definition)) and store this variable somewhere, like in metadata.
on_destruct: Get this variable and remove the particlespawner again.
api:
particlespawner
on_construct and destruct

Particle spawners get removed when the block is unloaded I think. Use LBM to spawn it again.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

User avatar
rubenwardy
Moderator
 
Posts: 5965
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: Post your modding questions here

by rubenwardy » Wed Feb 08, 2017 12:51

burli wrote:The documentation says, that get_node_timer accepts fractional values. But this code doesn't work. I only get full seconds

Code: Select all
minetest.get_node_timer(leaves_near[i]):start(math.random() * 10.0)


What's wrong? The documentation, the function or I?



There's a setting which makes this run faster. By default it only runs once a second
 

User avatar
burli
Member
 
Posts: 1641
Joined: Fri Apr 10, 2015 13:18
 

User avatar
GreenDimond
Member
 
Posts: 1295
Joined: Wed Oct 28, 2015 01:26
Location: SCP-3008
GitHub: GreenXenith
IRC: GreenDimond
In-game: GreenDimond

Re: Post your modding questions here

by GreenDimond » Wed Feb 08, 2017 17:35

How do I make items spawn in a certain area?
Explain:
I have block A and block B.
bA and bB form opposite corners of a cubic area.
I want a certain item to spawn anywhere in that area at a certain rate (appear and fall to the floor).
How do I do this (needs to be according to bA and BB so the area can be however I want)?
Y▹uTube | Mods | Patre●n | Twitter | Minetest Discord | GreenDimond#3232

Hey, you. You're finally awake.
You were trying to view their profile, right? Found the rest of their signature, same as us, and that guest over there.
 

ABJ
Member
 
Posts: 3015
Joined: Sun Jan 18, 2015 13:02
Location: In Earth orbit, with a perigee of 1048 km and an apogee of 1337 km and an inclination of 69 degrees.
GitHub: ABJ-MV
In-game: ABJ

Re: Post your modding questions here

by ABJ » Thu Feb 09, 2017 08:55

How do I make something that gets created with a block and deleted with it?
 

User avatar
GreenDimond
Member
 
Posts: 1295
Joined: Wed Oct 28, 2015 01:26
Location: SCP-3008
GitHub: GreenXenith
IRC: GreenDimond
In-game: GreenDimond

Re: Post your modding questions here

by GreenDimond » Fri Feb 10, 2017 01:54

Another question: Is it possible to use items as buttons in a custom chest?
Explain:
Have a chest with 2 items.
Click/select an item and it takes you to another "page" in the chest.
In that "page", have a "back" item so when pressed takes you back to main "page".
Y▹uTube | Mods | Patre●n | Twitter | Minetest Discord | GreenDimond#3232

Hey, you. You're finally awake.
You were trying to view their profile, right? Found the rest of their signature, same as us, and that guest over there.
 

User avatar
orwell
Member
 
Posts: 805
Joined: Wed Jun 24, 2015 18:45
Location: Raxacoricofallapatorius
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell

Re: Post your modding questions here

by orwell » Fri Feb 10, 2017 06:50

You can add image buttons that look like the item. (item_image_button[])
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

User avatar
Hybrid Dog
Member
 
Posts: 2728
Joined: Thu Nov 01, 2012 12:46

by Hybrid Dog » Fri Feb 10, 2017 10:33

ABJ, you can use the on_place, on_construct etc. in the node definition.

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪
 

ozkur
Member
 
Posts: 180
Joined: Wed Oct 07, 2015 20:59
Location: 6 minutes in the future
In-game: ozkur or XoRoUZ

Re: Post your modding questions here

by ozkur » Fri Feb 10, 2017 21:33

Sorry that this is the derpiest of all derpy and stupid questions:

How do I upload a mod to the forums?
Biplanes! 'Nuff said

I am a native English speaker, Ich spreche kein Deuscht, mais je parle un pue français.
 

User avatar
Hybrid Dog
Member
 
Posts: 2728
Joined: Thu Nov 01, 2012 12:46

by Hybrid Dog » Fri Feb 10, 2017 22:41

ozkur, there are lots of ways to upload a mod, e.g. here's the init.lua of my version of the drippingwater mod as png:
Image
(it's grey because ascii)
Attachments
tmp.png
(2.65 KiB) Downloaded 1 time

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪
 

User avatar
BrunoMine
Member
 
Posts: 1070
Joined: Thu Apr 25, 2013 17:29
Location: SP-Brasil
GitHub: BrunoMine

Re: Post your modding questions here

by BrunoMine » Fri Feb 10, 2017 23:16

Hello guys.
I'm having trouble for detect objects in an area. I have used the minetest.get_objects_inside_radius method, but it does not work correctly. Sometimes it does not work, usually when I'm at a disancia of approximately 20 blocks.
Is there any more consistent way to perform this verification?
 

ozkur
Member
 
Posts: 180
Joined: Wed Oct 07, 2015 20:59
Location: 6 minutes in the future
In-game: ozkur or XoRoUZ

Re:

by ozkur » Fri Feb 10, 2017 23:29

Hybrid Dog wrote:ozkur, there are lots of ways to upload a mod, e.g. here's the init.lua of my version of the drippingwater mod as png:
Image
(it's grey because ascii)

Thanks for trying, but I still am confused.
Are you saying I do something like turn the entire folder into a .png file?
Biplanes! 'Nuff said

I am a native English speaker, Ich spreche kein Deuscht, mais je parle un pue français.
 

User avatar
kaeza
Moderator
 
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
Location: Montevideo, Uruguay
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

Re: Post your modding questions here

by kaeza » Sat Feb 11, 2017 03:39

ozkur wrote:Sorry that this is the derpiest of all derpy and stupid questions:

How do I upload a mod to the forums?

Use an archiving program(*) to compress your folder in a ZIP file, create a new topic for it in the WIP Mods subforum(**), and upload the ZIP file as an attachment ("Upload attachment" tab under the posting text box).

(*) Windows comes with support to compress folders, or you can use an external program like 7-zip.
(**) See also the guidelines for mod releases.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal
 

ozkur
Member
 
Posts: 180
Joined: Wed Oct 07, 2015 20:59
Location: 6 minutes in the future
In-game: ozkur or XoRoUZ

Re: Post your modding questions here

by ozkur » Sat Feb 11, 2017 12:55

kaeza wrote:
ozkur wrote:Sorry that this is the derpiest of all derpy and stupid questions:

How do I upload a mod to the forums?

Use an archiving program(*) to compress your folder in a ZIP file, create a new topic for it in the WIP Mods subforum(**), and upload the ZIP file as an attachment ("Upload attachment" tab under the posting text box).

(*) Windows comes with support to compress folders, or you can use an external program like 7-zip.
(**) See also the guidelines for mod releases.

Thanks!
Biplanes! 'Nuff said

I am a native English speaker, Ich spreche kein Deuscht, mais je parle un pue français.
 

User avatar
Hybrid Dog
Member
 
Posts: 2728
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Sat Feb 11, 2017 21:00

BrunoMine, you can only get active objects. Maybe you need to forceload some chunks.

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪
 

User avatar
orwell
Member
 
Posts: 805
Joined: Wed Jun 24, 2015 18:45
Location: Raxacoricofallapatorius
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell

Re: Post your modding questions here

by orwell » Sat Feb 11, 2017 21:27

Hybrid Dog wrote:BrunoMine, you can only get active objects. Maybe you need to forceload some chunks.

Are you scanning for objects that your mod defines? Then let them save their last active position in a table and just search this yourself. Then just forceload that area(*)
#screwminetestsbuggyobjectmanagementsystem
To work consistently, that table has to be saved on shutdown.

(*) use that forceload anchors library, it handles forceloads better than minetest's internal.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

User avatar
burli
Member
 
Posts: 1641
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Mon Feb 13, 2017 06:00

How can I place a locked chest and a key to unlock to a map from a script?
 

User avatar
GreenDimond
Member
 
Posts: 1295
Joined: Wed Oct 28, 2015 01:26
Location: SCP-3008
GitHub: GreenXenith
IRC: GreenDimond
In-game: GreenDimond

Re: Post your modding questions here

by GreenDimond » Tue Feb 14, 2017 02:17

I seem to be having trouble with registering 2 'on_punch' to the same node.
Code: Select all
on_punch = function(pos, node, player, pointed_thing)
      local inv = player:get_inventory()
      inv:add_item("main", "modname:node")
on_punch = function(pos, node, puncher, pointed_thing)
      minetest.set_node(pos, {name = "modename:othernode", param2 = node.param2})
   end
   end

This is only one example of what I have tried. In this particular case, only the first function happens. Other times it was just the latter. I want both to happen. How do I do this?
Y▹uTube | Mods | Patre●n | Twitter | Minetest Discord | GreenDimond#3232

Hey, you. You're finally awake.
You were trying to view their profile, right? Found the rest of their signature, same as us, and that guest over there.
 

PreviousNext

Return to Modding Discussion



Who is online

Users browsing this forum: MSN [Bot] and 4 guests