mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-27 07:08:55 +01:00
[MIRROR] move the from belly (#10474)
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
co-authored by
Kashargul
parent
6d174d27c4
commit
5fd7b79c56
@@ -83,14 +83,18 @@
|
||||
var/reaction_occurred
|
||||
var/list/eligible_reactions = list()
|
||||
var/list/effect_reactions = list()
|
||||
var/from_belly
|
||||
do
|
||||
from_belly = FALSE
|
||||
reaction_occurred = FALSE
|
||||
for(var/datum/reagent/R as anything in reagent_list)
|
||||
if(SSchemistry.instant_reactions_by_reagent[R.id])
|
||||
eligible_reactions |= SSchemistry.instant_reactions_by_reagent[R.id]
|
||||
if(!from_belly)
|
||||
from_belly = R.from_belly
|
||||
|
||||
for(var/decl/chemical_reaction/C as anything in eligible_reactions)
|
||||
if(C.can_happen(src) && C.process(src))
|
||||
if(C.can_happen(src) && C.process(src, from_belly))
|
||||
effect_reactions |= C
|
||||
reaction_occurred = TRUE
|
||||
eligible_reactions.len = 0
|
||||
@@ -101,20 +105,21 @@
|
||||
|
||||
/* Holder-to-chemical */
|
||||
|
||||
/datum/reagents/proc/add_reagent(var/id, var/amount, var/data = null, var/safety = 0)
|
||||
/datum/reagents/proc/add_reagent(var/id, var/amount, var/data = null, var/safety = 0, var/was_from_belly)
|
||||
if(!isnum(amount) || amount <= 0)
|
||||
return 0
|
||||
|
||||
update_total()
|
||||
amount = min(amount, get_free_space())
|
||||
|
||||
|
||||
for(var/datum/reagent/current in reagent_list)
|
||||
if(current.id == id)
|
||||
if(current.id == REAGENT_ID_BLOOD)
|
||||
if(LAZYLEN(data) && !isnull(data["species"]) && !isnull(current.data["species"]) && data["species"] != current.data["species"]) // Species bloodtypes are already incompatible, this just stops it from mixing into the one already in a container.
|
||||
continue
|
||||
|
||||
if(was_from_belly)
|
||||
current.from_belly = was_from_belly
|
||||
current.volume += amount
|
||||
if(!isnull(data)) // For all we know, it could be zero or empty string and meaningful
|
||||
current.mix_data(data, amount)
|
||||
@@ -131,6 +136,8 @@
|
||||
R.holder = src
|
||||
R.volume = amount
|
||||
R.initialize_data(data)
|
||||
if(was_from_belly)
|
||||
R.from_belly = was_from_belly
|
||||
update_total()
|
||||
if(!safety)
|
||||
handle_reactions()
|
||||
@@ -255,7 +262,7 @@
|
||||
|
||||
for(var/datum/reagent/current in reagent_list)
|
||||
var/amount_to_transfer = current.volume * part
|
||||
target.add_reagent(current.id, amount_to_transfer * multiplier, current.get_data(), safety = 1) // We don't react until everything is in place
|
||||
target.add_reagent(current.id, amount_to_transfer * multiplier, current.get_data(), safety = 1, was_from_belly = current.from_belly) // We don't react until everything is in place
|
||||
if(!copy)
|
||||
remove_reagent(current.id, amount_to_transfer, 1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user