increased village density and trying to get locks working
This commit is contained in:
parent
5e8b1ae7a7
commit
0462b79dca
@ -5,8 +5,13 @@
|
|||||||
|
|
||||||
locks = {}
|
locks = {}
|
||||||
|
|
||||||
function locks.is_locked(pos, player)
|
locks.picked_time = tonumber(minetest.setting_getbool("locks_picked_time")) or 15 -- unlocked for 15 seconds
|
||||||
local pos = pointed_thing.under
|
|
||||||
|
local all_unlocked = minetest.setting_getbool("locks_all_unlocked")
|
||||||
|
|
||||||
|
function locks.is_locked(meta, player)
|
||||||
|
if meta:get_float("last_lock_pick") > locks.picked_time then
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_craftitem(
|
minetest.register_craftitem(
|
||||||
@ -18,10 +23,33 @@ minetest.register_craftitem(
|
|||||||
wield_image = "locks_pick.png",
|
wield_image = "locks_pick.png",
|
||||||
|
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
local pos = pointed_thing.under
|
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
|
|
||||||
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_node(
|
||||||
|
"locks:chest",
|
||||||
|
{
|
||||||
|
description = "Locked Chest",
|
||||||
|
tiles ={"default_chest_top.png", "default_chest_top.png", "default_chest_sides.png",
|
||||||
|
"default_chest_sides.png", "default_chest_sides.png", "default_chest_front.png^default_ingot_steel.png"},
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||||
|
is_ground_content = false,
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
after_place_node = function(pos, player)
|
||||||
|
local form = default.ui.get_page("default_chest")
|
||||||
|
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("formspec", form)
|
||||||
|
meta:set_string("infotext", "Locked Chest (Owned by " .. player:get_player_name() .. ")")
|
||||||
|
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
inv:set_size("main", 8*4)
|
||||||
|
end,
|
||||||
|
can_dig = function(pos, player)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
return inv:is_empty("main") and locks.is_owner(meta, player)
|
||||||
|
end,
|
||||||
|
})
|
@ -44,7 +44,7 @@ minetest.register_abm(
|
|||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
local pr = PseudoRandom(minetest.get_mapgen_params().seed+pos.x+pos.y+pos.z)
|
local pr = PseudoRandom(minetest.get_mapgen_params().seed+pos.x+pos.y+pos.z)
|
||||||
if node.name == "village:grassland_village_mg" then
|
if node.name == "village:grassland_village_mg" then
|
||||||
if pr:next(1, 80) == 1 then
|
if pr:next(1, 60) == 1 then
|
||||||
print("Spawning a (Mapgen)Grassland village at "..dump(pos))
|
print("Spawning a (Mapgen)Grassland village at "..dump(pos))
|
||||||
minetest.after(3.0, function() village.spawn_village(pos, pr) end) -- a short delay to (hopefully)ensure that the surrounding terrain is generated
|
minetest.after(3.0, function() village.spawn_village(pos, pr) end) -- a short delay to (hopefully)ensure that the surrounding terrain is generated
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user