forked from mtcontrib/basic_signs
Use signs_lib.register_sign() call
requires signs_lib commit 6f9ca21 or later also moved the sign-on-pole LBM stuff to signs_lib where they belong.
This commit is contained in:
parent
a0b8560101
commit
854b94349f
237
init.lua
237
init.lua
@ -9,20 +9,6 @@ dofile(basic_signs.path .. "/crafting.lua")
|
|||||||
local S, NS = dofile(basic_signs.path .. "/intllib.lua")
|
local S, NS = dofile(basic_signs.path .. "/intllib.lua")
|
||||||
basic_signs.gettext = S
|
basic_signs.gettext = S
|
||||||
|
|
||||||
local cbox
|
|
||||||
|
|
||||||
-- array : color, translated color, default text color
|
|
||||||
local sign_colors = {
|
|
||||||
{"green", S("green"), "f"},
|
|
||||||
{"yellow", S("yellow"), "0"},
|
|
||||||
{"red", S("red"), "f"},
|
|
||||||
{"white_red", S("white_red"), "4"},
|
|
||||||
{"white_black", S("white_black"), "0"},
|
|
||||||
{"orange", S("orange"), "0"},
|
|
||||||
{"blue", S("blue"), "f"},
|
|
||||||
{"brown", S("brown"), "f"},
|
|
||||||
}
|
|
||||||
|
|
||||||
function basic_signs.determine_sign_type(pos, placer, itemstack, pointed_thing)
|
function basic_signs.determine_sign_type(pos, placer, itemstack, pointed_thing)
|
||||||
local playername = placer:get_player_name()
|
local playername = placer:get_player_name()
|
||||||
local pt_name = minetest.get_node(pointed_thing.under).name
|
local pt_name = minetest.get_node(pointed_thing.under).name
|
||||||
@ -57,139 +43,66 @@ function basic_signs.determine_sign_type(pos, placer, itemstack, pointed_thing)
|
|||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, onpole in ipairs({"", "_onpole"}) do
|
minetest.override_item("default:sign_wall_wood", {
|
||||||
|
after_place_node = basic_signs.determine_sign_type
|
||||||
|
})
|
||||||
|
|
||||||
local nci = nil
|
signs_lib.register_sign("basic_signs:sign_wall_locked", {
|
||||||
local pole_mount_tex = nil
|
description = S("Locked Sign"),
|
||||||
|
tiles = {
|
||||||
|
"basic_signs_sign_wall_locked.png",
|
||||||
|
"signs_lib_sign_wall_steel_edges.png",
|
||||||
|
},
|
||||||
|
inventory_image = "basic_signs_sign_wall_locked_inv.png",
|
||||||
|
locked = true,
|
||||||
|
entity_info = "standard",
|
||||||
|
})
|
||||||
|
|
||||||
if onpole == "_onpole" then
|
minetest.register_alias("locked_sign:sign_wall_locked", "basic_signs:sign_wall_locked")
|
||||||
nci = 1
|
|
||||||
pole_mount_tex = "signs_lib_pole_mount.png" -- the metal straps on back, if needed
|
|
||||||
end
|
|
||||||
|
|
||||||
local wood_groups = table.copy(signs_lib.standard_wood_groups)
|
-- array : color, translated color, default text color
|
||||||
wood_groups.not_in_creative_inventory = nci
|
|
||||||
local steel_groups = table.copy(signs_lib.standard_steel_groups)
|
|
||||||
steel_groups.not_in_creative_inventory = nci
|
|
||||||
|
|
||||||
cbox = signs_lib.make_selection_boxes(35, 25, onpole)
|
local sign_colors = {
|
||||||
|
{"green", S("green"), "f"},
|
||||||
|
{"yellow", S("yellow"), "0"},
|
||||||
|
{"red", S("red"), "f"},
|
||||||
|
{"white_red", S("white_red"), "4"},
|
||||||
|
{"white_black", S("white_black"), "0"},
|
||||||
|
{"orange", S("orange"), "0"},
|
||||||
|
{"blue", S("blue"), "f"},
|
||||||
|
{"brown", S("brown"), "f"},
|
||||||
|
}
|
||||||
|
|
||||||
minetest.override_item("default:sign_wall_wood"..onpole, {
|
local cbox = signs_lib.make_selection_boxes(35, 25, true, 0, 0, 0, true)
|
||||||
after_place_node = basic_signs.determine_sign_type
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("basic_signs:sign_wall_locked"..onpole, {
|
for i, color in ipairs(sign_colors) do
|
||||||
description = S("Locked Sign"),
|
signs_lib.register_sign("basic_signs:sign_wall_steel_"..color[1], {
|
||||||
paramtype = "light",
|
description = S("Sign (@1, steel)", color[2]),
|
||||||
sunlight_propagates = true,
|
paramtype2 = "facedir",
|
||||||
paramtype2 = "wallmounted",
|
|
||||||
drawtype = "mesh",
|
|
||||||
node_box = cbox,
|
|
||||||
selection_box = cbox,
|
selection_box = cbox,
|
||||||
mesh = "signs_lib_standard_wall_sign"..onpole..".obj",
|
mesh = "signs_lib_standard_wall_sign_facedir.obj",
|
||||||
tiles = {
|
tiles = {
|
||||||
"basic_signs_sign_wall_locked.png",
|
"basic_signs_steel_"..color[1]..".png",
|
||||||
"signs_lib_sign_wall_steel_edges.png",
|
"signs_lib_sign_wall_steel_edges.png",
|
||||||
pole_mount_tex
|
|
||||||
},
|
},
|
||||||
inventory_image = "basic_signs_sign_wall_locked_inv.png",
|
inventory_image = "basic_signs_steel_"..color[1].."_inv.png",
|
||||||
wield_image = "basic_signs_sign_wall_locked_inv.png",
|
groups = signs_lib.standard_steel_groups,
|
||||||
groups = wood_groups,
|
sounds = signs_lib.standard_steel_sign_sounds,
|
||||||
sounds = signs_lib.standard_wood_sign_sounds,
|
default_color = color[3],
|
||||||
default_color = "0",
|
|
||||||
on_rightclick = signs_lib.construct_sign,
|
|
||||||
on_construct = signs_lib.construct_sign,
|
|
||||||
on_destruct = signs_lib.destruct_sign,
|
|
||||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
|
||||||
signs_lib.after_place_node(pos, placer, itemstack, pointed_thing, true)
|
|
||||||
end,
|
|
||||||
on_receive_fields = signs_lib.receive_fields,
|
|
||||||
on_punch = signs_lib.update_sign,
|
|
||||||
can_dig = signs_lib.can_modify,
|
|
||||||
on_rotate = signs_lib.wallmounted_rotate,
|
|
||||||
number_of_lines = signs_lib.standard_lines,
|
|
||||||
horiz_scaling = signs_lib.standard_hscale,
|
|
||||||
vert_scaling = signs_lib.standard_vscale,
|
|
||||||
line_spacing = signs_lib.standard_lspace,
|
|
||||||
font_size = signs_lib.standard_fsize,
|
|
||||||
x_offset = signs_lib.standard_xoffs,
|
|
||||||
y_offset = signs_lib.standard_yoffs,
|
|
||||||
chars_per_line = signs_lib.standard_cpl,
|
|
||||||
entity_info = {
|
entity_info = {
|
||||||
mesh = "signs_lib_standard_wall_sign_entity"..onpole..".obj",
|
mesh = "signs_lib_standard_wall_sign_entity.obj",
|
||||||
yaw = signs_lib.wallmounted_yaw
|
yaw = signs_lib.standard_yaw
|
||||||
},
|
},
|
||||||
drop = "basic_signs:sign_wall_locked"
|
|
||||||
})
|
})
|
||||||
table.insert(signs_lib.lbm_restore_nodes, "basic_signs:sign_wall_locked"..onpole)
|
|
||||||
table.insert(signs_lib.lbm_restore_nodes, "locked_sign:sign_wall_locked"..onpole)
|
|
||||||
|
|
||||||
minetest.register_alias("locked_sign:sign_wall_locked", "basic_signs:sign_wall_locked")
|
table.insert(signs_lib.lbm_restore_nodes, "signs:sign_wall_"..color[1])
|
||||||
|
minetest.register_alias("signs:sign_wall_"..color[1], "basic_signs:sign_wall_steel_"..color[1])
|
||||||
cbox = signs_lib.make_selection_boxes(35, 25, onpole, 0, 0, 0, true)
|
|
||||||
|
|
||||||
for i, color in ipairs(sign_colors) do
|
|
||||||
minetest.register_node("basic_signs:sign_wall_steel_"..color[1]..onpole, {
|
|
||||||
description = S("Sign (@1, steel)", color[2]),
|
|
||||||
paramtype = "light",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
drawtype = "mesh",
|
|
||||||
node_box = cbox,
|
|
||||||
selection_box = cbox,
|
|
||||||
mesh = "signs_lib_standard_wall_sign_facedir"..onpole..".obj",
|
|
||||||
tiles = {
|
|
||||||
"basic_signs_steel_"..color[1]..".png",
|
|
||||||
"signs_lib_sign_wall_steel_edges.png",
|
|
||||||
pole_mount_tex
|
|
||||||
},
|
|
||||||
inventory_image = "basic_signs_steel_"..color[1].."_inv.png",
|
|
||||||
wield_image = "basic_signs_steel_"..color[1].."_inv.png",
|
|
||||||
groups = steel_groups,
|
|
||||||
sounds = signs_lib.standard_steel_sign_sounds,
|
|
||||||
default_color = color[3],
|
|
||||||
on_rightclick = signs_lib.construct_sign,
|
|
||||||
on_construct = signs_lib.construct_sign,
|
|
||||||
on_destruct = signs_lib.destruct_sign,
|
|
||||||
after_place_node = signs_lib.after_place_node,
|
|
||||||
on_receive_fields = signs_lib.receive_fields,
|
|
||||||
on_punch = signs_lib.update_sign,
|
|
||||||
on_rotate = signs_lib.facedir_rotate,
|
|
||||||
number_of_lines = signs_lib.standard_lines,
|
|
||||||
horiz_scaling = signs_lib.standard_hscale,
|
|
||||||
vert_scaling = signs_lib.standard_vscale,
|
|
||||||
line_spacing = signs_lib.standard_lspace,
|
|
||||||
font_size = signs_lib.standard_fsize,
|
|
||||||
x_offset = signs_lib.standard_xoffs,
|
|
||||||
y_offset = signs_lib.standard_yoffs,
|
|
||||||
chars_per_line = signs_lib.standard_cpl,
|
|
||||||
entity_info = {
|
|
||||||
mesh = "signs_lib_standard_wall_sign_entity"..onpole..".obj",
|
|
||||||
yaw = signs_lib.standard_yaw
|
|
||||||
},
|
|
||||||
drop = "basic_signs:sign_wall_steel_"..color[1]
|
|
||||||
})
|
|
||||||
table.insert(signs_lib.lbm_restore_nodes, "basic_signs:sign_wall_steel_"..color[1]..onpole)
|
|
||||||
table.insert(signs_lib.lbm_restore_nodes, "signs:sign_wall_"..color[1]..onpole)
|
|
||||||
|
|
||||||
minetest.register_alias("signs:sign_wall_"..color[1], "basic_signs:sign_wall_steel_"..color[1])
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
cbox = signs_lib.make_selection_boxes(35, 34.5, false, 0, -1.25, -19.69, true)
|
signs_lib.register_sign("basic_signs:yard_sign", {
|
||||||
|
|
||||||
local nci_wood_groups = table.copy(signs_lib.standard_wood_groups)
|
|
||||||
nci_wood_groups.not_in_creative_inventory = 1
|
|
||||||
|
|
||||||
minetest.register_node("basic_signs:yard_sign", {
|
|
||||||
description = "Wooden yard sign",
|
description = "Wooden yard sign",
|
||||||
paramtype = "light",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
drawtype = "mesh",
|
selection_box = signs_lib.make_selection_boxes(35, 34.5, false, 0, -1.25, -19.69, true),
|
||||||
node_box = cbox,
|
|
||||||
selection_box = cbox,
|
|
||||||
mesh = "basic_signs_yard_sign.obj",
|
mesh = "basic_signs_yard_sign.obj",
|
||||||
tiles = {
|
tiles = {
|
||||||
"signs_lib_sign_wall_wooden.png",
|
"signs_lib_sign_wall_wooden.png",
|
||||||
@ -197,45 +110,18 @@ minetest.register_node("basic_signs:yard_sign", {
|
|||||||
"default_wood.png"
|
"default_wood.png"
|
||||||
},
|
},
|
||||||
inventory_image = "default_sign_wood.png",
|
inventory_image = "default_sign_wood.png",
|
||||||
wield_image = "default_sign_wood.png",
|
|
||||||
groups = nci_wood_groups,
|
|
||||||
sounds = signs_lib.standard_wood_sign_sounds,
|
|
||||||
default_color = "0",
|
|
||||||
on_rightclick = signs_lib.construct_sign,
|
|
||||||
on_construct = signs_lib.construct_sign,
|
|
||||||
on_destruct = signs_lib.destruct_sign,
|
|
||||||
after_place_node = signs_lib.after_place_node,
|
|
||||||
on_receive_fields = signs_lib.receive_fields,
|
|
||||||
on_punch = signs_lib.update_sign,
|
|
||||||
on_rotate = signs_lib.facedir_rotate,
|
|
||||||
number_of_lines = signs_lib.standard_lines,
|
|
||||||
horiz_scaling = signs_lib.standard_hscale,
|
|
||||||
vert_scaling = signs_lib.standard_vscale,
|
|
||||||
line_spacing = signs_lib.standard_lspace,
|
|
||||||
font_size = signs_lib.standard_fsize,
|
|
||||||
x_offset = signs_lib.standard_xoffs,
|
|
||||||
y_offset = signs_lib.standard_yoffs,
|
|
||||||
chars_per_line = signs_lib.standard_cpl,
|
|
||||||
entity_info = {
|
entity_info = {
|
||||||
mesh = "basic_signs_yard_sign_entity.obj",
|
mesh = "basic_signs_yard_sign_entity.obj",
|
||||||
yaw = signs_lib.standard_yaw
|
yaw = signs_lib.standard_yaw
|
||||||
},
|
},
|
||||||
drop = "default:sign_wall_wood"
|
drop = "default:sign_wall_wood",
|
||||||
|
allow_onpole = false
|
||||||
})
|
})
|
||||||
table.insert(signs_lib.lbm_restore_nodes, "basic_signs:yard_sign")
|
|
||||||
table.insert(signs_lib.lbm_restore_nodes, "signs:sign_yard")
|
|
||||||
minetest.register_alias("signs:sign_yard", "basic_signs:yard_sign")
|
|
||||||
|
|
||||||
cbox = signs_lib.make_selection_boxes(35, 32, false, 0, 3, -18.5, true)
|
signs_lib.register_sign("basic_signs:hanging_sign", {
|
||||||
|
|
||||||
minetest.register_node("basic_signs:hanging_sign", {
|
|
||||||
description = "Wooden sign, hanging",
|
description = "Wooden sign, hanging",
|
||||||
paramtype = "light",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
drawtype = "mesh",
|
selection_box = signs_lib.make_selection_boxes(35, 32, false, 0, 3, -18.5, true),
|
||||||
node_box = cbox,
|
|
||||||
selection_box = cbox,
|
|
||||||
mesh = "basic_signs_hanging_sign.obj",
|
mesh = "basic_signs_hanging_sign.obj",
|
||||||
tiles = {
|
tiles = {
|
||||||
"signs_lib_sign_wall_wooden.png",
|
"signs_lib_sign_wall_wooden.png",
|
||||||
@ -243,37 +129,16 @@ minetest.register_node("basic_signs:hanging_sign", {
|
|||||||
"basic_signs_ceiling_hangers.png"
|
"basic_signs_ceiling_hangers.png"
|
||||||
},
|
},
|
||||||
inventory_image = "default_sign_wood.png",
|
inventory_image = "default_sign_wood.png",
|
||||||
wield_image = "default_sign_wood.png",
|
|
||||||
groups = nci_wood_groups,
|
|
||||||
sounds = signs_lib.standard_wood_sign_sounds,
|
|
||||||
default_color = "0",
|
|
||||||
on_rightclick = signs_lib.construct_sign,
|
|
||||||
on_construct = signs_lib.construct_sign,
|
|
||||||
on_destruct = signs_lib.destruct_sign,
|
|
||||||
after_place_node = signs_lib.after_place_node,
|
|
||||||
on_receive_fields = signs_lib.receive_fields,
|
|
||||||
on_punch = signs_lib.update_sign,
|
|
||||||
on_rotate = signs_lib.facedir_rotate,
|
|
||||||
number_of_lines = signs_lib.standard_lines,
|
|
||||||
horiz_scaling = signs_lib.standard_hscale,
|
|
||||||
vert_scaling = signs_lib.standard_vscale,
|
|
||||||
line_spacing = signs_lib.standard_lspace,
|
|
||||||
font_size = signs_lib.standard_fsize,
|
|
||||||
x_offset = signs_lib.standard_xoffs,
|
|
||||||
y_offset = signs_lib.standard_yoffs,
|
|
||||||
chars_per_line = signs_lib.standard_cpl,
|
|
||||||
entity_info = {
|
entity_info = {
|
||||||
mesh = "basic_signs_hanging_sign_entity.obj",
|
mesh = "basic_signs_hanging_sign_entity.obj",
|
||||||
yaw = signs_lib.standard_yaw
|
yaw = signs_lib.standard_yaw
|
||||||
},
|
},
|
||||||
drop = "default:sign_wall_wood"
|
drop = "default:sign_wall_wood",
|
||||||
|
allow_onpole = false
|
||||||
})
|
})
|
||||||
table.insert(signs_lib.lbm_restore_nodes, "basic_signs:hanging_sign")
|
|
||||||
|
table.insert(signs_lib.lbm_restore_nodes, "signs:sign_yard")
|
||||||
table.insert(signs_lib.lbm_restore_nodes, "signs:sign_hanging")
|
table.insert(signs_lib.lbm_restore_nodes, "signs:sign_hanging")
|
||||||
|
minetest.register_alias("signs:sign_yard", "basic_signs:yard_sign")
|
||||||
minetest.register_alias("signs:sign_hanging", "basic_signs:hanging_sign")
|
minetest.register_alias("signs:sign_hanging", "basic_signs:hanging_sign")
|
||||||
|
|
||||||
-- insert the old wood sign-on-fencepost into signs_lib's conversion LBM
|
|
||||||
|
|
||||||
table.insert(signs_lib.old_fenceposts_with_signs, "signs:sign_post")
|
|
||||||
signs_lib.old_fenceposts["signs:sign_post"] = "default:fence_wood"
|
|
||||||
signs_lib.old_fenceposts_replacement_signs["signs:sign_post"] = "default:sign_wall_wood_onpole"
|
|
||||||
|
Loading…
Reference in New Issue
Block a user