Add mystery egg
parent
81e9019f91
commit
4f1e1c0ea4
|
@ -996,8 +996,9 @@ minetest.register_node("zoonami:excavation_core", {
|
|||
item_pool[6] = {name = "zoonami:red_berry_bush_1", count = 1, chance = math.random(1, 15)}
|
||||
item_pool[7] = {name = "zoonami:orange_berry_bush_1", count = 1, chance = math.random(1, 15)}
|
||||
item_pool[8] = {name = "zoonami:green_berry_bush_1", count = 1, chance = math.random(1, 15)}
|
||||
item_pool[9] = {name = "zoonami:move_book_diced", count = 1, chance = math.random(1, 20)}
|
||||
item_pool[10] = {name = "zoonami:move_book_monochrome", count = 1, chance = math.random(1, 20)}
|
||||
item_pool[9] = {name = "zoonami:mystery_egg", count = 1, chance = math.random(1, 20)}
|
||||
item_pool[10] = {name = "zoonami:move_book_diced", count = 1, chance = math.random(1, 20)}
|
||||
item_pool[11] = {name = "zoonami:move_book_monochrome", count = 1, chance = math.random(1, 20)}
|
||||
for i = 1, #item_pool do
|
||||
if item_pool[i].chance == 1 then
|
||||
local item = ItemStack(item_pool[i].name.." "..item_pool[i].count)
|
||||
|
@ -1037,3 +1038,69 @@ minetest.register_node("zoonami:excavation_debris", {
|
|||
_mcl_blast_resistance = 1,
|
||||
_mcl_hardness = 1,
|
||||
})
|
||||
|
||||
-- Mystery Egg
|
||||
minetest.register_node("zoonami:mystery_egg", {
|
||||
description = "Mystery Egg",
|
||||
drawtype = "mesh",
|
||||
mesh = "zoonami_mystery_egg.obj",
|
||||
tiles = {"zoonami_mystery_egg.png"},
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
sunlight_propagates = true,
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = {{-0.3, -0.5, -0.3, 0.3, 0.3, 0.3}},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {{-0.3, -0.5, -0.3, 0.3, 0.3, 0.3}},
|
||||
},
|
||||
groups = {
|
||||
cracky = 3,
|
||||
dig_stone = 1,
|
||||
handy = 3,
|
||||
oddly_breakable_by_hand = 3,
|
||||
},
|
||||
on_timer = function(pos, elapsed)
|
||||
minetest.set_node(pos, {name = "air"})
|
||||
local monster_pool = {"rampede", "ruptore"}
|
||||
local monster = monster_pool[math.random(#monster_pool)]
|
||||
local def = minetest.registered_entities["zoonami:"..monster]
|
||||
local spawn_pos = {x = pos.x, y = pos.y - def.collisionbox[2], z = pos.z}
|
||||
minetest.add_entity(pos, "zoonami:"..monster)
|
||||
end,
|
||||
preserve_metadata = function(pos, oldnode, oldmeta, drops)
|
||||
local meta = drops[1]:get_meta()
|
||||
meta:set_int("light", oldmeta.light or 0)
|
||||
end,
|
||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local stack_meta = itemstack:get_meta()
|
||||
local light = stack_meta:get_int("light")
|
||||
meta:set_int("light", light > 0 and light or math.random(1, 14))
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
minetest.get_node_timer(pos):stop()
|
||||
end,
|
||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
if player and player:is_player() then
|
||||
local player_name = player:get_player_name()
|
||||
local meta = minetest.get_meta(pos)
|
||||
local light = meta:get_int("light")
|
||||
local current_light = minetest.get_node_light(pos) or 0
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
if light == current_light and not timer:is_started() then
|
||||
timer:start(5)
|
||||
minetest.chat_send_player(player_name, "The egg is hatching!")
|
||||
elseif light > current_light then
|
||||
minetest.chat_send_player(player_name, "The egg needs more light to hatch.")
|
||||
elseif light < current_light then
|
||||
minetest.chat_send_player(player_name, "The egg needs less light to hatch.")
|
||||
end
|
||||
end
|
||||
end,
|
||||
sounds = sounds.stone,
|
||||
_mcl_blast_resistance = 1,
|
||||
_mcl_hardness = 1,
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue