mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-25 20:11:06 +01:00
Fix and weaken the broken mcl_tnt dependencies
Had possible crash because of missing mcl_death_messages dep.
This commit is contained in:
parent
5023e0247d
commit
6fa426741e
2 changed files with 28 additions and 15 deletions
|
@ -1,5 +1,5 @@
|
||||||
mcl_core
|
mcl_sounds?
|
||||||
mcl_sounds
|
mcl_mobitems?
|
||||||
mcl_fire
|
mcl_hunger?
|
||||||
mcl_hunger
|
mcl_death_messages?
|
||||||
doc_identifier?
|
doc_identifier?
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
local mod_death_messages = minetest.get_modpath("mcl_death_messages")
|
||||||
|
local mod_hunger = minetest.get_modpath("mcl_hunger")
|
||||||
|
|
||||||
local function spawn_tnt(pos, entname)
|
local function spawn_tnt(pos, entname)
|
||||||
minetest.sound_play("tnt_ignite", {pos = pos,gain = 1.0,max_hear_distance = 15,})
|
minetest.sound_play("tnt_ignite", {pos = pos,gain = 1.0,max_hear_distance = 15,})
|
||||||
local tnt = minetest.add_entity(pos, entname)
|
local tnt = minetest.add_entity(pos, entname)
|
||||||
|
@ -27,8 +30,12 @@ local function do_tnt_physics(tnt_np,tntr)
|
||||||
local dist = math.max(1, vector.distance(tnt_np, p))
|
local dist = math.max(1, vector.distance(tnt_np, p))
|
||||||
local damage = (4 / dist) * tntr
|
local damage = (4 / dist) * tntr
|
||||||
if obj:is_player() == true then
|
if obj:is_player() == true then
|
||||||
mcl_death_messages.player_damage(obj, string.format("%s was caught in an explosion.", obj:get_player_name()))
|
if mod_death_messages then
|
||||||
mcl_hunger.exhaust(obj:get_player_name(), mcl_hunger.EXHAUST_DAMAGE)
|
mcl_death_messages.player_damage(obj, string.format("%s was caught in an explosion.", obj:get_player_name()))
|
||||||
|
end
|
||||||
|
if mod_hunger then
|
||||||
|
mcl_hunger.exhaust(obj:get_player_name(), mcl_hunger.EXHAUST_DAMAGE)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
obj:set_hp(obj:get_hp() - damage)
|
obj:set_hp(obj:get_hp() - damage)
|
||||||
end
|
end
|
||||||
|
@ -45,6 +52,10 @@ end
|
||||||
|
|
||||||
local TNT_RANGE = 3
|
local TNT_RANGE = 3
|
||||||
|
|
||||||
|
local sounds
|
||||||
|
if minetest.get_modpath("mcl_sounds") then
|
||||||
|
sounds = mcl_sounds.node_sound_wood_defaults()
|
||||||
|
end
|
||||||
minetest.register_node("mcl_tnt:tnt", {
|
minetest.register_node("mcl_tnt:tnt", {
|
||||||
tiles = {"default_tnt_top.png", "default_tnt_bottom.png",
|
tiles = {"default_tnt_top.png", "default_tnt_bottom.png",
|
||||||
"default_tnt_side.png", "default_tnt_side.png",
|
"default_tnt_side.png", "default_tnt_side.png",
|
||||||
|
@ -63,7 +74,7 @@ minetest.register_node("mcl_tnt:tnt", {
|
||||||
_on_ignite = function(pos, player)
|
_on_ignite = function(pos, player)
|
||||||
tnt.ignite(pos)
|
tnt.ignite(pos)
|
||||||
end,
|
end,
|
||||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
sounds = sounds,
|
||||||
})
|
})
|
||||||
|
|
||||||
local TNT = {
|
local TNT = {
|
||||||
|
@ -218,14 +229,16 @@ end
|
||||||
|
|
||||||
minetest.register_entity("mcl_tnt:tnt", TNT)
|
minetest.register_entity("mcl_tnt:tnt", TNT)
|
||||||
|
|
||||||
minetest.register_craft({
|
if minetest.get_modpath("mcl_mobitems") then
|
||||||
output = "mcl_tnt:tnt",
|
minetest.register_craft({
|
||||||
recipe = {
|
output = "mcl_tnt:tnt",
|
||||||
{'mcl_mobitems:gunpowder','group:sand','mcl_mobitems:gunpowder'},
|
recipe = {
|
||||||
{'group:sand','mcl_mobitems:gunpowder','group:sand'},
|
{'mcl_mobitems:gunpowder','group:sand','mcl_mobitems:gunpowder'},
|
||||||
{'mcl_mobitems:gunpowder','group:sand','mcl_mobitems:gunpowder'}
|
{'group:sand','mcl_mobitems:gunpowder','group:sand'},
|
||||||
}
|
{'mcl_mobitems:gunpowder','group:sand','mcl_mobitems:gunpowder'}
|
||||||
})
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
if minetest.get_modpath("doc_identifier") then
|
if minetest.get_modpath("doc_identifier") then
|
||||||
doc.sub.identifier.register_object("mcl_tnt:tnt", "nodes", "mcl_tnt:tnt")
|
doc.sub.identifier.register_object("mcl_tnt:tnt", "nodes", "mcl_tnt:tnt")
|
||||||
|
|
Loading…
Reference in a new issue