forked from Mineclonia/Mineclonia
Merge pull request 'ITEMS/mcl_tnt: Add setting for TNT drop rate (default 100%)' (#291) from add-tnt-drop-rate-setting into master
Reviewed-on: Mineclonia/Mineclonia#291 Reviewed-by: Li0n_2 <li0n_2@noreply.git.minetest.land>
This commit is contained in:
commit
1ce88e7528
|
@ -1,4 +1,5 @@
|
|||
local S = minetest.get_translator("mcl_tnt")
|
||||
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")
|
||||
|
@ -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
|
||||
|
|
|
@ -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 <type>”.")
|
||||
errord = true
|
||||
|
|
Binary file not shown.
|
@ -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 1.0 0.0 1.0
|
||||
|
||||
# If enabled, TNT explosions destroy blocks.
|
||||
mcl_tnt_griefing (TNT destroys blocks) bool true
|
||||
|
||||
|
|
Loading…
Reference in New Issue