From 32d89d6d5f0b0422d743feae03d9341e3dddad7f Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Sun, 17 Apr 2022 17:20:45 +0200 Subject: [PATCH 1/3] Add TNT test structure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds a new test structure to the “/spawnstruct” command which can be spawned with this command: /spawnstruct test_structure_tnt The structure was added to reduce manual work when examining or verifying TNT explosion results after changes to TNT drop rate. --- mods/MAPGEN/mcl_structures/init.lua | 9 ++++++++- .../mcl_structures_test_structure_tnt.mts | Bin 0 -> 197 bytes 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 mods/MAPGEN/mcl_structures/schematics/mcl_structures_test_structure_tnt.mts diff --git a/mods/MAPGEN/mcl_structures/init.lua b/mods/MAPGEN/mcl_structures/init.lua index 0c3b1820..92a03470 100644 --- a/mods/MAPGEN/mcl_structures/init.lua +++ b/mods/MAPGEN/mcl_structures/init.lua @@ -542,9 +542,14 @@ mcl_structures.generate_test_structure_fireproof = function(pos, rotation, pr) mcl_structures.place_schematic(pos, path, rotation, nil, true, nil, nil, pr) end +mcl_structures.generate_test_structure_tnt = function(pos, rotation, pr) + local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_test_structure_tnt.mts" + mcl_structures.place_schematic(pos, path, rotation, nil, true, nil, nil, pr) +end + -- Debug command minetest.register_chatcommand("spawnstruct", { - params = "desert_temple | desert_well | igloo | witch_hut | boulder | ice_spike_small | ice_spike_large | fossil | end_exit_portal | end_portal_shrine | test_structure_comparator | test_structure_fireproof", + params = "desert_temple | desert_well | igloo | witch_hut | boulder | ice_spike_small | ice_spike_large | fossil | end_exit_portal | end_portal_shrine | test_structure_comparator | test_structure_fireproof | test_structure_tnt", description = S("Generate a pre-defined structure near your position."), privs = {debug = true}, func = function(name, param) @@ -582,6 +587,8 @@ minetest.register_chatcommand("spawnstruct", { mcl_structures.generate_test_structure_comparator(pos, rot, pr) elseif param == "test_structure_fireproof" then mcl_structures.generate_test_structure_fireproof(pos, rot, pr) + elseif param == "test_structure_tnt" then + mcl_structures.generate_test_structure_tnt(pos, rot, pr) elseif param == "" then message = S("Error: No structure type given. Please use “/spawnstruct ”.") errord = true diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_test_structure_tnt.mts b/mods/MAPGEN/mcl_structures/schematics/mcl_structures_test_structure_tnt.mts new file mode 100644 index 0000000000000000000000000000000000000000..c8a4f9b591f54b1c566d575b56446b9237dbc90f GIT binary patch literal 197 zcmeYb3HD`RVPI!qVqmYY2hxJM$vN@K`9-N#`ANl@DVd3R49tm{MGU-f@sgs{R0cjc zH$5k@xR^l#&QHlKDv2-8EXjyZF9OMMgJeqbO00kwNn3GAeqL(Doa6)rMgt>*Mnz>Y z%d`a=9Gf0YNIt6E?k%s(EG?0=nV<7YGAmC2&*Mcal2^DtR6M=#WwYi1wu*|109KaH NXA7Abm`-Us002s#LnZ(K literal 0 HcmV?d00001 From 5acc9191faccbe6fa113dec2caa2d6cd8291d050 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Sun, 17 Apr 2022 05:44:14 +0200 Subject: [PATCH 2/3] Add setting for TNT drop rate --- mods/ITEMS/mcl_tnt/init.lua | 3 ++- settingtypes.txt | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_tnt/init.lua b/mods/ITEMS/mcl_tnt/init.lua index 8001e5cf..12cc9748 100644 --- a/mods/ITEMS/mcl_tnt/init.lua +++ b/mods/ITEMS/mcl_tnt/init.lua @@ -1,4 +1,5 @@ local S = minetest.get_translator("mcl_tnt") +local tnt_drop_rate = tonumber(minetest.settings:get("mcl_tnt_drop_rate") or 0.25) local tnt_griefing = minetest.settings:get_bool("mcl_tnt_griefing", true) local mod_death_messages = minetest.get_modpath("mcl_death_messages") @@ -180,7 +181,7 @@ function TNT:on_step(dtime) self.blinkstatus = not self.blinkstatus end if self.timer > tnt.BOOMTIMER then - mcl_explosions.explode(self.object:get_pos(), 4, {}, self.object) + mcl_explosions.explode(self.object:get_pos(), 4, { drop_chance = tnt_drop_rate }, self.object) self.object:remove() end end diff --git a/settingtypes.txt b/settingtypes.txt index e5d1c593..0f45454f 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -24,6 +24,9 @@ mcl_doWeatherCycle (Change weather) bool true # Note that blocks never have drops when in Creative Mode. mcl_doTileDrops (Blocks have drops) bool true +# Chance of a node destroyed by a TNT explosion to be dropped as an item +mcl_tnt_drop_rate (TNT drop rate) float 0.25 0.0 1.0 + # If enabled, TNT explosions destroy blocks. mcl_tnt_griefing (TNT destroys blocks) bool true From 6e11819b794c941c0e88b698f706d1d02c6ef302 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Sun, 17 Apr 2022 18:44:09 +0200 Subject: [PATCH 3/3] Increase TNT drop rate to 100% This makes the TNT drop rate match Minecraft 1.14. --- mods/ITEMS/mcl_tnt/init.lua | 2 +- settingtypes.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_tnt/init.lua b/mods/ITEMS/mcl_tnt/init.lua index 12cc9748..4d91eb1d 100644 --- a/mods/ITEMS/mcl_tnt/init.lua +++ b/mods/ITEMS/mcl_tnt/init.lua @@ -1,5 +1,5 @@ local S = minetest.get_translator("mcl_tnt") -local tnt_drop_rate = tonumber(minetest.settings:get("mcl_tnt_drop_rate") or 0.25) +local tnt_drop_rate = tonumber(minetest.settings:get("mcl_tnt_drop_rate") or 1.0) local tnt_griefing = minetest.settings:get_bool("mcl_tnt_griefing", true) local mod_death_messages = minetest.get_modpath("mcl_death_messages") diff --git a/settingtypes.txt b/settingtypes.txt index 0f45454f..cd8201ac 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -25,7 +25,7 @@ mcl_doWeatherCycle (Change weather) bool true mcl_doTileDrops (Blocks have drops) bool true # Chance of a node destroyed by a TNT explosion to be dropped as an item -mcl_tnt_drop_rate (TNT drop rate) float 0.25 0.0 1.0 +mcl_tnt_drop_rate (TNT drop rate) float 1.0 0.0 1.0 # If enabled, TNT explosions destroy blocks. mcl_tnt_griefing (TNT destroys blocks) bool true