Fix magnocompass rotation if placed on stair
This commit is contained in:
parent
3ae44ce19d
commit
a25cccd3e1
@ -94,6 +94,7 @@ This is the list of all groups used for nodes. Note: If no number/rating is spec
|
|||||||
* `uses_canonical_compass`: This is used for nodes that can carry a compass. If this group is set, the compass will be
|
* `uses_canonical_compass`: This is used for nodes that can carry a compass. If this group is set, the compass will be
|
||||||
added to the node in "canonical" form, i.e. the needle always faces upwards. Otherwise,
|
added to the node in "canonical" form, i.e. the needle always faces upwards. Otherwise,
|
||||||
the compass needle is adjusted according to the node position and rotation (wallmounted/facedir).
|
the compass needle is adjusted according to the node position and rotation (wallmounted/facedir).
|
||||||
|
* `special_magnocompass_node_handling=1`: Node will handle placing a magno compass in a special way (see `rp_nav`)
|
||||||
* `seed`: A farming item that can be planted on the ground to spawn a plant that will grow over time.
|
* `seed`: A farming item that can be planted on the ground to spawn a plant that will grow over time.
|
||||||
Usually this is a seed, but it does not have to be.
|
Usually this is a seed, but it does not have to be.
|
||||||
* `_attached_node_top=1`: Node attaches to the top of another node. If the node above disappears, the node itself detaches
|
* `_attached_node_top=1`: Node attaches to the top of another node. If the node above disappears, the node itself detaches
|
||||||
|
@ -252,7 +252,11 @@ minetest.register_node("rp_itemshow:frame",{
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
groups = {choppy = 2, dig_immediate = 2, creative_decoblock = 1},
|
groups = {
|
||||||
|
choppy = 2, dig_immediate = 2, creative_decoblock = 1,
|
||||||
|
-- So that placing a magnocompass on it will point
|
||||||
|
-- the needle to the correct direction
|
||||||
|
special_magnocompass_place_handling = 1},
|
||||||
sounds = rp_sounds.node_sound_defaults(),
|
sounds = rp_sounds.node_sound_defaults(),
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
on_rotate = function(pos, node, user, mode, new_param2)
|
on_rotate = function(pos, node, user, mode, new_param2)
|
||||||
|
@ -214,12 +214,16 @@ for c=0,7 do
|
|||||||
end
|
end
|
||||||
-- Otherwise, adjust the compass needle so it shows to the correct direction
|
-- Otherwise, adjust the compass needle so it shows to the correct direction
|
||||||
else
|
else
|
||||||
local nodedef = minetest.registered_nodes[node.name]
|
|
||||||
local nodeyaw = 0
|
local nodeyaw = 0
|
||||||
if nodedef and (nodedef.paramtype2 == "wallmounted" or nodedef.paramtype2 == "colorwallmounted") then
|
-- If this group is set, calculate the node's "yaw" and use that
|
||||||
nodeyaw = minetest.dir_to_yaw(minetest.wallmounted_to_dir(node.param2))
|
-- for the placed magnocompass
|
||||||
elseif nodedef and (nodedef.paramtype2 == "facedir" or nodedef.paramtype2 == "colorfacedir") then
|
if minetest.get_item_group(node.name, "special_magnocompass_place_handling") == 1 then
|
||||||
nodeyaw = minetest.dir_to_yaw(minetest.facedir_to_dir(node.param2))
|
local nodedef = minetest.registered_nodes[node.name]
|
||||||
|
if nodedef and (nodedef.paramtype2 == "wallmounted" or nodedef.paramtype2 == "colorwallmounted") then
|
||||||
|
nodeyaw = minetest.dir_to_yaw(minetest.wallmounted_to_dir(node.param2))
|
||||||
|
elseif nodedef and (nodedef.paramtype2 == "facedir" or nodedef.paramtype2 == "colorfacedir") then
|
||||||
|
nodeyaw = minetest.dir_to_yaw(minetest.facedir_to_dir(node.param2))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
-- Special case: Item frame. Add a little offset for nodepos as
|
-- Special case: Item frame. Add a little offset for nodepos as
|
||||||
-- the compass entity is at the side of the node rather than the center.
|
-- the compass entity is at the side of the node rather than the center.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user