forked from Mirrorlandia_minetest/minetest
Put torch/signlike node on floor if no paramtype2 (#11074)
This commit is contained in:
parent
16e5b39e1d
commit
90a7bd6a0a
@ -84,9 +84,6 @@ core.register_entity(":__builtin:falling_node", {
|
|||||||
local textures
|
local textures
|
||||||
if def.tiles and def.tiles[1] then
|
if def.tiles and def.tiles[1] then
|
||||||
local tile = def.tiles[1]
|
local tile = def.tiles[1]
|
||||||
if def.drawtype == "torchlike" and def.paramtype2 ~= "wallmounted" then
|
|
||||||
tile = def.tiles[2] or def.tiles[1]
|
|
||||||
end
|
|
||||||
if type(tile) == "table" then
|
if type(tile) == "table" then
|
||||||
tile = tile.name
|
tile = tile.name
|
||||||
end
|
end
|
||||||
@ -147,11 +144,7 @@ core.register_entity(":__builtin:falling_node", {
|
|||||||
|
|
||||||
-- Rotate entity
|
-- Rotate entity
|
||||||
if def.drawtype == "torchlike" then
|
if def.drawtype == "torchlike" then
|
||||||
if def.paramtype2 == "wallmounted" then
|
|
||||||
self.object:set_yaw(math.pi*0.25)
|
self.object:set_yaw(math.pi*0.25)
|
||||||
else
|
|
||||||
self.object:set_yaw(-math.pi*0.25)
|
|
||||||
end
|
|
||||||
elseif ((node.param2 ~= 0 or def.drawtype == "nodebox" or def.drawtype == "mesh")
|
elseif ((node.param2 ~= 0 or def.drawtype == "nodebox" or def.drawtype == "mesh")
|
||||||
and (def.wield_image == "" or def.wield_image == nil))
|
and (def.wield_image == "" or def.wield_image == nil))
|
||||||
or def.drawtype == "signlike"
|
or def.drawtype == "signlike"
|
||||||
@ -165,8 +158,12 @@ core.register_entity(":__builtin:falling_node", {
|
|||||||
if euler then
|
if euler then
|
||||||
self.object:set_rotation(euler)
|
self.object:set_rotation(euler)
|
||||||
end
|
end
|
||||||
elseif (def.paramtype2 == "wallmounted" or def.paramtype2 == "colorwallmounted") then
|
elseif (def.paramtype2 == "wallmounted" or def.paramtype2 == "colorwallmounted" or def.drawtype == "signlike") then
|
||||||
local rot = node.param2 % 8
|
local rot = node.param2 % 8
|
||||||
|
if (def.drawtype == "signlike" and def.paramtype2 ~= "wallmounted" and def.paramtype2 ~= "colorwallmounted") then
|
||||||
|
-- Change rotation to "floor" by default for non-wallmounted paramtype2
|
||||||
|
rot = 1
|
||||||
|
end
|
||||||
local pitch, yaw, roll = 0, 0, 0
|
local pitch, yaw, roll = 0, 0, 0
|
||||||
if def.drawtype == "nodebox" or def.drawtype == "mesh" then
|
if def.drawtype == "nodebox" or def.drawtype == "mesh" then
|
||||||
if rot == 0 then
|
if rot == 0 then
|
||||||
|
@ -1140,14 +1140,20 @@ Look for examples in `games/devtest` or `games/minetest_game`.
|
|||||||
used to compensate for how `glasslike` reduces visual thickness.
|
used to compensate for how `glasslike` reduces visual thickness.
|
||||||
* `torchlike`
|
* `torchlike`
|
||||||
* A single vertical texture.
|
* A single vertical texture.
|
||||||
|
* If `paramtype2="[color]wallmounted":
|
||||||
* If placed on top of a node, uses the first texture specified in `tiles`.
|
* If placed on top of a node, uses the first texture specified in `tiles`.
|
||||||
* If placed against the underside of a node, uses the second texture
|
* If placed against the underside of a node, uses the second texture
|
||||||
specified in `tiles`.
|
specified in `tiles`.
|
||||||
* If placed on the side of a node, uses the third texture specified in
|
* If placed on the side of a node, uses the third texture specified in
|
||||||
`tiles` and is perpendicular to that node.
|
`tiles` and is perpendicular to that node.
|
||||||
|
* If `paramtype2="none"`:
|
||||||
|
* Will be rendered as if placed on top of a node (see
|
||||||
|
above) and only the first texture is used.
|
||||||
* `signlike`
|
* `signlike`
|
||||||
* A single texture parallel to, and mounted against, the top, underside or
|
* A single texture parallel to, and mounted against, the top, underside or
|
||||||
side of a node.
|
side of a node.
|
||||||
|
* If `paramtype2="[color]wallmounted", it rotates according to `param2`
|
||||||
|
* If `paramtype2="none"`, it will always be on the floor.
|
||||||
* `plantlike`
|
* `plantlike`
|
||||||
* Two vertical and diagonal textures at right-angles to each other.
|
* Two vertical and diagonal textures at right-angles to each other.
|
||||||
* See `paramtype2 = "meshoptions"` above for other options.
|
* See `paramtype2 = "meshoptions"` above for other options.
|
||||||
|
@ -129,14 +129,10 @@ minetest.register_node("testnodes:fencelike", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("testnodes:torchlike", {
|
minetest.register_node("testnodes:torchlike", {
|
||||||
description = S("Torchlike Drawtype Test Node"),
|
description = S("Floor Torchlike Drawtype Test Node"),
|
||||||
drawtype = "torchlike",
|
drawtype = "torchlike",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
tiles = {
|
tiles = { "testnodes_torchlike_floor.png^[colorize:#FF0000:64" },
|
||||||
"testnodes_torchlike_floor.png",
|
|
||||||
"testnodes_torchlike_ceiling.png",
|
|
||||||
"testnodes_torchlike_wall.png",
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
walkable = false,
|
walkable = false,
|
||||||
@ -161,9 +157,21 @@ minetest.register_node("testnodes:torchlike_wallmounted", {
|
|||||||
groups = { dig_immediate = 3 },
|
groups = { dig_immediate = 3 },
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_node("testnodes:signlike", {
|
minetest.register_node("testnodes:signlike", {
|
||||||
|
description = S("Floor Signlike Drawtype Test Node"),
|
||||||
|
drawtype = "signlike",
|
||||||
|
paramtype = "light",
|
||||||
|
tiles = { "testnodes_signlike.png^[colorize:#FF0000:64" },
|
||||||
|
|
||||||
|
|
||||||
|
walkable = false,
|
||||||
|
groups = { dig_immediate = 3 },
|
||||||
|
sunlight_propagates = true,
|
||||||
|
inventory_image = fallback_image("testnodes_signlike.png"),
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node("testnodes:signlike_wallmounted", {
|
||||||
description = S("Wallmounted Signlike Drawtype Test Node"),
|
description = S("Wallmounted Signlike Drawtype Test Node"),
|
||||||
drawtype = "signlike",
|
drawtype = "signlike",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
@ -583,7 +591,7 @@ scale("plantlike",
|
|||||||
scale("torchlike_wallmounted",
|
scale("torchlike_wallmounted",
|
||||||
S("Double-sized Wallmounted Torchlike Drawtype Test Node"),
|
S("Double-sized Wallmounted Torchlike Drawtype Test Node"),
|
||||||
S("Half-sized Wallmounted Torchlike Drawtype Test Node"))
|
S("Half-sized Wallmounted Torchlike Drawtype Test Node"))
|
||||||
scale("signlike",
|
scale("signlike_wallmounted",
|
||||||
S("Double-sized Wallmounted Signlike Drawtype Test Node"),
|
S("Double-sized Wallmounted Signlike Drawtype Test Node"),
|
||||||
S("Half-sized Wallmounted Signlike Drawtype Test Node"))
|
S("Half-sized Wallmounted Signlike Drawtype Test Node"))
|
||||||
scale("firelike",
|
scale("firelike",
|
||||||
|
@ -313,13 +313,15 @@ static scene::SMesh *createSpecialNodeMesh(Client *client, MapNode n,
|
|||||||
// keep it
|
// keep it
|
||||||
} else if (f.param_type_2 == CPT2_WALLMOUNTED ||
|
} else if (f.param_type_2 == CPT2_WALLMOUNTED ||
|
||||||
f.param_type_2 == CPT2_COLORED_WALLMOUNTED) {
|
f.param_type_2 == CPT2_COLORED_WALLMOUNTED) {
|
||||||
if (f.drawtype == NDT_TORCHLIKE)
|
if (f.drawtype == NDT_TORCHLIKE ||
|
||||||
n.setParam2(1);
|
f.drawtype == NDT_SIGNLIKE ||
|
||||||
else if (f.drawtype == NDT_SIGNLIKE ||
|
|
||||||
f.drawtype == NDT_NODEBOX ||
|
f.drawtype == NDT_NODEBOX ||
|
||||||
f.drawtype == NDT_MESH)
|
f.drawtype == NDT_MESH) {
|
||||||
n.setParam2(4);
|
n.setParam2(4);
|
||||||
}
|
}
|
||||||
|
} else if (f.drawtype == NDT_SIGNLIKE || f.drawtype == NDT_TORCHLIKE) {
|
||||||
|
n.setParam2(1);
|
||||||
|
}
|
||||||
gen.renderSingle(n.getContent(), n.getParam2());
|
gen.renderSingle(n.getContent(), n.getParam2());
|
||||||
|
|
||||||
colors->clear();
|
colors->clear();
|
||||||
|
@ -159,8 +159,11 @@ u8 MapNode::getWallMounted(const NodeDefManager *nodemgr) const
|
|||||||
{
|
{
|
||||||
const ContentFeatures &f = nodemgr->get(*this);
|
const ContentFeatures &f = nodemgr->get(*this);
|
||||||
if (f.param_type_2 == CPT2_WALLMOUNTED ||
|
if (f.param_type_2 == CPT2_WALLMOUNTED ||
|
||||||
f.param_type_2 == CPT2_COLORED_WALLMOUNTED)
|
f.param_type_2 == CPT2_COLORED_WALLMOUNTED) {
|
||||||
return getParam2() & 0x07;
|
return getParam2() & 0x07;
|
||||||
|
} else if (f.drawtype == NDT_SIGNLIKE || f.drawtype == NDT_TORCHLIKE) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user