Skip to content

Complete - (Not an actual) Powernet Optimization

Rob Nelson requested to merge pull/3662/powernets into Bleeding-Edge

Created by: clusterfack

This sets to put right the 'optimization' someone made to powernets a long time ago so that they could handle large explosions. Unfortunately the "defer powernet rebuild" never actually rebuilt the powernets causing them to simply pretend powernets were connected when destroyed by explosions or singularities.

At some point this problem has been further exacerbated to the point where disconnecting powernets doesn't work in the first place. So this PR aims to take a hybrid of the pipenet method of datum networks.

  1. Expand properly when adding something to the powernet (pipenets currently dont do this for shame)
  2. When the powernet is destroyed by cutting or explosions or something, null the powernet out and store some data about it in the cables
  3. When the powernet is used by a machine/cable or by the next tick, rebuild it from the cables giving it its old properties for the new tick update

To be clear: this has no performance gain or loss on the primary server, because the primary server uses defer_powernet_rebuild which results in the same performance but bugs out powernets. Whereas this doesn't bug out powernets.

Also on a related note, this makes make powernets not be slow.

Fixes #3388 (closed) Fixes #3368 (closed) Fixes #3266 (closed)

Merge request reports