144 lines
5.0 KiB
Lua
144 lines
5.0 KiB
Lua
minetest.register_node('hall:stanchion_post', {
|
|
description = 'Stanchion post',
|
|
drawtype = 'mesh',
|
|
mesh = 'hall_stanchion_post.obj',
|
|
tiles = {'default_aspen_wood.png'},
|
|
sounds = default.node_sound_wood_defaults(),
|
|
paramtype2 = 'facedir',
|
|
paramtype = 'light',
|
|
selection_box = {
|
|
type = 'fixed',
|
|
fixed = {-.2, -.5, -.2, .2, .5, .2},
|
|
},
|
|
collision_box = {
|
|
type = 'fixed',
|
|
fixed = {-.2, -.5, -.2, .2, .5, .2},
|
|
},
|
|
groups = {oddly_breakable_by_hand = 2, choppy=3},
|
|
})
|
|
|
|
minetest.register_node('hall:stanchion_post_sign', {
|
|
description = 'Stanchion post',
|
|
drawtype = 'mesh',
|
|
mesh = 'hall_stanchion_post_sign.obj',
|
|
tiles = {'default_aspen_wood.png', 'hall_plaque_texture.png'},
|
|
sounds = default.node_sound_wood_defaults(),
|
|
paramtype2 = 'facedir',
|
|
paramtype = 'light',
|
|
selection_box = {
|
|
type = 'fixed',
|
|
fixed = {-.2, -.5, -.2, .2, .5, .2},
|
|
},
|
|
collision_box = {
|
|
type = 'fixed',
|
|
fixed = {-.2, -.5, -.2, .2, .5, .2},
|
|
},
|
|
groups = {oddly_breakable_by_hand = 2, choppy=3},
|
|
after_place_node = function(pos, placer)
|
|
local meta = minetest.get_meta(pos)
|
|
meta:set_string('owner', placer:get_player_name())
|
|
meta:set_string('infotext', 'Empty Sign')
|
|
meta:set_string('title', '')
|
|
meta:set_string('bottom', '')
|
|
meta:set_string('left', '')
|
|
meta:set_string('right', '')
|
|
end,
|
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
|
local name = clicker:get_player_name()
|
|
local meta = minetest.get_meta(pos)
|
|
local owner = meta:get_string('owner')
|
|
local title = meta:get_string('title')
|
|
local bottom = meta:get_string('bottom')
|
|
local left = meta:get_string('left')
|
|
local right = meta:get_string('right')
|
|
if owner == name then
|
|
meta:set_string('formspec', hall.edit_sign(title, bottom, left, right))
|
|
else
|
|
meta:set_string('formspec', hall.view_sign(title, bottom, left, right))
|
|
end
|
|
end,
|
|
on_receive_fields = function(pos, formname, fields, sender)
|
|
local meta = minetest.get_meta(pos)
|
|
if fields ['save'] then
|
|
local player_name = sender:get_player_name()
|
|
meta:set_string('infotext', fields.title)
|
|
meta:set_string('title', fields.title)
|
|
meta:set_string('bottom', fields.bottom)
|
|
meta:set_string('left', fields.left)
|
|
meta:set_string('right', fields.right)
|
|
minetest.log("action", (player_name or "").." wrote \""..fields.title.."\" to stanchion at "..minetest.pos_to_string(pos))
|
|
end
|
|
end,
|
|
})
|
|
|
|
minetest.register_node('hall:stanchion_rope', {
|
|
description = 'Stanchion rope',
|
|
drawtype = 'mesh',
|
|
mesh = 'hall_stanchion_rope.obj',
|
|
tiles = {'wool.png^[multiply:#1a1a1a'},
|
|
paramtype2 = 'facedir',
|
|
paramtype = 'light',
|
|
selection_box = {
|
|
type = 'fixed',
|
|
fixed = {-.6, -.2, -.2, .6, .4, .2},
|
|
},
|
|
collision_box = {
|
|
type = 'fixed',
|
|
fixed = {-.6, -.2, -.2, .6, .4, .2},
|
|
},
|
|
groups = {oddly_breakable_by_hand = 2, snappy=3},
|
|
})
|
|
|
|
minetest.register_node('hall:stanchion_rope_sign', {
|
|
description = 'Stanchion rope',
|
|
drawtype = 'mesh',
|
|
mesh = 'hall_stanchion_rope_sign.obj',
|
|
tiles = {'wool.png^[multiply:#1a1a1a','hall_plaque_texture.png'},
|
|
paramtype2 = 'facedir',
|
|
paramtype = 'light',
|
|
selection_box = {
|
|
type = 'fixed',
|
|
fixed = {-.6, -.2, -.2, .6, .4, .2},
|
|
},
|
|
collision_box = {
|
|
type = 'fixed',
|
|
fixed = {-.6, -.2, -.2, .6, .4, .2},
|
|
},
|
|
groups = {oddly_breakable_by_hand = 2, snappy=3},
|
|
after_place_node = function(pos, placer)
|
|
local meta = minetest.get_meta(pos)
|
|
meta:set_string('owner', placer:get_player_name())
|
|
meta:set_string('infotext', 'Empty Sign')
|
|
meta:set_string('title', '')
|
|
meta:set_string('bottom', '')
|
|
meta:set_string('left', '')
|
|
meta:set_string('right', '')
|
|
end,
|
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
|
local name = clicker:get_player_name()
|
|
local meta = minetest.get_meta(pos)
|
|
local owner = meta:get_string('owner')
|
|
local title = meta:get_string('title')
|
|
local bottom = meta:get_string('bottom')
|
|
local left = meta:get_string('left')
|
|
local right = meta:get_string('right')
|
|
if owner == name then
|
|
meta:set_string('formspec', hall.edit_sign(title, bottom, left, right))
|
|
else
|
|
meta:set_string('formspec', hall.view_sign(title, bottom, left, right))
|
|
end
|
|
end,
|
|
on_receive_fields = function(pos, formname, fields, sender)
|
|
local meta = minetest.get_meta(pos)
|
|
if fields ['save'] then
|
|
local player_name = sender:get_player_name()
|
|
meta:set_string('infotext', fields.title)
|
|
meta:set_string('title', fields.title)
|
|
meta:set_string('bottom', fields.bottom)
|
|
meta:set_string('left', fields.left)
|
|
meta:set_string('right', fields.right)
|
|
minetest.log("action", (player_name or "").." wrote \""..fields.title.."\" to stanchion at "..minetest.pos_to_string(pos))
|
|
end
|
|
end,
|
|
})
|