ok
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
// Reaction priorities, higher makes it checked first. Otherwise, it goes based on reaction temperature requirements.
|
||||
|
||||
#define CHEMICAL_REACTION_PRIORITY_DEFAULT 100
|
||||
#define CHEMICAL_REACTION_PRIORITY_SMOKE 1000
|
||||
@@ -125,3 +125,11 @@ GLOBAL_VAR_INIT(cmp_field, "name")
|
||||
if(A.ui_category == B.ui_category)
|
||||
return sorttext(A.name, B.name)
|
||||
return sorttext(A.ui_category, B.ui_category)
|
||||
|
||||
/proc/cmp_chemical_reactions_default(datum/chemical_reaction/A, datum/chemical_reaction/B)
|
||||
if(A.priority != B.priority)
|
||||
return A.priority - B.priority
|
||||
else if(A.is_cold_recipe)
|
||||
return B.required_temp - A.required_temp //return coldest
|
||||
else
|
||||
return A.required_temp - B.required_temp //return hottest
|
||||
|
||||
@@ -463,17 +463,10 @@
|
||||
if(total_matching_reagents == total_required_reagents && total_matching_catalysts == total_required_catalysts && matching_container && matching_other && meets_temp_requirement && can_special_react)
|
||||
possible_reactions += C
|
||||
|
||||
sortTim(possible_reactions, /proc/cmp_chemical_reactions_default, FALSE)
|
||||
|
||||
if(possible_reactions.len)
|
||||
var/datum/chemical_reaction/selected_reaction = possible_reactions[1]
|
||||
//select the reaction with the most extreme temperature requirements
|
||||
for(var/V in possible_reactions)
|
||||
var/datum/chemical_reaction/competitor = V
|
||||
if(selected_reaction.is_cold_recipe)
|
||||
if(competitor.required_temp <= selected_reaction.required_temp)
|
||||
selected_reaction = competitor
|
||||
else
|
||||
if(competitor.required_temp >= selected_reaction.required_temp) //will return with the hotter reacting first.
|
||||
selected_reaction = competitor
|
||||
var/list/cached_required_reagents = selected_reaction.required_reagents//update reagents list
|
||||
var/list/cached_results = selected_reaction.results//resultant chemical list
|
||||
var/special_react_result = selected_reaction.check_special_react(src)
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
var/list/required_reagents = new/list()
|
||||
var/list/required_catalysts = new/list()
|
||||
|
||||
/// Higher is higher priority, determines which order reactions are checked.
|
||||
var/priority = CHEMICAL_REACTION_PRIORITY_DEFAULT
|
||||
|
||||
// Both of these variables are mostly going to be used with slime cores - but if you want to, you can use them for other things
|
||||
var/required_container = null // the exact container path required for the reaction to happen
|
||||
var/required_other = 0 // an integer required for the reaction to happen
|
||||
|
||||
@@ -280,6 +280,7 @@
|
||||
/datum/chemical_reaction/smoke_powder
|
||||
name = "smoke_powder"
|
||||
id = /datum/reagent/smoke_powder
|
||||
priority = CHEMICAL_REACTION_PRIORITY_SMOKE
|
||||
results = list(/datum/reagent/smoke_powder = 3)
|
||||
required_reagents = list(/datum/reagent/potassium = 1, /datum/reagent/consumable/sugar = 1, /datum/reagent/phosphorus = 1)
|
||||
|
||||
|
||||
@@ -123,6 +123,7 @@
|
||||
#include "code\__DEFINES\_flags\item_flags.dm"
|
||||
#include "code\__DEFINES\_flags\obj_flags.dm"
|
||||
#include "code\__DEFINES\admin\keybindings.dm"
|
||||
#include "code\__DEFINES\chemistry\reactions.dm"
|
||||
#include "code\__DEFINES\combat\attack_types.dm"
|
||||
#include "code\__DEFINES\combat\block.dm"
|
||||
#include "code\__DEFINES\combat\block_parry.dm"
|
||||
|
||||
Reference in New Issue
Block a user