mirror of
https://github.com/mt-mods/basic_signs.git
synced 2024-11-13 05:50:37 +01:00
use signs_lib's wide-font API features where appropriate
move the wide mode for default wood and steel to signs_lib requires signs_lib commit a5e711d3 or later
This commit is contained in:
parent
9317f1563a
commit
7c235ec779
66
init.lua
66
init.lua
|
@ -17,12 +17,11 @@ function basic_signs.check_for_floor(pointed_thing)
|
|||
end
|
||||
end
|
||||
|
||||
function basic_signs.determine_sign_type(pos, placer, itemstack, pointed_thing, widefont)
|
||||
function basic_signs.determine_sign_type(pos, placer, itemstack, pointed_thing)
|
||||
|
||||
local playername = placer:get_player_name()
|
||||
local pt_name = minetest.get_node(pointed_thing.under).name
|
||||
local node = minetest.get_node(pos) -- since we're in after-place, this will be the wall sign itself
|
||||
local widefont = widefont or ""
|
||||
|
||||
if minetest.is_protected(pointed_thing.under, playername) then
|
||||
minetest.record_protection_violation(pointed_thing.under, playername)
|
||||
|
@ -36,11 +35,11 @@ function basic_signs.determine_sign_type(pos, placer, itemstack, pointed_thing,
|
|||
not placer:get_player_control().sneak then
|
||||
return minetest.registered_nodes[pt_name].on_rightclick(pos, node, placer, itemstack, pointed_thing)
|
||||
elseif signs_lib.check_for_pole(pos, pointed_thing) then
|
||||
minetest.swap_node(pos, {name = "default:sign_wall_wood"..widefont.."_onpole", param2 = node.param2})
|
||||
minetest.swap_node(pos, {name = "default:sign_wall_wood_onpole", param2 = node.param2})
|
||||
elseif signs_lib.check_for_ceiling(pointed_thing) then
|
||||
minetest.swap_node(pos, {name = "default:sign_wall_wood"..widefont.."_hanging", param2 = newparam2})
|
||||
minetest.swap_node(pos, {name = "default:sign_wall_wood_hanging", param2 = newparam2})
|
||||
elseif basic_signs.check_for_floor(pointed_thing) then
|
||||
minetest.swap_node(pos, {name = "basic_signs:yard_sign"..widefont, param2 = newparam2})
|
||||
minetest.swap_node(pos, {name = "basic_signs:yard_sign", param2 = newparam2})
|
||||
end
|
||||
signs_lib.update_sign(pos)
|
||||
|
||||
|
@ -52,27 +51,16 @@ end
|
|||
|
||||
local def
|
||||
|
||||
local wgroups = table.copy(signs_lib.standard_wood_groups)
|
||||
wgroups.not_in_creative_inventory = 1
|
||||
|
||||
local sgroups = table.copy(signs_lib.standard_steel_groups)
|
||||
sgroups.not_in_creative_inventory = 1
|
||||
|
||||
minetest.override_item("default:sign_wall_wood", {
|
||||
after_place_node = basic_signs.determine_sign_type
|
||||
})
|
||||
|
||||
def = table.copy(minetest.registered_items["default:sign_wall_wood"])
|
||||
def.description = "Wooden wall sign (wide font)"
|
||||
def.inventory_image = def.inventory_image.."^signs_lib_wide_font_overlay_inv.png"
|
||||
def.wield_image = def.wield_image.."^signs_lib_wide_font_overlay_inv.png"
|
||||
def.horiz_scaling = signs_lib.standard_hscale / 2
|
||||
def.after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
basic_signs.determine_sign_type(pos, placer, itemstack, pointed_thing, "_widefont")
|
||||
end
|
||||
signs_lib.register_sign("default:sign_wall_wood_widefont", def)
|
||||
|
||||
def = table.copy(minetest.registered_items["default:sign_wall_steel"])
|
||||
def.description = "Steel wall sign (wide font)"
|
||||
def.inventory_image = def.inventory_image.."^signs_lib_wide_font_overlay_inv.png"
|
||||
def.wield_image = def.wield_image.."^signs_lib_wide_font_overlay_inv.png"
|
||||
def.horiz_scaling = signs_lib.standard_hscale / 2
|
||||
signs_lib.register_sign("default:sign_wall_steel_widefont", def)
|
||||
|
||||
signs_lib.register_sign("basic_signs:sign_wall_locked", {
|
||||
description = S("Locked Sign"),
|
||||
tiles = {
|
||||
|
@ -82,17 +70,12 @@ signs_lib.register_sign("basic_signs:sign_wall_locked", {
|
|||
inventory_image = "basic_signs_sign_wall_locked_inv.png",
|
||||
locked = true,
|
||||
entity_info = "standard",
|
||||
allow_hanging = true
|
||||
allow_hanging = true,
|
||||
allow_widefont = true
|
||||
})
|
||||
|
||||
minetest.register_alias("locked_sign:sign_wall_locked", "basic_signs:sign_wall_locked")
|
||||
|
||||
def = table.copy(minetest.registered_items["basic_signs:sign_wall_locked"])
|
||||
def.description = S("Locked Sign (wide font)")
|
||||
def.inventory_image = def.inventory_image.."^signs_lib_wide_font_overlay_inv.png"
|
||||
def.wield_image = def.wield_image.."^signs_lib_wide_font_overlay_inv.png"
|
||||
def.horiz_scaling = signs_lib.standard_hscale / 2
|
||||
signs_lib.register_sign("basic_signs:sign_wall_locked_widefont", def)
|
||||
|
||||
-- array : color, translated color, default text color
|
||||
|
||||
|
@ -127,23 +110,14 @@ for i, color in ipairs(sign_colors) do
|
|||
mesh = "signs_lib_standard_wall_sign_entity.obj",
|
||||
yaw = signs_lib.standard_yaw
|
||||
},
|
||||
allow_hanging = true
|
||||
allow_hanging = true,
|
||||
allow_widefont = true
|
||||
})
|
||||
|
||||
def = table.copy(minetest.registered_items["basic_signs:sign_wall_steel_"..color[1]])
|
||||
def.description = S("Sign (@1, steel, wide font)", color[2])
|
||||
def.horiz_scaling = signs_lib.standard_hscale / 2
|
||||
def.inventory_image = def.inventory_image.."^signs_lib_wide_font_overlay_inv.png"
|
||||
def.wield_image = def.wield_image.."^signs_lib_wide_font_overlay_inv.png"
|
||||
signs_lib.register_sign("basic_signs:sign_wall_steel_widefont_"..color[1], def)
|
||||
|
||||
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])
|
||||
end
|
||||
|
||||
local wgroups = table.copy(signs_lib.standard_wood_groups)
|
||||
wgroups.not_in_creative_inventory = 1
|
||||
|
||||
signs_lib.register_sign("basic_signs:yard_sign", {
|
||||
description = "Wooden yard sign",
|
||||
paramtype2 = "facedir",
|
||||
|
@ -161,17 +135,9 @@ signs_lib.register_sign("basic_signs:yard_sign", {
|
|||
},
|
||||
groups = wgroups,
|
||||
drop = "default:sign_wall_wood",
|
||||
allow_onpole = false
|
||||
allow_onpole = false,
|
||||
allow_widefont = true
|
||||
})
|
||||
|
||||
def = table.copy(minetest.registered_items["basic_signs:yard_sign"])
|
||||
def.description = "Wooden yard sign (wide font)"
|
||||
def.inventory_image = def.inventory_image.."^signs_lib_wide_font_overlay_inv.png"
|
||||
def.wield_image = def.wield_image.."^signs_lib_wide_font_overlay_inv.png"
|
||||
def.wield_image = def.wield_image.."^signs_lib_wide_font_overlay_inv.png"
|
||||
def.horiz_scaling = signs_lib.standard_hscale / 2
|
||||
def.groups = wgroups
|
||||
minetest.register_node("basic_signs:yard_sign_widefont", def)
|
||||
|
||||
table.insert(signs_lib.lbm_restore_nodes, "signs:sign_yard")
|
||||
minetest.register_alias("signs:sign_yard", "basic_signs:yard_sign")
|
||||
|
|
Loading…
Reference in New Issue
Block a user