Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: PilzAdam/TNT
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: Wuzzy2/TNT
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Sep 24, 2013

  1. Added support for on_blast callback

    Wuzzy committed Sep 24, 2013

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    4427d79 View commit details
Showing with 16 additions and 5 deletions.
  1. +16 −5 init.lua
21 changes: 16 additions & 5 deletions init.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
local destroy = function(pos)
local nodename = minetest.env:get_node(pos).name
if nodename ~= "air" then
minetest.env:remove_node(pos)
local on_blast = minetest.registered_nodes[nodename].on_blast
if on_blast ~= nil then
on_blast(pos, 1) -- the intensity of TNT is defined to be 1
return
else
minetest.env:remove_node(pos)
end
nodeupdate(pos)
if minetest.registered_nodes[nodename].groups.flammable ~= nil then
minetest.env:set_node(pos, {name="fire:basic_flame"})
@@ -68,10 +74,7 @@ boom = function(pos, time)
pos.z = pos.z+dz

local node = minetest.env:get_node(pos)
if node.name == "tnt:tnt" or node.name == "tnt:tnt_burning" then
minetest.env:set_node(pos, {name="tnt:tnt_burning"})
boom({x=pos.x, y=pos.y, z=pos.z}, 0)
elseif node.name == "fire:basic_flame" or string.find(node.name, "default:water_") or string.find(node.name, "default:lava_") or node.name == "tnt:boom" then
if node.name == "fire:basic_flame" or string.find(node.name, "default:water_") or string.find(node.name, "default:lava_") or node.name == "tnt:boom" then

else
if math.abs(dx)<2 and math.abs(dy)<2 and math.abs(dz)<2 then
@@ -122,6 +125,11 @@ minetest.register_node("tnt:tnt", {
boom(pos, 4)
end
end,

on_blast = function(pos, intensity)
minetest.env:set_node(pos, {name="tnt:tnt_burning"})
boom({x=pos.x, y=pos.y, z=pos.z}, 0)
end,

mesecons = {
effector = {
@@ -138,6 +146,9 @@ minetest.register_node("tnt:tnt_burning", {
light_source = 5,
drop = "",
sounds = default.node_sound_wood_defaults(),
on_blast = function(pos, intensity)
boom({x=pos.x, y=pos.y, z=pos.z}, 0)
end,
})

minetest.register_node("tnt:boom", {