dungeons and treasure chest
parent
88b240425a
commit
df1f2c34b4
|
@ -193,6 +193,61 @@ minetest.register_node("decoblocks:Ancient_vase_sand", {
|
|||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
chest_items = {
|
||||
{"default:gold_ingot", 20},
|
||||
}
|
||||
|
||||
minetest.register_node("decoblocks:chest", {
|
||||
description = "Treasure Chest",
|
||||
tiles = {"decoblocks_chest_top.png", "decoblocks_chest_top.png", "decoblocks_chest_side.png",
|
||||
"decoblocks_chest_side.png", "decoblocks_chest_side.png", "decoblocks_chest_front.png"},
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky = 2, oddly_breakable_by_hand = 1},
|
||||
is_ground_content = false,
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
for _, row in ipairs(chest_items) do
|
||||
local item = row[1]
|
||||
local rarity = row[2]
|
||||
if math.random(1,rarity) == 1 then
|
||||
meta:set_string("item", item)
|
||||
else
|
||||
meta:set_string("item", "default:steel_ingot 3")
|
||||
end
|
||||
end
|
||||
inv:set_size("main", 1*1)
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
return inv:is_empty("main")
|
||||
end,
|
||||
on_rightclick = function(pos, node, clicker, item, _)
|
||||
local name = clicker:get_player_name()
|
||||
--if clicker:get_wielded_item():get_name() == "hyruletools:key" then
|
||||
item:take_item()
|
||||
local meta = minetest.get_meta(pos)
|
||||
local item = meta:get_string("item")
|
||||
if item == nil then
|
||||
for _, row in ipairs(chest_items) do
|
||||
local item = row[1]
|
||||
local rarity = row[2]
|
||||
if math.random(1,rarity) == 1 then
|
||||
meta:set_string("item", item)
|
||||
else
|
||||
meta:set_string("item", "default:steel_ingot 3")
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.env:add_item(pos, item)
|
||||
minetest.env:remove_node(pos)
|
||||
--else
|
||||
--minetest.chat_send_player(name, "It is locked, you need a key!")
|
||||
--end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("decoblocks:dartblock", {
|
||||
description = "Dart Trap",
|
||||
tiles = {
|
||||
|
|
|
@ -2021,4 +2021,28 @@ minetest.register_on_generated(function(minp, maxp)
|
|||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
--underground dungeons
|
||||
|
||||
local dungeon_rarity = 500
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp)
|
||||
if maxp.y > -60 or maxp.y < -30000 then
|
||||
return
|
||||
end
|
||||
local stone = minetest.find_nodes_in_area(minp, maxp,
|
||||
{"hyrule_mapgen:dungeon_seed"})
|
||||
for n = 1, #stone do
|
||||
if math.random(1, dungeon_rarity) == 1 then
|
||||
local pos = {x = stone[n].x, y = stone[n].y, z = stone[n].z }
|
||||
local number = math.random(1,4)
|
||||
if math.random(1,10) == 1 then
|
||||
minetest.place_schematic(pos, minetest.get_modpath("hyrule_mapgen").."/schematics/dungeon"..number..".mts", random, {{["decoblocks:chest"] = "mobs_m:mimic_chest2",}, {["mobs_m:mimic_chest2"] = "decoblocks:chest",}}, true)
|
||||
else
|
||||
minetest.place_schematic(pos, minetest.get_modpath("hyrule_mapgen").."/schematics/dungeon"..number..".mts", random, {}, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -72,6 +72,78 @@ mobs:register_mob("mobs_m:mimic", {
|
|||
},
|
||||
})
|
||||
|
||||
minetest.register_node("mobs_m:mimic_chest2", {
|
||||
description = "Mimic Treasure Chest",
|
||||
tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
|
||||
"default_chest_side.png", "default_chest_side.png", "default_chest_front.png"},
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=4},
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
minetest.env:remove_node(pos)
|
||||
minetest.env:add_entity(pos, "mobs_m:mimic2")
|
||||
end
|
||||
})
|
||||
|
||||
mobs:register_mob("mobs_m:mimic2", {
|
||||
type = "monster",
|
||||
passive = false,
|
||||
attack_type = "dogfight",
|
||||
reach = 2,
|
||||
damage = 3,
|
||||
hp_min = 10,
|
||||
hp_max = 27,
|
||||
armor = 90,
|
||||
collisionbox = {-0.5, 0, -0.5, 0.5, 1, 0.5},
|
||||
visual = "mesh",
|
||||
mesh = "mimic.b3d",
|
||||
textures = {
|
||||
{"mobs_mimic2.png"},
|
||||
},
|
||||
blood_texture = "mobs_rotten_blood.png",
|
||||
makes_footstep_sound = false,
|
||||
sounds = {
|
||||
random = "mobs_dirtmonster",
|
||||
},
|
||||
view_range = 3.5,
|
||||
walk_velocity = 0.01,
|
||||
run_velocity = 2,
|
||||
jump = false,
|
||||
jump_height = 0,
|
||||
drops = {
|
||||
{name = "default:gold_lump",
|
||||
chance = 4, min = 1, max = 1},
|
||||
},
|
||||
do_custom = function(self)
|
||||
if self.state ~= "attack" then
|
||||
minetest.after(3, function()
|
||||
if self.state ~= "attack" and self.object ~= nil then
|
||||
local pos = self.object:getpos()
|
||||
if pos ~= nil then
|
||||
minetest.set_node(pos, {name="mobs_m:mimic_chest2", param2=1})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
end,
|
||||
water_damage = 1,
|
||||
lava_damage = 5,
|
||||
light_damage = 0,
|
||||
fear_height = 3,
|
||||
animation = {
|
||||
speed_normal = 15,
|
||||
speed_run = 17,
|
||||
stand_start = 1,
|
||||
stand_end = 1,
|
||||
walk_start = 1,
|
||||
walk_end = 20,
|
||||
run_start = 1,
|
||||
run_end = 20,
|
||||
punch_start = 20,
|
||||
punch_end = 45,
|
||||
},
|
||||
})
|
||||
|
||||
mobs:register_mob("mobs_m:mammoth", {
|
||||
type = "animal",
|
||||
passive = false,
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
|
@ -0,0 +1 @@
|
|||
default
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
minetest.register_craftitem("tools:doompick", {
|
||||
description = "Pickaxe of Doom",
|
||||
inventory_image = "default_tool_diamondpick.png^[colorize:red:100",
|
||||
liquids_pointable = true,
|
||||
on_use = function(item, placer, pointed_thing)
|
||||
if pointed_thing.under == nil then
|
||||
return end
|
||||
if minetest.get_node(pointed_thing.under) ~= nil then
|
||||
minetest.remove_node(pointed_thing.under)
|
||||
end
|
||||
end,
|
||||
})
|
Loading…
Reference in New Issue