Use one node for all direction
Bug correct and optimization for later -Facedir 5 and 7 bug texture -Prediction node for facedir to change
210
init.lua
@ -12,7 +12,7 @@ arrow_signs={}
|
|||||||
minetest.chat_send_player(sender:get_player_name(), "error: you don't have permission to edit the sign. you need the interact priv")
|
minetest.chat_send_player(sender:get_player_name(), "error: you don't have permission to edit the sign. you need the interact priv")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local meta = minetest.env:get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
fields.text = fields.text or ""
|
fields.text = fields.text or ""
|
||||||
print((sender:get_player_name() or "").." wrote \""..fields.text..
|
print((sender:get_player_name() or "").." wrote \""..fields.text..
|
||||||
"\" to sign at "..minetest.pos_to_string(pos))
|
"\" to sign at "..minetest.pos_to_string(pos))
|
||||||
@ -61,68 +61,40 @@ else
|
|||||||
end
|
end
|
||||||
minetest.register_node(":default:sign_wall", node)
|
minetest.register_node(":default:sign_wall", node)
|
||||||
|
|
||||||
|
--Sign arrow
|
||||||
|
minetest.register_node("arrow_signs:wall", {
|
||||||
|
description = "Arrow signs",
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{0.25, -0.5, 0.25, -0.5, -0.47, -0.25},
|
||||||
--Sign right
|
{0.3125, -0.5, 0.1875, 0.25, -0.47, -0.1875},
|
||||||
minetest.register_node("arrow_signs:wall_right", {
|
{0.3125, -0.5, 0.125, 0.375, -0.47, -0.125},
|
||||||
description = "Sign right",
|
{0.375, -0.5, 0.0625, 0.437, -0.47, -0.0625}
|
||||||
drawtype = "signlike",
|
}
|
||||||
tiles = {"arrow_sign_right.png"},
|
},
|
||||||
inventory_image = "arrow_sign_right.png",
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{0.25, -0.5, 0.25, -0.5, -0.47, -0.25},
|
||||||
|
{0.3125, -0.5, 0.1875, 0.25, -0.47, -0.1875},
|
||||||
|
{0.3125, -0.5, 0.125, 0.375, -0.47, -0.125},
|
||||||
|
{0.375, -0.5, 0.0625, 0.437, -0.47, -0.0625}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tiles = {"arrow_sign.png", "arrow_sign.png", "arrow_sign_border_right.png", "arrow_sign_border_left.png", "arrow_sign_border_up.png", "arrow_sign_border_down.png" },
|
||||||
|
inventory_image = "arrow_sign.png",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "wallmounted",
|
paramtype2 = "facedir",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
walkable = false,
|
walkable = false,
|
||||||
selection_box = {
|
groups = {choppy=2,dig_immediate=2,sign=1},
|
||||||
type = "wallmounted",
|
|
||||||
--wall_top = <default>
|
|
||||||
--wall_bottom = <default>
|
|
||||||
--wall_side = <default>
|
|
||||||
},
|
|
||||||
groups = {choppy=2,dig_immediate=2,attached_node=1,sign=1},
|
|
||||||
legacy_wallmounted = true,
|
|
||||||
sounds = default.node_sound_defaults(),
|
sounds = default.node_sound_defaults(),
|
||||||
|
on_place = minetest.rotate_node,
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
--local n = minetest.env:get_node(pos)
|
--local n = minetest.get_node(pos)
|
||||||
local meta = minetest.env:get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("formspec", "hack:sign_text_input")
|
|
||||||
meta:set_string("infotext", "\"\"")
|
|
||||||
end,
|
|
||||||
on_receive_fields = function(pos, formname, fields, sender)
|
|
||||||
arrow_signs:savetext(pos, formname, fields, sender)
|
|
||||||
end,
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
-- sign left
|
|
||||||
minetest.register_node("arrow_signs:wall_left", {
|
|
||||||
description = "Sign left",
|
|
||||||
drawtype = "signlike",
|
|
||||||
tiles = {"arrow_sign_left.png"},
|
|
||||||
inventory_image = "arrow_sign_left.png",
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "wallmounted",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
walkable = false,
|
|
||||||
selection_box = {
|
|
||||||
type = "wallmounted",
|
|
||||||
--wall_top = <default>
|
|
||||||
--wall_bottom = <default>
|
|
||||||
--wall_side = <default>
|
|
||||||
},
|
|
||||||
groups = {choppy=2,dig_immediate=2,attached_node=1,sign=1},
|
|
||||||
legacy_wallmounted = true,
|
|
||||||
sounds = default.node_sound_defaults(),
|
|
||||||
on_construct = function(pos)
|
|
||||||
--local n = minetest.env:get_node(pos)
|
|
||||||
local meta = minetest.env:get_meta(pos)
|
|
||||||
meta:set_string("formspec", "hack:sign_text_input")
|
meta:set_string("formspec", "hack:sign_text_input")
|
||||||
meta:set_string("infotext", "\"\"")
|
meta:set_string("infotext", "\"\"")
|
||||||
end,
|
end,
|
||||||
@ -131,115 +103,20 @@ minetest.register_node("arrow_signs:wall_left", {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
--Recipes
|
||||||
--Sign up
|
|
||||||
minetest.register_node("arrow_signs:wall_up", {
|
|
||||||
description = "Sign up",
|
|
||||||
drawtype = "signlike",
|
|
||||||
tiles = {"arrow_sign_up.png"},
|
|
||||||
inventory_image = "arrow_sign_up.png",
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "wallmounted",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
walkable = false,
|
|
||||||
selection_box = {
|
|
||||||
type = "wallmounted",
|
|
||||||
--wall_top = <default>
|
|
||||||
--wall_bottom = <default>
|
|
||||||
--wall_side = <default>
|
|
||||||
},
|
|
||||||
groups = {choppy=2,dig_immediate=2,attached_node=1,sign=1},
|
|
||||||
legacy_wallmounted = true,
|
|
||||||
sounds = default.node_sound_defaults(),
|
|
||||||
on_construct = function(pos)
|
|
||||||
--local n = minetest.env:get_node(pos)
|
|
||||||
local meta = minetest.env:get_meta(pos)
|
|
||||||
meta:set_string("formspec", "hack:sign_text_input")
|
|
||||||
meta:set_string("infotext", "\"\"")
|
|
||||||
end,
|
|
||||||
on_receive_fields = function(pos, formname, fields, sender)
|
|
||||||
arrow_signs:savetext(pos, formname, fields, sender)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
--Sign down
|
|
||||||
minetest.register_node("arrow_signs:wall_down", {
|
|
||||||
description = "Sign down",
|
|
||||||
drawtype = "signlike",
|
|
||||||
tiles = {"arrow_sign_down.png"},
|
|
||||||
inventory_image = "arrow_sign_down.png",
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "wallmounted",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
walkable = false,
|
|
||||||
selection_box = {
|
|
||||||
type = "wallmounted",
|
|
||||||
--wall_top = <default>
|
|
||||||
--wall_bottom = <default>
|
|
||||||
--wall_side = <default>
|
|
||||||
},
|
|
||||||
groups = {choppy=2,dig_immediate=2,attached_node=1,sign=1},
|
|
||||||
legacy_wallmounted = true,
|
|
||||||
sounds = default.node_sound_defaults(),
|
|
||||||
on_construct = function(pos)
|
|
||||||
--local n = minetest.env:get_node(pos)
|
|
||||||
local meta = minetest.env:get_meta(pos)
|
|
||||||
meta:set_string("formspec", "hack:sign_text_input")
|
|
||||||
meta:set_string("infotext", "\"\"")
|
|
||||||
end,
|
|
||||||
on_receive_fields = function(pos, formname, fields, sender)
|
|
||||||
arrow_signs:savetext(pos, formname, fields, sender)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--recipes
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'arrow_signs:wall_right 1',
|
type = 'shapeless',
|
||||||
recipe = {
|
output = 'arrow_signs:wall',
|
||||||
{'', '', ''},
|
recipe = {'group:sign', 'default:stick'},
|
||||||
{'', 'group:sign', 'default:stick'},
|
|
||||||
{'', '', ''},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'arrow_signs:wall_left 1',
|
|
||||||
recipe = {
|
|
||||||
{'', '', ''},
|
|
||||||
{'default:stick', 'group:sign', ''},
|
|
||||||
{'', '', ''},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'arrow_signs:wall_up 1',
|
|
||||||
recipe = {
|
|
||||||
{'', 'default:stick', ''},
|
|
||||||
{'', 'group:sign', ''},
|
|
||||||
{'', '', ''},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'arrow_signs:wall_down 1',
|
|
||||||
recipe = {
|
|
||||||
{'', '', ''},
|
|
||||||
{'', 'group:sign', ''},
|
|
||||||
{'', 'default:stick', ''},
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'default:sign_wall',
|
output = 'default:sign_wall',
|
||||||
recipe = {
|
recipe = {
|
||||||
|
|
||||||
{'group:sign'},
|
{'group:sign'},
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
--Alias
|
||||||
minetest.register_alias("more_signs:wall_right", "arrow_signs:wall_right")
|
minetest.register_alias("more_signs:wall_right", "arrow_signs:wall_right")
|
||||||
minetest.register_alias("sign_right", "arrow_signs:wall_right")
|
minetest.register_alias("sign_right", "arrow_signs:wall_right")
|
||||||
|
|
||||||
@ -252,7 +129,24 @@ minetest.register_alias("sign_up", "arrow_signs:wall_up")
|
|||||||
minetest.register_alias("more_signs:wall_down", "arrow_signs:wall_down")
|
minetest.register_alias("more_signs:wall_down", "arrow_signs:wall_down")
|
||||||
minetest.register_alias("sign_down", "arrow_signs:wall_down")
|
minetest.register_alias("sign_down", "arrow_signs:wall_down")
|
||||||
|
|
||||||
|
--Redefinition
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"arrow_signs:wall_right", "arrow_signs:wall_left", "arrow_signs:wall_up", "arrow_signs:wall_down"},
|
||||||
|
interval = 1,
|
||||||
|
chance = 1,
|
||||||
|
action = function(pos, node)
|
||||||
|
local convert_facedir={
|
||||||
|
["arrow_signs:wall_right"]={17,15,8,6},
|
||||||
|
["arrow_signs:wall_left"]={19,13,10,4},
|
||||||
|
["arrow_signs:wall_up"]={16,14,11,5},
|
||||||
|
["arrow_signs:wall_down"]={18,12,9,7}
|
||||||
|
}
|
||||||
|
minetest.swap_node(pos, {name="arrow_signs:wall",param2=convert_facedir[node.name][node.param2-1]})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
--Locked sign
|
||||||
if locks then
|
if locks then
|
||||||
local MODPATH = minetest.get_modpath("arrow_signs");
|
local MODPATH = minetest.get_modpath("arrow_signs");
|
||||||
dofile(MODPATH.."/shared_locked.lua")
|
dofile(MODPATH.."/shared_locked.lua")
|
||||||
|
@ -1,25 +1,38 @@
|
|||||||
-- a sign
|
-- a sign
|
||||||
minetest.register_node("arrow_signs:shared_locked_right", {
|
minetest.register_node("arrow_signs:shared_locked", {
|
||||||
description = "Shared locked sign right",
|
description = "Shared locked sign",
|
||||||
drawtype = "signlike",
|
drawtype = "nodebox",
|
||||||
tiles = {"arrow_sign_right.png"},
|
node_box = {
|
||||||
inventory_image = "arrow_sign_right.png",
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{0.25, -0.5, 0.25, -0.5, -0.47, -0.25},
|
||||||
|
{0.3125, -0.5, 0.1875, 0.25, -0.47, -0.1875},
|
||||||
|
{0.3125, -0.5, 0.125, 0.375, -0.47, -0.125},
|
||||||
|
{0.375, -0.5, 0.0625, 0.437, -0.47, -0.0625}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{0.25, -0.5, 0.25, -0.5, -0.47, -0.25},
|
||||||
|
{0.3125, -0.5, 0.1875, 0.25, -0.47, -0.1875},
|
||||||
|
{0.3125, -0.5, 0.125, 0.375, -0.47, -0.125},
|
||||||
|
{0.375, -0.5, 0.0625, 0.437, -0.47, -0.0625}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tiles = {"arrow_sign.png", "arrow_sign.png", "arrow_sign_border_right.png", "arrow_sign_border_left.png", "arrow_sign_border_up.png", "arrow_sign_border_down.png" },
|
||||||
|
inventory_image = "arrow_sign.png",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "wallmounted",
|
paramtype2 = "wallmounted",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
walkable = false,
|
walkable = false,
|
||||||
selection_box = {
|
|
||||||
type = "wallmounted",
|
|
||||||
--wall_top = <default>
|
|
||||||
--wall_bottom = <default>
|
|
||||||
--wall_side = <default>
|
|
||||||
},
|
|
||||||
groups = {choppy=2,dig_immediate=2,sign_locked=1},
|
groups = {choppy=2,dig_immediate=2,sign_locked=1},
|
||||||
legacy_wallmounted = true,
|
legacy_wallmounted = true,
|
||||||
|
|
||||||
|
on_place = minetest.rotate_node,
|
||||||
|
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.env:get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
-- prepare the lock of the sign
|
-- prepare the lock of the sign
|
||||||
locks:lock_init( pos,
|
locks:lock_init( pos,
|
||||||
"size[8,4]"..
|
"size[8,4]"..
|
||||||
@ -46,193 +59,7 @@ minetest.register_node("arrow_signs:shared_locked_right", {
|
|||||||
and locks:lock_allow_use( pos, sender )) then
|
and locks:lock_allow_use( pos, sender )) then
|
||||||
|
|
||||||
--print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
|
--print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
|
||||||
local meta = minetest.env:get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
fields.text = fields.text or "";
|
|
||||||
print((sender:get_player_name() or "").." wrote \""..fields.text..
|
|
||||||
"\" to sign at "..minetest.pos_to_string(pos));
|
|
||||||
meta:set_string("text", fields.text.." ["..sender:get_player_name().."]");
|
|
||||||
meta:set_string("infotext", '"'..fields.text..'"'.." ["..sender:get_player_name().."]");
|
|
||||||
|
|
||||||
-- a command for the lock?
|
|
||||||
else
|
|
||||||
arrow_signs:savetext( pos, formname, fields, sender );
|
|
||||||
end
|
|
||||||
|
|
||||||
end,
|
|
||||||
});
|
|
||||||
--left
|
|
||||||
minetest.register_node("arrow_signs:shared_locked_left", {
|
|
||||||
description = "Shared locked sign left",
|
|
||||||
drawtype = "signlike",
|
|
||||||
tiles = {"arrow_sign_left.png"},
|
|
||||||
inventory_image = "arrow_sign_left.png",
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "wallmounted",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
walkable = false,
|
|
||||||
selection_box = {
|
|
||||||
type = "wallmounted",
|
|
||||||
--wall_top = <default>
|
|
||||||
--wall_bottom = <default>
|
|
||||||
--wall_side = <default>
|
|
||||||
},
|
|
||||||
groups = {choppy=2,dig_immediate=2,sign_locked=1},
|
|
||||||
legacy_wallmounted = true,
|
|
||||||
|
|
||||||
|
|
||||||
on_construct = function(pos)
|
|
||||||
local meta = minetest.env:get_meta(pos)
|
|
||||||
-- prepare the lock of the sign
|
|
||||||
locks:lock_init( pos,
|
|
||||||
"size[8,4]"..
|
|
||||||
"field[0.3,0.6;6,0.7;text;Text:;]"..
|
|
||||||
"field[0.3,3.6;6,0.7;locks_sent_lock_command;Locked sign. Type /help for help:;]"..
|
|
||||||
"button_exit[6.3,3.2;1.7,0.7;locks_sent_input;Proceed]" );
|
|
||||||
end,
|
|
||||||
|
|
||||||
after_place_node = function(pos, placer)
|
|
||||||
locks:lock_set_owner( pos, placer, "Shared locked sign" );
|
|
||||||
end,
|
|
||||||
|
|
||||||
|
|
||||||
can_dig = function(pos,player)
|
|
||||||
return locks:lock_allow_dig( pos, player );
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_receive_fields = function(pos, formname, fields, sender)
|
|
||||||
|
|
||||||
-- if the user already has the right to use this and did input text
|
|
||||||
if( fields.text
|
|
||||||
and ( not(fields.locks_sent_lock_command)
|
|
||||||
or fields.locks_sent_lock_command=="")
|
|
||||||
and locks:lock_allow_use( pos, sender )) then
|
|
||||||
|
|
||||||
--print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
|
|
||||||
local meta = minetest.env:get_meta(pos)
|
|
||||||
fields.text = fields.text or "";
|
|
||||||
print((sender:get_player_name() or "").." wrote \""..fields.text..
|
|
||||||
"\" to sign at "..minetest.pos_to_string(pos));
|
|
||||||
meta:set_string("text", fields.text.." ["..sender:get_player_name().."]");
|
|
||||||
meta:set_string("infotext", '"'..fields.text..'"'.." ["..sender:get_player_name().."]");
|
|
||||||
|
|
||||||
-- a command for the lock?
|
|
||||||
else
|
|
||||||
arrow_signs:savetext( pos, formname, fields, sender );
|
|
||||||
end
|
|
||||||
|
|
||||||
end,
|
|
||||||
});
|
|
||||||
--up
|
|
||||||
minetest.register_node("arrow_signs:shared_locked_up", {
|
|
||||||
description = "Shared locked sign up",
|
|
||||||
drawtype = "signlike",
|
|
||||||
tiles = {"arrow_sign_up.png"},
|
|
||||||
inventory_image = "arrow_sign_up.png",
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "wallmounted",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
walkable = false,
|
|
||||||
selection_box = {
|
|
||||||
type = "wallmounted",
|
|
||||||
--wall_top = <default>
|
|
||||||
--wall_bottom = <default>
|
|
||||||
--wall_side = <default>
|
|
||||||
},
|
|
||||||
groups = {choppy=2,dig_immediate=2,sign_locked=1},
|
|
||||||
legacy_wallmounted = true,
|
|
||||||
|
|
||||||
|
|
||||||
on_construct = function(pos)
|
|
||||||
local meta = minetest.env:get_meta(pos)
|
|
||||||
-- prepare the lock of the sign
|
|
||||||
locks:lock_init( pos,
|
|
||||||
"size[8,4]"..
|
|
||||||
"field[0.3,0.6;6,0.7;text;Text:;]"..
|
|
||||||
"field[0.3,3.6;6,0.7;locks_sent_lock_command;Locked sign. Type /help for help:;]"..
|
|
||||||
"button_exit[6.3,3.2;1.7,0.7;locks_sent_input;Proceed]" );
|
|
||||||
end,
|
|
||||||
|
|
||||||
after_place_node = function(pos, placer)
|
|
||||||
locks:lock_set_owner( pos, placer, "Shared locked sign" );
|
|
||||||
end,
|
|
||||||
|
|
||||||
|
|
||||||
can_dig = function(pos,player)
|
|
||||||
return locks:lock_allow_dig( pos, player );
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_receive_fields = function(pos, formname, fields, sender)
|
|
||||||
|
|
||||||
-- if the user already has the right to use this and did input text
|
|
||||||
if( fields.text
|
|
||||||
and ( not(fields.locks_sent_lock_command)
|
|
||||||
or fields.locks_sent_lock_command=="")
|
|
||||||
and locks:lock_allow_use( pos, sender )) then
|
|
||||||
|
|
||||||
--print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
|
|
||||||
local meta = minetest.env:get_meta(pos)
|
|
||||||
fields.text = fields.text or "";
|
|
||||||
print((sender:get_player_name() or "").." wrote \""..fields.text..
|
|
||||||
"\" to sign at "..minetest.pos_to_string(pos));
|
|
||||||
meta:set_string("text", fields.text.." ["..sender:get_player_name().."]");
|
|
||||||
meta:set_string("infotext", '"'..fields.text..'"'.." ["..sender:get_player_name().."]");
|
|
||||||
|
|
||||||
-- a command for the lock?
|
|
||||||
else
|
|
||||||
arrow_signs:savetext( pos, formname, fields, sender );
|
|
||||||
end
|
|
||||||
|
|
||||||
end,
|
|
||||||
});
|
|
||||||
--down
|
|
||||||
minetest.register_node("arrow_signs:shared_locked_down", {
|
|
||||||
description = "Shared locked sign down",
|
|
||||||
drawtype = "signlike",
|
|
||||||
tiles = {"arrow_sign_down.png"},
|
|
||||||
inventory_image = "arrow_sign_down.png",
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "wallmounted",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
walkable = false,
|
|
||||||
selection_box = {
|
|
||||||
type = "wallmounted",
|
|
||||||
--wall_top = <default>
|
|
||||||
--wall_bottom = <default>
|
|
||||||
--wall_side = <default>
|
|
||||||
},
|
|
||||||
groups = {choppy=2,dig_immediate=2,sign_locked=1},
|
|
||||||
legacy_wallmounted = true,
|
|
||||||
|
|
||||||
|
|
||||||
on_construct = function(pos)
|
|
||||||
local meta = minetest.env:get_meta(pos)
|
|
||||||
-- prepare the lock of the sign
|
|
||||||
locks:lock_init( pos,
|
|
||||||
"size[8,4]"..
|
|
||||||
"field[0.3,0.6;6,0.7;text;Text:;]"..
|
|
||||||
"field[0.3,3.6;6,0.7;locks_sent_lock_command;Locked sign. Type /help for help:;]"..
|
|
||||||
"button_exit[6.3,3.2;1.7,0.7;locks_sent_input;Proceed]" );
|
|
||||||
end,
|
|
||||||
|
|
||||||
after_place_node = function(pos, placer)
|
|
||||||
locks:lock_set_owner( pos, placer, "Shared locked sign" );
|
|
||||||
end,
|
|
||||||
|
|
||||||
|
|
||||||
can_dig = function(pos,player)
|
|
||||||
return locks:lock_allow_dig( pos, player );
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_receive_fields = function(pos, formname, fields, sender)
|
|
||||||
|
|
||||||
-- if the user already has the right to use this and did input text
|
|
||||||
if( fields.text
|
|
||||||
and ( not(fields.locks_sent_lock_command)
|
|
||||||
or fields.locks_sent_lock_command=="")
|
|
||||||
and locks:lock_allow_use( pos, sender )) then
|
|
||||||
|
|
||||||
--print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
|
|
||||||
local meta = minetest.env:get_meta(pos)
|
|
||||||
fields.text = fields.text or "";
|
fields.text = fields.text or "";
|
||||||
print((sender:get_player_name() or "").." wrote \""..fields.text..
|
print((sender:get_player_name() or "").." wrote \""..fields.text..
|
||||||
"\" to sign at "..minetest.pos_to_string(pos));
|
"\" to sign at "..minetest.pos_to_string(pos));
|
||||||
@ -248,37 +75,23 @@ minetest.register_node("arrow_signs:shared_locked_right", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'arrow_signs:shared_locked_right',
|
type = 'shapeless',
|
||||||
recipe = {
|
output = 'arrow_signs:shared_locked',
|
||||||
{ 'arrow_signs:wall_right', 'locks:lock', '' },
|
recipe = {'arrow_signs:wall', 'locks:lock'},
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
--Redefinition
|
||||||
output = 'arrow_signs:shared_locked_left',
|
minetest.register_abm({
|
||||||
recipe = {
|
nodenames = {"arrow_signs:shared_locked_right", "'arrow_signs:shared_locked_left", "arrow_signs:shared_locked_up", "arrow_signs:shared_locked_down"},
|
||||||
{ 'arrow_signs:wall_left', 'locks:lock', '' },
|
interval = 1,
|
||||||
},
|
chance = 1,
|
||||||
})
|
action = function(pos, node)
|
||||||
|
local convert_facedir={
|
||||||
minetest.register_craft({
|
["arrow_signs:shared_locked_right"]={17,15,8,6},
|
||||||
output = 'arrow_signs:shared_locked_up',
|
["arrow_signs:shared_locked_left"]={19,13,10,4},
|
||||||
recipe = {
|
["arrow_signs:shared_locked_up"]={16,14,11,5},
|
||||||
{ 'arrow_signs:wall_up', 'locks:lock', '' },
|
["arrow_signs:shared_locked_down"]={18,12,9,7}
|
||||||
},
|
}
|
||||||
})
|
minetest.swap_node(pos, {name="arrow_signs:shared_locked",param2=convert_facedir[node.name][node.param2-1]})
|
||||||
|
end,
|
||||||
minetest.register_craft({
|
|
||||||
output = 'arrow_signs:shared_locked_down',
|
|
||||||
recipe = {
|
|
||||||
{ 'arrow_signs:wall_down', 'locks:lock', '' },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'arrow_signs:shared_locked_right',
|
|
||||||
recipe = {
|
|
||||||
{ 'group:', 'locks:lock', '' },
|
|
||||||
},
|
|
||||||
})
|
})
|
Before Width: | Height: | Size: 666 B After Width: | Height: | Size: 666 B |
BIN
textures/arrow_sign_border_down.png
Normal file
After Width: | Height: | Size: 220 B |
BIN
textures/arrow_sign_border_left.png
Normal file
After Width: | Height: | Size: 202 B |
BIN
textures/arrow_sign_border_right.png
Normal file
After Width: | Height: | Size: 176 B |
BIN
textures/arrow_sign_border_up.png
Normal file
After Width: | Height: | Size: 222 B |
Before Width: | Height: | Size: 676 B |
Before Width: | Height: | Size: 658 B |
Before Width: | Height: | Size: 691 B |