Added protected trapdoor
This commit is contained in:
parent
41dd28c8c8
commit
4b3d084167
@ -583,7 +583,7 @@ function default.can_interact_with_node(player, pos)
|
||||
return true
|
||||
end
|
||||
|
||||
if meta:get_bool("obeys_protection") then
|
||||
if meta:get_int("obeys_protection") == 1 then
|
||||
if minetest.is_protected(pos, player:get_player_name()) == false then
|
||||
return true
|
||||
end
|
||||
|
@ -326,7 +326,7 @@ function doors.register(name, def)
|
||||
meta:set_int("state", state)
|
||||
|
||||
if def.obeys_protection then
|
||||
meta:set_string("obeys_protection", true)
|
||||
meta:set_int("obeys_protection", 1)
|
||||
meta:set_string("infotext", "Protected Door")
|
||||
elseif def.protected then
|
||||
meta:set_string("owner", pn)
|
||||
@ -579,7 +579,16 @@ function doors.register_trapdoor(name, def)
|
||||
def.paramtype2 = "facedir"
|
||||
def.is_ground_content = false
|
||||
|
||||
if def.protected then
|
||||
if def.obeys_protection then
|
||||
def.can_dig = can_dig_door
|
||||
def.after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
local pn = placer:get_player_name()
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("obeys_protection", 1)
|
||||
meta:set_string("infotext", "Protected Trapdoor")
|
||||
return (creative and creative.is_enabled_for and creative.is_enabled_for(pn))
|
||||
end
|
||||
elseif def.protected then
|
||||
def.can_dig = can_dig_door
|
||||
def.after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
local pn = placer:get_player_name()
|
||||
|
@ -19,3 +19,30 @@ minetest.register_craft({
|
||||
type = "shapeless",
|
||||
recipe = {"doors:door_steel", "default:copper_ingot"}
|
||||
})
|
||||
|
||||
doors.register_trapdoor("kingdoms:trapdoor_protected", {
|
||||
description = "Protected Trapdoor",
|
||||
inventory_image = "doors_trapdoor_steel.png",
|
||||
wield_image = "doors_trapdoor_steel.png",
|
||||
tile_front = "doors_trapdoor_steel.png",
|
||||
tile_side = "doors_trapdoor_steel_side.png",
|
||||
obeys_protection = true,
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
sound_open = "doors_steel_door_open",
|
||||
sound_close = "doors_steel_door_close",
|
||||
groups = {cracky = 1, level = 2, door = 1},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "kingdoms:trapdoor_protected",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "default:copper_ingot"},
|
||||
{"default:steel_ingot", "default:steel_ingot"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "kingdoms:trapdoor_protected",
|
||||
type = "shapeless",
|
||||
recipe = {"doors:trapdoor_steel", "default:copper_ingot"}
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user