add worm farm drops

This commit is contained in:
tenplus1 2022-08-02 08:35:48 +01:00
parent c83f406f37
commit 27fa7e1223
3 changed files with 50 additions and 6 deletions

@ -26,5 +26,6 @@ Changelog:
- 1.1 - Spawning mobs can now select randomly from a table or single string
- 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
Lucky Blocks: 262 (depending on mods enabled)

@ -881,6 +881,48 @@ if minetest.get_modpath("nether") then
end
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},
{name = "worm_farm:worm_tea", max = 5},
{name = "ethereal:worm", max = 5},
{name = "worm_farm:worm_farm", max = 1}
}},
{"cus", wormy},
{"dro", {"worm_farm:worm_farm"}, 1}
})
end
-- Additional Wishing Well Styles
lucky_block:add_blocks({

@ -180,12 +180,13 @@ local function fill_chest(pos, items)
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)
})
end
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)
})
end
end
end
end