move the from belly (#17386)

* move the from belly

* reactions

* attempt two

* this really needs testing

* .

* clean that up

* also fix that

* make it clear

* .

* .
This commit is contained in:
Kashargul
2025-03-20 15:24:03 +01:00
committed by GitHub
parent ef8454a395
commit 77ac89b2e6
9 changed files with 55 additions and 167 deletions
+11 -4
View File
@@ -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()
@@ -252,7 +259,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)
@@ -78,7 +78,7 @@
return progress
/decl/chemical_reaction/process(var/datum/reagents/holder)
/decl/chemical_reaction/process(var/datum/reagents/holder, var/belly_reagent)
//determine how far the reaction can proceed
var/list/reaction_limits = list()
for(var/reactant in required_reagents)
@@ -101,7 +101,7 @@
//add the product
var/amt_produced = result_amount * reaction_progress
if(result)
holder.add_reagent(result, amt_produced, data, safety = 1)
holder.add_reagent(result, amt_produced, data, safety = 1, was_from_belly = belly_reagent)
on_reaction(holder, amt_produced)
@@ -1,49 +0,0 @@
// Subtypes of other reagents specifically used in liquid bellies, otherwise identical to the parent
/datum/reagent/water/liquid_belly
id = REAGENT_ID_WATER_BELLY
from_belly = TRUE
/datum/reagent/drink/milk/liquid_belly
id = REAGENT_ID_MILK_BELLY
from_belly = TRUE
/datum/reagent/drink/milk/cream/liquid_belly
id = REAGENT_ID_CREAM_BELLY
from_belly = TRUE
/datum/reagent/nutriment/honey/liquid_belly
id = REAGENT_ID_HONEY_BELLY
from_belly = TRUE
/datum/reagent/nutriment/cherryjelly/liquid_belly
id = REAGENT_ID_CHERRYJELLY_BELLY
from_belly = TRUE
/datum/reagent/acid/digestive/liquid_belly
id = REAGENT_ID_STOMACID_BELLY
from_belly = TRUE
/datum/reagent/acid/diet_digestive/liquid_belly
id = REAGENT_ID_DIETSTOMACID_BELLY
from_belly = TRUE
/datum/reagent/space_cleaner/liquid_belly
id = REAGENT_ID_CLEANER_BELLY
from_belly = TRUE
/datum/reagent/lube/liquid_belly
id = REAGENT_ID_LUBE_BELLY
from_belly = TRUE
/datum/reagent/nutriment/biomass/liquid_belly
id = REAGENT_ID_BIOMASS_BELLY
from_belly = TRUE
/datum/reagent/radium/concentrated/liquid_belly
id = REAGENT_ID_CONCENTRATEDRADIUM_BELLY
from_belly = TRUE
/datum/reagent/tricordrazine/liquid_belly
id = REAGENT_ID_TRICORDRAZINE_BELLY
from_belly = TRUE