mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-27 10:02:12 +00:00
Some more harddel fixes (#58305)
This commit is contained in:
@@ -167,3 +167,8 @@
|
||||
/// For the pH meter flashing method
|
||||
#define ENABLE_FLASHING -1
|
||||
#define DISABLE_FLASHING 14
|
||||
|
||||
#define GOLDSCHLAGER_VODKA (10)
|
||||
#define GOLDSCHLAGER_GOLD (1)
|
||||
|
||||
#define GOLDSCHLAGER_GOLD_RATIO (GOLDSCHLAGER_GOLD/(GOLDSCHLAGER_VODKA+GOLDSCHLAGER_GOLD))
|
||||
|
||||
@@ -51,32 +51,32 @@
|
||||
//there is at least one unique catalyst for the short reaction, so there is no conflict
|
||||
return FALSE
|
||||
|
||||
//if we got this far, the longer reaction will be impossible to create if the shorter one is earlier in GLOB.chemical_reactions_list, and will require the reagents to be added in a particular order otherwise
|
||||
//if we got this far, the longer reaction will be impossible to create if the shorter one is earlier in GLOB.chemical_reactions_list_reactant_index, and will require the reagents to be added in a particular order otherwise
|
||||
return TRUE
|
||||
|
||||
/proc/get_chemical_reaction(id)
|
||||
if(!GLOB.chemical_reactions_list)
|
||||
if(!GLOB.chemical_reactions_list_reactant_index)
|
||||
return
|
||||
for(var/reagent in GLOB.chemical_reactions_list)
|
||||
for(var/R in GLOB.chemical_reactions_list[reagent])
|
||||
for(var/reagent in GLOB.chemical_reactions_list_reactant_index)
|
||||
for(var/R in GLOB.chemical_reactions_list_reactant_index[reagent])
|
||||
var/datum/reac = R
|
||||
if(reac.type == id)
|
||||
return R
|
||||
|
||||
/proc/remove_chemical_reaction(datum/chemical_reaction/R)
|
||||
if(!GLOB.chemical_reactions_list || !R)
|
||||
if(!GLOB.chemical_reactions_list_reactant_index || !R)
|
||||
return
|
||||
for(var/rid in R.required_reagents)
|
||||
GLOB.chemical_reactions_list[rid] -= R
|
||||
GLOB.chemical_reactions_list_reactant_index[rid] -= R
|
||||
|
||||
//see build_chemical_reactions_list in holder.dm for explanations
|
||||
/proc/add_chemical_reaction(datum/chemical_reaction/R)
|
||||
if(!GLOB.chemical_reactions_list || !R.required_reagents || !R.required_reagents.len)
|
||||
if(!GLOB.chemical_reactions_list_reactant_index || !R.required_reagents || !R.required_reagents.len)
|
||||
return
|
||||
var/primary_reagent = R.required_reagents[1]
|
||||
if(!GLOB.chemical_reactions_list[primary_reagent])
|
||||
GLOB.chemical_reactions_list[primary_reagent] = list()
|
||||
GLOB.chemical_reactions_list[primary_reagent] += R
|
||||
if(!GLOB.chemical_reactions_list_reactant_index[primary_reagent])
|
||||
GLOB.chemical_reactions_list_reactant_index[primary_reagent] = list()
|
||||
GLOB.chemical_reactions_list_reactant_index[primary_reagent] += R
|
||||
|
||||
//Creates foam from the reagent. Metaltype is for metal foam, notification is what to show people in textbox
|
||||
/datum/reagents/proc/create_foam(foamtype,foam_volume,metaltype = 0,notification = null)
|
||||
|
||||
@@ -17,7 +17,8 @@ GLOBAL_LIST_EMPTY(alarmdisplay) //list of all machines or programs that
|
||||
GLOBAL_LIST_EMPTY_TYPED(singularities, /datum/component/singularity) //list of all singularities on the station
|
||||
GLOBAL_LIST_EMPTY(mechpad_list) //list of all /obj/machinery/mechpad
|
||||
|
||||
GLOBAL_LIST(chemical_reactions_list) //list of all /datum/chemical_reaction datums. Used during chemical reactions. Indexed by REACTANT types
|
||||
GLOBAL_LIST(chemical_reactions_list) //list of all /datum/chemical_reaction datums indexed by their typepath. Use this for general lookup stuff
|
||||
GLOBAL_LIST(chemical_reactions_list_reactant_index) //list of all /datum/chemical_reaction datums. Used during chemical reactions. Indexed by REACTANT types
|
||||
GLOBAL_LIST(chemical_reactions_list_product_index) //list of all /datum/chemical_reaction datums. Used for the reaction lookup UI. Indexed by PRODUCT type
|
||||
GLOBAL_LIST(chemical_reagents_list) //list of all /datum/reagent datums indexed by reagent id. Used by chemistry stuff
|
||||
GLOBAL_LIST(chemical_reactions_results_lookup_list) //List of all reactions with their associated product and result ids. Used for reaction lookups
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
/datum/chemical_reaction/drink/goldschlager
|
||||
results = list(/datum/reagent/consumable/ethanol/goldschlager = 10)
|
||||
required_reagents = list(/datum/reagent/consumable/ethanol/vodka = 10, /datum/reagent/gold = 1)
|
||||
required_reagents = list(/datum/reagent/consumable/ethanol/vodka = GOLDSCHLAGER_VODKA, /datum/reagent/gold = GOLDSCHLAGER_GOLD)
|
||||
reaction_tags = REACTION_TAG_DRINK | REACTION_TAG_EASY
|
||||
|
||||
/datum/chemical_reaction/drink/patron
|
||||
|
||||
@@ -41,6 +41,11 @@
|
||||
|
||||
ADD_TRAIT(src, TRAIT_VENTCRAWLER_ALWAYS, INNATE_TRAIT)
|
||||
|
||||
/mob/living/simple_animal/hostile/regalrat/Destroy()
|
||||
. = ..()
|
||||
QDEL_NULL(domain)
|
||||
QDEL_NULL(riot)
|
||||
|
||||
/mob/living/simple_animal/hostile/regalrat/proc/get_player()
|
||||
var/list/mob/dead/observer/candidates = pollGhostCandidates("Do you want to play as the Royal Rat, cheesey be his crown?", ROLE_SENTIENCE, null, FALSE, 100, POLL_IGNORE_SENTIENCE_POTION)
|
||||
if(LAZYLEN(candidates) && !mind)
|
||||
|
||||
@@ -23,19 +23,20 @@
|
||||
//Chemical Reactions - Initialises all /datum/chemical_reaction into a list
|
||||
// It is filtered into multiple lists within a list.
|
||||
// For example:
|
||||
// chemical_reaction_list[/datum/reagent/toxin/plasma] is a list of all reactions relating to plasma
|
||||
// chemical_reactions_list_reactant_index[/datum/reagent/toxin/plasma] is a list of all reactions relating to plasma
|
||||
//For chemical reaction list product index - indexes reactions based off the product reagent type - see get_recipe_from_reagent_product() in helpers
|
||||
//For chemical reactions list lookup list - creates a bit list of info passed to the UI. This is saved to reduce lag from new windows opening, since it's a lot of data.
|
||||
|
||||
//Prevent these reactions from appearing in lookup tables (UI code)
|
||||
var/list/blacklist = (/datum/chemical_reaction/randomized)
|
||||
|
||||
if(GLOB.chemical_reactions_list)
|
||||
if(GLOB.chemical_reactions_list_reactant_index)
|
||||
return
|
||||
|
||||
//Randomized need to go last since they need to check against conflicts with normal recipes
|
||||
var/paths = subtypesof(/datum/chemical_reaction) - typesof(/datum/chemical_reaction/randomized) + subtypesof(/datum/chemical_reaction/randomized)
|
||||
GLOB.chemical_reactions_list = list() //reagents to reaction list
|
||||
GLOB.chemical_reactions_list = list() //typepath to reaction list
|
||||
GLOB.chemical_reactions_list_reactant_index = list() //reagents to reaction list
|
||||
GLOB.chemical_reactions_results_lookup_list = list() //UI glob
|
||||
GLOB.chemical_reactions_list_product_index = list() //product to reaction list
|
||||
|
||||
@@ -50,6 +51,8 @@
|
||||
if(!D.required_reagents || !D.required_reagents.len) //Skip impossible reactions
|
||||
continue
|
||||
|
||||
GLOB.chemical_reactions_list[path] = D
|
||||
|
||||
for(var/reaction in D.required_reagents)
|
||||
reaction_ids += reaction
|
||||
var/datum/reagent/reagent = find_reagent_object_from_type(reaction)
|
||||
@@ -81,9 +84,9 @@
|
||||
|
||||
// Create filters based on each reagent id in the required reagents list - this is used to speed up handle_reactions()
|
||||
for(var/id in reaction_ids)
|
||||
if(!GLOB.chemical_reactions_list[id])
|
||||
GLOB.chemical_reactions_list[id] = list()
|
||||
GLOB.chemical_reactions_list[id] += D
|
||||
if(!GLOB.chemical_reactions_list_reactant_index[id])
|
||||
GLOB.chemical_reactions_list_reactant_index[id] = list()
|
||||
GLOB.chemical_reactions_list_reactant_index[id] += D
|
||||
break // Don't bother adding ourselves to other reagent ids, it is redundant
|
||||
|
||||
///////////////////////////////Main reagents code/////////////////////////////////////////////
|
||||
@@ -818,7 +821,7 @@
|
||||
return FALSE
|
||||
|
||||
var/list/cached_reagents = reagent_list
|
||||
var/list/cached_reactions = GLOB.chemical_reactions_list
|
||||
var/list/cached_reactions = GLOB.chemical_reactions_list_reactant_index
|
||||
var/datum/cached_my_atom = my_atom
|
||||
LAZYNULL(failed_but_capable_reactions)
|
||||
|
||||
@@ -1482,7 +1485,7 @@
|
||||
var/list/possible_reactions = list()
|
||||
if(!length(cached_reagents))
|
||||
return null
|
||||
cached_reactions = GLOB.chemical_reactions_list
|
||||
cached_reactions = GLOB.chemical_reactions_list_reactant_index
|
||||
for(var/_reagent in cached_reagents)
|
||||
var/datum/reagent/reagent = _reagent
|
||||
for(var/_reaction in cached_reactions[reagent.type]) // Was a big list but now it should be smaller since we filtered it with our reagent id
|
||||
|
||||
@@ -77,10 +77,10 @@
|
||||
/obj/machinery/chem_recipe_debug/proc/setup_reactions()
|
||||
cached_reactions = list()
|
||||
if(process_all)
|
||||
for(var/reaction in GLOB.chemical_reactions_list)
|
||||
if(is_type_in_list(GLOB.chemical_reactions_list[reaction], cached_reactions))
|
||||
for(var/reaction in GLOB.chemical_reactions_list_reactant_index)
|
||||
if(is_type_in_list(GLOB.chemical_reactions_list_reactant_index[reaction], cached_reactions))
|
||||
continue
|
||||
cached_reactions += GLOB.chemical_reactions_list[reaction]
|
||||
cached_reactions += GLOB.chemical_reactions_list_reactant_index[reaction]
|
||||
else
|
||||
cached_reactions = reaction_names
|
||||
reagents.clear_reagents()
|
||||
|
||||
@@ -516,22 +516,9 @@ All effects don't start immediately, but rather get worse over time; the rate is
|
||||
shot_glass_icon_state = "shotglassgold"
|
||||
chemical_flags = REAGENT_CAN_BE_SYNTHESIZED
|
||||
|
||||
/// Ratio of gold that the goldschlager recipe contains
|
||||
var/static/gold_ratio
|
||||
|
||||
// This drink is really popular with a certain demographic.
|
||||
var/teenage_girl_quality = DRINK_VERYGOOD
|
||||
|
||||
/datum/reagent/consumable/ethanol/goldschlager/New()
|
||||
. = ..()
|
||||
if(!gold_ratio)
|
||||
// Calculate the amount of gold that goldschlager is made from
|
||||
var/datum/chemical_reaction/drink/goldschlager/goldschlager_reaction = new
|
||||
var/vodka_amount = goldschlager_reaction.required_reagents[/datum/reagent/consumable/ethanol/vodka]
|
||||
var/gold_amount = goldschlager_reaction.required_reagents[/datum/reagent/gold]
|
||||
gold_ratio = gold_amount / (gold_amount + vodka_amount)
|
||||
qdel(goldschlager_reaction)
|
||||
|
||||
/datum/reagent/consumable/ethanol/goldschlager/expose_mob(mob/living/exposed_mob, methods=TOUCH, reac_volume)
|
||||
// Reset quality each time, since the bottle can be shared
|
||||
quality = initial(quality)
|
||||
@@ -548,7 +535,7 @@ All effects don't start immediately, but rather get worse over time; the rate is
|
||||
if(!(methods & INGEST))
|
||||
return ..()
|
||||
|
||||
var/convert_amount = trans_volume * gold_ratio
|
||||
var/convert_amount = trans_volume * min(GOLDSCHLAGER_GOLD_RATIO, 1)
|
||||
A.reagents.remove_reagent(/datum/reagent/consumable/ethanol/goldschlager, convert_amount)
|
||||
A.reagents.add_reagent(/datum/reagent/gold, convert_amount)
|
||||
return ..()
|
||||
|
||||
@@ -169,7 +169,7 @@ GLOBAL_LIST_INIT(medicine_reagents, build_medicine_reagents())
|
||||
|
||||
/datum/chemical_reaction/randomized/proc/HasConflicts()
|
||||
for(var/x in required_reagents)
|
||||
for(var/datum/chemical_reaction/R in GLOB.chemical_reactions_list[x])
|
||||
for(var/datum/chemical_reaction/R in GLOB.chemical_reactions_list_reactant_index[x])
|
||||
if(chem_recipes_do_conflict(R,src))
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
build_chemical_reactions_lists()
|
||||
build_chemical_reagent_list()
|
||||
|
||||
for(var/I in GLOB.chemical_reactions_list)
|
||||
for(var/V in GLOB.chemical_reactions_list[I])
|
||||
for(var/I in GLOB.chemical_reactions_list_reactant_index)
|
||||
for(var/V in GLOB.chemical_reactions_list_reactant_index[I])
|
||||
var/datum/chemical_reaction/R = V
|
||||
for(var/id in (R.required_reagents + R.required_catalysts))
|
||||
if(!GLOB.chemical_reagents_list[id])
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
/datum/unit_test/reagent_recipe_collisions/Run()
|
||||
build_chemical_reactions_lists()
|
||||
var/list/reactions = list()
|
||||
for(var/V in GLOB.chemical_reactions_list)
|
||||
reactions += GLOB.chemical_reactions_list[V]
|
||||
for(var/V in GLOB.chemical_reactions_list_reactant_index)
|
||||
reactions += GLOB.chemical_reactions_list_reactant_index[V]
|
||||
for(var/i in 1 to (reactions.len-1))
|
||||
for(var/i2 in (i+1) to reactions.len)
|
||||
var/datum/chemical_reaction/r1 = reactions[i]
|
||||
|
||||
Reference in New Issue
Block a user