mirror of
https://notabug.org/TenPlus1/lucky_block.git
synced 2024-08-21 06:24:20 +02:00
fix chest fill, move all blocks to blocks.lua
This commit is contained in:
parent
590fa457b2
commit
08ca96708f
126
blocks.lua
126
blocks.lua
@ -21,9 +21,12 @@ lucky_block:add_schematics({
|
|||||||
|
|
||||||
-- Default blocks
|
-- Default blocks
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
|
{"lig"},
|
||||||
|
{"fal", {"default:wood", "default:gravel", "default:sand",
|
||||||
|
"default:desert_sand", "default:stone", "default:dirt",
|
||||||
|
"default:goldblock"}, 0},
|
||||||
{"sch", "watertrap", 1, true},
|
{"sch", "watertrap", 1, true},
|
||||||
{"tel"},
|
{"tel"},
|
||||||
{"dro", {"wool:"}, 10, true},
|
|
||||||
{"dro", {"default:apple"}, 10},
|
{"dro", {"default:apple"}, 10},
|
||||||
{"sch", "appletree", 0, false},
|
{"sch", "appletree", 0, false},
|
||||||
{"dro", {"default:snow"}, 10},
|
{"dro", {"default:snow"}, 10},
|
||||||
@ -56,6 +59,7 @@ lucky_block:add_blocks({
|
|||||||
{"sch", "sandtrap", 1, true, {{"default:sand", "default:silver_sand"}} },
|
{"sch", "sandtrap", 1, true, {{"default:sand", "default:silver_sand"}} },
|
||||||
{"dro", {"default:pick_steel"}},
|
{"dro", {"default:pick_steel"}},
|
||||||
{"dro", {"default:shovel_steel"}},
|
{"dro", {"default:shovel_steel"}},
|
||||||
|
{"exp"},
|
||||||
{"dro", {"default:coal_lump"}, 3},
|
{"dro", {"default:coal_lump"}, 3},
|
||||||
{"sch", "defaultbush", 0, false},
|
{"sch", "defaultbush", 0, false},
|
||||||
{"tro", "default:mese", "tnt_blast", true},
|
{"tro", "default:mese", "tnt_blast", true},
|
||||||
@ -103,15 +107,102 @@ lucky_block:add_blocks({
|
|||||||
{name = "default:tree", max = 10},
|
{name = "default:tree", max = 10},
|
||||||
{name = "default:jungletree", max = 10},
|
{name = "default:jungletree", max = 10},
|
||||||
}},
|
}},
|
||||||
})
|
|
||||||
|
|
||||||
-- default coral blocks
|
|
||||||
if minetest.registered_nodes["default:coral_brown"] then
|
|
||||||
lucky_block:add_blocks({
|
|
||||||
{"dro", {"default:coral_brown"}, 5},
|
{"dro", {"default:coral_brown"}, 5},
|
||||||
{"dro", {"default:coral_orange"}, 5},
|
{"dro", {"default:coral_orange"}, 5},
|
||||||
{"dro", {"default:coral_skeleton"}, 5},
|
{"dro", {"default:coral_skeleton"}, 5},
|
||||||
{"sch", "corals", 0, true},
|
{"sch", "corals", 0, true},
|
||||||
|
{"dro", {"default:mese_post_light"}, 5},
|
||||||
|
{"dro", {"default:fence_wood"}, 5},
|
||||||
|
{"nod", "default:mese_post_light"},
|
||||||
|
{"dro", {"default:silver_sand"}, 20},
|
||||||
|
{"dro", {"default:sand"}, 20},
|
||||||
|
{"dro", {"default:desert_sand"}, 20},
|
||||||
|
{"dro", {"default:gravel"}, 15},
|
||||||
|
{"nod", "default:chest", 0, {
|
||||||
|
{name = "default:silver_sand", max = 20},
|
||||||
|
{name = "default:silver_sandstone", max = 20},
|
||||||
|
{name = "default:desert_sand", max = 20},
|
||||||
|
{name = "default:silver_sandstone", max = 20},
|
||||||
|
{name = "default:sand", max = 20},
|
||||||
|
{name = "default:sandstone", max = 20},
|
||||||
|
{name = "default:gravel", max = 20},
|
||||||
|
}},
|
||||||
|
})
|
||||||
|
|
||||||
|
local green = minetest.get_color_escape_sequence("#1eff00")
|
||||||
|
|
||||||
|
-- custom function (punches player with 5 damage)
|
||||||
|
local function punchy(pos, player)
|
||||||
|
|
||||||
|
player:punch(player, 1.0, {
|
||||||
|
full_punch_interval = 1.0,
|
||||||
|
damage_groups = {fleshy = 5}
|
||||||
|
}, nil)
|
||||||
|
|
||||||
|
minetest.sound_play("player_damage", {pos = pos, gain = 1.0})
|
||||||
|
|
||||||
|
minetest.chat_send_player(player:get_player_name(),
|
||||||
|
green .. S("Stop hitting yourself!"))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- custom function (pint sized player)
|
||||||
|
local function pint(pos, player)
|
||||||
|
|
||||||
|
player:set_properties({visual_size = {x = 0.5, y = 0.5}})
|
||||||
|
|
||||||
|
minetest.chat_send_player(player:get_player_name(),
|
||||||
|
green .. S("Pint Sized Player!"))
|
||||||
|
|
||||||
|
minetest.sound_play("default_place_node", {pos = pos, gain = 1.0})
|
||||||
|
|
||||||
|
minetest.after (180, function(player, pos) -- 3 minutes
|
||||||
|
|
||||||
|
if player and player:is_player() then
|
||||||
|
|
||||||
|
player:set_properties({visual_size = {x = 1.0, y = 1.0}})
|
||||||
|
|
||||||
|
minetest.sound_play("default_place_node", {pos = pos, gain = 1.0})
|
||||||
|
end
|
||||||
|
end, player)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- custom function (drop player inventory and replace with dry shrubs)
|
||||||
|
local function bushy(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:setvelocity({
|
||||||
|
x = math.random(-10, 10) / 9,
|
||||||
|
y = 5,
|
||||||
|
z = math.random(-10, 10) / 9,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
player_inv:set_stack("main", i, "default:dry_shrub")
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.chat_send_player(player:get_player_name(),
|
||||||
|
green .. S("Dry shrub takeover!"))
|
||||||
|
end
|
||||||
|
|
||||||
|
lucky_block:add_blocks({
|
||||||
|
{"cus", pint},
|
||||||
|
{"cus", bushy},
|
||||||
|
{"cus", punchy},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- wool mod
|
||||||
|
if minetest.get_modpath("wool") then
|
||||||
|
lucky_block:add_blocks({
|
||||||
|
{"dro", {"wool:"}, 10, true},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -141,28 +232,6 @@ if minetest.get_modpath("extra_doors") then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- default mese post light or sands
|
|
||||||
if minetest.registered_nodes["default:mese_post_light"] then
|
|
||||||
lucky_block:add_blocks({
|
|
||||||
{"dro", {"default:mese_post_light"}, 5},
|
|
||||||
{"dro", {"default:fence_wood"}, 5},
|
|
||||||
{"nod", "default:mese_post_light"},
|
|
||||||
{"dro", {"default:silver_sand"}, 20},
|
|
||||||
{"dro", {"default:sand"}, 20},
|
|
||||||
{"dro", {"default:desert_sand"}, 20},
|
|
||||||
{"dro", {"default:gravel"}, 15},
|
|
||||||
{"nod", "default:chest", 0, {
|
|
||||||
{name = "default:silver_sand", max = 20},
|
|
||||||
{name = "default:silver_sandstone", max = 20},
|
|
||||||
{name = "default:desert_sand", max = 20},
|
|
||||||
{name = "default:silver_sandstone", max = 20},
|
|
||||||
{name = "default:sand", max = 20},
|
|
||||||
{name = "default:sandstone", max = 20},
|
|
||||||
{name = "default:gravel", max = 20},
|
|
||||||
}},
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Flowers mod
|
-- Flowers mod
|
||||||
if minetest.get_modpath("flowers") then
|
if minetest.get_modpath("flowers") then
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -517,6 +586,7 @@ end
|
|||||||
|
|
||||||
-- Additional Wishing Well Styles
|
-- Additional Wishing Well Styles
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
|
{"sch", "wishingwell", 0, true},
|
||||||
{"sch", "wishingwell", 0, true, {
|
{"sch", "wishingwell", 0, true, {
|
||||||
{"default:stonebrick", "default:silver_sandstone_brick"},
|
{"default:stonebrick", "default:silver_sandstone_brick"},
|
||||||
{"stairs:slab_stonebrick", "stairs:slab_silver_sandstone_brick"},
|
{"stairs:slab_stonebrick", "stairs:slab_silver_sandstone_brick"},
|
||||||
|
81
init.lua
81
init.lua
@ -11,81 +11,9 @@ local S, NS = dofile(MP .. "/intllib.lua")
|
|||||||
local green = minetest.get_color_escape_sequence("#1eff00")
|
local green = minetest.get_color_escape_sequence("#1eff00")
|
||||||
|
|
||||||
|
|
||||||
-- example custom function (punches player with 5 damage)
|
|
||||||
local function punchy(pos, player)
|
|
||||||
|
|
||||||
player:punch(player, 1.0, {
|
|
||||||
full_punch_interval = 1.0,
|
|
||||||
damage_groups = {fleshy = 5}
|
|
||||||
}, nil)
|
|
||||||
|
|
||||||
minetest.sound_play("player_damage", {pos = pos, gain = 1.0})
|
|
||||||
|
|
||||||
minetest.chat_send_player(player:get_player_name(),
|
|
||||||
green .. S("Stop hitting yourself!"))
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- pint sized player
|
|
||||||
local function pint(pos, player)
|
|
||||||
|
|
||||||
player:set_properties({visual_size = {x = 0.5, y = 0.5}})
|
|
||||||
|
|
||||||
minetest.chat_send_player(player:get_player_name(),
|
|
||||||
green .. S("Pint Sized Player!"))
|
|
||||||
|
|
||||||
minetest.sound_play("default_place_node", {pos = pos, gain = 1.0})
|
|
||||||
|
|
||||||
minetest.after (180, function(player, pos) -- 3 minutes
|
|
||||||
|
|
||||||
if player and player:is_player() then
|
|
||||||
|
|
||||||
player:set_properties({visual_size = {x = 1.0, y = 1.0}})
|
|
||||||
|
|
||||||
minetest.sound_play("default_place_node", {pos = pos, gain = 1.0})
|
|
||||||
end
|
|
||||||
end, player)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- custom function to drop player inventory and replace with dry shrubs
|
|
||||||
local function bushy(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:setvelocity({
|
|
||||||
x = math.random(-10, 10) / 9,
|
|
||||||
y = 5,
|
|
||||||
z = math.random(-10, 10) / 9,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
player_inv:set_stack("main", i, "default:dry_shrub")
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.chat_send_player(player:get_player_name(),
|
|
||||||
green .. S("Dry shrub takeover!"))
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- default blocks
|
-- default blocks
|
||||||
local lucky_list = {
|
local lucky_list = {
|
||||||
{"cus", pint},
|
|
||||||
{"sch", "wishingwell", 0, true},
|
|
||||||
{"cus", bushy},
|
|
||||||
{"cus", punchy},
|
|
||||||
{"fal", {"default:wood", "default:gravel", "default:sand",
|
|
||||||
"default:desert_sand", "default:stone", "default:dirt",
|
|
||||||
"default:goldblock"}, 0},
|
|
||||||
{"lig"},
|
|
||||||
{"nod", "lucky_block:super_lucky_block", 0},
|
{"nod", "lucky_block:super_lucky_block", 0},
|
||||||
{"exp", 2},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -243,14 +171,17 @@ local function fill_chest(pos, items)
|
|||||||
|
|
||||||
local stuff = chest_stuff[math.random(1, #chest_stuff)]
|
local stuff = chest_stuff[math.random(1, #chest_stuff)]
|
||||||
|
|
||||||
table.insert(stacks, {
|
table.insert(stacks, {name = stuff.name, max = stuff.max})
|
||||||
name = stuff.name, count = math.random(1, stuff.max)})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
for s = 1, #stacks do
|
for s = 1, #stacks do
|
||||||
|
|
||||||
if not inv:contains_item("main", stacks[s]) then
|
if not inv:contains_item("main", stacks[s]) then
|
||||||
inv:set_stack("main", math.random(1, 32), stacks[s])
|
|
||||||
|
inv:set_stack("main", math.random(1, 32), {
|
||||||
|
name = stacks[s].name,
|
||||||
|
count = math.random(1, stacks[s].max)
|
||||||
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user