Page 1 of 1
Tnt changes?

Posted:
Sat Mar 29, 2014 13:58
by mcfan
I'm trying to make tnt not destroy anything that has water between it and the tnt, and...
I'm trying to make obsidian take 10 tnt hits before breaking.
Are these possible? Am I posting to many questions and ideas? lol

Posted:
Sat Mar 29, 2014 17:12
by pop_harte
OK

Posted:
Sat Mar 29, 2014 17:13
by mcfan
Ok what?

Posted:
Sat Mar 29, 2014 17:51
by DeepGaze
can you provide a link to the mod(Tnt has been made by many modders)

Posted:
Sat Mar 29, 2014 19:02
by mcfan

Posted:
Sat Mar 29, 2014 19:46
by DeepGaze
replace the init.lua file with this(the init.lua is in the mods file) this replaces the water for a node called nomod:nonode witch AFAIK doesn't exist

Posted:
Sat Mar 29, 2014 20:24
by mcfan
So is it replacing the default:water? What is it doing exactly?

Posted:
Sat Mar 29, 2014 21:29
by DeepGaze
it is stopping the function by telling it to look for a false node(the code is pretty foreign to me)

Posted:
Sat Mar 29, 2014 21:37
by mcfan
Sorry to tell you this, but it didn't change anything. Destroyed stuff while in water and destroyed obsidian in one blast.

Posted:
Sat Mar 29, 2014 22:41
by noobly
1. ask the mod creators
2. next time post these sort of things under mod requests
3. no hard feelings :)
4. HAVE FUN!

Posted:
Sat Mar 29, 2014 22:44
by mcfan
Why ask the mod creators? Why can't someone else take a stab at it if I can't get ahold of them?

Posted:
Sun Mar 30, 2014 15:48
by DeepGaze
post on the forum topic for best results: I was doing what I could without knowing the code (worst idea ever conceived, forgive me)

Posted:
Mon Mar 31, 2014 00:42
by minermoder27
PilzAdam's TNT mod simply removes all non-liquid nodes inside a area: it does not check what is between that node and the TNT. Consider copying parts of
my TNT mod, as it checks all the nodes in between

Posted:
Tue Apr 01, 2014 11:42
by mcfan
your mod would make a BIG mess of my place though because of all the tnt and their power. Does your tnt stop if there is water between it and a node?

Posted:
Thu Apr 03, 2014 19:56
by mcfan
So was this a impossible idea?

Posted:
Fri Apr 04, 2014 01:10
by LionsDen
I would say it's possible but difficult to implement. Not super difficult but a little bit.

Posted:
Wed Apr 09, 2014 01:04
by minermoder27
I was not suggesting you copy all of it, just the ray casting bits.
[spoiler]
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
local ents = {}
local storedPoses = {}
for dx=-tnt_range,tnt_range do
for dz=-tnt_range,tnt_range do
for dy=-tnt_range,tnt_range do
--local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
----------------------------------------
local dist = (dx^2) + (dy^2) + (dz^2)
dist = dist^(1/2.0)
if dist < tnt_range and dist + 1 >= tnt_range and dist~=0 then
local dir = {x=dx, y=dy, z=dz}
--local totalnum = math.abs(dir.x)+math.abs(dir.y)+math.abs(dir.z)
--dir = vector.normalize(dir)--vector.divide(dir, vector.new(totalnum, totalnum, totalnum))
dir.x = dir.x / dist
dir.y = dir.y / dist
dir.z = dir.z / dist
--local p = {x=pos.x, y=pos.y, z=pos.z} -- {x=0,y=0,z=0}--
local blast = tnt_range / 3
for i=1, dist do
-- i = i - 0.5
local pp = {x=dir.x*i, y=dir.y*i, z=dir.z*i}
local p = vector.add(pp, pos)
p.x = math.floor(p.x)
p.y = math.floor(p.y)
p.z = math.floor(p.z)
for i=1, #storedPoses do
if p.x==storedPoses[i].x and p.y==storedPoses[i].y and p.z==storedPoses[i].z then
--print("p: "..dump(p) .. " storedPoses: "..dump(storedPoses[i]))
p = nil
break
end
end
if p==nil then break end
--local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
--vector.add(p, dir)
----------------------------------------
-- local p_node = area:index(p.x, p.y, p.z)
-- local d_p_node = nodes[p_node]
local node = minetest.get_node(p)
-------------------------------------------------------------
blast = blast - (tnt.force[node.name] or 3)
if tnt.accl[node.name]==true then
storedPoses[#storedPoses + 1] = {x=p.x, y=p.y, z=p.z}
local stored = minetest.get_meta(p):get_int("blast") or 0
blast = blast + stored
end
if blast <= 0 then
if tnt.accl[node.name]==true then
minetest.get_meta(p):set_int("blast", tnt.force[node.name] + blast)
end
break
end
-------------------------------------------------------------
-- if d_p_node == tnt_c_tnt
-- or d_p_node == tnt_c_tnt_burning then
if is_tnt(node.name)==true then
--nodes[p_node] = tnt_c_tnt
minetest.remove_node(p)
boom_id(p, 0.5, player, node.name) -- was {x=p.x, y=p.y, z=p.z}
elseif not ( d_p_node == tnt_c_fire
or string.find(node.name, "default:water_")
or string.find(node.name, "default:lava_")) then
--if math.abs(dx)<tnt_range and math.abs(dy)<tnt_range and math.abs(dz)<tnt_range then
destroy(p, player, ents)
--elseif pr:next(1,5) <= 4 then
-- destroy(p, player, ents)
--end
end
end
--------------------------------------------
end
--------------------------------------------
end
end
end
for name, val in pairs(ents) do
drop_item(pos, name, player, val)
end
[/spoiler]
you would need to change it to fit, and make it stop when it hits water
[spoiler]Hint: somewhere around
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 is_tnt(node.name)==true then
--nodes[p_node] = tnt_c_tnt
minetest.remove_node(p)
boom_id(p, 0.5, player, node.name) -- was {x=p.x, y=p.y, z=p.z}
elseif not ( d_p_node == tnt_c_fire
or string.find(node.name, "default:water_")
or string.find(node.name, "default:lava_")) then
--if math.abs(dx)<tnt_range and math.abs(dy)<tnt_range and math.abs(dz)<tnt_range then
destroy(p, player, ents)
--elseif pr:next(1,5) <= 4 then
-- destroy(p, player, ents)
--end
end
[/spoiler]