mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-23 16:42:13 +00:00
Metabolism Precision Runtime Errors (#5701)
Because of precision issues with floating point values, metabolism would sometimes runtime and cause performance issues. This PR fixes this. Fixes #5698 as well.
This commit is contained in:
@@ -98,7 +98,6 @@
|
||||
//returns 1 if the holder should continue reactiong, 0 otherwise.
|
||||
/datum/reagents/proc/process_reactions()
|
||||
if(!my_atom || !my_atom.loc || my_atom.flags & NOREACT)
|
||||
equalize_temperature()
|
||||
return 0
|
||||
|
||||
var/reaction_occured
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
/datum/reagent/proc/initialize_data(var/newdata) // Called when the reagent is created.
|
||||
if(!isnull(newdata))
|
||||
data = newdata
|
||||
metabolism = round(metabolism,0.001)
|
||||
|
||||
/datum/reagent/proc/remove_self(var/amount) // Shortcut
|
||||
if (!holder)
|
||||
|
||||
@@ -66,7 +66,6 @@
|
||||
|
||||
var/total_thermal_energy = 0
|
||||
var/total_heat_capacity = 0
|
||||
|
||||
var/was_changed = FALSE
|
||||
|
||||
for(var/datum/reagent/R in reagent_list)
|
||||
@@ -76,8 +75,7 @@
|
||||
for(var/datum/reagent/R in reagent_list)
|
||||
var/old_thermal_energy = R.get_thermal_energy()
|
||||
var/new_thermal_energy = total_thermal_energy * (R.get_heat_capacity()/total_heat_capacity)
|
||||
|
||||
if(old_thermal_energy != new_thermal_energy)
|
||||
if(round(old_thermal_energy,1) != round(new_thermal_energy,1))
|
||||
R.set_thermal_energy( new_thermal_energy )
|
||||
was_changed = TRUE
|
||||
|
||||
|
||||
37
html/changelogs/burgerbb - temperature fixes changelog.yml
Normal file
37
html/changelogs/burgerbb - temperature fixes changelog.yml
Normal file
@@ -0,0 +1,37 @@
|
||||
################################
|
||||
# Example Changelog File
|
||||
#
|
||||
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
|
||||
#
|
||||
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
|
||||
# When it is, any changes listed below will disappear.
|
||||
#
|
||||
# Valid Prefixes:
|
||||
# bugfix
|
||||
# wip (For works in progress)
|
||||
# tweak
|
||||
# soundadd
|
||||
# sounddel
|
||||
# rscadd (general adding of nice things)
|
||||
# rscdel (general deleting of nice things)
|
||||
# imageadd
|
||||
# imagedel
|
||||
# maptweak
|
||||
# spellcheck (typo fixes)
|
||||
# experiment
|
||||
# balance
|
||||
#################################
|
||||
|
||||
# Your name.
|
||||
author: BurgerBB
|
||||
|
||||
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
|
||||
delete-after: True
|
||||
|
||||
# Any changes you've made. See valid prefix list above.
|
||||
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
|
||||
# SCREW THIS UP AND IT WON'T WORK.
|
||||
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
|
||||
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
|
||||
changes:
|
||||
- bugfix: "Fixed a bug that would cause runtimes with chemicals with low metabolism."
|
||||
Reference in New Issue
Block a user