Replace thermomachine dynamic per-tick power with flat target-based draw#617
Draft
Replace thermomachine dynamic per-tick power with flat target-based draw#617
Conversation
…ased power draw Co-authored-by: Ossa88 <8151625+Ossa88@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix thermomachine power calculation issues due to tick interference
Replace thermomachine dynamic per-tick power with flat target-based draw
Mar 9, 2026
Collaborator
|
I kinda wanted to see how this system functioned as it was kinda interesting. None the less CoPilot basically undid my last PR, which only worked when a single thermo machine was on the network, and totally failed the second multiple thermo machines on the same network. For whatever reason I never thought to think of testing two machines both fighting to heat up, and cool down, the same pipe network. Nor did I realize that each instance of the machine registering how much power it was consuming... all shared the same registration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Multiple thermomachines on the same gas network race on the shared area power total: each tick they remove their old registration and add a new one, causing compounding interference when two machines process in the same tick.
Changes
recalculate_power()proc: computes a stableactive_power_usagefrom the target temperature offset from room temp (T20C), registered once via standardset_active_power()/set_idle_power():last_registered_powervariable and the entire per-tickaddStaticPower/removeStaticPowerdance fromprocess_atmos()recalculate_power()called on all state-changing paths:RefreshParts(),ui_act()(power toggle + target change),CtrlClick(),freezer/on/Initialize(),coldroom/Initialize(),freezer/AltClick(),heater/AltClick()update_parents()inprocess_atmos()— only fires when temperature actually changed by >1K, matching theheat_exchangerpatterninvestigate_loginCtrlClick()that was referencing the wrongusrvariableOriginal prompt
This pull request was created from Copilot chat.
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.