Page 5 of 5

PostPosted: Thu May 30, 2013 14:06
by Zeg9
Jordach wrote:"Modding API has been deprecated in favour of a new one."

Does it mean we'll have to convert all our mods to the new api ?
/me hides...

PostPosted: Thu May 30, 2013 15:30
by Jordach
Zeg9 wrote:
Jordach wrote:"Modding API has been deprecated in favour of a new one."

Does it mean we'll have to convert all our mods to the new api ?
/me hides...
I was using a fake past tense.

PostPosted: Wed Jun 19, 2013 11:40
by AndDT
TNT from latest commit explodes immediately after I hit it with torch. Is it bug or feature? Minetest 0.4.7

PostPosted: Wed Jun 19, 2013 12:01
by PilzAdam
AndDT wrote:TNT from latest commit explodes immediately after I hit it with torch. Is it bug or feature? Minetest 0.4.7

It works for me...

PostPosted: Wed Jun 19, 2013 13:53
by arsdragonfly
What about adding mese crystal to the recipe?It resembles sulfur,and adding it also prevents abuse of TNT(it's super easy to get coal and gravel)

PostPosted: Fri Jul 05, 2013 00:16
by Tedypig
Is there a way to make it drop Mese and Diamonds? As of now it just destroys/removes them when it explodes.

PostPosted: Fri Jul 05, 2013 00:33
by PilzAdam
Tedypig wrote:Is there a way to make it drop Mese and Diamonds? As of now it just destroys/removes them when it explodes.

1/3 of all nodes are dropped as items.

PostPosted: Fri Jul 05, 2013 00:44
by Tedypig
PilzAdam wrote:
Tedypig wrote:Is there a way to make it drop Mese and Diamonds? As of now it just destroys/removes them when it explodes.

1/3 of all nodes are dropped as items.


Is there a way to make it drop 100% of removed nodes as items?

PostPosted: Fri Jul 05, 2013 04:38
by LionsDen
Tedypig wrote:
PilzAdam wrote:
Tedypig wrote:Is there a way to make it drop Mese and Diamonds? As of now it just destroys/removes them when it explodes.

1/3 of all nodes are dropped as items.


Is there a way to make it drop 100% of removed nodes as items?


Yes, at least this seemed to work for me when I just tried it. In the init.lua file, lines 10, 11 and 12 need to be commented out so it looks like this.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
        -- if math.random(1,3) == 3 then
        --    return
        -- end


EDIT: Bolded the filename.

PostPosted: Fri Jul 05, 2013 06:32
by Dan Duncombe
Is there any way to make it more powerful? I was thinking of doing a mod which includes an explosive and I was wondering how to make the explosion of this bigger. I will give credit to PilzAdam and whoever can help.

PostPosted: Fri Jul 05, 2013 07:57
by LionsDen
Dan Duncombe wrote:Is there any way to make it more powerful? I was thinking of doing a mod which includes an explosive and I was wondering how to make the explosion of this bigger. I will give credit to PilzAdam and whoever can help.


I have looked and tested and think I have found out the answer. You may not like it though. Lines 63, 64 and 65 control the size of the damage. they are part of the boom function in init.lua. They look like the following:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
        for dx=-2,2 do
            for dz=-2,2 do
                for dy=2,-2,-1 do


They are the x, y and z sizes of the file. I haven't played with the -1 value in the dy variable so I'm not sure what that does. Currently, the explosion damages nodes 5 nodes wide, 5 nodes deep and 5 nodes high. For my first test, I changed the 2's to 10's and tried it out. Ouch! My system slowed to a super crawl. Snails that are bedridden could move faster. That's because I was blowing up an area 21 wide by 21 deep by 21 nodes high which means the code was deciding what got sent on which trajectory and for how far as well as if any particular node survived the explosion. This was a total of 9,261 nodes that needed to be checked and managed. I had to kill Minetest because I would have been waiting for hours for it to finish. :)

I next tried a smaller number, 4 in place of each 2 and that was far more reasonable. That still gave me an area 9 by 9 by 9 or 729 nodes to check for. This ran much smoother. So if you want really big explosions, you will need to change quite a bit of code and likely at least remove the node drops and velocity calculations or something.


P.S. If you want to remove every node in the area affected, you will need to delete line 79 through 82, look below, but that just leaves a cube.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
                        else
                            if math.random(1,5) <= 4 then
                                destroy(pos)
                            end


If you want to leave less nodes in the explosion area but still leave some you could change the 5 to a larger number like 10 and the 4 to 1 less than the number chose which in my example would be 9. This would likely leave 1 node for every 10 damaged. If the code is left alone as is, it leaves 1 node out of every 5.


Hope this helps you out.

EDIT: Had to remove one line of code or it would have not been good. :) I accidentally put line 83 in the last code segment I was showing, you don't want to delete that if you do delete it. :)

EDIT #2: Just realized, if you do delete those lines, you wont remove any nodes at all. :D lol You do need them, just modify the numbers to be 5 and 5 or 1 and 1 and it will always remove a node. :)

PostPosted: Fri Jul 05, 2013 08:30
by kaeza
LionsDen wrote: I haven't played with the -1 value in the dy variable so I'm not sure what that does

It's the step size for the `for' loop.
If you look, both x and z increase the value each iteration (from -2 to 2), but y does the inverse (from 2 to -2), so the "step" (increment) must be negative (default is 1 if not specified). For more info, I suggest you read the Lua Manual (see §2.4.5).

PostPosted: Fri Jul 05, 2013 11:26
by PilzAdam
I see people have fun with my code :-)

I have set the explosion radius to 5 and drop chance to 1/3 to make the TNT not too overpowered.

PostPosted: Fri Jul 05, 2013 15:20
by Dan Duncombe
Thankyou! I will probably make it not drop many items. Just so you know, the idea is going to be a part of my mod that only loads if this mod is installed, that adds 'condensed explosives'. i.e. Several TNT compacted into one.
Quick Question: Is there any way of making it not fall when lit? My explosive is intended to be like c4 in MW3- so it sticks to whatever surface you put it on, then blows up.

PostPosted: Fri Jul 05, 2013 18:02
by LionsDen
Dan Duncombe wrote:Thankyou! I will probably make it not drop many items. Just so you know, the idea is going to be a part of my mod that only loads if this mod is installed, that adds 'condensed explosives'. i.e. Several TNT compacted into one.
Quick Question: Is there any way of making it not fall when lit? My explosive is intended to be like c4 in MW3- so it sticks to whatever surface you put it on, then blows up.


I have the TNT mod installed and the TNT stays wherever I put it. I have yet to have it fall whether it is lit or unlit.

PostPosted: Fri Jul 05, 2013 19:29
by Dan Duncombe
Oh! I didn't know that! Thanks for all this help, everyone!

PostPosted: Sat Jul 06, 2013 16:04
by BrunoMine
The TNT makes everything disappear. The blocks should be put in place where it exploded disassembled

PostPosted: Tue Sep 24, 2013 21:46
by Wuzzy

PostPosted: Wed Sep 25, 2013 13:54
by darthvader
ModError: Failed to load and run
C:\Users\prosper\Desktop\Minetest\bin\..\mods\TNT\init.lua

PostPosted: Wed Sep 25, 2013 15:29
by Evergreen
darthvader wrote:ModError: Failed to load and run
C:\Users\prosper\Desktop\Minetest\bin\..\mods\TNT\init.lua
Rename the mod folder "tnt" not "TNT"

Re: [Mod] TNT [tnt]

PostPosted: Wed Apr 23, 2014 16:58
by Glünggi
Hi,
i'm workin on a Minetest - Game and i have your tnt turn in to a Terrabomb.
There dosnt destroy blocks but removed it to default dirt.
Image
Image
simply insert Line
minetest.set_node(pos, {name="default:dirt"})
and delete the dropsection

I hope ist ok for you?
A have a lot of other questions.. because i use other Mods from you like Mobs. But i cant send PM...
There write "conntact a Admin" when u cant send a pm..but how i can conntact when i cant send pm's?
My english is so poor and i cant figure it out
So i try it on this way to conntact you.
Sorry
So pls pm me..an do it on german ;)

Re: [Mod] TNT [tnt]

PostPosted: Fri Apr 25, 2014 00:41
by Daven
Awesome mod

Re: [Mod] TNT [tnt]

PostPosted: Sat Aug 02, 2014 21:29
by gsmanners
I noticed the 0.4.10 standard game includes a variation of this mod. I'm wondering where all that radius code came from.

Re: [Mod] TNT [tnt]

PostPosted: Sat Mar 05, 2016 22:53
by KzoneDD
Hi Adam (not calling you Pilz <--- please take note of this), anyone else who knows,

Is there a way to make other nodes respond to burning gunpowder? I'm working on a mod that logically should go boom if in contact with a string of burning gunpowder, see... (well, according to cartoon logic, anyway, which is the best kind of logic).

I mean, I know there are ways, there always are ways... but is there something you specifically recommend I do?

Solutions like checking adjacent nodes ever n ticks seem kinda... lag-inducing...

TIA!

Greetz.
DD.

Re: [Mod] TNT [tnt]

PostPosted: Sun Mar 06, 2016 06:35
by Wuzzy
KzoneDD, you can use ABMs for that. I don't know how well they perform but that's the way how the tnt mod does it.

Besides, the tnt mod already has a “string” of gunpowder (it does not look like a string but behaves like one), just place gunpowder on the ground and ignite it with torch. I don't know why you want to make another mod for the same feature.
Note that Minetest Game also has a tnt mod. In this one there are actual gunpowder strings.

By the way:
I just looked into the Minetest Game tnt mod and noticed that gunpowder is actually only ignited by lava and fire, hardcoded. It would have been better if groups are used IMO.

Re: [Mod] TNT [tnt]

PostPosted: Sun Mar 06, 2016 06:43
by im-poke
ACDC-TNT

BOOOOOOM!
Can you make it respond to mesecon, or is it already?

Re: [Mod] TNT [tnt]

PostPosted: Sun Mar 06, 2016 14:07
by KzoneDD
I actually want to use the existing mod. :)

An ABM seems like an 'always-on' solution, which in my limited understanding == extra lag.

That's why I was wondering if there was a 'on demand' solution.

Re: [Mod] TNT [tnt]

PostPosted: Fri Jul 15, 2016 19:09
by ABJ
Check this out guys!
Realistic TNT explosion demo
I will continue improving it, I know there is still room, but I feel the devs really should take a look.
Also, don't talk about lag before actually testing my mod. I personally find it less laggy than many default blasts I've experienced.

Re: [Mod] TNT [tnt]

PostPosted: Tue Nov 29, 2016 13:38
by Andrey01
Simple red TNT has default in game