mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-02-09 07:30:04 +00:00
![Jonathan Coates](/assets/img/avatar_default.png)
Previously we had the invariant that if we had a server monitor, we also had a terminal. When a monitor shrank into a place, we deleted the monitor, and then recreated it when a peripheral was requested. As of ab785a090698e6972caac95691393428c6f8370b this has changed slightly, and we now just delete the terminal (keeping the ServerMonitor around). However, we didn't adjust the peripheral code accordingly, meaning we didn't recreate the /terminal/ when a peripheral was requested. The fix for this is very simple - most of the rest of this commit is some additional code for ensuring monitor invariants hold, so we can write tests with a little more confidence. I'm not 100% sold on this approach. It's tricky having a double layer of nullable state (ServerMonitor, and then the terminal). However, I think this is reasonable - the ServerMonitor is a reference to the multiblock, and the Terminal is part of the multiblock's state. Even after all the refactors, monitor code is still nastier than I'd like :/. Fixes #1608