[Mod] TNT [tnt]

User avatar
Tedypig
Member
 
Posts: 286
Joined: Tue Mar 05, 2013 12:33
Location: Largo, FL, USA
IRC: Piggybear87
In-game: Piggybear

by Tedypig » Fri Jul 05, 2013 00:16

Is there a way to make it drop Mese and Diamonds? As of now it just destroys/removes them when it explodes.
01010100 01100101 01100100 01111001 01110000 01101001 01100111
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
Location: Germany
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Fri Jul 05, 2013 00:33

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.
 

User avatar
Tedypig
Member
 
Posts: 286
Joined: Tue Mar 05, 2013 12:33
Location: Largo, FL, USA
IRC: Piggybear87
In-game: Piggybear

by Tedypig » Fri Jul 05, 2013 00:44

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?
01010100 01100101 01100100 01111001 01110000 01101001 01100111
 

User avatar
LionsDen
Member
 
Posts: 530
Joined: Thu Jun 06, 2013 03:19

by LionsDen » Fri Jul 05, 2013 04:38

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.

Code: Select all
        -- if math.random(1,3) == 3 then
        --    return
        -- end


EDIT: Bolded the filename.
Last edited by LionsDen on Fri Jul 05, 2013 04:39, edited 1 time in total.
 

User avatar
Dan Duncombe
Member
 
Posts: 904
Joined: Thu May 09, 2013 21:11
Location: In the unknown depths of Earth

by Dan Duncombe » Fri Jul 05, 2013 06:32

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.
Some Mods: Castles Prefab Camouflage
My Games: Nostalgia Realtest Revamped
Servers: See above games.
 

User avatar
LionsDen
Member
 
Posts: 530
Joined: Thu Jun 06, 2013 03:19

by LionsDen » Fri Jul 05, 2013 07:57

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:

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.

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. :)
Last edited by LionsDen on Fri Jul 05, 2013 08:01, edited 1 time in total.
 

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

by kaeza » Fri Jul 05, 2013 08:30

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).
Last edited by kaeza on Fri Jul 05, 2013 08:37, edited 1 time in total.
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
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
Location: Germany
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Fri Jul 05, 2013 11:26

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.
 

User avatar
Dan Duncombe
Member
 
Posts: 904
Joined: Thu May 09, 2013 21:11
Location: In the unknown depths of Earth

by Dan Duncombe » Fri Jul 05, 2013 15:20

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.
Some Mods: Castles Prefab Camouflage
My Games: Nostalgia Realtest Revamped
Servers: See above games.
 

User avatar
LionsDen
Member
 
Posts: 530
Joined: Thu Jun 06, 2013 03:19

by LionsDen » Fri Jul 05, 2013 18:02

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.
 

User avatar
Dan Duncombe
Member
 
Posts: 904
Joined: Thu May 09, 2013 21:11
Location: In the unknown depths of Earth

by Dan Duncombe » Fri Jul 05, 2013 19:29

Oh! I didn't know that! Thanks for all this help, everyone!
Some Mods: Castles Prefab Camouflage
My Games: Nostalgia Realtest Revamped
Servers: See above games.
 

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

by BrunoMine » Sat Jul 06, 2013 16:04

The TNT makes everything disappear. The blocks should be put in place where it exploded disassembled
Last edited by BrunoMine on Sat Jul 06, 2013 16:04, edited 1 time in total.
My small square universe under construction ... Minemacro
Comunidade Minetest Brasil
www.minetestbrasil.com
 

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

by Wuzzy » Tue Sep 24, 2013 21:46

My creations. I gladly accept bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH
 

User avatar
darthvader
Member
 
Posts: 119
Joined: Sun Sep 08, 2013 14:35
Location: Death Star

by darthvader » Wed Sep 25, 2013 13:54

ModError: Failed to load and run
C:\Users\prosper\Desktop\Minetest\bin\..\mods\TNT\init.lua
Q. Why cant you write with a broken pencil?
A. Because its not in minetest.
(The original answer is "Because it's pointless.")
 

User avatar
Evergreen
Member
 
Posts: 2135
Joined: Sun Jan 06, 2013 01:22
Location: A forest in the midwest
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

by Evergreen » Wed Sep 25, 2013 15:29

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"
Back from the dead!
 

Glünggi
Member
 
Posts: 126
Joined: Wed Apr 16, 2014 08:13
Location: Switzerland

Re: [Mod] TNT [tnt]

by Glünggi » Wed Apr 23, 2014 16:58

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 ;)
 

Daven
Member
 
Posts: 26
Joined: Mon Jan 20, 2014 21:51
Location: Inside the white whale
 

gsmanners
Member
 
Posts: 159
Joined: Fri Jan 10, 2014 21:37

Re: [Mod] TNT [tnt]

by gsmanners » Sat Aug 02, 2014 21:29

I noticed the 0.4.10 standard game includes a variation of this mod. I'm wondering where all that radius code came from.
 

KzoneDD
Member
 
Posts: 64
Joined: Wed Sep 17, 2014 09:29

Re: [Mod] TNT [tnt]

by KzoneDD » Sat Mar 05, 2016 22:53

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.
 

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

Re: [Mod] TNT [tnt]

by Wuzzy » Sun Mar 06, 2016 06:35

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.
My creations. I gladly accept bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH
 

im-poke
Member
 
Posts: 1084
Joined: Sat Apr 18, 2015 15:50
Location: Somewhere in the Universe, on a weird planet called Earth/
IRC: poke
In-game: poke

Re: [Mod] TNT [tnt]

by im-poke » Sun Mar 06, 2016 06:43

ACDC-TNT

BOOOOOOM!
Can you make it respond to mesecon, or is it already?
ARE YOU A NYAN CAT?????
--ABJ
 

KzoneDD
Member
 
Posts: 64
Joined: Wed Sep 17, 2014 09:29

Re: [Mod] TNT [tnt]

by KzoneDD » Sun Mar 06, 2016 14:07

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.
 

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: [Mod] TNT [tnt]

by ABJ » Fri Jul 15, 2016 19:09

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.
 

User avatar
Andrey01
Member
 
Posts: 2347
Joined: Wed Oct 19, 2016 15:18
Location: Russia, Moscow
GitHub: Andrey2470T
In-game: Andrey01
 

Previous

Return to Old Mods



Who is online

Users browsing this forum: No registered users and 2 guests