This line should probably be

 destroyed |= "\ref[A]"
destroyed["\ref[A]"] = world.time

So that everything is always added in time order instead of just usually being in time order. With the previous checks, this should be safe.