Topic on Talk:Beer
Jump to navigation
Jump to search
This page shows the changes between two versions of a post by Harakoni in the topic "Temperatures" on Talk:Beer.
You can see other versions of this post at its history page.
Line 3: | Line 3: | ||
As for the second part, it does seem to do as you say. Tick up at a rate defined by the difference between actual temperature and the safe temperature, and then ruin when it gets to 100% (1) | As for the second part, it does seem to do as you say. Tick up at a rate defined by the difference between actual temperature and the safe temperature, and then ruin when it gets to 100% (1) | ||
+ | <code> | ||
private void DoTicks(int ticks) | private void DoTicks(int ticks) | ||
− | |||
{ | { | ||
− | + | if (!this.Ruined) | |
− | + | { | |
− | + | float ambientTemperature = this.parent.AmbientTemperature; | |
− | + | if (ambientTemperature > this.Props.maxSafeTemperature) | |
− | + | { | |
− | + | this.ruinedPercent += (ambientTemperature - this.Props.maxSafeTemperature) * this.Props.progressPerDegreePerTick * (float)ticks; | |
− | + | } | |
− | + | else if (ambientTemperature < this.Props.minSafeTemperature) | |
− | + | { | |
− | + | this.ruinedPercent -= (ambientTemperature - this.Props.minSafeTemperature) * this.Props.progressPerDegreePerTick * (float)ticks; | |
− | + | } | |
− | + | if (this.ruinedPercent >= 1f) | |
− | + | { | |
− | + | this.ruinedPercent = 1f; | |
− | + | this.parent.BroadcastCompSignal("RuinedByTemperature"); | |
− | + | return; | |
− | + | } | |
− | + | if (this.ruinedPercent < 0f) | |
− | + | { | |
− | + | this.ruinedPercent = 0f; | |
− | + | } | |
− | + | } | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
+ | </code> |