Skip to content

fix: laser angle offsets#95

Open
hugeblank wants to merge 4 commits into1.20.1from
hugeblank/laser-angle-fix
Open

fix: laser angle offsets#95
hugeblank wants to merge 4 commits into1.20.1from
hugeblank/laser-angle-fix

Conversation

@hugeblank
Copy link
Contributor

Changes the position from which the laser is fired from block entities by taking the motion of the laser and clamping it to the perimeter of the cube from the center of the block. This could potentially break existing programs that depended on the weird prior behavior.

Program to demonstrate changes, to be run in a turtle with a laser in the left slot, some distance above the ground (for visibility):

local l = peripheral.wrap("left")
for p = 0, 360, 5 do
  for y = 0, 360, 5 do
    l.fire(y, p, 0.5)
  end
end

fixes: #94

Copy link
Member

@Lemmmy Lemmmy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why two calls to setPosition?

@hugeblank
Copy link
Contributor Author

Every time I tried using one call, the position would be messed up. I accepted this as an eldritch horror of the game and didn't bother digging into it any deeper. I guess I could look more into it today though.

@Wojbie
Copy link

Wojbie commented Apr 3, 2024

This changes seem to also touch part of code dealing with standalone manipulators. Have you verified if they still work as expected in all cardinal placements after this change?

@hugeblank
Copy link
Contributor Author

I have, yes. The positions are near identical except for in conditions outlined in the issue that prompted this PR. The code is easily modifiable to test with an adjacent manipulator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lasers fired from turtles originate a block lower than they should when pitch is 180

3 participants