diff options
| author | Wuzzy <Wuzzy@disroot.org> | 2022-09-16 13:18:55 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-16 13:18:55 +0200 |
| commit | 1d04903c1973591e795d3275b900d76d7cb7877a (patch) | |
| tree | 06891c6fe3075c1868832bc0007308e525cef70f /builtin/game/item.lua | |
| parent | b5e7280708221cdcca89df7d16f2aea19e4b3c4c (diff) | |
| download | minetest-1d04903c1973591e795d3275b900d76d7cb7877a.tar.xz | |
Add paramtype2s for 4 horizontal rotations and 64 colors (#11431)
4dir is like facedir, but only for 4 horizontal directions: NESW. It is identical in behavior to facedir otherwise. The reason why game makers would want to use this over facedir is 1) simplicity and 2) you get 6 free bits.
It can be used for things like chests and furnaces and you don't need or want them to "flip them on the side" (like you could with facedir).
color4dir is like colorfacedir, but you get 64 colors instead of only 8.
Diffstat (limited to 'builtin/game/item.lua')
| -rw-r--r-- | builtin/game/item.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/builtin/game/item.lua b/builtin/game/item.lua index 00601c68c..af3fcb645 100644 --- a/builtin/game/item.lua +++ b/builtin/game/item.lua @@ -205,7 +205,9 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2, newnode.param2 = core.dir_to_wallmounted(dir) -- Calculate the direction for furnaces and chests and stuff elseif (def.paramtype2 == "facedir" or - def.paramtype2 == "colorfacedir") and not param2 then + def.paramtype2 == "colorfacedir" or + def.paramtype2 == "4dir" or + def.paramtype2 == "color4dir") and not param2 then local placer_pos = placer and placer:get_pos() if placer_pos then local dir = vector.subtract(above, placer_pos) @@ -225,6 +227,8 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2, color_divisor = 8 elseif def.paramtype2 == "colorfacedir" then color_divisor = 32 + elseif def.paramtype2 == "color4dir" then + color_divisor = 4 elseif def.paramtype2 == "colordegrotate" then color_divisor = 32 end |
