diff options
| author | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2016-10-22 13:14:14 +0200 | 
|---|---|---|
| committer | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2016-10-22 13:14:14 +0200 | 
| commit | ead9f0fac5a177a88e0751d44181c6e906b81344 (patch) | |
| tree | 95111947a02050709f89d0a55a196aaa88fc2ad4 /init.lua | |
| parent | 50e5c520713a4031ae23d8693a443984be9ac263 (diff) | |
Added Readme and License file, minimum depth can now be configured, gunpowder cannot be lighted above that minimum depth so players are not annoyed.HEADorigin/masterorigin/HEADmaster
Diffstat (limited to 'init.lua')
| -rw-r--r-- | init.lua | 13 | 
1 files changed, 8 insertions, 5 deletions
| @@ -3,6 +3,8 @@ tnt = {}  local singleplayer = minetest.is_singleplayer()  local setting = minetest.setting_getbool("enable_tnt")  setting = true -- this mod is multiplayer-safe, so enable it. +local tntmindepth = tonumber(minetest.setting_get("tnt_mindepth")) or -100 +  if (not singleplayer and setting ~= true) or  		(singleplayer and setting == false) then  	return @@ -364,8 +366,8 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast)  end  function tnt.boom(pos, def) -        if pos.y > -100 then ---	   minetest.chat_send_all("TNT can only explode when deeper than -100") +        if pos.y > tntmindepth then +--	   check if we're deep enough  	   minetest.set_node(pos, {name = "tnt:tnt"})  	   return  	end @@ -417,9 +419,10 @@ minetest.register_node("tnt:gunpowder", {  	sounds = default.node_sound_leaves_defaults(),  	on_punch = function(pos, node, puncher) -		if puncher:get_wielded_item():get_name() == "default:torch" then -			tnt.burn(pos) -		end +	   if puncher:get_wielded_item():get_name() == "default:torch" and pos.y < (tntmindepth + 16)then +	      -- check if we're deep enough, don't annoy people with the air-raid sound. +	      tnt.burn(pos) +	   end  	end,  	on_blast = function(pos, intensity)  		tnt.burn(pos) | 
