added treasure chests to dungeons
This commit is contained in:
parent
a988f7be4f
commit
0b25178b0f
@ -20,7 +20,7 @@ classes.register_weapon = function(name,fromLevel,levels, def)
|
||||
if pointed_thing.type == "object" then
|
||||
if xp.player_levels[user:get_player_name()] and xp.player_levels[user:get_player_name()] > i-1 then
|
||||
pointed_thing.ref:punch(user, 10,minetest.registered_tools[itemstack:get_name()].tool_capabilities)
|
||||
itemstack:add_wear(100)
|
||||
itemstack:add_wear(300)
|
||||
print("[info]" .. user:get_player_name() .. " is fighting!")
|
||||
else
|
||||
cmsg.push_message_player(user, "[info] You have to be level "..tostring(i).. " to use this weapon!")
|
||||
|
11
mods/dungeons/LICENSE.txt
Normal file
11
mods/dungeons/LICENSE.txt
Normal file
@ -0,0 +1,11 @@
|
||||
License for Code
|
||||
----------------
|
||||
|
||||
Copyright (C) 2016 cd2 (cdqwertz) <cdqwertz@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
http://www.gnu.org/licenses/lgpl-2.1.html
|
20
mods/dungeons/init.lua
Normal file
20
mods/dungeons/init.lua
Normal file
@ -0,0 +1,20 @@
|
||||
local function place_treasure(d)
|
||||
if d == nil or #d < 1 then
|
||||
return
|
||||
end
|
||||
for i=1,2,1 do
|
||||
local p = d[math.random(1, #d)]
|
||||
if minetest.get_node({x=p.x, y =p.y-1, z=p.z}) ~= "air" then
|
||||
minetest.set_node(p, {name = "default:treasure_chest"})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
minetest.set_gen_notify("dungeon")
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||
local g = minetest.get_mapgen_object("gennotify")
|
||||
if g and g.dungeon and #g.dungeon > 4 then
|
||||
minetest.after(3, place_treasure, table.copy(g.dungeon))
|
||||
end
|
||||
end)
|
Loading…
x
Reference in New Issue
Block a user