From e2167c4ba3bda30a5a9368ceb8027593bf3fb356 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Wed, 5 Jun 2024 00:14:17 +0100 Subject: [PATCH] core.param2: add todo reimplement notice Ref https://discord.com/channels/1135598362821935254/1247681375935533119 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --------------------------------------- Hi, a wild //orient+ appeared! While it (probably) doesn't crash, it also unfortunately doesn't work yet. This is because facedir e.g. points towards the direction the node is pointing, and minetest.facedir_to_dir doesn't capture all the nuance of how the node is pointing, and e.g. if a node is pointing +y and you want to rotate by (0, 90, 0) [degrees], then the current implementation won't do anything. Then I decided that this is silly and there has to be a solution. After all, screwdriver2 has a great implementation! https://content.minetest.net/packages/12Me21/screwdriver2/ ....then I found this lookup table in their codebase: https://github.com/12Me21/screwdriver2/blob/master/init.lua#L75-L79 ....aaaaarrrggggghhhhh //orient+ is such a pain to implement! and my existing implementation is so neat 😢 https://github.com/sbrl/Minetest-WorldEditAdditions/blob/1dd073f14bcac8e26a5ced2abe54c709099b1de2/worldeditadditions_core/utils/param2.lua so, in other words, although I've implemented //orient+ I'm going to have to reimplement the nuts-and-bolts function that does the rotation, which may make it slightly more complicated and annoying to implement support for nodes with param2 types other than facedir. /rant about Minetest's param2 value and rotations 😛 --- worldeditadditions_core/utils/param2.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/worldeditadditions_core/utils/param2.lua b/worldeditadditions_core/utils/param2.lua index e6d0fe4..05acb05 100644 --- a/worldeditadditions_core/utils/param2.lua +++ b/worldeditadditions_core/utils/param2.lua @@ -3,6 +3,8 @@ local Vector3 = core.Vector3 --- -- @module worldeditadditions_core.param2 +-- TODO Reimplement for facedir ref https://github.com/12Me21/screwdriver2/blob/master/init.lua#L75-L79 + -- //set -- //set param2|p2 @@ -25,6 +27,7 @@ local function dir_to_param2(param2_type, dir) end + --- Rotates the given param2 value of the given type by the given COMPILED list of rotations. -- In other words, reorients a given param2 value of a given param2_type (aka paramtype2 in the Minetest engine but the Minetest engine naming scheme is dumb in this case) according to a given COMPILED rotation list. -- @param param2 number The param2 value to rotate.