Page 1 of 1

[Patch] Add randomness to Sfan5's nuke mod

PostPosted: Tue Apr 10, 2012 19:40
by lkjoel
Well, I tried the nuke mod, and sfan5 did a great job, but the explosions were too spherical, so I decided to use my friend: Math.random!
So here is the new explosion (Hardcore MESE TNT), Before:
Image
After:
Image
I like that better than circles :P
So here is the patch:
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
0a1,4
> -- Math.random variables
> mrmin = -5
> mrmax = 5
>
116c120
<             if x*x+y*y+z*z <= IRON_TNT_RANGE * IRON_TNT_RANGE + IRON_TNT_RANGE then
---
>             if x*x+y*y+z*z <= (IRON_TNT_RANGE + math.floor(math.random(mrmin,mrmax))) * (IRON_TNT_RANGE + math.floor(math.random(mrmin,mrmax))) + (IRON_TNT_RANGE + math.floor(math.random(mrmin,mrmax))) then
229c233
<             if x*x+y*y+z*z <= MESE_TNT_RANGE * MESE_TNT_RANGE + MESE_TNT_RANGE then
---
>             if x*x+y*y+z*z <= (MESE_TNT_RANGE + math.floor(math.random(mrmin,mrmax))) * (MESE_TNT_RANGE + math.floor(math.random(mrmin,mrmax))) + (MESE_TNT_RANGE + math.floor(math.random(mrmin,mrmax))) then

Note that each TNT can have an explosion from 5 blocks shallower to 5 blocks deeper (this can be changed with the mrmin and mrmax variables).

PostPosted: Tue Apr 10, 2012 19:51
by jordan4ibanez
THATS AWESOME! :D

PostPosted: Tue Apr 10, 2012 19:51
by sfan5
Amazing! :D

PostPosted: Tue Apr 10, 2012 19:59
by lkjoel
Thanks! It looks really cool when you start making a huge crater out of many hardcore mese's:
Image

PostPosted: Tue Apr 10, 2012 20:26
by jordan4ibanez
ikjoel do you mind if i include this into my repo? :)

PostPosted: Tue Apr 10, 2012 20:31
by lkjoel
sure! Where is your repo? EDIT: wow, I never look at people's signatures. I found it

PostPosted: Tue Apr 10, 2012 22:38
by LolManKuba
lkjoel wrote:Thanks! It looks really cool when you start making a huge crater out of many hardcore mese's:
Image

Nice.

PostPosted: Wed Apr 11, 2012 01:23
by bgsmithjr
I like spherical, it is more realistic, your nukes have nails in them, lol.

PostPosted: Sun Jun 17, 2012 10:57
by Mito551
how do i install this?

PostPosted: Sun Jun 17, 2012 11:11
by Topywo
Mito551 wrote:how do i install this?


I'm not 100% sure, but I think you have to open init.lua. Then jump to the number 116 and 229 and replace the < sentence with the > sentence. For both the Iron and the mese TNT.

PostPosted: Sun Jun 17, 2012 12:01
by Mito551
oh, that makes it easy, thanks!

PostPosted: Mon Jun 18, 2012 06:41
by cosarara97
I think the explosion should destroy weak materials (trees, fences, etc.) in a bigger range than stone or dirt, because it's still unrealistic now.