pixelnodebox = function ( size, boxes )
local fixed = { };
local i, box;
for i, box in ipairs(boxes) do
local x, y, z, w, h, l = unpack(box);
fixed[#fixed + 1] = {
(x / size) - 0.5,
(y / size) - 0.5,
(z / size) - 0.5,
((x + w) / size) - 0.5,
((y + h) / size) - 0.5,
((z + l) / size) - 0.5,
};
end
return {
type = "fixed";
fixed = fixed;
};
end;
minetest.register_node("modname:nodename", {
drawtype = "nodebox";
-- Other node defs here...
node_box = pixelnodebox(32, {
-- X Y Z W H L
{ 0, 0, 17, 32, 32, 12 }, -- Monitor Screen
{ 3, 3, 29, 26, 26, 3 }, -- Monitor Tube
{ 0, 0, 0, 32, 4, 17 }, -- Keyboard
});
});
Inocudom wrote:Is there a way to disable this mod's version of the tree trunks should it be necessary to do so?
VanessaE wrote:In light of the above, I'd like to reiterate my previous suggestion that the furniture and bathroom kit be split into a separate mod (or two) from trees/papyrus.
Jade_0420 wrote:IS THIS FOR 0.4.4?
kaeza wrote:About node boxes, you may find this useful (it's part of my computers mod):
- Code: Select all
pixelnodebox = function ( size, boxes )
local fixed = { };
local i, box;
for i, box in ipairs(boxes) do
local x, y, z, w, h, l = unpack(box);
fixed[#fixed + 1] = {
(x / size) - 0.5,
(y / size) - 0.5,
(z / size) - 0.5,
((x + w) / size) - 0.5,
((y + h) / size) - 0.5,
((z + l) / size) - 0.5,
};
end
return {
type = "fixed";
fixed = fixed;
};
end;
It is useful if you draw the basic layout of the object in a paint program, and then use the pixel coordinates for the nodeboxes. That way, you can use the layout you drew as a texture and it will map 1:1 into the nodeboxes.
Here's a piece of code that illustrates the usage:
- Code: Select all
minetest.register_node("modname:nodename", {
drawtype = "nodebox";
-- Other node defs here...
node_box = pixelnodebox(32, {
-- X Y Z W H L
{ 0, 0, 17, 32, 32, 12 }, -- Monitor Screen
{ 3, 3, 29, 26, 26, 3 }, -- Monitor Tube
{ 0, 0, 0, 32, 4, 17 }, -- Keyboard
});
});
(X, Y, Z) is the position of the nodebox, W is the width (lenght in X direction), H is the height (length in Y direction), and L is length (length in Z direction).
Look at my mod for a real usage.
deivan wrote:A link please kaeza. :D
Ambrace wrote:Sorry if someone answered this already; but I couldn't find the answer. How do I install this on Minetest? Like which parts go where? I tried Textures in texture area and mods in mod area but it doesn't seem to be working.
Users browsing this forum: No registered users and 3 guests