fix mergeconflicts
This commit is contained in:
commit
8a3f06a18f
47 changed files with 1139 additions and 330 deletions
|
@ -7,7 +7,7 @@ local loss_prob = {}
|
|||
loss_prob["default:cobble"] = 3
|
||||
loss_prob["default:dirt"] = 4
|
||||
|
||||
local tnt_radius = tonumber(minetest.setting_get("tnt_radius") or 3)
|
||||
local tnt_radius = tonumber(minetest.settings:get("tnt_radius") or 3)
|
||||
|
||||
-- Fill a list with data for content IDs, after all nodes are registered
|
||||
local cid_data = {}
|
||||
|
@ -78,8 +78,12 @@ local function add_drop(drops, item)
|
|||
end
|
||||
end
|
||||
|
||||
local function destroy(drops, npos, cid, c_air, c_fire, on_blast_queue, ignore_protection, ignore_on_blast)
|
||||
if not ignore_protection and minetest.is_protected(npos, "") then
|
||||
=======
|
||||
local basic_flame_on_construct -- cached value
|
||||
local function destroy(drops, npos, cid, c_air, c_fire,
|
||||
on_blast_queue, on_construct_queue,
|
||||
ignore_protection, ignore_on_blast, owner)
|
||||
if not ignore_protection and minetest.is_protected(npos, owner) then
|
||||
return cid
|
||||
end
|
||||
|
||||
|
@ -251,13 +255,13 @@ function tnt.burn(pos, nodename)
|
|||
elseif def.on_ignite then
|
||||
def.on_ignite(pos)
|
||||
elseif minetest.get_item_group(name, "tnt") > 0 then
|
||||
minetest.swap_node(pos, {name = name .. "_burning"})
|
||||
minetest.sound_play("tnt_ignite", {pos = pos})
|
||||
minetest.set_node(pos, {name = name .. "_burning"})
|
||||
minetest.get_node_timer(pos):start(1)
|
||||
end
|
||||
end
|
||||
|
||||
local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast)
|
||||
local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast, owner)
|
||||
pos = vector.round(pos)
|
||||
-- scan for adjacent TNT nodes first, and enlarge the explosion
|
||||
local vm1 = VoxelManip()
|
||||
|
@ -315,8 +319,8 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast)
|
|||
local p = {x = pos.x + x, y = pos.y + y, z = pos.z + z}
|
||||
if cid ~= c_air then
|
||||
data[vi] = destroy(drops, p, cid, c_air, c_fire,
|
||||
on_blast_queue, ignore_protection,
|
||||
ignore_on_blast)
|
||||
on_blast_queue, on_construct_queue,
|
||||
ignore_protection, ignore_on_blast, owner)
|
||||
end
|
||||
end
|
||||
vi = vi + 1
|
||||
|
@ -354,14 +358,23 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast)
|
|||
end
|
||||
end
|
||||
|
||||
for _, queued_data in pairs(on_construct_queue) do
|
||||
queued_data.fn(queued_data.pos)
|
||||
end
|
||||
|
||||
minetest.log("action", "TNT owned by " .. owner .. " detonated at " ..
|
||||
minetest.pos_to_string(pos) .. " with radius " .. radius)
|
||||
|
||||
return drops, radius
|
||||
end
|
||||
|
||||
function tnt.boom(pos, def)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local owner = meta:get_string("owner")
|
||||
minetest.sound_play("tnt_explode", {pos = pos, gain = 1.5, max_hear_distance = 2*64})
|
||||
minetest.set_node(pos, {name = "tnt:boom"})
|
||||
local drops, radius = tnt_explode(pos, def.radius, def.ignore_protection,
|
||||
def.ignore_on_blast)
|
||||
def.ignore_on_blast, owner)
|
||||
-- append entity drops
|
||||
local damage_radius = (radius / def.radius) * def.damage_radius
|
||||
entity_physics(pos, damage_radius, drops)
|
||||
|
@ -490,17 +503,17 @@ minetest.register_node("tnt:gunpowder_burning", {
|
|||
on_timer = function(pos, elapsed)
|
||||
for dx = -1, 1 do
|
||||
for dz = -1, 1 do
|
||||
for dy = -1, 1 do
|
||||
if not (dx == 0 and dz == 0) then
|
||||
tnt.burn({
|
||||
x = pos.x + dx,
|
||||
y = pos.y + dy,
|
||||
z = pos.z + dz,
|
||||
})
|
||||
if math.abs(dx) + math.abs(dz) == 1 then
|
||||
for dy = -1, 1 do
|
||||
tnt.burn({
|
||||
x = pos.x + dx,
|
||||
y = pos.y + dy,
|
||||
z = pos.z + dz,
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.remove_node(pos)
|
||||
end,
|
||||
-- unaffected by explosions
|
||||
|
@ -560,9 +573,16 @@ function tnt.register_tnt(def)
|
|||
is_ground_content = false,
|
||||
groups = {dig_immediate = 2, mesecon = 2, tnt = 1, flammable = 5},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
after_place_node = function(pos, placer)
|
||||
if placer:is_player() then
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("owner", placer:get_player_name())
|
||||
end
|
||||
end,
|
||||
on_punch = function(pos, node, puncher)
|
||||
if puncher:get_wielded_item():get_name() == "default:torch" then
|
||||
minetest.set_node(pos, {name = name .. "_burning"})
|
||||
minetest.swap_node(pos, {name = name .. "_burning"})
|
||||
minetest.registered_nodes[name .. "_burning"].on_construct(pos)
|
||||
minetest.log("action", puncher:get_player_name() ..
|
||||
" ignites " .. node.name .. " at " ..
|
||||
minetest.pos_to_string(pos))
|
||||
|
@ -581,10 +601,12 @@ function tnt.register_tnt(def)
|
|||
}
|
||||
},
|
||||
on_burn = function(pos)
|
||||
minetest.set_node(pos, {name = name .. "_burning"})
|
||||
minetest.swap_node(pos, {name = name .. "_burning"})
|
||||
minetest.registered_nodes[name .. "_burning"].on_construct(pos)
|
||||
end,
|
||||
on_ignite = function(pos, igniter)
|
||||
minetest.set_node(pos, {name = name .. "_burning"})
|
||||
minetest.swap_node(pos, {name = name .. "_burning"})
|
||||
minetest.registered_nodes[name .. "_burning"].on_construct(pos)
|
||||
end,
|
||||
})
|
||||
--end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue