-
Notifications
You must be signed in to change notification settings - Fork 155
support every paramtype2 #662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
end | ||
rotation = rotation % 24 | ||
|
||
new_param2 = aux * 32 + rotation | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idea: You could move this code up such that a final else
case could be used for return
. It would effectively deduplicate the lines L38-47.
Admittedly this code does not look great (magic numbers and many different cases) but I don't see much that could be done to improve it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be done
if mode == ROTATE_FACE then | ||
rotation = rotation + 1 | ||
elseif mode == ROTATE_AXIS then | ||
rotation = rotation + 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I use paramtype2 = "degrotate",
in the nodedef of "default:aspen_sapling"
(nodes.lua), the rotation oddly jumps in this case. There is no such anomaly with paramtype2 = "degrotate",
.
Is it because you're using modulo 32 in L94, but modulo 24 in L101?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
describe the jump
(%32 is bitwise extraction, %24 is rotation modulo)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry. I meant that colordegorate
jumps oddly whereas degrotate
works well.
It turns out this code is not flawed but my perception. It simply turned too far to notice at a stationary viewing position. When following the node around in its rotation, there is no such "glitch" or "jump".
Resolved.
local axisdir = math.floor(rotationPart / 4) | ||
local rotation = rotationPart - axisdir * 4 | ||
if mode == ROTATE_FACE then | ||
rotationPart = axisdir * 4 + nextrange(rotation, 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
luacheck is yet unhappy technic/tools/sonic_screwdriver.lua:11:16: unused function nextrange
To fix that, you could ignore the warning (I hope it's the correct code) or remove the function.
-- luacheck: push ignore 211
local function foobar()
end
-- luacheck: pop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the function
done: 150e738
Thanks. Looks good. Will merge in a few days unless there are objections. |
No description provided.