[Mod] TNT [tnt]

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

by Tedypig » Post

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
GitHub: PilzAdam
IRC: PilzAdam
Location: Germany

by PilzAdam » Post

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
IRC: Piggybear87
In-game: Piggybear
Location: Largo, FL, USA

by Tedypig » Post

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 » Post

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 » Post

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 » Post

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

by kaeza » Post

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
GitHub: PilzAdam
IRC: PilzAdam
Location: Germany

by PilzAdam » Post

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 » Post

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 » Post

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 » Post

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

by BrunoMine » Post

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: 4803
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

by Wuzzy » Post


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

by darthvader » Post

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
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen
Location: A forest in the midwest
Contact:

by Evergreen » Post

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: 128
Joined: Wed Apr 16, 2014 08:13
Location: Switzerland

Re: [Mod] TNT [tnt]

by Glünggi » Post

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

Re: [Mod] TNT [tnt]

by Daven » Post

Awesome mod

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

Re: [Mod] TNT [tnt]

by gsmanners » Post

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: 65
Joined: Wed Sep 17, 2014 09:29

Re: [Mod] TNT [tnt]

by KzoneDD » Post

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: 4803
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] TNT [tnt]

by Wuzzy » Post

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.

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

Re: [Mod] TNT [tnt]

by im-poke » Post

ACDC-TNT

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

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

Re: [Mod] TNT [tnt]

by KzoneDD » Post

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

by ABJ » Post

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: 2577
Joined: Wed Oct 19, 2016 15:18
GitHub: Andrey2470T
In-game: Andrey01
Location: Russia, Moscow

Re: [Mod] TNT [tnt]

by Andrey01 » Post

Simple red TNT has default in game

roscoeb
Member
Posts: 16
Joined: Fri Jan 21, 2022 22:27

Re: [Mod] TNT [tnt]

by roscoeb » Post

hi!!!
this mod doesn't work for me, i enable it, then when i click to join the server immediately shuts down

2022-02-23 15:14:29: ERROR[Main]: ModError: Failed to load and run script from C:\Users\whyulookinPC\Downloads\minetest-5.4.1-win64\minetest-5.4.1-win64\bin\..\mods\pilzadam_tnt_d6a0b7d\init.lua:
2022-02-23 15:14:29: ERROR[Main]: ...64\minetest-5.4.1-win64\bin\..\builtin\game\register.lua:65: Name tnt:tnt does not follow naming conventions: "pilzadam_tnt_d6a0b7d:" or ":" prefix required
2022-02-23 15:14:29: ERROR[Main]: stack traceback:
2022-02-23 15:14:29: ERROR[Main]: [C]: in function 'error'
2022-02-23 15:14:29: ERROR[Main]: ...64\minetest-5.4.1-win64\bin\..\builtin\game\register.lua:65: in function 'check_modname_prefix'
2022-02-23 15:14:29: ERROR[Main]: ...64\minetest-5.4.1-win64\bin\..\builtin\game\register.lua:115: in function 'register_item'
2022-02-23 15:14:29: ERROR[Main]: ...64\minetest-5.4.1-win64\bin\..\builtin\game\register.lua:208: in function 'register_node'
2022-02-23 15:14:29: ERROR[Main]: ...st-5.4.1-win64\bin\..\mods\pilzadam_tnt_d6a0b7d\init.lua:112: in main chunk
2022-02-23 15:14:29: ERROR[Main]: Check debug.txt for details.
2022-02-23 15:14:29: ACTION[Main]: Server: Shutting down

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests