SwitchCraftCC / Plethora-Fabric

A peripheral provider for ComputerCraft, ported to Fabric
MIT License
16 stars 11 forks source link

fix: laser angle offsets #95

Open hugeblank opened 5 months ago

hugeblank commented 5 months ago

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

hugeblank commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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.