Tnt, sulfur
This commit is contained in:
parent
f3d9dc6b8a
commit
61ae32f4eb
@ -191,7 +191,7 @@ for _, anvil in ipairs(anvils) do
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
if inv:is_empty("src1") and inv:is_empty("src2") and inv:is_empty("hammer")
|
||||
and inv:is_empty("output") and inv:is_empty("flux") then
|
||||
and inv:is_empty("output") then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
@ -205,9 +205,8 @@ for _, anvil in ipairs(anvils) do
|
||||
"list[current_name;src1;2.9,0.25;1,1;]"..
|
||||
"image[3.69,0.22;0.54,1.5;anvil_arrow.png]"..
|
||||
"list[current_name;src2;4.1,0.25;1,1;]"..
|
||||
"list[current_name;hammer;0.5,1;1,1;]"..
|
||||
"list[current_name;hammer;1,1;1,1;]"..
|
||||
"list[current_name;output;3.5,1.5;1,1;]"..
|
||||
"list[current_name;flux;1.5,1;1,1;]"..
|
||||
"list[current_player;main;0,3;8,4;]")
|
||||
meta:set_string("infotext", anvil[2].." Anvil")
|
||||
local inv = meta:get_inventory()
|
||||
@ -248,46 +247,12 @@ for _, anvil in ipairs(anvils) do
|
||||
end
|
||||
end
|
||||
end
|
||||
local weld = function()
|
||||
if flux:get_name() == "minerals:flux" then
|
||||
for _, recipe in ipairs(realtest.registered_anvil_recipes) do
|
||||
if recipe.type == "weld" and recipe.item1 == src1:get_name() and recipe.item2 == src2:get_name() and
|
||||
anvil[3] >= recipe.level and
|
||||
minetest.get_item_group(instrument:get_name(), recipe.instrument) == 1 and
|
||||
minetest.get_item_group(instrument:get_name(), "material_level") >= recipe.level then
|
||||
if inv:room_for_item("output", recipe.output) then
|
||||
if recipe.rmitem1 then
|
||||
src1:take_item()
|
||||
inv:set_stack("src1", 1, src1)
|
||||
end
|
||||
if recipe.item2 ~= "" and recipe.rmitem2 then
|
||||
src2:take_item()
|
||||
inv:set_stack("src2", 1, src2)
|
||||
end
|
||||
output:add_item(recipe.output)
|
||||
inv:set_stack("output", 1, output)
|
||||
flux:take_item()
|
||||
inv:set_stack("flux", 1, flux)
|
||||
instrument:add_wear(65535/minetest.get_item_group(instrument:get_name(), "durability")/2)
|
||||
inv:set_stack("hammer", 1, instrument)
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if fields["buttonForge"] then
|
||||
forge()
|
||||
elseif fields["buttonForge10"] then
|
||||
for i = 0, 9 do
|
||||
forge()
|
||||
end
|
||||
elseif fields["buttonWeld"] then
|
||||
weld()
|
||||
elseif fields["buttonWeld10"] then
|
||||
for i = 0, 9 do
|
||||
weld()
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
@ -1,174 +0,0 @@
|
||||
local function generate_peat(name, wherein, minp, maxp, seed, chunks_per_volume, chunk_size, ore_per_chunk, height_min, height_max)
|
||||
if maxp.y < height_min or minp.y > height_max then
|
||||
return
|
||||
end
|
||||
local y_min = math.max(minp.y, height_min)
|
||||
local y_max = math.min(maxp.y, height_max)
|
||||
local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1)
|
||||
local pr = PseudoRandom(seed)
|
||||
local num_chunks = math.floor(chunks_per_volume * volume)
|
||||
local inverse_chance = math.floor(chunk_size*chunk_size*chunk_size / ore_per_chunk)
|
||||
--print("generate_ore num_chunks: "..dump(num_chunks))
|
||||
for i=1,num_chunks do
|
||||
local y0 = pr:next(y_min, y_max-chunk_size+1)
|
||||
if y0 >= height_min and y0 <= height_max then
|
||||
local x0 = pr:next(minp.x, maxp.x-chunk_size+1)
|
||||
local z0 = pr:next(minp.z, maxp.z-chunk_size+1)
|
||||
local p0 = {x=x0, y=y0, z=z0}
|
||||
for x1=0,chunk_size-1 do
|
||||
for y1=0,chunk_size-1 do
|
||||
for z1=0,chunk_size-1 do
|
||||
if pr:next(1,inverse_chance) == 1 then
|
||||
local x2 = x0+x1
|
||||
local y2 = y0+y1
|
||||
local z2 = z0+z1
|
||||
local p2 = {x=x2, y=y2, z=z2}
|
||||
if minetest.get_node(p2).name == wherein then
|
||||
if minetest.get_node({x=p2.x, y=p2.y + 1, z=p2.z}).name == "default:water_source" and
|
||||
minetest.get_node({x=p2.x, y=p2.y + 2, z=p2.z}).name == "air" then
|
||||
minetest.set_node(p2, {name=name})
|
||||
end
|
||||
if minetest.get_node({x=p2.x, y=p2.y + 1, z=p2.z}).name == "default:water_source" and
|
||||
minetest.get_node({x=p2.x, y=p2.y + 2, z=p2.z}).name == "default:water_source" and
|
||||
minetest.get_node({x=p2.x, y=p2.y + 3, z=p2.z}).name == "air" then
|
||||
minetest.set_node(p2, {name=name})
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function is_node_beside(pos, node)
|
||||
local sides = {{x=-1,y=0,z=0}, {x=1,y=0,z=0}, {x=0,y=0,z=-1}, {x=0,y=0,z=1}, {x=0,y=-1,z=0}, {x=0,y=1,z=0},}
|
||||
for i, s in ipairs(sides) do
|
||||
if minetest.get_node({x=pos.x+s.x,y=pos.y+s.y,z=pos.z+s.z}).name == node then
|
||||
return true, minetest.dir_to_wallmounted(s)
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function generate_sulfur(name, minp, maxp, seed, chunks_per_volume, chunk_size, ore_per_chunk, height_min, height_max)
|
||||
if maxp.y < height_min or minp.y > height_max then
|
||||
return
|
||||
end
|
||||
local y_min = math.max(minp.y, height_min)
|
||||
local y_max = math.min(maxp.y, height_max)
|
||||
local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1)
|
||||
local pr = PseudoRandom(seed)
|
||||
local num_chunks = math.floor(chunks_per_volume * volume)
|
||||
local inverse_chance = math.floor(chunk_size*chunk_size*chunk_size / ore_per_chunk)
|
||||
for i=1,num_chunks do
|
||||
local y0 = pr:next(y_min, y_max-chunk_size+1)
|
||||
if y0 >= height_min and y0 <= height_max then
|
||||
local x0 = pr:next(minp.x, maxp.x-chunk_size+1)
|
||||
local z0 = pr:next(minp.z, maxp.z-chunk_size+1)
|
||||
local p0 = {x=x0, y=y0, z=z0}
|
||||
for x1=0,chunk_size-1 do
|
||||
for y1=0,chunk_size-1 do
|
||||
for z1=0,chunk_size-1 do
|
||||
if pr:next(1,inverse_chance) == 1 then
|
||||
local x2 = x0+x1
|
||||
local y2 = y0+y1
|
||||
local z2 = z0+z1
|
||||
local p2 = {x=x2, y=y2, z=z2}
|
||||
if minetest.get_node(p2).name == "air" and minetest.find_node_near(p2, 3, {"default:lava_source","default:lava_flowing"}) then
|
||||
local inb, side = is_node_beside(p2, "default:stone")
|
||||
if inb then
|
||||
minetest.set_node(p2, {name=name, param2 = side})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, chunk_size,
|
||||
ore_per_chunk, height_min, height_max, noise_min, noise_max)
|
||||
if maxp.y < height_min or minp.y > height_max then
|
||||
return
|
||||
end
|
||||
local ore_noise1
|
||||
local ore_noise2
|
||||
local y_min = math.max(minp.y, height_min)
|
||||
local y_max = math.min(maxp.y, height_max)
|
||||
local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1)
|
||||
local pr = PseudoRandom(seed)
|
||||
local num_chunks = math.floor(chunks_per_volume * volume)
|
||||
local inverse_chance = math.floor(chunk_size*chunk_size*chunk_size / ore_per_chunk)
|
||||
|
||||
-- perlin. Only done if borders are defined.
|
||||
if type(noise_min) == "number" or type(noise_max) == "number" then
|
||||
if type(noise_min) ~= "number" then
|
||||
noise_min = -2
|
||||
end
|
||||
if type(noise_max) ~= "number" then
|
||||
noise_max = 2
|
||||
end
|
||||
ore_noise1 = minetest.get_perlin(seed, 3, 0.7, 100)
|
||||
end
|
||||
|
||||
--print("generate_ore num_chunks: "..dump(num_chunks))
|
||||
for i=1,num_chunks do
|
||||
local y0 = pr:next(y_min, y_max-chunk_size+1)
|
||||
if y0 >= height_min and y0 <= height_max then
|
||||
local x0 = pr:next(minp.x, maxp.x-chunk_size+1)
|
||||
local z0 = pr:next(minp.z, maxp.z-chunk_size+1)
|
||||
local p0 = {x=x0, y=y0, z=z0}
|
||||
|
||||
-- perlin
|
||||
if type(noise_min) == "number" or type(noise_max) == "number" then
|
||||
ore_noise2 = (ore_noise1:get3d(p0))
|
||||
end
|
||||
|
||||
for x1=0,chunk_size-1 do
|
||||
for y1=0,chunk_size-1 do
|
||||
for z1=0,chunk_size-1 do
|
||||
if pr:next(1,inverse_chance) == 1 then
|
||||
local x2 = x0+x1
|
||||
local y2 = y0+y1
|
||||
local z2 = z0+z1
|
||||
local p2 = {x=x2, y=y2, z=z2}
|
||||
if minetest.get_node(p2).name == wherein then
|
||||
|
||||
-- perlin
|
||||
if type(noise_min) == "number" or type(noise_max) == "number" then
|
||||
if ore_noise2 >= noise_min and ore_noise2 <= noise_max then
|
||||
minetest.set_node(p2, {name=name})
|
||||
end
|
||||
else
|
||||
minetest.set_node(p2, {name=name})
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
--print("generate_perlinore done")
|
||||
end
|
||||
|
||||
minetest.after(0, function()
|
||||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
local pr = PseudoRandom(seed)
|
||||
local ore = realtest.registered_ores[realtest.registered_ores_list[pr:next(1,#realtest.registered_ores_list)]]
|
||||
|
||||
for __, wherein in ipairs(ore.wherein) do
|
||||
generate_ore(ore.name.."_in_"..wherein:gsub(":","_"), wherein, minp, maxp, seed+ore.delta_seed,
|
||||
ore.chunks_per_volume, ore.chunk_size,
|
||||
ore.ore_per_chunk, ore.height_min, ore.height_max, ore.noise_min, ore.noise_max)
|
||||
end
|
||||
generate_sulfur("ores:sulfur", minp, maxp, seed+400, 1/8/8/8/8, 10, 850, -30912, 200)
|
||||
generate_peat("ores:peat", "default:dirt", minp, maxp, seed+401, 1/8/16/24, 10, 1000, -100, 200)
|
||||
end)
|
||||
end)
|
@ -12,5 +12,14 @@ minetest.register_ore({
|
||||
height_max = 0,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:stone"},
|
||||
nodenames = {"default:lava_source"},
|
||||
interval = 10,
|
||||
chance = 100,
|
||||
action = function(pos, node)
|
||||
minetest.add_node(pos, {name="ores:sulfur"})
|
||||
end
|
||||
})
|
||||
|
||||
dofile(minetest.get_modpath("ores").."/registration.lua")
|
||||
|
@ -20,7 +20,7 @@ function realtest.register_ore(name, OreDef)
|
||||
clust_num_ores = OreDef.ore_per_chunk or 10,
|
||||
height_min = OreDef.height_min or -30912,
|
||||
height_max = OreDef.height_max or 30912,
|
||||
noise_threshhold = OreDef.noise_min or 1.4,
|
||||
noise_threshhold = OreDef.noise_min or 1.2,
|
||||
noise_params = {offset=0, scale=1, spread={x=100, y=100, z=100}, octaves=3, persist=0.70, seed = OreDef.delta_seed or d_seed},
|
||||
generate = true
|
||||
}
|
||||
@ -192,16 +192,10 @@ realtest.register_ore("ores:graphite", {
|
||||
|
||||
minetest.register_node("ores:sulfur", {
|
||||
description = "Sulfur Ore",
|
||||
drawtype = "signlike",
|
||||
tile_images = {"ores_sulfur.png"},
|
||||
tile_images = {"default_stone.png^ores_sulfur.png"},
|
||||
particle_image = {"minerals_sulfur.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
walkable = false,
|
||||
selection_box = {
|
||||
type = "wallmounted",
|
||||
},
|
||||
groups = {cracky=3,drop_on_dig=1,dig_immediate=2,attached_node=1},
|
||||
groups = {cracky=3,drop_on_dig=1,dig_immediate=2},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
|
28
mods/tnt/README.txt
Normal file
28
mods/tnt/README.txt
Normal file
@ -0,0 +1,28 @@
|
||||
=== TNT-MOD for MINETEST-C55 ===
|
||||
by PilzAdam
|
||||
|
||||
Introduction:
|
||||
This mod adds TNT to Minetest. TNT is a tool to help the player
|
||||
in mining.
|
||||
|
||||
How to install:
|
||||
Unzip the archive an place it in minetest-base-directory/mods/minetest/
|
||||
if you have a windows client or a linux run-in-place client. If you have
|
||||
a linux system-wide instalation place it in ~/.minetest/mods/minetest/.
|
||||
If you want to install this mod only in one world create the folder
|
||||
worldmods/ in your worlddirectory.
|
||||
For further information or help see:
|
||||
http://wiki.minetest.com/wiki/Installing_Mods
|
||||
|
||||
How to use the mod:
|
||||
Craft gunpowder by placing coal and gravel in the crafting area. The
|
||||
gunpowder can be used to craft TNT or as fuze for TNT. To craft TNT
|
||||
surround gunpowder with 4 wood in a + shape.
|
||||
There are different ways to blow up TNT:
|
||||
1. Hit it with a torch.
|
||||
2. Hit a gunpowder fuze that leads to a TNT block with a torch.
|
||||
3. Activate it with mesecons (fastest way)
|
||||
Be aware of the damage radius of 7 blocks!
|
||||
|
||||
License:
|
||||
WTFPL
|
3
mods/tnt/depends.txt
Normal file
3
mods/tnt/depends.txt
Normal file
@ -0,0 +1,3 @@
|
||||
default
|
||||
fire
|
||||
trees
|
240
mods/tnt/init.lua
Normal file
240
mods/tnt/init.lua
Normal file
@ -0,0 +1,240 @@
|
||||
local destroy = function(pos)
|
||||
local nodename = minetest.env:get_node(pos).name
|
||||
if nodename ~= "air" then
|
||||
minetest.env:remove_node(pos)
|
||||
nodeupdate(pos)
|
||||
if minetest.registered_nodes[nodename].groups.flammable ~= nil then
|
||||
minetest.env:set_node(pos, {name="fire:basic_flame"})
|
||||
return
|
||||
end
|
||||
local drop = minetest.get_node_drops(nodename, "")
|
||||
for _,item in ipairs(drop) do
|
||||
if type(item) == "string" then
|
||||
local obj = minetest.env:add_item(pos, item)
|
||||
if obj == nil then
|
||||
return
|
||||
end
|
||||
obj:get_luaentity().collect = true
|
||||
obj:setacceleration({x=0, y=-10, z=0})
|
||||
obj:setvelocity({x=math.random(0,6)-3, y=10, z=math.random(0,6)-3})
|
||||
else
|
||||
for i=1,item:get_count() do
|
||||
local obj = minetest.env:add_item(pos, item:get_name())
|
||||
if obj == nil then
|
||||
return
|
||||
end
|
||||
obj:get_luaentity().collect = true
|
||||
obj:setacceleration({x=0, y=-10, z=0})
|
||||
obj:setvelocity({x=math.random(0,6)-3, y=10, z=math.random(0,6)-3})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
boom = function(pos, time)
|
||||
minetest.after(time, function(pos)
|
||||
if minetest.env:get_node(pos).name ~= "tnt:tnt_burning" then
|
||||
return
|
||||
end
|
||||
minetest.sound_play("tnt_explode", {pos=pos, gain=1.5, max_hear_distance=2*64})
|
||||
minetest.env:set_node(pos, {name="tnt:boom"})
|
||||
minetest.after(0.5, function(pos)
|
||||
minetest.env:remove_node(pos)
|
||||
end, {x=pos.x, y=pos.y, z=pos.z})
|
||||
|
||||
local objects = minetest.env:get_objects_inside_radius(pos, 3)
|
||||
for _,obj in ipairs(objects) do
|
||||
if obj:is_player() or (obj:get_luaentity() and obj:get_luaentity().name ~= "__builtin:item") then
|
||||
local obj_p = obj:getpos()
|
||||
local vec = {x=obj_p.x-pos.x, y=obj_p.y-pos.y, z=obj_p.z-pos.z}
|
||||
local dist = (vec.x^2+vec.y^2+vec.z^2)^0.5
|
||||
local damage = (80*0.5^dist)*2
|
||||
obj:punch(obj, 1.0, {
|
||||
full_punch_interval=1.0,
|
||||
damage_groups = {
|
||||
fleshy=7,
|
||||
snappy=7
|
||||
},
|
||||
-- groupcaps={
|
||||
-- fleshy={times={[1]=1/damage, [2]=1/damage, [3]=1/damage}},
|
||||
-- snappy={times={[1]=1/damage, [2]=1/damage, [3]=1/damage}},
|
||||
-- }
|
||||
}, nil)
|
||||
end
|
||||
end
|
||||
|
||||
for dx=-1,1 do
|
||||
for dz=-1,1 do
|
||||
for dy=1,-1,-1 do
|
||||
pos.x = pos.x+dx
|
||||
pos.y = pos.y+dy
|
||||
pos.z = pos.z+dz
|
||||
|
||||
local node = minetest.env:get_node(pos)
|
||||
if node.name == "tnt:tnt" or node.name == "tnt:tnt_burning" then
|
||||
minetest.env:set_node(pos, {name="tnt:tnt_burning"})
|
||||
boom({x=pos.x, y=pos.y, z=pos.z}, 0)
|
||||
elseif node.name == "fire:basic_flame" or string.find(node.name, "default:water_") or string.find(node.name, "default:lava_") or node.name == "tnt:boom" then
|
||||
|
||||
else
|
||||
if math.abs(dx)<2 and math.abs(dy)<2 and math.abs(dz)<2 then
|
||||
if minetest.env:get_node(pos).name ~= "default:obsidian" then
|
||||
destroy(pos)
|
||||
end
|
||||
else
|
||||
if math.random(1,5) <= 4 then
|
||||
if minetest.env:get_node(pos).name ~= "default:obsidian" then
|
||||
destroy(pos)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
pos.x = pos.x-dx
|
||||
pos.y = pos.y-dy
|
||||
pos.z = pos.z-dz
|
||||
end
|
||||
end
|
||||
end
|
||||
end, pos)
|
||||
end
|
||||
|
||||
minetest.register_node("tnt:tnt", {
|
||||
description = "Gunpowder Keg",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-3/16,-8/16,-3/16,3/16,0/16,3/16},
|
||||
},
|
||||
},
|
||||
tiles = {"tnt_top.png", "tnt_bottom.png", "tnt_side.png"},
|
||||
groups = {dig_immediate=2, mesecon=2, falling_node=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_punch = function(pos, node, puncher)
|
||||
if puncher:get_wielded_item():get_name() == "default:torch" then
|
||||
minetest.sound_play("tnt_ignite", {pos=pos})
|
||||
minetest.env:set_node(pos, {name="tnt:tnt_burning"})
|
||||
boom(pos, 4)
|
||||
end
|
||||
end,
|
||||
|
||||
on_timer = function(pos,elapsed)
|
||||
minetest.env:set_node(pos, {name="tnt:tnt_burning"})
|
||||
boom(pos, 0)
|
||||
end,
|
||||
|
||||
mesecons = {
|
||||
effector = {
|
||||
action_on = function(pos, node)
|
||||
minetest.env:set_node(pos, {name="tnt:tnt_burning"})
|
||||
boom(pos, 0)
|
||||
end
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node("tnt:tnt_burning", {
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-3/16,-8/16,-3/16,3/16,0/16,3/16},
|
||||
},
|
||||
},
|
||||
tiles = {"tnt_top_burning.png", "tnt_bottom.png", "tnt_side.png"},
|
||||
light_source = 5,
|
||||
drop = "",
|
||||
groups = {falling_node=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
|
||||
on_timer = function(pos,elapsed)
|
||||
minetest.env:set_node(pos, {name="tnt:tnt_burning"})
|
||||
boom(pos, 0)
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
minetest.register_node("tnt:boom", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"tnt_boom.png"},
|
||||
light_source = LIGHT_MAX,
|
||||
walkable = false,
|
||||
drop = "",
|
||||
groups = {dig_immediate=3},
|
||||
})
|
||||
|
||||
burn = function(pos)
|
||||
if minetest.env:get_node(pos).name == "tnt:tnt" then
|
||||
minetest.sound_play("tnt_ignite", {pos=pos})
|
||||
minetest.env:set_node(pos, {name="tnt:tnt_burning"})
|
||||
boom(pos, 1)
|
||||
return
|
||||
end
|
||||
if minetest.env:get_node(pos).name ~= "tnt:gunpowder" then
|
||||
return
|
||||
end
|
||||
minetest.sound_play("tnt_gunpowder_burning", {pos=pos, gain=2})
|
||||
minetest.env:set_node(pos, {name="tnt:gunpowder_burning"})
|
||||
|
||||
minetest.after(1, function(pos)
|
||||
if minetest.env:get_node(pos).name ~= "tnt:gunpowder_burning" then
|
||||
return
|
||||
end
|
||||
minetest.after(0.5, function(pos)
|
||||
minetest.env:remove_node(pos)
|
||||
end, {x=pos.x, y=pos.y, z=pos.z})
|
||||
for dx=-1,1 do
|
||||
for dz=-1,1 do
|
||||
for dy=-1,1 do
|
||||
pos.x = pos.x+dx
|
||||
pos.y = pos.y+dy
|
||||
pos.z = pos.z+dz
|
||||
|
||||
if not (math.abs(dx) == 1 and math.abs(dz) == 1) then
|
||||
if dy == 0 then
|
||||
burn({x=pos.x, y=pos.y, z=pos.z})
|
||||
else
|
||||
if math.abs(dx) == 1 or math.abs(dz) == 1 then
|
||||
burn({x=pos.x, y=pos.y, z=pos.z})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
pos.x = pos.x-dx
|
||||
pos.y = pos.y-dy
|
||||
pos.z = pos.z-dz
|
||||
end
|
||||
end
|
||||
end
|
||||
end, pos)
|
||||
end
|
||||
|
||||
if minetest.setting_get("log_mods") then
|
||||
minetest.log("action", "tnt loaded")
|
||||
end
|
||||
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"tnt:tnt_burning"},
|
||||
interval = 4,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local ntimer = minetest.env:get_node_timer(pos)
|
||||
ntimer:start(1)
|
||||
end,
|
||||
})
|
||||
|
||||
for _, tree in pairs(realtest.registered_trees) do
|
||||
minetest.register_craft({
|
||||
output = "tnt:tnt",
|
||||
recipe = {
|
||||
{"trees:birch_plank","minerals:saltpeter","trees:birch_plank"},
|
||||
{"trees:birch_plank","minerals:sulfur","trees:birch_plank"},
|
||||
{"trees:birch_plank","minerals:saltpeter","trees:birch_plank"},
|
||||
}
|
||||
})
|
||||
end
|
BIN
mods/tnt/sounds/tnt_explode.ogg
Normal file
BIN
mods/tnt/sounds/tnt_explode.ogg
Normal file
Binary file not shown.
BIN
mods/tnt/sounds/tnt_gunpowder_burning.ogg
Normal file
BIN
mods/tnt/sounds/tnt_gunpowder_burning.ogg
Normal file
Binary file not shown.
BIN
mods/tnt/sounds/tnt_ignite.ogg
Normal file
BIN
mods/tnt/sounds/tnt_ignite.ogg
Normal file
Binary file not shown.
BIN
mods/tnt/textures/tnt_boom.png
Normal file
BIN
mods/tnt/textures/tnt_boom.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 330 B |
BIN
mods/tnt/textures/tnt_bottom.png
Normal file
BIN
mods/tnt/textures/tnt_bottom.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 435 B |
BIN
mods/tnt/textures/tnt_side.png
Normal file
BIN
mods/tnt/textures/tnt_side.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 484 B |
BIN
mods/tnt/textures/tnt_top.png
Normal file
BIN
mods/tnt/textures/tnt_top.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 441 B |
BIN
mods/tnt/textures/tnt_top_burning.png
Normal file
BIN
mods/tnt/textures/tnt_top_burning.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 475 B |
Loading…
x
Reference in New Issue
Block a user