chests can add tools with custom wear levels, code tidy & tweak

This commit is contained in:
tenplus1 2022-08-22 08:17:34 +01:00
parent 27fa7e1223
commit 874806563d
4 changed files with 319 additions and 312 deletions

@ -27,5 +27,6 @@ Changelog:
- 1.2 - Code tidy and fixed wishing well replacements
- 1.3 - Add lightning staff as rare drop, tidy code, lightning fire check, slender potion
- 1.4 - Bug fix falling nodes, add worm farm drops
- 1.5 - Filled chests can now add tools with custom wear levels, code tidy and tweaks
Lucky Blocks: 262 (depending on mods enabled)
Lucky Blocks: 266 (depending on mods enabled)

12
api.txt

@ -150,11 +150,12 @@ Place a chest containing random items from default chest items list
{"nod", "default:chest", 0}
Place chest as above only add up to 5 roses and a 1/5 chance of mese also
Place chest with a 1/5 chance of adding roses, up to 10x dirt and a worn shovel
{"nod", "default:chest", 0, {
{name = "flowers:rose", max = 5},
{name = "default:mese", max = 1, chance = 5},
{name = "default:dirt", max = 10},
{name = "flowers:rose", max = 5, chance = 5},
{name = "default:shovel_wood", max = 1, min_wear = 20000, max_wear = 65535},
}}
Place fire at player position
@ -331,9 +332,10 @@ Custom Function
---------------
This allows mod makers to use there own functions when opening lucky blocks and
passes the block position and player opening it.
passes the block position, the player opening it and a def table with anything
else the function needs.
{"cus", myfunction}
{"cus", myfunction, def}
e.g.

@ -13,17 +13,16 @@ lucky_block:add_schematics({
{"defpinetree", dpath .. "pine_tree_from_sapling.mts", {x = 2, y = 1, z = 2}},
{"acaciatree", dpath .. "acacia_tree_from_sapling.mts", {x = 4, y = 1, z = 4}},
{"aspentree", dpath .. "aspen_tree_from_sapling.mts", {x = 2, y = 1, z = 2}},
-- {"corals", dpath .. "corals.mts", {x = 2, y = 1, z = 2}},
{"largecactus", dpath .. "large_cactus.mts", {x = 2, y = 1, z = 2}},
{"defaultbush", dpath .. "bush.mts", {x = 1, y = 1, z = 1}},
{"acaciabush", dpath .. "acacia_bush.mts", {x = 1, y = 1, z = 1}},
{"corals", MP .. "/schematics/corals.mts", {x = 2, y = 1, z = 2}},
{"corals", MP .. "/schematics/corals.mts", {x = 2, y = 1, z = 2}}
})
-- Default blocks
lucky_block:add_blocks({
{"nod", {"default:chest"}, 0},
{"lig"},
{"fal", {"default:wood", "default:gravel", "default:sand",
"default:desert_sand", "default:stone", "default:dirt",
@ -37,7 +36,8 @@ lucky_block:add_blocks({
{name = "bucket:bucket_water", max = 1},
{name = "default:wood", max = 3},
{name = "default:pick_diamond", max = 1},
{name = "default:coal_lump", max = 3} } },
{name = "default:coal_lump", max = 3}
}},
{"sch", "sandtrap", 1, true},
{"sch", "defpinetree", 0, false},
{"sch", "lavatrap", 1, true},
@ -130,7 +130,7 @@ lucky_block:add_blocks({
{name = "default:sandstone", max = 20},
{name = "default:gravel", max = 20},
}},
{"dro", {"default:obsidian"}, 14},
{"dro", {"default:obsidian"}, 14}
})
local green = minetest.get_color_escape_sequence("#1eff00")
@ -146,7 +146,7 @@ local function punchy(pos, player)
minetest.sound_play("player_damage", {pos = pos, gain = 1.0}, true)
minetest.chat_send_player(player:get_player_name(),
green .. S("Stop hitting yourself!"))
green .. S("Stop hitting yourself!"))
end
-- custom function (pint sized player) and potion with recipe
@ -160,7 +160,7 @@ local function pint(pos, player)
})
minetest.chat_send_player(player:get_player_name(),
green .. S("Pint Sized Player!"))
green .. S("Pint Sized Player!"))
minetest.sound_play("default_place_node", {pos = pos, gain = 1.0}, true)
@ -181,9 +181,11 @@ local function pint(pos, player)
end, player)
end
-- pint sized potion item
minetest.register_craftitem("lucky_block:pint_sized_potion", {
description = S("Pint Sized Potion (DRINK ME)"),
inventory_image = "lucky_pint_sized_potion.png",
groups = {vessel = 1},
on_use = function(itemstack, user, pointed_thing)
itemstack:take_item()
@ -201,16 +203,16 @@ minetest.register_craftitem("lucky_block:pint_sized_potion", {
pint(pos, user)
return itemstack
end,
groups = {vessel = 1},
end
})
-- pint sized potion recipe
minetest.register_craft({
output = "lucky_block:pint_sized_potion",
recipe = {
{"default:bush_sapling", "flowers:tulip", "default:acacia_bush_sapling"},
{"dye:blue", "default:apple", "dye:cyan"},
{"", "vessels:glass_bottle", ""},
{"", "vessels:glass_bottle", ""}
}
})
@ -225,7 +227,7 @@ local function slender(pos, player)
})
minetest.chat_send_player(player:get_player_name(),
green .. S("Slender Player!"))
green .. S("Slender Player!"))
minetest.sound_play("default_place_node", {pos = pos, gain = 1.0}, true)
@ -246,9 +248,11 @@ local function slender(pos, player)
end, player)
end
-- slender player potion item
minetest.register_craftitem("lucky_block:slender_player_potion", {
description = S("Slender Player Potion (DRINK ME)"),
inventory_image = "lucky_slender_potion.png",
groups = {vessel = 1},
on_use = function(itemstack, user, pointed_thing)
itemstack:take_item()
@ -266,21 +270,21 @@ minetest.register_craftitem("lucky_block:slender_player_potion", {
slender(pos, user)
return itemstack
end,
groups = {vessel = 1},
end
})
-- slender player potion recipe
minetest.register_craft({
output = "lucky_block:slender_player_potion",
recipe = {
{"default:bush_sapling", "flowers:rose", "default:pine_bush_sapling"},
{"dye:red", "default:apple", "dye:orange"},
{"", "vessels:glass_bottle", ""},
{"", "vessels:glass_bottle", ""}
}
})
-- custom function (drop player inventory and replace with dry shrubs)
local function bushy(pos, player)
-- custom function (drop player inventory and replace with items and show msg)
local function dropsy(pos, player, def)
local player_inv = player:get_inventory()
@ -295,15 +299,14 @@ local function bushy(pos, player)
obj:set_velocity({
x = math.random(-10, 10) / 9,
y = 5,
z = math.random(-10, 10) / 9,
z = math.random(-10, 10) / 9
})
end
player_inv:set_stack("main", i, "default:dry_shrub")
player_inv:set_stack("main", i, def.item)
end
minetest.chat_send_player(player:get_player_name(),
green .. S("Dry shrub takeover!"))
minetest.chat_send_player(player:get_player_name(), green .. S(def.msg))
end
-- lightning staff
@ -316,20 +319,20 @@ minetest.register_tool("lucky_block:lightning_staff", {
on_use = function(itemstack, user, pointed_thing)
local pos = user:get_pos()
if pointed_thing.type == "object" then
pos = pointed_thing.ref:get_pos()
elseif pointed_thing.type == "node" then
pos = pointed_thing.above
end
if not pos then return end
if not pos then return end
local bnod = pos and minetest.get_node_or_nil(pos)
local bref = bnod and minetest.registered_items[bnod.name]
if bref and bref.buildable_to == true then
local nod = "fire:basic_flame"
minetest.set_node(pos, {name = nod})
minetest.set_node(pos, {name = "fire:basic_flame"})
end
local radius = 4
@ -356,13 +359,13 @@ if not pos then return end
minetest.after(0.1, function()
objs[n]:punch(tmp_ent, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = damage, fire = 1},
damage_groups = {fleshy = damage, fire = 1}
}, pos)
end)
else
objs[n]:punch(tmp_ent, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = damage, fire = 1},
damage_groups = {fleshy = damage, fire = 1}
}, pos)
end
end
@ -375,24 +378,21 @@ if not pos then return end
collisiondetection = false,
texture = "lucky_lightning.png",
size = 100,
glow = 15,
glow = 15
})
minetest.sound_play("lightning", {
pos = pos,
gain = 1.0,
max_hear_distance = 25
}, true)
pos = pos, gain = 1.0, max_hear_distance = 25}, true)
itemstack:add_wear(65535 / 50) -- 50 uses
return itemstack
end,
end
})
lucky_block:add_blocks({
{"cus", pint},
{"cus", bushy},
{"cus", dropsy, {item = "default:dry_shrub", msg = "Dry shrub takeover!"}},
{"cus", punchy},
{"cus", slender},
{"dro", {"lucky_block:pint_sized_potion"}, 1},
@ -404,21 +404,24 @@ lucky_block:add_blocks({
{name = "default:pine_bush_stem", max = 10},
{name = "default:grass_1", max = 10},
{name = "default:dry_grass_1", max = 10},
{name = "lucky_block:lightning_staff", max = 1, chance = 10}}},
{name = "lucky_block:lightning_staff", max = 1, chance = 10}
}}
})
-- wool mod
if minetest.get_modpath("wool") then
lucky_block:add_blocks({
{"sch", "sandtrap", 1, true, {{"default:sand", "wool:red"}} },
{"dro", {"wool:"}, 10, true},
{"sch", "sandtrap", 1, true, {{"default:sand", "wool:green"}} },
{"dro", {"wool:white"}, 10},
{"dro", {"wool:white"}, 10}
})
end
-- extra doors mod
if minetest.get_modpath("extra_doors") then
lucky_block:add_blocks({
{"dro", {"default:steel_rod"}, 10},
{"dro", {"extra_doors:door_woodpanel1"}, 1},
@ -439,12 +442,13 @@ if minetest.get_modpath("extra_doors") then
{"dro", {"extra_doors:door_door_dungeon2"}, 1},
{"dro", {"extra_doors:door_door_steelpanel1"}, 1},
{"dro", {"extra_doors:door_door_steelglass1"}, 1},
{"dro", {"extra_doors:door_door_steelglass2"}, 1},
{"dro", {"extra_doors:door_door_steelglass2"}, 1}
})
end
-- Flowers mod
if minetest.get_modpath("flowers") then
lucky_block:add_blocks({
{"nod", "flowers:rose", 0},
{"dro", {"flowers:mushroom_red"}, 5},
@ -460,13 +464,14 @@ if minetest.get_modpath("flowers") then
{name = "flowers:rose", max = 15},
{name = "flowers:mushroom_brown", max = 10},
{name = "flowers:mushroom_red", max = 10},
{name = "flowers:waterlily", max = 10},
}},
{name = "flowers:waterlily", max = 10}
}}
})
end
-- Doors mod
if minetest.get_modpath("doors") then
lucky_block:add_blocks({
{"dro", {"doors:door_wood"}},
{"dro", {"doors:door_steel"}},
@ -478,30 +483,34 @@ if minetest.get_modpath("doors") then
{"dro", {"doors:gate_aspen_wood_closed"}},
{"dro", {"doors:gate_wood_closed"}},
{"dro", {"doors:gate_pine_wood_closed"}},
{"dro", {"doors:gate_junglewood_closed"}},
{"dro", {"doors:gate_junglewood_closed"}}
})
end
-- Screwdriver mod
if minetest.get_modpath("screwdriver") then
if screwdriver and screwdriver.handler then
minetest.register_tool(":screwdriver:screwdriver_magenta", {
description = S("Super Mega Magenta Ultra Screwdriver 2500\n(left-click to rotate face, right-click to rotates axis)"),
inventory_image = "screwdriver.png^[colorize:#ff009970",
groups = {not_in_creative_inventory = 1},
if screwdriver and screwdriver.handler then
on_use = function(itemstack, user, pointed_thing)
screwdriver.handler(itemstack, user, pointed_thing, screwdriver.ROTATE_FACE, 2500)
return itemstack
end,
minetest.register_tool(":screwdriver:screwdriver_magenta", {
description = S("Super Mega Magenta Ultra Screwdriver 2500"
.. "\n(left-click to rotate face, right-click to rotates axis)"),
inventory_image = "screwdriver.png^[colorize:#ff009970",
groups = {not_in_creative_inventory = 1},
on_place = function(itemstack, user, pointed_thing)
screwdriver.handler(itemstack, user, pointed_thing, screwdriver.ROTATE_AXIS, 2500)
return itemstack
end,
})
end
on_use = function(itemstack, user, pointed_thing)
screwdriver.handler(itemstack, user, pointed_thing,
screwdriver.ROTATE_FACE, 2500)
return itemstack
end,
on_place = function(itemstack, user, pointed_thing)
screwdriver.handler(itemstack, user, pointed_thing,
screwdriver.ROTATE_AXIS, 2500)
return itemstack
end
})
end
lucky_block:add_blocks({
{"dro", {"screwdriver:screwdriver"}},
@ -511,28 +520,31 @@ end
-- Vessels mod
if minetest.get_modpath("vessels") then
lucky_block:add_blocks({
{"dro", {"vessels:shelf", "vessels:drinking_glass", "vessels:glass_bottle",
"vessels:steel_bottle", "vessels:glass_fragments"}, 5},
{"nod", "vessels:drinking_glass", 0},
{"nod", "vessels:glass_bottle", 0},
{"nod", "vessels:steel_bottle", 0},
{"nod", "vessels:steel_bottle", 0}
})
end
-- Farming mod (default)
if minetest.get_modpath("farming") then
lucky_block:add_blocks({
{"dro", {"farming:bread"}, 5},
{"sch", "instafarm", 0, true},
{"nod", "default:water_source", 1},
{"nod", "farming:straw", 0},
{"dro", {"farming:straw"}, 8},
{"dro", {"farming:straw"}, 8}
})
end
-- Home Decor mod
if minetest.get_modpath("homedecor") then
lucky_block:add_blocks({
{"nod", "homedecor:toilet", 0},
{"nod", "homedecor:table", 0},
@ -552,256 +564,274 @@ if minetest.get_modpath("homedecor") then
{"dro", {"homedecor:shutter_violet"}, 5},
{"dro", {"homedecor:table_legs_wrought_iron", "homedecor:utility_table_legs"}, 5},
{"dro", {"homedecor:pole_wrought_iron"}, 10},
{"dro", {"homedecor:fence_picket_white"}, 20},
{"dro", {"homedecor:fence_picket_white"}, 20}
})
end
-- Boats mod
if minetest.get_modpath("boats") then
lucky_block:add_blocks({
{"dro", {"boats:boat"}},
{"dro", {"boats:boat"}}
})
end
-- Beds mod
if minetest.get_modpath("beds") then
lucky_block:add_blocks({
{"dro", {"beds:bed"}},
{"dro", {"beds:fancy_bed"}},
{"dro", {"beds:fancy_bed"}}
})
end
-- Walls mod
if minetest.get_modpath("walls") then
lucky_block:add_blocks({
{"dro", {"walls:cobble"}, 10},
{"dro", {"walls:mossycobble"}, 10},
{"dro", {"walls:desertcobble"}, 10},
{"dro", {"walls:desertcobble"}, 10}
})
end
-- Carts mod
if minetest.get_modpath("carts")
or minetest.get_modpath("boost_cart") then
lucky_block:add_blocks({
{"dro", {"carts:cart"}},
{"dro", {"default:rail"}, 10},
{"dro", {"carts:powerrail"}, 5},
{"dro", {"carts:brakerail"}, 5}
})
end
-- 3D Armor mod
if minetest.get_modpath("3d_armor") then
lucky_block:add_blocks({
{"dro", {"3d_armor:boots_wood"}},
{"dro", {"3d_armor:leggings_wood"}},
{"dro", {"3d_armor:chestplate_wood"}},
{"dro", {"3d_armor:helmet_wood"}},
{"tel"},
{"dro", {"3d_armor:boots_steel"}},
{"dro", {"3d_armor:leggings_steel"}},
{"dro", {"3d_armor:chestplate_steel"}},
{"dro", {"3d_armor:helmet_steel"}},
{"dro", {"3d_armor:boots_gold"}},
{"dro", {"3d_armor:leggings_gold"}},
{"dro", {"3d_armor:chestplate_gold"}},
{"exp"},
{"dro", {"3d_armor:helmet_gold"}},
{"dro", {"3d_armor:boots_cactus"}},
{"dro", {"3d_armor:leggings_cactus"}},
{"dro", {"3d_armor:chestplate_cactus"}},
{"dro", {"3d_armor:helmet_cactus"}},
{"dro", {"3d_armor:boots_bronze"}},
{"dro", {"3d_armor:leggings_bronze"}},
{"dro", {"3d_armor:chestplate_bronze"}},
{"dro", {"3d_armor:helmet_bronze"}},
{"lig"}
})
lucky_block:add_blocks({
{"dro", {"3d_armor:boots_wood"}},
{"dro", {"3d_armor:leggings_wood"}},
{"dro", {"3d_armor:chestplate_wood"}},
{"dro", {"3d_armor:helmet_wood"}},
{"tel"},
{"dro", {"3d_armor:boots_steel"}},
{"dro", {"3d_armor:leggings_steel"}},
{"dro", {"3d_armor:chestplate_steel"}},
{"dro", {"3d_armor:helmet_steel"}},
{"dro", {"3d_armor:boots_gold"}},
{"dro", {"3d_armor:leggings_gold"}},
{"dro", {"3d_armor:chestplate_gold"}},
{"exp"},
{"dro", {"3d_armor:helmet_gold"}},
{"dro", {"3d_armor:boots_cactus"}},
{"dro", {"3d_armor:leggings_cactus"}},
{"dro", {"3d_armor:chestplate_cactus"}},
{"dro", {"3d_armor:helmet_cactus"}},
{"dro", {"3d_armor:boots_bronze"}},
{"dro", {"3d_armor:leggings_bronze"}},
{"dro", {"3d_armor:chestplate_bronze"}},
{"dro", {"3d_armor:helmet_bronze"}},
{"lig"}
})
end
-- 3D Armor's Shields mod
if minetest.get_modpath("shields") then
lucky_block:add_blocks({
{"dro", {"shields:shield_wood"}},
{"dro", {"shields:shield_steel"}},
{"dro", {"shields:shield_gold"}},
{"dro", {"shields:shield_cactus"}},
{"dro", {"shields:shield_bronze"}},
{"exp", 2}
})
lucky_block:add_blocks({
{"dro", {"shields:shield_wood"}},
{"dro", {"shields:shield_steel"}},
{"dro", {"shields:shield_gold"}},
{"dro", {"shields:shield_cactus"}},
{"dro", {"shields:shield_bronze"}},
{"exp", 2}
})
end
-- Fire mod
if minetest.get_modpath("fire") then
lucky_block:add_blocks({
{"dro", {"fire:flint_and_steel"}},
{"dro", {"default:flint"}, 5},
{"nod", "fire:basic_flame", 1},
{"nod", "fire:permanent_flame", 1},
{"sch", "firetrap", 1, true},
})
lucky_block:add_blocks({
{"dro", {"fire:flint_and_steel"}},
{"dro", {"default:flint"}, 5},
{"nod", "fire:basic_flame", 1},
{"nod", "fire:permanent_flame", 1},
{"sch", "firetrap", 1, true},
})
end
-- Caverealms
if minetest.get_modpath("caverealms") then
lucky_block:add_blocks({
{"sch", "sandtrap", 1, true, {{"default:sand", "caverealms:coal_dust"}} },
{"sch", "obsidiantrap", 1, true, {{"default:obsidian", "caverealms:glow_obsidian_brick_2"}} },
{"flo", 5, {"caverealms:stone_with_moss"}, 2},
{"flo", 5, {"caverealms:stone_with_lichen"}, 2},
{"flo", 5, {"caverealms:stone_with_algae"}, 2},
})
lucky_block:add_blocks({
{"sch", "sandtrap", 1, true, {{"default:sand", "caverealms:coal_dust"}} },
{"sch", "obsidiantrap", 1, true, {{"default:obsidian",
"caverealms:glow_obsidian_brick_2"}} },
{"flo", 5, {"caverealms:stone_with_moss"}, 2},
{"flo", 5, {"caverealms:stone_with_lichen"}, 2},
{"flo", 5, {"caverealms:stone_with_algae"}, 2},
})
end
-- TNT mod
if minetest.get_modpath("tnt") then
local p = "tnt:tnt_burning"
lucky_block:add_blocks({
{"dro", {"tnt:gunpowder"}, 5},
{"fal", {p, p, p, p, p}, 1, true, 4},
{"nod", "tnt:tnt_burning", 0},
})
local p = "tnt:tnt_burning"
lucky_block:add_blocks({
{"dro", {"tnt:gunpowder"}, 5},
{"fal", {p, p, p, p, p}, 1, true, 4},
{"nod", "tnt:tnt_burning", 0}
})
end
-- More Ore's mod
if minetest.get_modpath("moreores") then
lucky_block:add_blocks({
{"nod", "moreores:tin_block", 0},
{"nod", "moreores:silver_block", 0},
{"fal", {"default:sand", "default:sand", "default:sand", "default:sand",
"default:sand", "default:sand", "moreores:mithril_block"}, 0},
{"dro", {"moreores:pick_silver"}},
{"dro", {"moreores:pick_mithril"}},
{"tro", "moreores:silver_block"},
{"dro", {"moreores:shovel_silver"}},
{"dro", {"moreores:shovel_mithril"}},
{"dro", {"moreores:axe_silver"}},
{"dro", {"moreores:axe_mithril"}},
{"tro", "moreores:mithril_block"},
{"dro", {"moreores:hoe_silver"}},
{"dro", {"moreores:hoe_mithril"}},
{"lig"},
{"nod", "default:chest", 0, {
{name = "moreores:silver_lump", max = 10},
{name = "moreores:mithril_lump", max = 10},
{name = "default:copper_lump", max = 10},
{name = "default:gold_lump", max = 10},
{name = "default:iron_lump", max = 10},
{name = "default:tin_lump", max = 10},
{name = "default:coal_lump", max = 10},
{name = "default:clay_lump", max = 10},
}},
})
if minetest.get_modpath("3d_armor") then
lucky_block:add_blocks({
{"dro", {"3d_armor:helmet_mithril"}},
{"dro", {"3d_armor:chestplate_mithril"}},
{"dro", {"3d_armor:leggings_mithril"}},
{"dro", {"3d_armor:boots_mithril"}},
})
end
lucky_block:add_blocks({
{"nod", "moreores:tin_block", 0},
{"nod", "moreores:silver_block", 0},
{"fal", {"default:sand", "default:sand", "default:sand", "default:sand",
"default:sand", "default:sand", "moreores:mithril_block"}, 0},
{"dro", {"moreores:pick_silver"}},
{"dro", {"moreores:pick_mithril"}},
{"tro", "moreores:silver_block"},
{"dro", {"moreores:shovel_silver"}},
{"dro", {"moreores:shovel_mithril"}},
{"dro", {"moreores:axe_silver"}},
{"dro", {"moreores:axe_mithril"}},
{"tro", "moreores:mithril_block"},
{"dro", {"moreores:hoe_silver"}},
{"dro", {"moreores:hoe_mithril"}},
{"lig"},
{"nod", "default:chest", 0, {
{name = "moreores:silver_lump", max = 10},
{name = "moreores:mithril_lump", max = 10},
{name = "default:copper_lump", max = 10},
{name = "default:gold_lump", max = 10},
{name = "default:iron_lump", max = 10},
{name = "default:tin_lump", max = 10},
{name = "default:coal_lump", max = 10},
{name = "default:clay_lump", max = 10}
}}
})
if minetest.get_modpath("shields") then
lucky_block:add_blocks({
{"dro", {"shields:shield_mithril"}},
})
end
if minetest.get_modpath("3d_armor") then
lucky_block:add_blocks({
{"dro", {"3d_armor:helmet_mithril"}},
{"dro", {"3d_armor:chestplate_mithril"}},
{"dro", {"3d_armor:leggings_mithril"}},
{"dro", {"3d_armor:boots_mithril"}}
})
end
if minetest.get_modpath("shields") then
lucky_block:add_blocks({
{"dro", {"shields:shield_mithril"}}
})
end
end -- END moreores
-- Moreblocks mod
if minetest.get_modpath("moreblocks") then
local p = "moreblocks:"
local lav = {name = "default:lava_source"}
local air = {name = "air"}
local trs = {name = p.."trap_stone"}
local trg = {name = p.."trap_glow_glass"}
local trapstone_trap = {
size = {x = 3, y = 6, z = 3},
data = {
lav, lav, lav, air, air, air, air, air, air,
air, air, air, air, air, air, trs, trs, trs,
lav, lav, lav, air, air, air, air, air, air,
air, air, air, air, trg, air, trs, air, trs,
lav, lav, lav, air, air, air, air, air, air,
air, air, air, air, air, air, trs, trs, trs,
},
}
lucky_block:add_schematics({
{"trapstonetrap", trapstone_trap, {x = 1, y = 6, z = 1}},
})
local p = "moreblocks:"
local lav = {name = "default:lava_source"}
local air = {name = "air"}
local trs = {name = p .. "trap_stone"}
local trg = {name = p .. "trap_glow_glass"}
local trapstone_trap = {
size = {x = 3, y = 6, z = 3},
data = {
lav, lav, lav, air, air, air, air, air, air,
air, air, air, air, air, air, trs, trs, trs,
lav, lav, lav, air, air, air, air, air, air,
air, air, air, air, trg, air, trs, air, trs,
lav, lav, lav, air, air, air, air, air, air,
air, air, air, air, air, air, trs, trs, trs
}
}
lucky_block:add_blocks({
{"dro", {p.."wood_tile"}, 10},
{"dro", {p.."wood_tile_center"}, 10},
{"dro", {p.."wood_tile_full"}, 10},
{"dro", {p.."wood_tile_offset"}, 10},
{"dro", {p.."circle_stone_bricks"}, 20},
{"dro", {p.."grey_bricks"}, 20},
{"dro", {p.."stone_tile"}, 10},
{"dro", {p.."split_stone_tile"}, 10},
{"dro", {p.."split_stone_tile_alt"}, 10},
{"flo", 5, {"moreblocks:stone_tile", "moreblocks:split_stone_tile"}, 2},
{"dro", {p.."tar", p.."cobble_compressed"}, 10},
{"dro", {p.."cactus_brick"}, 10},
{"dro", {p.."cactus_checker"}, 10},
{"nod", {p.."empty_bookshelf"}, 0},
{"dro", {p.."coal_stone"}, 10},
{"dro", {p.."coal_checker"}, 10},
{"dro", {p.."coal_stone_bricks"}, 10},
{"dro", {p.."coal_glass"}, 10},
{"exp", 3},
{"dro", {p.."iron_stone"}, 10},
{"dro", {p.."iron_checker"}, 10},
{"dro", {p.."iron_stone_bricks"}, 10},
{"dro", {p.."iron_glass"}, 10},
{"dro", {p.."trap_obsidian"}, 10},
{"dro", {p.."trap_sandstone"}, 10},
{"dro", {p.."trap_desert_stone"}, 10},
{"dro", {p.."trap_stone"}, 10},
{"dro", {p.."trap_glass"}, 10},
{"dro", {p.."trap_glow_glass"}, 10},
{"dro", {p.."trap_obsidian_glass"}, 10},
{"lig"},
{"sch", "trapstonetrap", 0, true},
{"dro", {p.."all_faces_tree"}, 10},
{"dro", {p.."all_faces_jungle_tree"}, 10},
{"dro", {p.."all_faces_pine_tree"}, 10},
{"dro", {p.."all_faces_acacia_tree"}, 10},
{"dro", {p.."all_faces_aspen_tree"}, 10},
{"flo", 3, {p.."all_faces_acacia_tree"}, 1},
{"dro", {p.."plankstone"}, 10},
{"fal", {p.."all_faces_tree", p.."all_faces_tree", p.."all_faces_tree", p.."all_faces_tree", p.."all_faces_tree"}, 0},
{"dro", {p.."glow_glass"}, 10},
{"dro", {p.."super_glow_glass"}, 10},
{"dro", {p.."clean_glass"}, 10},
{"nod", "default:chest", 0, {
{name = p.."rope", max = 10},
{name = p.."sweeper", max = 1},
{name = p.."circular_saw", max = 1},
{name = p.."grey_bricks", max = 10},
{name = p.."tar", max = 3}}},
{"flo", 3, {"moreblocks:copperpatina"}, 1},
})
lucky_block:add_schematics({
{"trapstonetrap", trapstone_trap, {x = 1, y = 6, z = 1}}
})
lucky_block:add_blocks({
{"dro", {p.."wood_tile"}, 10},
{"dro", {p.."wood_tile_center"}, 10},
{"dro", {p.."wood_tile_full"}, 10},
{"dro", {p.."wood_tile_offset"}, 10},
{"dro", {p.."circle_stone_bricks"}, 20},
{"dro", {p.."grey_bricks"}, 20},
{"dro", {p.."stone_tile"}, 10},
{"dro", {p.."split_stone_tile"}, 10},
{"dro", {p.."split_stone_tile_alt"}, 10},
{"flo", 5, {"moreblocks:stone_tile", "moreblocks:split_stone_tile"}, 2},
{"dro", {p.."tar", p.."cobble_compressed"}, 10},
{"dro", {p.."cactus_brick"}, 10},
{"dro", {p.."cactus_checker"}, 10},
{"nod", {p.."empty_bookshelf"}, 0},
{"dro", {p.."coal_stone"}, 10},
{"dro", {p.."coal_checker"}, 10},
{"dro", {p.."coal_stone_bricks"}, 10},
{"dro", {p.."coal_glass"}, 10},
{"exp", 3},
{"dro", {p.."iron_stone"}, 10},
{"dro", {p.."iron_checker"}, 10},
{"dro", {p.."iron_stone_bricks"}, 10},
{"dro", {p.."iron_glass"}, 10},
{"dro", {p.."trap_obsidian"}, 10},
{"dro", {p.."trap_sandstone"}, 10},
{"dro", {p.."trap_desert_stone"}, 10},
{"dro", {p.."trap_stone"}, 10},
{"dro", {p.."trap_glass"}, 10},
{"dro", {p.."trap_glow_glass"}, 10},
{"dro", {p.."trap_obsidian_glass"}, 10},
{"lig"},
{"sch", "trapstonetrap", 0, true},
{"dro", {p.."all_faces_tree"}, 10},
{"dro", {p.."all_faces_jungle_tree"}, 10},
{"dro", {p.."all_faces_pine_tree"}, 10},
{"dro", {p.."all_faces_acacia_tree"}, 10},
{"dro", {p.."all_faces_aspen_tree"}, 10},
{"flo", 3, {p.."all_faces_acacia_tree"}, 1},
{"dro", {p.."plankstone"}, 10},
{"fal", {p.."all_faces_tree", p.."all_faces_tree", p.."all_faces_tree",
p.."all_faces_tree", p.."all_faces_tree"}, 0},
{"dro", {p.."glow_glass"}, 10},
{"dro", {p.."super_glow_glass"}, 10},
{"dro", {p.."clean_glass"}, 10},
{"nod", "default:chest", 0, {
{name = p.."rope", max = 10},
{name = p.."sweeper", max = 1},
{name = p.."circular_saw", max = 1},
{name = p.."grey_bricks", max = 10},
{name = p.."tar", max = 3}
}},
{"flo", 3, {"moreblocks:copperpatina"}, 1}
})
end
-- Bags mod
if minetest.get_modpath("bags") or minetest.get_modpath("sfinv_bags") then
minetest.register_craftitem(":bags:spar", {
description = "Spar Bag",
inventory_image = "bags_spar.png",
groups = {bagslots = 2, flammable = 2},
})
lucky_block:add_blocks({
{"dro", {"bags:spar"}},
{"dro", {"bags:small"}},
{"dro", {"bags:medium"}},
{"dro", {"bags:large"}},
{"dro", {"bags:trolley"}},
})
minetest.register_craftitem(":bags:spar", {
description = "Spar Bag",
inventory_image = "bags_spar.png",
groups = {bagslots = 2, flammable = 2}
})
lucky_block:add_blocks({
{"dro", {"bags:spar"}},
{"dro", {"bags:small"}},
{"dro", {"bags:medium"}},
{"dro", {"bags:large"}},
{"dro", {"bags:trolley"}}
})
end
-- Nether Mod
@ -829,8 +859,7 @@ if minetest.get_modpath("nether") then
{name = p.."rack", max = 5},
{name = p.."axe_nether", max = 1},
{name = p.."sword_nether", max = 1},
{name = p.."nether_lump", max = 3},
{name = p.."nether_lump", max = 3}
}},
{"exp", 2},
{"sch", "wishingwell", 0, true, {
@ -867,12 +896,14 @@ if minetest.get_modpath("nether") then
end
if minetest.get_modpath("shields") then
lucky_block:add_blocks({
{"dro", {"shields:shield_nether"}}
})
end
if minetest.get_modpath("xpanes") and minetest.registered_nodes["nether:geode"] then
lucky_block:add_blocks({
{"dro", {"xpanes:nether_crystal_pane_flat"}, 5},
{"nod", "nether_geode", 0},
@ -884,33 +915,6 @@ end
-- worm farm mod
if minetest.get_modpath("worm_farm") then
-- custom function (drop player inventory and replace with dry shrubs)
local function wormy(pos, player)
local player_inv = player:get_inventory()
pos = player:get_pos() or pos
for i = 1, player_inv:get_size("main") do
local obj = minetest.add_item(pos, player_inv:get_stack("main", i))
if obj then
obj:set_velocity({
x = math.random(-10, 10) / 9,
y = 5,
z = math.random(-10, 10) / 9,
})
end
player_inv:set_stack("main", i, "ethereal:worm")
end
minetest.chat_send_player(player:get_player_name(),
green .. S("Worm Attack!"))
end
lucky_block:add_blocks({
{"nod", "default:chest", 0, {
{name = "ethereal:worm", max = 5},
@ -918,7 +922,7 @@ if minetest.get_modpath("worm_farm") then
{name = "ethereal:worm", max = 5},
{name = "worm_farm:worm_farm", max = 1}
}},
{"cus", wormy},
{"cus", dropsy, {item = "ethereal:worm", msg = "Worm Attack!"}},
{"dro", {"worm_farm:worm_farm"}, 1}
})
end
@ -960,11 +964,11 @@ minetest.register_node("lucky_block:void_mirror", {
tiles = {"default_obsidian_glass.png^[brighten"},
use_texture_alpha = "clip",
groups = {snappy = 3, not_in_creative_inventory = 1},
sounds = default.node_sound_glass_defaults(),
sounds = default.node_sound_glass_defaults()
})
lucky_block:add_blocks({
{"dro", {"lucky_block:void_mirror"}},
{"dro", {"lucky_block:void_mirror"}}
})
-- Troll
@ -974,24 +978,23 @@ local function fake_items(pos, player, def)
for n = 1, 25 do
minetest.add_particle({
time = 15,
pos = {
x = pos.x + math.random(-20, 20) / 10,
y = pos.y,
z = pos.z + math.random(-20, 20) / 10,
},
velocity = {x = 0, y = 2, z = 0},
acceleration = {x = 0, y = -10, z = 0},
expirationtime = 4,
maxsize = 4,
texture = def.tex,
glow = 2,
size = 5,
collisiondetection = true,
vertical = true,
})
minetest.add_particle({
time = 15,
pos = {
x = pos.x + math.random(-20, 20) / 10,
y = pos.y,
z = pos.z + math.random(-20, 20) / 10
},
velocity = {x = 0, y = 2, z = 0},
acceleration = {x = 0, y = -10, z = 0},
expirationtime = 4,
maxsize = 4,
texture = def.tex,
glow = 2,
size = 5,
collisiondetection = true,
vertical = true
})
end
minetest.chat_send_player(player:get_player_name(),
@ -1001,7 +1004,7 @@ end
lucky_block:add_blocks({
{"cus", fake_items, {tex = "default_diamond.png", txt = "diamonds"} },
{"cus", fake_items, {tex = "default_gold_ingot.png", txt = "ingots"} },
{"cus", fake_items, {tex = "default_mese_crystal.png", txt = "crystals"} },
{"cus", fake_items, {tex = "default_mese_crystal.png", txt = "crystals"} }
})
-- Void Pick
@ -1056,6 +1059,6 @@ lucky_block:add_blocks({
{name = "default:stone_with_copper", max = 5},
{name = "default:stone_with_mese", max = 5},
{name = "default:stone_with_gold", max = 5},
{name = "default:stone_with_diamond", max = 5},
{name = "default:stone_with_diamond", max = 5}
}}
})

@ -58,7 +58,7 @@ local chest_stuff = {
{name = "default:steel_ingot", max = 2},
{name = "default:gold_ingot", max = 2, chance = 2},
{name = "default:diamond", max = 1, chance = 3},
{name = "default:pick_steel", max = 1, chance = 2},
{name = "default:pick_steel", max = 1, chance = 2, min_wear = 20000, max_wear = 65536},
{name = "default:mese_crystal_fragment", max = 3, chance = 3},
}
@ -159,34 +159,35 @@ local function entity_physics(pos, radius)
end
-- fill chest with random items from list
-- function to fill chest at position
local function fill_chest(pos, items)
local stacks = items or {}
local inv = minetest.get_meta(pos):get_inventory()
local stacks = items or chest_stuff
local meta = minetest.get_meta(pos)
local inv = meta and meta:get_inventory()
local size = inv and inv:get_size("main")
local stack
inv:set_size("main", 8 * 4)
if not inv then return end
for i = 0, 2, 1 do
-- loop through inventory
for _, def in ipairs(stacks) do
local stuff = chest_stuff[math.random(1, #chest_stuff)]
if math.random((def.chance or 1)) == 1 then
table.insert(stacks, {name = stuff.name, max = stuff.max})
end
-- only add if item existd
if minetest.registered_items[def.name] then
for s = 1, #stacks do
stack = ItemStack(def.name .. " " .. math.random((def.max or 1)))
if not inv:contains_item("main", stacks[s]) then
-- if wear levels found choose random wear between both values
if def.max_wear and def.min_wear then
if not stacks[s].chance
or math.random(1, stacks[s].chance) == 1 then
if minetest.registered_items[stacks[s].name] then
inv:set_stack("main", math.random(32), {
name = stacks[s].name,
count = math.random(stacks[s].max)
})
stack:set_wear(65535 - (math.random(def.max_wear, def.min_wear)))
end
-- set stack in random position
inv:set_stack("main", math.random(size), stack)
end
end
end