1
0
Fork 0

Add setting: mcl_tnt_griefing

This commit is contained in:
Wuzzy 2020-02-05 03:11:32 +01:00
parent 2ef5f0232d
commit bed0849bb0
6 changed files with 25 additions and 4 deletions

View File

@ -2179,6 +2179,7 @@ local do_states = function(self, dtime)
radius = node_break_radius, radius = node_break_radius,
damage_radius = entity_damage_radius, damage_radius = entity_damage_radius,
sound = self.sounds.explode, sound = self.sounds.explode,
is_tnt = false,
}) })
else else
@ -3740,6 +3741,7 @@ function mobs:boom(self, pos, radius)
damage_radius = radius, damage_radius = radius,
sound = self.sounds and self.sounds.explode, sound = self.sounds and self.sounds.explode,
explode_center = true, explode_center = true,
is_tnt = false,
}) })
else else
mobs:safe_boom(self, pos, radius) mobs:safe_boom(self, pos, radius)

View File

@ -308,7 +308,7 @@ function mcl_beds.on_rightclick(pos, player, is_top)
-- Bed goes BOOM in the Nether or End. -- Bed goes BOOM in the Nether or End.
minetest.remove_node(pos) minetest.remove_node(pos)
if minetest.get_modpath("mcl_tnt") then if minetest.get_modpath("mcl_tnt") then
tnt.boom(pos, {radius = 4, damage_radius = 4}) tnt.boom(pos, {radius = 4, damage_radius = 4, is_tnt = false})
end end
return return
end end

View File

@ -1,4 +1,5 @@
local S = minetest.get_translator("mcl_tnt") local S = minetest.get_translator("mcl_tnt")
local tnt_griefing = minetest.settings:get_bool("mcl_tnt_griefing", true)
local mod_death_messages = minetest.get_modpath("mcl_death_messages") local mod_death_messages = minetest.get_modpath("mcl_death_messages")
@ -78,6 +79,14 @@ if minetest.get_modpath("mesecons") then
rules = mesecon.rules.alldirs, rules = mesecon.rules.alldirs,
}} }}
end end
local longdesc
if tnt_griefing then
longdesc = S("An explosive device. When it explodes, it will hurt living beings and destroy blocks around it. TNT has an explosion radius of @1. With a small chance, blocks may drop as an item (as if being mined) rather than being destroyed. TNT can be ignited by tools, explosions, fire, lava and redstone signals.", TNT_RANGE)
else
longdesc = S("An explosive device. When it explodes, it will hurt living beings. TNT has an explosion radius of @1. TNT can be ignited by tools, explosions, fire, lava and redstone signals.", TNT_RANGE)
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",
@ -87,7 +96,7 @@ minetest.register_node("mcl_tnt:tnt", {
description = S("TNT"), description = S("TNT"),
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
_doc_items_longdesc = S("An explosive device. When it explodes, it will hurt living beings and destroy blocks around it. TNT has an explosion radius of @1. With a small chance, blocks may drop as an item (as if being mined) rather than being destroyed. TNT can be ignited by tools, explosions, fire, lava and redstone signals.", TNT_RANGE), _doc_items_longdesc = longdesc,
_doc_items_usagehelp = S("Place the TNT and ignite it with one of the methods above. Quickly get in safe distance. The TNT will start to be affected by gravity and explodes in 4 seconds."), _doc_items_usagehelp = S("Place the TNT and ignite it with one of the methods above. Quickly get in safe distance. The TNT will start to be affected by gravity and explodes in 4 seconds."),
groups = { dig_immediate = 3, tnt = 1, enderman_takable=1 }, groups = { dig_immediate = 3, tnt = 1, enderman_takable=1 },
mesecons = tnt_mesecons, mesecons = tnt_mesecons,
@ -213,6 +222,9 @@ tnt.boom = function(pos, info)
else else
sound = info.sound sound = info.sound
end end
if info.is_tnt == nil then
info.is_tnt = true
end
minetest.sound_play(sound, {pos = pos,gain = 1.0,max_hear_distance = 16,}) minetest.sound_play(sound, {pos = pos,gain = 1.0,max_hear_distance = 16,})
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
if minetest.get_item_group("water") == 1 or minetest.get_item_group("lava") == 1 then if minetest.get_item_group("water") == 1 or minetest.get_item_group("lava") == 1 then
@ -230,9 +242,11 @@ tnt.boom = function(pos, info)
-- TODO: Implement the real blast resistance algorithm -- TODO: Implement the real blast resistance algorithm
if def and n.name ~= "air" and n.name ~= "ignore" and (def._mcl_blast_resistance == nil or def._mcl_blast_resistance < 1000) then if def and n.name ~= "air" and n.name ~= "ignore" and (def._mcl_blast_resistance == nil or def._mcl_blast_resistance < 1000) then
activate_if_tnt(n.name, np, pos, 3) activate_if_tnt(n.name, np, pos, 3)
if (not tnt_griefing) and info.is_tnt ~= false then
-- No-op
-- Custom blast function defined by node. -- Custom blast function defined by node.
-- Node removal and drops must be handled manually. -- Node removal and drops must be handled manually.
if def.on_blast then elseif def.on_blast then
def.on_blast(np, 1.0) def.on_blast(np, 1.0)
-- Default destruction handling: Remove nodes, drop items -- Default destruction handling: Remove nodes, drop items
else else

View File

@ -2,4 +2,5 @@
@1 was caught in an explosion.=@1 wurde Opfer einer Explosion. @1 was caught in an explosion.=@1 wurde Opfer einer Explosion.
TNT=TNT TNT=TNT
An explosive device. When it explodes, it will hurt living beings and destroy blocks around it. TNT has an explosion radius of @1. With a small chance, blocks may drop as an item (as if being mined) rather than being destroyed. TNT can be ignited by tools, explosions, fire, lava and redstone signals.=Ein Sprengstoff. Wenn er explodiert, wird er Lebewesen verletzen und Blöcke in der Nähe zerstören. TNT hat einen Explosionsradius von @1. Mit einer geringen Wahrscheinlichkeit werden Blöcke als Gegenstand abfallen (als ob sie abgebaut worden wären), anstatt völlig zerstört zu werden. TNT kann mit Werkzeugen, Explosionen, Feuer, Lava und Redstone-Signalen angezündet werden. An explosive device. When it explodes, it will hurt living beings and destroy blocks around it. TNT has an explosion radius of @1. With a small chance, blocks may drop as an item (as if being mined) rather than being destroyed. TNT can be ignited by tools, explosions, fire, lava and redstone signals.=Ein Sprengstoff. Wenn er explodiert, wird er Lebewesen verletzen und Blöcke in der Nähe zerstören. TNT hat einen Explosionsradius von @1. Mit einer geringen Wahrscheinlichkeit werden Blöcke als Gegenstand abfallen (als ob sie abgebaut worden wären), anstatt völlig zerstört zu werden. TNT kann mit Werkzeugen, Explosionen, Feuer, Lava und Redstone-Signalen angezündet werden.
An explosive device. When it explodes, it will hurt living beings. TNT has an explosion radius of @1. TNT can be ignited by tools, explosions, fire, lava and redstone signals.=Ein Sprengstoff. Wenn er explodiert, wird er Lebewesen verletzen. TNT hat einen Explosionsradius von @1. TNT kann mit Werkzeugen, Explosionen, Feuer, Lava und Redstone-Signalen angezündet werden.
Place the TNT and ignite it with one of the methods above. Quickly get in safe distance. The TNT will start to be affected by gravity and explodes in 4 seconds.=Platizeren sie das TNT und zünden Sie es mit einer der obigen Methoden an. Begeben Sie sich rasch in eine sichere Entfernung. Das TNT wird anfangen, von der Schwerkraft beeinflusst zu sein und explodiert in 4 Sekunden. Place the TNT and ignite it with one of the methods above. Quickly get in safe distance. The TNT will start to be affected by gravity and explodes in 4 seconds.=Platizeren sie das TNT und zünden Sie es mit einer der obigen Methoden an. Begeben Sie sich rasch in eine sichere Entfernung. Das TNT wird anfangen, von der Schwerkraft beeinflusst zu sein und explodiert in 4 Sekunden.

View File

@ -1,5 +1,6 @@
# textdomain: mcl_tnt # textdomain: mcl_tnt
@1 was caught in an explosion.= @1 was caught in an explosion.=
TNT= TNT=
An explosive device. When it explodes, it will hurt living beings and destroy blocks around it. TNT has an explosion radius of @1. With a small chance, blocks may drop as an item (as if being mined) rather than being destroyed. TNT can be ignited by tools, explosions, fire, lava and redstone signals. An explosive device. When it explodes, it will hurt living beings and destroy blocks around it. TNT has an explosion radius of @1. With a small chance, blocks may drop as an item (as if being mined) rather than being destroyed. TNT can be ignited by tools, explosions, fire, lava and redstone signals.=
An explosive device. When it explodes, it will hurt living beings. TNT has an explosion radius of @1. TNT can be ignited by tools, explosions, fire, lava and redstone signals.=
Place the TNT and ignite it with one of the methods above. Quickly get in safe distance. The TNT will start to be affected by gravity and explodes in 4 seconds.= Place the TNT and ignite it with one of the methods above. Quickly get in safe distance. The TNT will start to be affected by gravity and explodes in 4 seconds.=

View File

@ -24,6 +24,9 @@ mcl_doWeatherCycle (Change weather) bool true
# Note that blocks never have drops when in Creative Mode. # Note that blocks never have drops when in Creative Mode.
mcl_doTileDrops (Blocks have drops) bool true mcl_doTileDrops (Blocks have drops) bool true
# If enabled, TNT explosions destroy blocks.
mcl_tnt_griefing (TNT destroys blocks) bool true
[Players] [Players]
# If enabled, players respawn at the bed they last lay on instead of normal # If enabled, players respawn at the bed they last lay on instead of normal
# spawn. # spawn.