mirror of
https://github.com/mt-mods/signs_lib.git
synced 2024-12-25 16:50:17 +01:00
allow visible text on
floor and when flat on a ceiling
This commit is contained in:
parent
03bd471230
commit
01e2adaa46
31
api.lua
31
api.lua
@ -105,7 +105,7 @@ end
|
|||||||
function signs_lib.spawn_entity(pos, texture)
|
function signs_lib.spawn_entity(pos, texture)
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
local def = minetest.registered_items[node.name]
|
local def = minetest.registered_items[node.name]
|
||||||
if not def or not def.entity_info or not def.entity_info.yaw[node.param2 + 1] then return end
|
if not def or not def.entity_info then return end
|
||||||
|
|
||||||
local text_scale = (node and node.text_scale) or signs_lib.default_text_scale
|
local text_scale = (node and node.text_scale) or signs_lib.default_text_scale
|
||||||
local objects = minetest.get_objects_inside_radius(pos, 0.5)
|
local objects = minetest.get_objects_inside_radius(pos, 0.5)
|
||||||
@ -117,7 +117,33 @@ function signs_lib.spawn_entity(pos, texture)
|
|||||||
obj = minetest.add_entity(pos, "signs_lib:text")
|
obj = minetest.add_entity(pos, "signs_lib:text")
|
||||||
end
|
end
|
||||||
|
|
||||||
obj:setyaw(def.entity_info.yaw[node.param2 + 1])
|
local yaw = def.entity_info.yaw[node.param2 + 1]
|
||||||
|
local pitch = 0
|
||||||
|
|
||||||
|
if not string.find(node.name, "onpole") and not string.find(node.name, "hanging") then
|
||||||
|
local rot90 = math.pi/2
|
||||||
|
|
||||||
|
if def.paramtype2 == "wallmounted" then
|
||||||
|
if node.param2 == 1 then -- on floor
|
||||||
|
pitch = -rot90
|
||||||
|
yaw = 0
|
||||||
|
elseif node.param2 == 0 then -- on ceiling
|
||||||
|
pitch = rot90
|
||||||
|
yaw = math.pi
|
||||||
|
end
|
||||||
|
elseif def.paramtype2 == "facedir" then
|
||||||
|
if node.param2 == 4 then
|
||||||
|
pitch = -rot90
|
||||||
|
yaw = 0
|
||||||
|
elseif node.param2 == 6 then
|
||||||
|
pitch = rot90
|
||||||
|
yaw = math.pi
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if yaw then
|
||||||
|
obj:set_rotation({x = pitch, y = yaw, z=0})
|
||||||
|
|
||||||
if not texture then
|
if not texture then
|
||||||
obj:set_properties({
|
obj:set_properties({
|
||||||
@ -132,6 +158,7 @@ function signs_lib.spawn_entity(pos, texture)
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- rotation
|
-- rotation
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user