Post your modding questions here

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

@BrunoMine: #players doesn't work with such tables. Count the players in the for thing.
he/him; Codeberg; GitHub; ContentDB; public personal TODO list; "DS" is preferred (but often too short)

ABJ
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

by ABJ » Post

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: 1082
Joined: Thu Apr 25, 2013 17:29
GitHub: BrunoMine
Location: SP-Brasil
Contact:

Re: Post your modding questions here

by BrunoMine » Post

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: 1082
Joined: Thu Apr 25, 2013 17:29
GitHub: BrunoMine
Location: SP-Brasil
Contact:

Re: Post your modding questions here

by BrunoMine » Post

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
Desour
Member
Posts: 1473
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

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
he/him; Codeberg; GitHub; ContentDB; public personal TODO list; "DS" is preferred (but often too short)

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

Re: Post your modding questions here

by burli » Post

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

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

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

by rubenwardy » Post

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
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

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

Re: Post your modding questions here

by burli » Post

Ah, ok. Thanks

User avatar
GreenXenith
Member
Posts: 1356
Joined: Wed Oct 28, 2015 01:26
GitHub: GreenXenith
Location: UTC-8:00
Contact:

Re: Post your modding questions here

by GreenXenith » Post

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)?
YouTube | Mods | Patreon | Minetest Discord @greenxenith

You should not be able to read this message.

ABJ
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

by ABJ » Post

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

User avatar
GreenXenith
Member
Posts: 1356
Joined: Wed Oct 28, 2015 01:26
GitHub: GreenXenith
Location: UTC-8:00
Contact:

Re: Post your modding questions here

by GreenXenith » Post

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".
YouTube | Mods | Patreon | Minetest Discord @greenxenith

You should not be able to read this message.

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 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: 2836
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

by Hybrid Dog » Post

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
In-game: ozkur or XoRoUZ
Location: 6 minutes in the future

Re: Post your modding questions here

by ozkur » Post

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: 2836
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

by Hybrid Dog » Post

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
tmp.png (2.65 KiB) Viewed 719 times

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

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

Re: Post your modding questions here

by BrunoMine » Post

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
In-game: ozkur or XoRoUZ
Location: 6 minutes in the future

Re:

by ozkur » Post

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
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

Re: Post your modding questions here

by kaeza » Post

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
In-game: ozkur or XoRoUZ
Location: 6 minutes in the future

Re: Post your modding questions here

by ozkur » Post

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: 2836
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

Re: Post your modding questions here

by Hybrid Dog » Post

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

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

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

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: 1643
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Post

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

User avatar
GreenXenith
Member
Posts: 1356
Joined: Wed Oct 28, 2015 01:26
GitHub: GreenXenith
Location: UTC-8:00
Contact:

Re: Post your modding questions here

by GreenXenith » Post

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?
YouTube | Mods | Patreon | Minetest Discord @greenxenith

You should not be able to read this message.

Locked

Who is online

Users browsing this forum: No registered users and 7 guests