I cant... to much stuff changed. I lost track. Everything is in chaos.
Schematics broke... please, help me.
This commit is contained in:
184
mods/ITEMS/pyutest_blocks/api.lua
Normal file
184
mods/ITEMS/pyutest_blocks/api.lua
Normal file
@@ -0,0 +1,184 @@
|
||||
PyuTest.make_node_sounds = function(tbl)
|
||||
local t = tbl or {}
|
||||
t.footstep = t.footstep or { name = "block_walk", gain = 1 }
|
||||
t.dig = t.dig or { name = "block_dig", gain = 0.50 }
|
||||
t.dug = t.dug or { name = "block_break", gain = 0.50 }
|
||||
t.place = t.place or { name = "block_place", gain = 0.50 }
|
||||
return t
|
||||
end
|
||||
|
||||
PyuTest.make_node = function(name, desc, groups, tiles, extra_conf)
|
||||
local conf = {
|
||||
description = Translate(desc),
|
||||
tiles = tiles,
|
||||
groups = PyuTest.util.tableconcat(groups, {
|
||||
block = 1
|
||||
}),
|
||||
}
|
||||
|
||||
if extra_conf ~= nil then
|
||||
for k, v in pairs(extra_conf) do
|
||||
conf[k] = v
|
||||
end
|
||||
|
||||
conf["sounds"] = PyuTest.make_node_sounds(extra_conf.sounds)
|
||||
end
|
||||
|
||||
minetest.register_node(name, conf)
|
||||
end
|
||||
|
||||
PyuTest.node_boxes = {
|
||||
CARPET = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, -0.45, 0.5 }
|
||||
},
|
||||
SLAB = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
|
||||
},
|
||||
PILLAR = {
|
||||
type = "fixed",
|
||||
fixed = { -0.15, -0.5, -0.15, 0.15, 0.5, 0.15 }
|
||||
},
|
||||
STAIRS = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -0.5, -0.5, -0.5, 0.5, 0, 0.5 },
|
||||
{ -0.5, 0, 0, 0.5, 0.5, 0.5 },
|
||||
},
|
||||
},
|
||||
}
|
||||
PyuTest.building_blocks = {}
|
||||
|
||||
PyuTest.make_building_blocks = function(name, desc, tex, colortint, cgroups, extra_conf)
|
||||
local groups = PyuTest.util.tablecopy(cgroups) or {}
|
||||
groups["block"] = 1
|
||||
|
||||
local econf = extra_conf or {}
|
||||
econf["is_ground_content"] = econf["is_ground_content"] or true
|
||||
econf["color"] = colortint
|
||||
|
||||
local id_block = name .. "_block"
|
||||
local id_carpet = name .. "_carpet"
|
||||
local id_slab = name .. "_slab"
|
||||
local id_pillar = name .. "_pillar"
|
||||
local id_stairs = name .. "_stairs"
|
||||
local id_fence = name .. "_fence"
|
||||
|
||||
|
||||
table.insert(PyuTest.building_blocks, {
|
||||
ns = name:split(":")[1],
|
||||
name = name:split(":")[2],
|
||||
desc = desc,
|
||||
tiles = tex,
|
||||
groups = groups,
|
||||
econf = econf
|
||||
})
|
||||
|
||||
minetest.register_node(id_block, PyuTest.util.tableconcat({
|
||||
description = Translate(desc .. " Block"),
|
||||
tiles = tex,
|
||||
groups = PyuTest.util.tableconcat(groups, {
|
||||
solid = 1
|
||||
}),
|
||||
sounds = PyuTest.make_node_sounds(),
|
||||
}, econf))
|
||||
|
||||
minetest.register_node(id_carpet, PyuTest.util.tableconcat({
|
||||
description = Translate(desc .. " Carpet"),
|
||||
tiles = tex,
|
||||
groups = PyuTest.util.tableconcat(PyuTest.util.tablecopy(groups), {
|
||||
attached_node = 1
|
||||
}),
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
node_box = PyuTest.node_boxes.CARPET,
|
||||
sounds = PyuTest.make_node_sounds(),
|
||||
buildable_to = true
|
||||
}, econf))
|
||||
|
||||
minetest.register_node(id_slab, PyuTest.util.tableconcat({
|
||||
description = Translate(desc .. " Slab"),
|
||||
tiles = tex,
|
||||
groups = groups,
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
node_box = PyuTest.node_boxes.SLAB,
|
||||
sounds = PyuTest.make_node_sounds(),
|
||||
}, econf))
|
||||
|
||||
minetest.register_node(id_pillar, PyuTest.util.tableconcat({
|
||||
description = Translate(desc .. " Pillar"),
|
||||
tiles = tex,
|
||||
groups = groups,
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
node_box = PyuTest.node_boxes.PILLAR,
|
||||
sounds = PyuTest.make_node_sounds(),
|
||||
}, econf))
|
||||
|
||||
minetest.register_node(id_stairs, PyuTest.util.tableconcat({
|
||||
description = Translate(desc .. " Stairs"),
|
||||
tiles = tex,
|
||||
groups = groups,
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
node_box = PyuTest.node_boxes.STAIRS,
|
||||
sounds = PyuTest.make_node_sounds(),
|
||||
}, econf))
|
||||
|
||||
minetest.register_node(id_fence, PyuTest.util.tableconcat({
|
||||
description = Translate(desc .. " Fence"),
|
||||
tiles = tex,
|
||||
groups = groups,
|
||||
drawtype = "fencelike",
|
||||
paramtype = "light",
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.25, -0.5, -0.25, 0.25, 0.5, 0.25 }
|
||||
},
|
||||
sounds = PyuTest.make_node_sounds(),
|
||||
}, econf))
|
||||
|
||||
minetest.register_craft({
|
||||
output = id_carpet .. " 2",
|
||||
recipe = {
|
||||
{ id_block, id_block }
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = id_slab .. " 3",
|
||||
recipe = {
|
||||
{ id_block, id_block, id_block }
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = id_pillar .. " 3",
|
||||
recipe = {
|
||||
{ id_block },
|
||||
{ id_block },
|
||||
{ id_block }
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = id_stairs .. " 4",
|
||||
recipe = {
|
||||
{ id_block, "", "" },
|
||||
{ id_block, id_block, "" },
|
||||
{ id_block, id_block, id_block }
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = id_fence .. " 4",
|
||||
recipe = {
|
||||
{ id_block, "pyutest_tools:stick", id_block },
|
||||
{ id_block, "pyutest_tools:stick", id_block }
|
||||
}
|
||||
})
|
||||
end
|
231
mods/ITEMS/pyutest_blocks/basic.lua
Normal file
231
mods/ITEMS/pyutest_blocks/basic.lua
Normal file
@@ -0,0 +1,231 @@
|
||||
PyuTest.make_building_blocks("pyutest_blocks:grass", "Grass", {
|
||||
"pyutest-grass.png"
|
||||
}, nil, {
|
||||
ground = 1,
|
||||
acid_vulnerable = 1,
|
||||
grass = 1,
|
||||
crumbly = PyuTest.BLOCK_FAST
|
||||
})
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:dark_grass", "Dark Grass", {
|
||||
"pyutest-dark-grass.png"
|
||||
}, nil, {
|
||||
ground = 1,
|
||||
acid_vulnerable = 1,
|
||||
grass = 1,
|
||||
crumbly = PyuTest.BLOCK_FAST
|
||||
})
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:swampy_grass", "Swampy Grass", {
|
||||
"pyutest-swampy-grass.png"
|
||||
}, nil, {
|
||||
ground = 1,
|
||||
acid_vulnerable = 1,
|
||||
sugarcane_spawn_on = 1,
|
||||
grass = 1,
|
||||
crumbly = PyuTest.BLOCK_FAST
|
||||
})
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:savanna_grass", "Savanna Grass", {
|
||||
"pyutest-savanna-grass.png"
|
||||
}, nil, {
|
||||
ground = 1,
|
||||
acid_vulnerable = 1,
|
||||
sugarcane_spawn_on = 1,
|
||||
grass = 1,
|
||||
crumbly = PyuTest.BLOCK_FAST
|
||||
})
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:aspen_grass", "Aspen Grass", {
|
||||
"pyutest-aspen-grass.png"
|
||||
}, nil, {
|
||||
ground = 1,
|
||||
acid_vulnerable = 1,
|
||||
grass = 1,
|
||||
crumbly = PyuTest.BLOCK_FAST
|
||||
})
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:jungle_grass", "Jungle Grass", {
|
||||
"pyutest-jungle-grass.png"
|
||||
}, nil, {
|
||||
ground = 1,
|
||||
acid_vulnerable = 1,
|
||||
grass = 1,
|
||||
crumbly = PyuTest.BLOCK_FAST
|
||||
})
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:dirt", "Dirt", { "pyutest-dirt.png" }, nil, {
|
||||
ground = 1,
|
||||
acid_vulnerable = 1,
|
||||
crumbly = PyuTest.BLOCK_FAST
|
||||
})
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:podzol", "Podzol", { "pyutest-podzol.png" }, nil, {
|
||||
ground = 1,
|
||||
acid_vulnerable = 1,
|
||||
crumbly = PyuTest.BLOCK_FAST
|
||||
})
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:snow", "Snow", { "pyutest-snow.png" }, nil, {
|
||||
ground = 1,
|
||||
acid_vulnerable = 1,
|
||||
crumbly = PyuTest.BLOCK_FAST
|
||||
})
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:sand", "Sand", { "pyutest-sand.png" }, nil, {
|
||||
ground = 1,
|
||||
acid_vulnerable = 1,
|
||||
falling_node = 1,
|
||||
sugarcane_spawn_on = 1,
|
||||
crumbly = PyuTest.BLOCK_FAST
|
||||
})
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:mycelium", "Mycelium", {
|
||||
"pyutest-mycelium.png"
|
||||
}, nil, {
|
||||
ground = 1,
|
||||
crumbly = PyuTest.BLOCK_FAST
|
||||
})
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:clay", "Clay", { "pyutest-clay-block.png" }, nil, {
|
||||
acid_vulnerable = 1,
|
||||
crumbly = PyuTest.BLOCK_FAST
|
||||
})
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:gravel", "Gravel", { "pyutest-gravel.png" }, nil, {
|
||||
falling_node = 1,
|
||||
acid_vulnerable = 1,
|
||||
crumbly = PyuTest.BLOCK_FAST
|
||||
})
|
||||
|
||||
-- Cracky
|
||||
PyuTest.make_building_blocks("pyutest_blocks:stone", "Stone", { "pyutest-stone.png" }, nil, {
|
||||
ground = 1,
|
||||
stone = 1,
|
||||
cracky = PyuTest.BLOCK_NORMAL,
|
||||
level = 1
|
||||
}, { is_ground_content = true })
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:darkstone", "Darkstone", { "pyutest-darkstone.png" }, nil, {
|
||||
ground = 1,
|
||||
stone = 1,
|
||||
cracky = PyuTest.BLOCK_NORMAL,
|
||||
level = 1
|
||||
}, { is_ground_content = true })
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:granite", "Granite", {"pyutest-granite.png"}, nil, {
|
||||
ground = 1,
|
||||
stone = 1,
|
||||
cracky = PyuTest.BLOCK_NORMAL,
|
||||
level = 1
|
||||
})
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:andesite", "Andesite", {"pyutest-andesite.png"}, nil, {
|
||||
ground = 1,
|
||||
stone = 1,
|
||||
cracky = PyuTest.BLOCK_NORMAL,
|
||||
level = 1
|
||||
})
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:sandstone", "Sandstone", { "pyutest-sandstone.png" }, nil, {
|
||||
ground = 1,
|
||||
acid_vulnerable = 1,
|
||||
cracky = PyuTest.BLOCK_FAST,
|
||||
}, { is_ground_content = false })
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:ice", "Ice", { "pyutest-ice.png" }, nil, {
|
||||
ground = 1,
|
||||
acid_vulnerable = 1,
|
||||
slippery = 4,
|
||||
cracky = PyuTest.BLOCK_FAST,
|
||||
thawable = 1
|
||||
})
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:molten_rock", "Molten Rock", { "pyutest-molten-rock.png" }, nil, {
|
||||
ground = 1,
|
||||
cracky = PyuTest.BLOCK_FAST,
|
||||
}, { is_ground_content = false })
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:basalt", "Basalt", { "pyutest-basalt.png" }, nil, {
|
||||
ground = 1,
|
||||
cracky = PyuTest.BLOCK_FAST,
|
||||
}, { is_ground_content = false })
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:obsidian", "Obsidian", { "pyutest-obsidian.png" }, nil, {
|
||||
cracky = PyuTest.BLOCK_SLOW,
|
||||
}, { is_ground_content = false })
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:crystal_lantern", "Crystal Lantern", { "pyutest-crystal-lantern.png" }, nil, {
|
||||
cracky = PyuTest.BLOCK_FAST
|
||||
}, {
|
||||
light_source = minetest.LIGHT_MAX,
|
||||
paramtype = "light"
|
||||
})
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:bone", "Bone", {
|
||||
"pyutest-bone-block-top-bottom.png",
|
||||
"pyutest-bone-block-top-bottom.png",
|
||||
"pyutest-bone-block.png"
|
||||
}, nil, {
|
||||
cracky = PyuTest.BLOCK_FAST
|
||||
})
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:enchanted_obsidian", "Enchanted Obsidian", {
|
||||
"pyutest-enchanted-obsidian.png"
|
||||
}, nil, {
|
||||
cracky = PyuTest.BLOCK_SLOW
|
||||
}, {
|
||||
is_ground_content = false
|
||||
})
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:brick", "Brick", { "pyutest-bricks.png" }, nil, {
|
||||
cracky = PyuTest.BLOCK_NORMAL
|
||||
}, {
|
||||
is_ground_content = false
|
||||
})
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:stone_bricks", "Stone Bricks", { "pyutest-stone-bricks.png" }, nil, {
|
||||
cracky = PyuTest.BLOCK_SLOW
|
||||
}, {
|
||||
is_ground_content = false
|
||||
})
|
||||
|
||||
-- Choppy
|
||||
PyuTest.make_building_blocks("pyutest_blocks:mushroom", "Mushroom", { "pyutest-mushroom.png" }, nil, {
|
||||
flammable = 1,
|
||||
choppy = PyuTest.BLOCK_FAST
|
||||
}, { is_ground_content = false })
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:mushroom_stem", "Mushroom Stem", { "pyutest-mushroom-stem.png" }, nil, {
|
||||
flammable = 1,
|
||||
choppy = PyuTest.BLOCK_FAST
|
||||
}, { is_ground_content = false })
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:purple_mushroom", "Purple Mushroom", {
|
||||
"pyutest-purple-mushroom.png"
|
||||
}, nil, {
|
||||
flammable = 1,
|
||||
choppy = PyuTest.BLOCK_FAST
|
||||
}, { is_ground_content = false })
|
||||
|
||||
-- Breakable by hand
|
||||
PyuTest.make_building_blocks("pyutest_blocks:haybale", "Haybale", {
|
||||
"pyutest-haybale-top-bottom.png",
|
||||
"pyutest-haybale-top-bottom.png",
|
||||
"pyutest-haybale.png"
|
||||
}, nil, {
|
||||
oddly_breakable_by_hand = PyuTest.BLOCK_FAST
|
||||
})
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:slime", "Slime", { "pyutest-slime.png" }, nil, {
|
||||
bouncy = 85,
|
||||
oddly_breakable_by_hand = PyuTest.BLOCK_FAST
|
||||
})
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:glowslime", "Glowslime", { "pyutest-glowslime.png" }, nil, {
|
||||
bouncy = 85,
|
||||
oddly_breakable_by_hand = PyuTest.BLOCK_FAST
|
||||
}, {
|
||||
paramtype = "light",
|
||||
light_source = minetest.LIGHT_MAX
|
||||
})
|
6
mods/ITEMS/pyutest_blocks/init.lua
Normal file
6
mods/ITEMS/pyutest_blocks/init.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
local modpath = minetest.get_modpath("pyutest_blocks")
|
||||
|
||||
dofile(modpath .. "/api.lua")
|
||||
dofile(modpath .. "/basic.lua")
|
||||
dofile(modpath .. "/liquid.lua")
|
||||
dofile(modpath .. "/special.lua")
|
68
mods/ITEMS/pyutest_blocks/liquid.lua
Normal file
68
mods/ITEMS/pyutest_blocks/liquid.lua
Normal file
@@ -0,0 +1,68 @@
|
||||
PyuTest.make_liquid = function(name, desc, groups, texture, speed, extra_conf)
|
||||
local function make_liquid_flags(liquidtype)
|
||||
local drawtype = ""
|
||||
|
||||
if liquidtype == "source" then
|
||||
drawtype = "liquid"
|
||||
elseif liquidtype == "flowing" then
|
||||
drawtype = "flowingliquid"
|
||||
end
|
||||
|
||||
local t = PyuTest.util.tableconcat({
|
||||
drawtype = drawtype,
|
||||
waving = 3,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = false,
|
||||
use_texture_alpha = "blend",
|
||||
paramtype = "light",
|
||||
drop = "",
|
||||
drowning = 3,
|
||||
liquidtype = liquidtype,
|
||||
liquid_renewable = true,
|
||||
liquid_viscosity = speed or 1,
|
||||
liquid_alternative_flowing = name .. "_flowing",
|
||||
liquid_alternative_source = name .. "_source",
|
||||
paramtype2 = liquidtype == "flowing" and "flowingliquid" or nil,
|
||||
special_tiles = liquidtype == "flowing" and {
|
||||
{
|
||||
name = texture,
|
||||
backface_culling = false
|
||||
},
|
||||
{
|
||||
name = texture,
|
||||
backface_culling = true
|
||||
}
|
||||
} or nil
|
||||
}, extra_conf or {})
|
||||
return t
|
||||
end
|
||||
|
||||
local g = groups or {}
|
||||
g["liquid"] = 1
|
||||
|
||||
PyuTest.make_node(name .. "_source", desc .. " Source", g, { texture }, make_liquid_flags("source"))
|
||||
PyuTest.make_node(name .. "_flowing", "Flowing " .. desc, g, { texture }, make_liquid_flags("flowing"))
|
||||
end
|
||||
|
||||
PyuTest.make_liquid("pyutest_blocks:water", "Water", {
|
||||
water = 1,
|
||||
freezable = 1,
|
||||
heatable = 1
|
||||
}, "pyutest-water.png", 1, {
|
||||
post_effect_color = { a = 60, r = 24.7, g = 46.3, b = 89.4 },
|
||||
paramtype2 = "color",
|
||||
})
|
||||
|
||||
PyuTest.make_liquid("pyutest_blocks:lava", "Lava", {
|
||||
lava = 1,
|
||||
coolable = 1
|
||||
}, "pyutest-lava.png", 5, {
|
||||
damage_per_second = 4,
|
||||
light_source = 8
|
||||
})
|
||||
PyuTest.make_liquid("pyutest_blocks:oil", "Oil", {}, "pyutest-oil.png", 3)
|
||||
PyuTest.make_liquid("pyutest_blocks:liquid_acid", "Acid", {}, "pyutest-acid.png", 7, {
|
||||
damage_per_second = 4
|
||||
})
|
0
mods/ITEMS/pyutest_blocks/mod.conf
Normal file
0
mods/ITEMS/pyutest_blocks/mod.conf
Normal file
231
mods/ITEMS/pyutest_blocks/special.lua
Normal file
231
mods/ITEMS/pyutest_blocks/special.lua
Normal file
@@ -0,0 +1,231 @@
|
||||
PyuTest.make_node("pyutest_blocks:sponge", "Sponge", {
|
||||
oddly_breakable_by_hand = PyuTest.BLOCK_FAST
|
||||
}, { "pyutest-sponge.png" })
|
||||
|
||||
PyuTest.make_node("pyutest_blocks:light", "Light", {
|
||||
light = 1,
|
||||
dig_immediate = 1,
|
||||
oddly_breakable_by_hand = PyuTest.BLOCK_FAST
|
||||
}, {
|
||||
"pyutest-light.png"
|
||||
}, {
|
||||
drawtype = "torchlike",
|
||||
walkable = false,
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
light_source = minetest.LIGHT_MAX,
|
||||
floodable = true
|
||||
})
|
||||
|
||||
PyuTest.make_node("pyutest_blocks:torch", "Torch", {
|
||||
dig_immediate = 1,
|
||||
light = 1,
|
||||
attached_node = 1,
|
||||
oddly_breakable_by_hand = PyuTest.BLOCK_FAST
|
||||
}, {
|
||||
"pyutest-torch.png",
|
||||
"pyutest-torch.png^[transform6",
|
||||
"pyutest-torch.png^[transform1"
|
||||
}, {
|
||||
light_source = minetest.LIGHT_MAX,
|
||||
walkable = false,
|
||||
drawtype = "torchlike",
|
||||
paramtype = "light",
|
||||
inventory_image = "pyutest-torch.png",
|
||||
paramtype2 = "wallmounted",
|
||||
floodable = true
|
||||
})
|
||||
|
||||
PyuTest.make_node("pyutest_blocks:glass", "Glass", {
|
||||
cracky = PyuTest.BLOCK_NORMAL
|
||||
}, { "pyutest-glass.png" }, {
|
||||
drawtype = "glasslike_framed",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true
|
||||
})
|
||||
|
||||
-- FIXME: This has been in the game for a month, implement it already!
|
||||
PyuTest.make_node("pyutest_blocks:trapdoor", "Trapdoor", {
|
||||
choppy = PyuTest.BLOCK_NORMAL,
|
||||
flammable = 1
|
||||
}, { "pyutest-trapdoor.png" }, {
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, -0.15, 0.5 }
|
||||
}
|
||||
})
|
||||
|
||||
PyuTest.make_node("pyutest_blocks:contagious_acid", "Contagious Acid", {
|
||||
crumbly = PyuTest.BLOCK_NORMAL,
|
||||
solid_node = 1
|
||||
}, { "pyutest-acid.png" }, {})
|
||||
|
||||
PyuTest.make_node("pyutest_blocks:fire", "Fire", {
|
||||
dig_immediate = 1
|
||||
}, { "pyutest-fire.png" }, {
|
||||
drawtype = "firelike",
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
damage_per_second = 2,
|
||||
light_source = 8,
|
||||
drop = "pyutest_blocks:ash 4"
|
||||
})
|
||||
|
||||
PyuTest.make_node("pyutest_blocks:tnt", "TNT", {
|
||||
dig_immediate = 1,
|
||||
oddly_breakable_by_hand = PyuTest.BLOCK_FAST
|
||||
}, {
|
||||
"pyutest-tnt-top-bottom.png",
|
||||
"pyutest-tnt-top-bottom.png",
|
||||
"pyutest-tnt-side.png" -- Affects all other sides
|
||||
}, {
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
minetest.after(3, function()
|
||||
if minetest.get_node(pos).name ~= "pyutest_blocks:tnt" then
|
||||
return
|
||||
end
|
||||
PyuTest.create_explosion(pos, 3, true, 7, clicker, true)
|
||||
end)
|
||||
end,
|
||||
|
||||
__on_electricity_activated = function(pos, node, clicker, sender_pos)
|
||||
minetest.after(3, function()
|
||||
if minetest.get_node(pos).name ~= "pyutest_blocks:tnt" then
|
||||
return
|
||||
end
|
||||
PyuTest.create_explosion(pos, 3, true, 7, clicker, true)
|
||||
end)
|
||||
end,
|
||||
})
|
||||
|
||||
PyuTest.make_node("pyutest_blocks:crate", "Crate", {
|
||||
choppy = PyuTest.BLOCK_NORMAL
|
||||
}, { "pyutest-crate.png" }, {
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inventory = meta:get_inventory()
|
||||
inventory:set_size("main", 8 * 4)
|
||||
end,
|
||||
|
||||
can_dig = function(pos, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inventory = meta:get_inventory()
|
||||
local empty = inventory:is_empty("main")
|
||||
|
||||
if not empty then
|
||||
minetest.chat_send_player(player:get_player_name(), "Cannot destroy crate, it's not empty!")
|
||||
end
|
||||
|
||||
return empty
|
||||
end,
|
||||
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
local spos = string.format("%d,%d,%d", pos.x, pos.y, pos.z)
|
||||
local formspec =
|
||||
"size[8,9]" ..
|
||||
"list[nodemeta:" .. spos .. ";main;0,0;8,4;]" ..
|
||||
"list[current_player;main;0,5;8,4;]" ..
|
||||
"listring[nodemeta:" .. spos .. ";main]" ..
|
||||
"listring[current_player;main]"
|
||||
minetest.show_formspec(clicker:get_player_name(), string.format("pyutest_blocks:crate_%d_%d_%d", pos.x, pos.y, pos.z),
|
||||
formspec)
|
||||
minetest.sound_play({ name = "crate_open", gain = 1 }, { pos = pos })
|
||||
end
|
||||
})
|
||||
|
||||
PyuTest.make_node("pyutest_blocks:workbench", "Workbench", {
|
||||
choppy = PyuTest.BLOCK_NORMAL
|
||||
}, {
|
||||
"pyutest-workbench-top.png",
|
||||
"pyutest-workbench-bottom.png",
|
||||
"pyutest-workbench-sides.png"
|
||||
}, {
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
minetest.show_formspec(clicker:get_player_name(), "pyutest_blocks:workbench", table.concat({
|
||||
"size[8,9]",
|
||||
"list[current_player;craft;2.5,1;3,3;]",
|
||||
"list[current_player;main;0,5;8,4;]"
|
||||
}))
|
||||
end
|
||||
})
|
||||
|
||||
PyuTest.make_node("pyutest_blocks:ladder", "Ladder", {
|
||||
dig_immediate = 1
|
||||
}, { "pyutest-ladder.png" }, {
|
||||
drawtype = "signlike",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
climbable = true,
|
||||
buildable_to = true,
|
||||
sunlight_propagates = true,
|
||||
paramtype2 = "wallmounted",
|
||||
selection_box = {
|
||||
type = "wallmounted"
|
||||
},
|
||||
inventory_image = "pyutest-ladder.png"
|
||||
})
|
||||
|
||||
PyuTest.make_node("pyutest_blocks:magma", "Magma", {
|
||||
cracky = PyuTest.BLOCK_NORMAL
|
||||
}, { "pyutest-magma.png" }, {
|
||||
paramtype = "light",
|
||||
light_source = 11,
|
||||
damage_per_second = 3
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Sponge Loop",
|
||||
nodenames = { "pyutest_blocks:sponge" },
|
||||
neighbors = { "group:liquid" },
|
||||
interval = 0,
|
||||
chance = 1,
|
||||
action = function(pos)
|
||||
local range = 4
|
||||
|
||||
local function replace(npos)
|
||||
local node = minetest.get_node(npos)
|
||||
if node.name == "air" then return end
|
||||
local def = minetest.registered_nodes[node.name]
|
||||
|
||||
if def.groups["liquid"] == 1 then
|
||||
minetest.remove_node(npos)
|
||||
end
|
||||
end
|
||||
|
||||
PyuTest.dorange(pos, range, function(p)
|
||||
replace(p)
|
||||
end)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Contagious Acid Spread",
|
||||
nodenames = { "group:acid_vulnerable" },
|
||||
neighbors = { "pyutest_blocks:contagious_acid" },
|
||||
interval = 2.4,
|
||||
chance = 2.2,
|
||||
catchup = true,
|
||||
action = function(pos)
|
||||
minetest.set_node(pos, {
|
||||
name = "pyutest_blocks:contagious_acid"
|
||||
})
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Fire Spread",
|
||||
nodenames = { "group:flammable" },
|
||||
neighbors = { "pyutest_blocks:fire" },
|
||||
interval = 1,
|
||||
chance = 4,
|
||||
action = function(pos)
|
||||
minetest.set_node(pos, {
|
||||
name = "pyutest_blocks:fire"
|
||||
})
|
||||
end
|
||||
})
|
Reference in New Issue
Block a user