forked from mtcontrib/signs_lib
create a generic hanging sign feature and
move basic_signs' hanging wooden sign back to here, use it.
This commit is contained in:
parent
f6673dc0f1
commit
78418de9c9
37
api.lua
37
api.lua
@ -611,6 +611,14 @@ function signs_lib.check_for_pole(pos, pointed_thing)
|
||||
end
|
||||
end
|
||||
|
||||
function signs_lib.check_for_ceiling(pointed_thing)
|
||||
if pointed_thing.above.x == pointed_thing.under.x
|
||||
and pointed_thing.above.z == pointed_thing.under.z
|
||||
and pointed_thing.above.y < pointed_thing.under.y then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
function signs_lib.after_place_node(pos, placer, itemstack, pointed_thing, locked)
|
||||
local playername = placer:get_player_name()
|
||||
local def = minetest.registered_items[itemstack:get_name()]
|
||||
@ -622,6 +630,10 @@ function signs_lib.after_place_node(pos, placer, itemstack, pointed_thing, locke
|
||||
if (def.allow_onpole ~= false) and signs_lib.check_for_pole(pos, pointed_thing) then
|
||||
local node = minetest.get_node(pos)
|
||||
minetest.swap_node(pos, {name = itemstack:get_name().."_onpole", param2 = node.param2})
|
||||
elseif def.allow_hanging and signs_lib.check_for_ceiling(pointed_thing) then
|
||||
local newparam2 = minetest.dir_to_facedir(placer:get_look_dir())
|
||||
local node = minetest.get_node(pos)
|
||||
minetest.swap_node(pos, {name = itemstack:get_name().."_hanging", param2 = newparam2})
|
||||
end
|
||||
if locked then
|
||||
local meta = minetest.get_meta(pos)
|
||||
@ -711,13 +723,13 @@ function signs_lib.register_sign(name, rdef)
|
||||
end
|
||||
|
||||
def.paramtype = rdef.paramtype or "light"
|
||||
def.paramtype2 = rdef.paramtype2 or "wallmounted"
|
||||
def.drawtype = rdef.drawtype or "mesh"
|
||||
def.mesh = rdef.mesh or "signs_lib_standard_wall_sign.obj"
|
||||
def.wield_image = rdef.wield_image or def.inventory_image
|
||||
def.drop = rdef.drop or name
|
||||
def.sounds = rdef.sounds or signs_lib.standard_wood_sign_sounds
|
||||
def.on_rotate = rdef.on_rotate or signs_lib.wallmounted_rotate
|
||||
def.paramtype2 = rdef.paramtype2 or "wallmounted"
|
||||
|
||||
if rdef.on_rotate then
|
||||
def.on_rotate = rdef.on_rotate
|
||||
@ -780,6 +792,29 @@ function signs_lib.register_sign(name, rdef)
|
||||
minetest.register_node(":"..name.."_onpole", opdef)
|
||||
table.insert(signs_lib.lbm_restore_nodes, name.."_onpole")
|
||||
end
|
||||
|
||||
if rdef.allow_hanging then
|
||||
|
||||
local hdef = table.copy(def)
|
||||
hdef.paramtype2 = "facedir"
|
||||
|
||||
hdef.selection_box = rdef.selection_box or signs_lib.make_selection_boxes(35, 32, false, 0, 3, -18.5, true)
|
||||
hdef.node_box = rdef.node_box or rdef.selection_box or hdef.selection_box
|
||||
|
||||
hdef.groups.not_in_creative_inventory = 1
|
||||
hdef.tiles[3] = "signs_lib_hangers.png"
|
||||
hdef.mesh = string.gsub(hdef.mesh, ".obj$", "_hanging.obj")
|
||||
hdef.on_rotate = nil
|
||||
|
||||
if hdef.entity_info then
|
||||
hdef.entity_info.mesh = string.gsub(hdef.entity_info.mesh, ".obj$", "_hanging.obj")
|
||||
hdef.entity_info.yaw = signs_lib.standard_yaw
|
||||
end
|
||||
|
||||
minetest.register_node(":"..name.."_hanging", hdef)
|
||||
table.insert(signs_lib.lbm_restore_nodes, name.."_hanging")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- restore signs' text after /clearobjects and the like, the next time
|
||||
|
15
models/signs_lib_standard_wall_sign_entity_hanging.obj
Normal file
15
models/signs_lib_standard_wall_sign_entity_hanging.obj
Normal file
@ -0,0 +1,15 @@
|
||||
# Blender v2.79 (sub 0) OBJ File: 'basic_signs wooden hanging sign.blend'
|
||||
# www.blender.org
|
||||
o Plane
|
||||
v 0.406250 -0.281250 -0.042969
|
||||
v -0.406250 -0.281250 -0.042969
|
||||
v 0.406250 0.281250 -0.042969
|
||||
v -0.406250 0.281250 -0.042969
|
||||
vt 0.000000 0.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 0.000000 1.000000
|
||||
vn 0.0000 -0.0000 -1.0000
|
||||
g Plane_Plane_None
|
||||
s off
|
||||
f 1/1/1 2/2/1 4/3/1 3/4/1
|
62
models/signs_lib_standard_wall_sign_hanging.obj
Normal file
62
models/signs_lib_standard_wall_sign_hanging.obj
Normal file
@ -0,0 +1,62 @@
|
||||
# Blender v2.79 (sub 0) OBJ File: 'basic_signs wooden hanging sign.blend'
|
||||
# www.blender.org
|
||||
o Cube
|
||||
v 0.437500 -0.312500 0.031250
|
||||
v 0.437500 -0.312500 -0.031250
|
||||
v 0.437500 0.312500 0.031250
|
||||
v 0.437500 0.312500 -0.031250
|
||||
v -0.437500 -0.312500 0.031250
|
||||
v -0.437500 -0.312500 -0.031250
|
||||
v -0.437500 0.312500 0.031250
|
||||
v -0.437500 0.312500 -0.031250
|
||||
v 0.437500 -0.312500 0.031250
|
||||
v 0.437500 -0.312500 -0.031250
|
||||
v 0.437500 0.312500 0.031250
|
||||
v 0.437500 0.312500 -0.031250
|
||||
v -0.437500 -0.312500 0.031250
|
||||
v -0.437500 -0.312500 -0.031250
|
||||
v -0.437500 0.312500 0.031250
|
||||
v -0.437500 0.312500 -0.031250
|
||||
v 0.500000 0.312500 -0.000000
|
||||
v 0.500000 0.500000 0.000000
|
||||
v -0.500000 0.312500 -0.000000
|
||||
v -0.500000 0.500000 0.000000
|
||||
vt 0.468750 0.812500
|
||||
vt 0.031250 0.812500
|
||||
vt 0.031250 0.187500
|
||||
vt 0.468750 0.187500
|
||||
vt 0.531250 0.812500
|
||||
vt 0.968750 0.812500
|
||||
vt 0.968750 0.187500
|
||||
vt 0.531250 0.187500
|
||||
vt 0.234375 0.000000
|
||||
vt 0.234375 1.000000
|
||||
vt 0.015625 1.000000
|
||||
vt 0.015625 -0.000000
|
||||
vt 0.609375 -0.000000
|
||||
vt 0.609375 1.000000
|
||||
vt 0.390625 1.000000
|
||||
vt 0.390625 -0.000000
|
||||
vt 0.765625 0.000000
|
||||
vt 0.765625 1.000000
|
||||
vt 1.000000 0.812500
|
||||
vt 1.000000 1.000000
|
||||
vt 0.000000 1.000000
|
||||
vt -0.000000 0.812500
|
||||
vn 0.0000 0.0000 -1.0000
|
||||
vn 0.0000 -0.0000 1.0000
|
||||
vn 0.0000 -1.0000 0.0000
|
||||
vn 0.0000 1.0000 0.0000
|
||||
vn 1.0000 -0.0000 0.0000
|
||||
vn -1.0000 -0.0000 0.0000
|
||||
g Cube_Cube_front-back
|
||||
s off
|
||||
f 8/1/1 4/2/1 2/3/1 6/4/1
|
||||
f 3/5/2 7/6/2 5/7/2 1/8/2
|
||||
g Cube_Cube_edges
|
||||
f 13/9/3 14/10/3 10/11/3 9/12/3
|
||||
f 11/13/4 12/14/4 16/15/4 15/16/4
|
||||
f 11/13/5 9/17/5 10/18/5 12/14/5
|
||||
f 13/9/6 15/16/6 16/15/6 14/10/6
|
||||
g Cube_Cube_hangers
|
||||
f 19/19/1 20/20/1 18/21/1 17/22/1
|
@ -7,7 +7,8 @@ signs_lib.register_sign("default:sign_wall_wood", {
|
||||
"signs_lib_sign_wall_wooden.png",
|
||||
"signs_lib_sign_wall_wooden_edges.png",
|
||||
},
|
||||
entity_info = "standard"
|
||||
entity_info = "standard",
|
||||
allow_hanging = true,
|
||||
})
|
||||
|
||||
signs_lib.register_sign("default:sign_wall_steel", {
|
||||
@ -23,6 +24,12 @@ signs_lib.register_sign("default:sign_wall_steel", {
|
||||
entity_info = "standard"
|
||||
})
|
||||
|
||||
minetest.register_alias("signs:sign_hanging", "default:sign_wall_wood_hanging")
|
||||
minetest.register_alias("basic_signs:hanging_sign", "default:sign_wall_wood_hanging")
|
||||
|
||||
table.insert(signs_lib.lbm_restore_nodes, "signs:sign_hanging")
|
||||
table.insert(signs_lib.lbm_restore_nodes, "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")
|
||||
|
BIN
textures/signs_lib_hangers.png
Normal file
BIN
textures/signs_lib_hangers.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 155 B |
Loading…
Reference in New Issue
Block a user