'splosions!

This commit is contained in:
FaceDeer 2022-08-07 14:27:29 -06:00
parent b1cbe64c7a
commit bc07e123ce
10 changed files with 58 additions and 23 deletions

View File

@ -180,4 +180,15 @@ df_dependencies.register_all_stairs_and_fences = function(name, override_def)
df_dependencies.register_stairs(name, override_def)
df_dependencies.register_more_stairs(name, override_def)
df_dependencies.register_all_fences(name, override_def)
end
df_dependencies.mods_required.tnt = true
df_dependencies.mods_required.mcl_explosions = true
if minetest.get_modpath("tnt") then
df_dependencies.tnt_boom = tnt.boom
elseif minetest.get_modpath("mcl_explosions") then
df_dependencies.tnt_boom = function(pos, def)
mcl_explosions.explode(pos, def.radius)
end
end

View File

@ -1,4 +1,4 @@
name = df_dependencies
description = A utility mod for df_caverns that gathers all dependencies on minetest_game in one place, to ease compatibility efforts with mineclone and other such games
depends =
optional_depends = beds, bucket, default, doors, farming, fireflies, mcl_beds, mcl_buckets, mcl_chests, mcl_compatibility, mcl_copper, mcl_core, mcl_doors, mcl_farming, mcl_furnaces, mcl_init, mcl_lanterns, mcl_mapgen, mcl_mobitems, mcl_ocean, mcl_potions, mcl_sounds, mcl_strongholds, mcl_torches, mcl_wool, mcl_worlds, mclx_core, mesecons, moreblocks, stairs, vessels, wool, mcl_stairs
optional_depends = beds, bucket, default, doors, farming, fireflies, mcl_beds, mcl_buckets, mcl_chests, mcl_compatibility, mcl_copper, mcl_core, mcl_doors, mcl_explosions, mcl_farming, mcl_fences, mcl_furnaces, mcl_init, mcl_mapgen, mcl_mobitems, mcl_ocean, mcl_potions, mcl_sounds, mcl_stairs, mcl_strongholds, mcl_tnt, mcl_torches, mcl_wool, mcl_worlds, mclx_core, mesecons, moreblocks, stairs, tnt, vessels, wool

View File

@ -99,3 +99,8 @@ df_dependencies.node_name_stair_inner_slade_brick = select_required("stairs:stai
df_dependencies.node_name_stair_outer_slade_brick = select_required("stairs:stair_outer_slade_brick", "mcl_stairs:stair_slade_brick_outer")
df_dependencies.node_name_stair_slade_block = select_required("stairs:stair_slade_block", "mcl_stairs:stair_slade_block")
df_dependencies.node_name_stair_slade_brick = select_required("stairs:stair_slade_brick", "mcl_stairs:stair_slade_brick")
-- from "tnt"
-- TODO: make optional
df_dependencies.node_name_gunpowder = select_required("tnt:gunpowder", "mcl_mobitems:gunpowder")

View File

@ -35,3 +35,4 @@ df_dependencies.soundfile_grass_footstep = select_required({default="default_gra
df_dependencies.soundfile_snow_footstep = select_required({default="default_snow_footstep", mcl_sounds="pedology_snow_soft_footstep"})
df_dependencies.soundfile_gravel_footstep = select_required({default="default_gravel_footstep", mcl_sounds="default_gravel_footstep"})
df_dependencies.soundfile_cool_lava = select_required({default="default_cool_lava", mcl_sounds="default_cool_lava"})
df_dependencies.soundfile_tnt_ignite = select_required({default="tnt_ignite", mcl_tnt="tnt_ignite"})

View File

@ -43,7 +43,8 @@ for _, tree in pairs(trees) do
setting("float", tree.name.."_delay_multiplier", tree.delay_multiplier, tree.name.." growth delay multiplier")
end
if minetest.get_modpath("tnt") then
-- TODO: mineclone settings
if df_dependencies.tnt_boom then
df_trees.config.enable_tnt = minetest.settings:get_bool("enable_tnt")
if df_trees.config.enable_tnt == nil then
-- Default to enabled when in singleplayer

View File

@ -180,12 +180,22 @@ minetest.register_craft({
-- TNT
-----------------------------------------------------------------------------------------------------------
local gunpowder = df_dependencies.node_name_gunpowder
local tnt_ignite_sound = df_dependencies.soundfile_tnt_ignite
local tnt_boom = df_dependencies.tnt_boom
if df_trees.config.enable_tnt then
local tnt_radius = tonumber(minetest.settings:get("tnt_radius") or 3) * 2/3
local tnt_def = {radius = tnt_radius, damage_radius = tnt_radius * 2}
local torch_item = df_trees.node_names.torch
local on_burn = function(pos)
minetest.swap_node(pos, {name = "df_trees:tunnel_tube_fruiting_body_burning"})
minetest.registered_nodes["df_trees:tunnel_tube_fruiting_body_burning"].on_construct(pos)
end
minetest.register_node("df_trees:tunnel_tube_fruiting_body", {
description = S("Tunnel Tube Fruiting Body"),
_doc_items_longdesc = df_trees.doc.tunnel_tube_desc,
@ -204,11 +214,11 @@ if df_trees.config.enable_tnt then
rarity = 2,
},
{
items = {'df_trees:tunnel_tube_sapling', 'tnt:gunpowder'},
items = {'df_trees:tunnel_tube_sapling', gunpowder},
rarity = 2,
},
{
items = {'df_trees:tunnel_tube_sapling', 'tnt:gunpowder 2'},
items = {'df_trees:tunnel_tube_sapling', gunpowder .. ' 2'},
rarity = 2,
},
},
@ -224,25 +234,22 @@ if df_trees.config.enable_tnt then
end
end,
on_blast = function(pos, intensity)
minetest.swap_node(pos, {name="air"})
minetest.after(0.1, function()
tnt.boom(pos, tnt_def)
tnt_boom(pos, tnt_def)
end)
end,
mesecons = {effector =
{action_on =
function(pos)
tnt.boom(pos, tnt_def)
minetest.swap_node(pos, {name="air"})
tnt_boom(pos, tnt_def)
end
}
},
on_burn = function(pos)
minetest.swap_node(pos, {name = "df_trees:tunnel_tube_fruiting_body_burning"})
minetest.registered_nodes["df_trees:tunnel_tube_fruiting_body_burning"].on_construct(pos)
end,
on_ignite = function(pos, igniter)
minetest.swap_node(pos, {name = "df_trees:tunnel_tube_fruiting_body_burning"})
minetest.registered_nodes["df_trees:tunnel_tube_fruiting_body_burning"].on_construct(pos)
end,
on_burn = on_burn,
on_ignite = on_burn,
_on_burn = on_burn,
})
minetest.register_node("df_trees:tunnel_tube_fruiting_body_burning", {
@ -258,12 +265,17 @@ if df_trees.config.enable_tnt then
_mcl_blast_resistance = 0,
_mcl_hardness = 2,
on_timer = function(pos, elapsed)
tnt.boom(pos, tnt_def)
minetest.swap_node(pos, {name="air"})
tnt_boom(pos, tnt_def)
end,
on_blast = function(pos)
minetest.swap_node(pos, {name="air"})
minetest.after(0.1, function()
tnt_boom(pos, tnt_def)
end)
end,
-- unaffected by explosions
on_blast = function() end,
on_construct = function(pos)
minetest.sound_play("tnt_ignite", {pos = pos})
minetest.sound_play(tnt_ignite_sound, {pos = pos})
minetest.get_node_timer(pos):start(4)
end,
})

View File

@ -27,9 +27,10 @@ local glowstone_def = {
_mcl_blast_resistance = 0.5,
_mcl_hardness = 0.5,
}
local tnt_boom = df_dependencies.tnt_boom
if minetest.get_modpath("tnt") then
glowstone_def.on_dig = function(pos, node, digger)
tnt.boom(pos, {radius=3})
tnt_boom(pos, {radius=3})
end
end
minetest.register_node("df_underworld_items:glowstone", glowstone_def)

View File

@ -245,6 +245,8 @@ minetest.register_node("df_underworld_items:puzzle_seal", puzzle_seal_def)
--------------------------------------------------------------------------------
-- Once the seal is opened, it turns into this and digs its way down through the slade.
local tnt_boom = df_dependencies.tnt_boom
local digging_seal_def = {
description = S("Active Slade Breacher"),
_doc_items_longdesc = nil,
@ -310,7 +312,7 @@ local digging_seal_def = {
})
if minetest.get_item_group(below_node.name, "slade") == 0 then
tnt.boom({x=pos.x, y=pos.y-2, z=pos.z}, {radius=3})
tnt_boom({x=pos.x, y=pos.y-2, z=pos.z}, {radius=3})
minetest.set_node(pos, {name=lava_source})
return
end
@ -329,7 +331,7 @@ local digging_seal_def = {
minetest.place_schematic({x=pos.x-3, y=pos.y-2, z=pos.z-3}, df_underworld_items.seal_stair_schem, 270, {}, true)
node.param2 = 0
else
tnt.boom(pos, {radius=3})
tnt_boom(pos, {radius=3})
minetest.set_node(pos, {name=lava_source})
return
end

View File

@ -72,7 +72,7 @@ local slade_wall_def = {
tiles = {"dfcaverns_slade_brick.png"},
walkable = true,
is_ground_content = false,
groups = { cracky=3, stone=1, level=3, slade=1, pit_plasma_resistant=1, mese_radiation_shield=1},
groups = { cracky=3, stone=1, level=3, slade=1, pit_plasma_resistant=1, mese_radiation_shield=1, wall=1},
sounds = df_underworld_items.sounds.slade,
_mcl_blast_resistance = 1200,
_mcl_hardness = 50,

View File

@ -145,6 +145,8 @@ minetest.register_abm({
end,
})
local tnt_boom = df_dependencies.tnt_boom
if minetest.get_modpath("tnt") then
minetest.register_abm({
label = "mine_gas:gas ignition",
@ -155,7 +157,7 @@ if minetest.get_modpath("tnt") then
catch_up = true,
action = function(pos, node)
if minetest.find_node_near(pos, 1, "air") then
tnt.boom(pos, {radius=1, damage_radius=6})
tnt_boom(pos, {radius=1, damage_radius=6})
-- One in a hundred explosions will spawn a gas wisp
if math.random() < 0.01 then
minetest.set_node(pos, {name="mine_gas:gas_wisp"})