Skip to content

[Optics] Fixes Beamsplitter Beam Duplication

Rob Nelson requested to merge pull/13419/optics-mirror-beam-spam-fix into Bleeding-Edge

Created by: N3X15

Executive Summary

Fixes #12077 (closed), a severe exploitable issue that leaves beams floating around after a beam to a beamsplitter is interrupted. This can result in free energy and crashes, and also causes some runtime errors.

Analysis

This ended up being a fucking mess, and it looks like the underlying cause is a problem with BYOND's GC: When a list index is set from non-null to null, BYOND removes that position for some FUCKING reason. In the case of the mirror, which requires everything to stay in their assigned positions, it results in the following sequence of events:

  1. Mirror nukes a beam because it's no longer needed.
  2. GC nukes that position in the list because it is retard fuckstupid.
  3. Beam in the position above falls to the position just nuked.
  4. Loop continues.
  5. Loop runs into the end of the list because the list size changed from 4 to 3 and triggers a runtime and jumps out of the update process.
  6. Players figure out they can stack beams and get jiggawatts of juice and even negative energy.

Testing Apparatus

Just to show I did test this, the following in test_tiny.dmm is what I used to test the bug. dreammaker_2017-01-11_22-59-37

Changelog

🆑

  • bugfix: Fixed a series of bugs and exploits involving mirrors. WE RESPECT THE LAW OF THERMODYNAMICS IN THIS HOUSE.

Merge request reports