mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 15:17:01 +01:00
Fixes math for chiral inversion buffer & reagent display messages (#93946)
## About The Pull Request - Chiral inversion buffer now converts multiple reagents with 1u being able to convert 10u of the entire solution & not just one reagent in the target. This means if we have say 5u of reagent A & 5u of reagent B where both can be inverted, then 1u of the inversing buffer can convert both reagents - Chiral inversion buffer can now be transferred to another reagent holder if no conversion occurred instead of just disappearing into the wind - Fixes some objects displaying 0u of reagent transferred which happens when reagent intercept occurs ## Changelog 🆑 fix: Chiral inversion buffer now converts multiple reagents fix: Chiral inversion buffer can now be transferred into another reagent holder if no conversion took place instead of just evaporating fix: dropper, bottles & syringes now won't display messages like 0u of reagent transferred /🆑
This commit is contained in:
@@ -156,19 +156,35 @@
|
||||
if(!.)
|
||||
return
|
||||
|
||||
for(var/_reagent in target.reagent_list)
|
||||
var/datum/reagent/reaction_agent/reagent = _reagent
|
||||
var/conversion_buffer = amount * 10 //Converts up to 10 units of reagent per 1 unit of inversing buffer.
|
||||
var/converted = 0
|
||||
var/list/cached_reagents = target.reagent_list.Copy()
|
||||
for(var/datum/reagent/reagent as anything in cached_reagents)
|
||||
if(!conversion_buffer)
|
||||
return
|
||||
if(reagent.purity <= reagent.inverse_chem_val)
|
||||
target.my_atom.audible_message(span_warning("The beaker goes into a rolling boil as the contents begin inversing!"))
|
||||
playsound(target.my_atom, 'sound/effects/chemistry/catalyst.ogg', 50, TRUE)
|
||||
var/converted = min(reagent.volume, amount * 10)//Converts up to 10 units of reagent per 1 unit of inversing buffer.
|
||||
if(converted > 0)
|
||||
target.remove_reagent(reagent.type, converted, safety = FALSE)
|
||||
target.add_reagent(reagent.inverse_chem, converted, FALSE, added_purity = reagent.get_inverse_purity(reagent.purity))
|
||||
volume -= amount
|
||||
holder.update_total()
|
||||
break
|
||||
else
|
||||
target.my_atom.audible_message(span_warning("The buffer quietly fizzles away with no effect."))
|
||||
volume -= amount
|
||||
holder.update_total()
|
||||
//compute volume of reagent to be converted
|
||||
converted = min(reagent.volume, conversion_buffer)
|
||||
//remove original reagent from target
|
||||
reagent.volume -= converted
|
||||
target.update_total()
|
||||
//add new inverse reagent to target
|
||||
target.add_reagent(reagent.inverse_chem, converted, FALSE, added_purity = reagent.get_inverse_purity(reagent.purity))
|
||||
//remove from buffer remaining
|
||||
conversion_buffer -= converted
|
||||
|
||||
//audible feedback
|
||||
if(conversion_buffer < amount * 10)
|
||||
target.my_atom.audible_message(span_warning("The beaker goes into a rolling boil as the contents begin inversing!"))
|
||||
playsound(target.my_atom, 'sound/effects/chemistry/catalyst.ogg', 50, TRUE)
|
||||
else
|
||||
target.my_atom.audible_message(span_warning("The buffer fizzles with no effect."))
|
||||
|
||||
//remove inversening reagent based on total buffer removed
|
||||
var/volume_to_transfer = amount - (amount * (1 - (conversion_buffer / (amount * 10))))
|
||||
if(volume_to_transfer)
|
||||
target.add_reagent(type, volume_to_transfer, reagtemp = holder.chem_temp, added_purity = purity, added_ph = ph)
|
||||
if(!copy_only)
|
||||
volume -= amount
|
||||
holder.update_total()
|
||||
|
||||
|
||||
@@ -404,7 +404,8 @@
|
||||
|
||||
var/trans = round(reagents.trans_to(target, amount_per_transfer_from_this, transferred_by = user), CHEMICAL_VOLUME_ROUNDING)
|
||||
playsound(target.loc, SFX_LIQUID_POUR, 50, TRUE)
|
||||
to_chat(user, span_notice("You transfer [trans] unit\s of the solution to [target]."))
|
||||
if(trans)
|
||||
to_chat(user, span_notice("You transfer [trans] unit\s of the solution to [target]."))
|
||||
SEND_SIGNAL(src, COMSIG_REAGENTS_CUP_TRANSFER_TO, target)
|
||||
target.update_appearance()
|
||||
return ITEM_INTERACT_SUCCESS
|
||||
|
||||
@@ -548,7 +548,8 @@
|
||||
return ITEM_INTERACT_BLOCKING
|
||||
|
||||
var/transfer_amount = round(reagents.trans_to(tool, amount_per_transfer_from_this, transferred_by = user), CHEMICAL_VOLUME_ROUNDING)
|
||||
balloon_alert(user, "transferred [transfer_amount] unit\s")
|
||||
if(transfer_amount)
|
||||
balloon_alert(user, "transferred [transfer_amount] unit\s")
|
||||
flick("syrup_anim",src)
|
||||
tool.update_appearance()
|
||||
update_appearance()
|
||||
|
||||
@@ -60,7 +60,8 @@
|
||||
log_combat(user, M, "squirted", reagents.get_reagent_log_string())
|
||||
|
||||
trans = round(reagents.trans_to(target, amount_per_transfer_from_this, transferred_by = user), CHEMICAL_VOLUME_ROUNDING)
|
||||
to_chat(user, span_notice("You transfer [trans] unit\s of the solution."))
|
||||
if(trans)
|
||||
to_chat(user, span_notice("You transfer [trans] unit\s of the solution."))
|
||||
update_appearance()
|
||||
target.update_appearance()
|
||||
return ITEM_INTERACT_SUCCESS
|
||||
@@ -74,8 +75,8 @@
|
||||
return ITEM_INTERACT_BLOCKING
|
||||
|
||||
var/trans = round(target.reagents.trans_to(src, amount_per_transfer_from_this, transferred_by = user), CHEMICAL_VOLUME_ROUNDING)
|
||||
|
||||
to_chat(user, span_notice("You fill [src] with [trans] unit\s of the solution."))
|
||||
if(trans)
|
||||
to_chat(user, span_notice("You fill [src] with [trans] unit\s of the solution."))
|
||||
|
||||
update_appearance()
|
||||
target.update_appearance()
|
||||
|
||||
@@ -137,8 +137,8 @@
|
||||
return ITEM_INTERACT_BLOCKING
|
||||
|
||||
var/trans = target.reagents.trans_to(src, amount_per_transfer_from_this, transferred_by = user) // transfer from, transfer to - who cares?
|
||||
|
||||
to_chat(user, span_notice("You fill [src] with [trans] units of the solution. It now contains [reagents.total_volume] units."))
|
||||
if(trans)
|
||||
to_chat(user, span_notice("You fill [src] with [trans] units of the solution. It now contains [reagents.total_volume] units."))
|
||||
target.update_appearance()
|
||||
return ITEM_INTERACT_SUCCESS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user