Files
Bubberstation/code/modules
esainane d0e8bf35de Many smart pipe fixes (#60981)
* Smart pipes now actually go over smart pipes

This was ostensibly the main feature of smart pipes, so should be
fairly important

Parentheses are technically not required around the |, but I think
it's important to emphasise the importance of parentheses around
bitwise operators as this was apparently broken since 3e8407c471

Also purge var/connections and var/connection_num, since it's
literally only used for a `machine.connection_num < 3` check
which is completely redundant, and we already build a bitfield
tracking active directions.

* Smart pipes bridge over straight pipe types

This improves bridging to now go over most devices where possible,
letting you, for example, bridge over a perpindicular layer adapter.

* Pipe construction: Better documentation

Cleans up smart pipe documentation to match what's actually happening.

No functional changes.

* Skip pipes on different layers earlier

This prevents a pipe being made into a bridge perpindicular to a pipe
on a completely different layer, then failing to turn into a bridge
perpindicular to a relevant pipe.

* Pop superfluous parentheses

* Prevent creation of stub pipes

Setting the RPD to create a smart pipe that can only connect in one
direction would cause it to create invisible pipes that would still
block the placement of other pipes.

* The RPD can now reprogram smart pipes

The RPD can only affect smart pipes in directions that they are not
currently connected to.

This makes it easier to adjust designs after the fact, including
prevening round-start pipes from eagerly linking to a grey layer
adapter.

* Even smarter pipes

No more turning into bridge pipes. We now only try to be smart if
placement would fail, and we do our best to find a solution
whenever there is at least one smart pipe involved, regardless
of whether we're currently placing a smart pipe or not.

We never reconfigure any directions that a smart pipe is currently
connected, and we never reconfigure a smart pipe to have one or less
usable directions.

* Smartly go across perpindicular layer adapters

Also works when we're placing a layer adapter perpindicular to a
promiscuous smart pipe

* Pipes: Factor out loops and some bitfiddling

Create and use helpers with documented purposes over inline bitfiddling,
when it makes sense.

Many loops and switch statements were recreating information that was
already there.

Some relationships between pipe bitfield states were already assumed.
This centralises the functionality that relies upon these assumptions,
places them where the bits are defined, and documents them.

Rewrite some bitwise operations to be more idiomatic.

* Smart pipes: Debugging output

I normally clean history before pushing changes to any project,
but I feel like this should be saved.

* Revert "Smart pipes: Debugging output"

This reverts commit bb3aa76cf6d08e4d0951113a26fc9d48b6bc1735.

* Add trailing comma

The lack of this was making the linter sad
2021-08-29 15:42:53 +03:00
..
2021-08-29 13:11:24 +03:00
2021-08-27 11:18:51 +02:00
2021-08-20 16:02:48 -04:00
2021-08-21 18:31:34 +02:00
2021-08-16 12:21:45 -04:00