mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-24 21:40:55 +01:00
Cigarette Fixes (#5597)
There was an issue with one of the travis checks that caused reagents with incorrect specific heat values to sneak into the game and cause havok. This fixes that. Fixes #5594 Fixes #5593
This commit is contained in:
@@ -11,24 +11,29 @@ var/datum/controller/subsystem/chemistry/SSchemistry
|
||||
var/list/chemical_reagents
|
||||
|
||||
var/tmp/list/processing_holders = list()
|
||||
|
||||
/datum/controller/subsystem/chemistry/proc/has_valid_specific_heat(var/datum/reagent/R) //Used for unit tests
|
||||
|
||||
/datum/controller/subsystem/chemistry/proc/has_valid_specific_heat(var/datum/reagent/R) //Used for unit tests. Same as check_specific_heat but returns a boolean instead.
|
||||
|
||||
if(R.specific_heat > 0)
|
||||
return TRUE
|
||||
return TRUE
|
||||
|
||||
if(chemical_reagents[R.id].specific_heat > 0) //Don't think this will happen but you never know.
|
||||
return TRUE
|
||||
|
||||
|
||||
var/datum/chemical_reaction/recipe = find_recipe_by_result(R.id)
|
||||
if(recipe)
|
||||
for(var/chem in recipe.required_reagents)
|
||||
if(!has_valid_specific_heat(chemical_reagents[chem]))
|
||||
return FALSE
|
||||
log_ss("chemistry", "ERROR: [recipe.type] has an improper recipe!")
|
||||
return R.fallback_specific_heat > 0
|
||||
|
||||
if(R.fallback_specific_heat)
|
||||
return TRUE
|
||||
|
||||
return FALSE
|
||||
else
|
||||
if(R.fallback_specific_heat > 0)
|
||||
return TRUE
|
||||
else
|
||||
log_ss("chemistry", "ERROR: [R.type] does not have a valid specific heat ([R.specific_heat]) or a valid fallback specific heat ([R.fallback_specific_heat]) assigned!")
|
||||
return FALSE
|
||||
|
||||
/datum/controller/subsystem/chemistry/proc/check_specific_heat(var/datum/reagent/R)
|
||||
|
||||
@@ -44,15 +49,17 @@ var/datum/controller/subsystem/chemistry/SSchemistry
|
||||
var/result_amount = recipe.result_amount
|
||||
for(var/chem in recipe.required_reagents)
|
||||
var/chem_specific_heat = check_specific_heat(chemical_reagents[chem])
|
||||
if(!chem_specific_heat)
|
||||
if(chem_specific_heat <= 0)
|
||||
log_ss("chemistry", "ERROR: [R.type] does not have a specific heat value set, and there is no associated recipe for it! Please fix this by giving it a specific_heat value!")
|
||||
final_heat = 0
|
||||
break
|
||||
final_heat += chem_specific_heat * (recipe.required_reagents[chem]/result_amount)
|
||||
|
||||
if(final_heat > 0)
|
||||
chemical_reagents[R.id].specific_heat = final_heat
|
||||
return final_heat
|
||||
|
||||
if(R.fallback_specific_heat)
|
||||
if(R.fallback_specific_heat > 0)
|
||||
chemical_reagents[R.id].specific_heat = R.fallback_specific_heat
|
||||
return R.fallback_specific_heat
|
||||
|
||||
|
||||
Reference in New Issue
Block a user