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
+5 -5
View File
@@ -41,12 +41,12 @@
testname = replacetext(testname, "()", "")
if(targetselected && !hascall(target,testname))
to_chat(usr, span_filter_adminlog("" + span_red("Error: callproc(): type [target.type] has no proc named [procname].") + ""))
to_chat(usr, span_filter_adminlog(span_red("Error: callproc(): type [target.type] has no proc named [procname].")))
return
else
var/procpath = text2path(procname)
if (!procpath)
to_chat(usr, span_filter_adminlog("" + span_red("Error: callproc(): proc [procname] does not exist. (Did you forget the /proc/ part?)") + ""))
to_chat(usr, span_filter_adminlog(span_red("Error: callproc(): proc [procname] does not exist. (Did you forget the /proc/ part?)")))
return
var/list/lst = get_callproc_args()
if(!lst)
@@ -54,7 +54,7 @@
if(targetselected)
if(!target)
to_chat(usr, span_filter_adminlog("" + span_red("Error: callproc(): owner of proc no longer exists.") + ""))
to_chat(usr, span_filter_adminlog(span_red("Error: callproc(): owner of proc no longer exists.")))
return
var/msg = "[key_name(src)] called [target]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"]."
log_admin(msg)
@@ -138,11 +138,11 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
if(!check_rights(R_DEBUG))
return
var/procname = tgui_input_text(usr, "Proc name, eg: fake_blood","Proc:", null)
var/procname = tgui_input_text(usr, "Proc name, eg: fake_blood","Proc:")
if(!procname)
return
if(!hascall(A,procname))
to_chat(usr, span_filter_adminlog("" + span_red("Error: callproc_datum(): type [A.type] has no proc named [procname].") + ""))
to_chat(usr, span_filter_adminlog(span_red("Error: callproc_datum(): type [A.type] has no proc named [procname].")))
return
var/list/lst = get_callproc_args()
if(!lst)
+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
+33 -33
View File
@@ -1,7 +1,7 @@
///////////////////// NUTRITION REAGENT PRODUCTION /////////////////
/obj/belly/proc/HandleBellyReagents()
if(show_liquids && reagentbellymode && reagent_mode_flags & DM_FLAG_REAGENTSNUTRI && reagents.total_volume < custom_max_volume && !isnewplayer(owner)) //Removed if(reagentbellymode == TRUE) since that's less optimized
if(show_liquids && reagentbellymode && reagent_mode_flags & DM_FLAG_REAGENTSNUTRI && reagents.total_volume < custom_max_volume && !isnewplayer(owner))
if(isrobot(owner))
var/mob/living/silicon/robot/R = owner
if(R.cell && R.cell.charge >= gen_cost*10 && gen_interval >= gen_time)
@@ -53,7 +53,7 @@
else
owner.nutrition -= gen_cost
for(var/reagent in generated_reagents)
reagents.add_reagent(reagent, generated_reagents[reagent])
reagents.add_reagent(reagent, generated_reagents[reagent], was_from_belly = TRUE)
if(count_liquid_for_sprite)
owner.handle_belly_update() //This is run whenever a belly's contents are changed.
if(LAZYLEN(belly_surrounding))
@@ -64,7 +64,7 @@
/obj/belly/proc/GenerateBellyReagents_digesting() //The rate isnt based on selected reagent, due to the fact that the price of the reagent is already paid by nutrient not gained.
if(reagents.total_volume + (digest_nutri_gain * gen_amount) <= custom_max_volume) //By default a reagent with an amount of 1 should result in pred getting 100 units from a full health prey
for(var/reagent in generated_reagents)
reagents.add_reagent(reagent, generated_reagents[reagent] * digest_nutri_gain / gen_cost)
reagents.add_reagent(reagent, generated_reagents[reagent] * digest_nutri_gain / gen_cost, was_from_belly = TRUE)
else
owner_adjust_nutrition(digest_nutri_gain * owner.get_digestion_efficiency_modifier())
digest_nutri_gain = 0
@@ -72,10 +72,10 @@
/obj/belly/proc/GenerateBellyReagents_digested()
if(reagents.total_volume <= custom_max_volume - 25 * gen_amount)
for(var/reagent in generated_reagents)
reagents.add_reagent(reagent, generated_reagents[reagent] * 25)
reagents.add_reagent(reagent, generated_reagents[reagent] * 25, was_from_belly = TRUE)
else
for(var/reagent in generated_reagents)
reagents.add_reagent(reagent, generated_reagents[reagent] / gen_amount * (custom_max_volume - reagents.total_volume))
reagents.add_reagent(reagent, generated_reagents[reagent] / gen_amount * (custom_max_volume - reagents.total_volume), was_from_belly = TRUE)
digest_nutri_gain = 0
//////////////////////////// REAGENT_ABSORB ////////////////////////
@@ -83,18 +83,18 @@
/obj/belly/proc/GenerateBellyReagents_absorbing()
if(reagents.total_volume <= custom_max_volume - 1.5 * gen_amount) //Going for 1.5 amount of reagent per cycle, can be adjusted in future if need adjustments
for(var/reagent in generated_reagents)
reagents.add_reagent(reagent, generated_reagents[reagent] * 1.5)
reagents.add_reagent(reagent, generated_reagents[reagent] * 1.5, was_from_belly = TRUE)
else
for(var/reagent in generated_reagents)
reagents.add_reagent(reagent, generated_reagents[reagent] / gen_amount * (custom_max_volume - reagents.total_volume))
reagents.add_reagent(reagent, generated_reagents[reagent] / gen_amount * (custom_max_volume - reagents.total_volume), was_from_belly = TRUE)
/obj/belly/proc/GenerateBellyReagents_absorbed()
if(reagents.total_volume <= custom_max_volume - 25 * gen_amount) //Going for 25 amount of reagent for absorbing the prey, can be adjusted in future if need adjustments
for(var/reagent in generated_reagents)
reagents.add_reagent(reagent, generated_reagents[reagent] * 10)
reagents.add_reagent(reagent, generated_reagents[reagent] * 10, was_from_belly = TRUE)
else
for(var/reagent in generated_reagents)
reagents.add_reagent(reagent, generated_reagents[reagent] / gen_amount * (custom_max_volume - reagents.total_volume))
reagents.add_reagent(reagent, generated_reagents[reagent] / gen_amount * (custom_max_volume - reagents.total_volume), was_from_belly = TRUE)
//////////////////////////// REAGENT_DRAIN ///////////////////////// //Currently not needed, maybe later a specific proc for drain needs to be made - Jack
@@ -110,100 +110,100 @@
our_reagents.Add(lowertext(entry))
switch(reagent_chosen)
if(REAGENT_WATER)
generated_reagents = list(REAGENT_ID_WATER_BELLY = 1)
generated_reagents = list(REAGENT_ID_WATER = 1)
if(reagent_name in our_reagents)
reagent_name = lowertext(REAGENT_WATER)
gen_amount = 1
gen_cost = 1
reagentid = REAGENT_ID_WATER_BELLY
reagentid = REAGENT_ID_WATER
reagentcolor = "#0064C877"
if(REAGENT_MILK)
generated_reagents = list(REAGENT_ID_MILK_BELLY = 1)
generated_reagents = list(REAGENT_ID_MILK = 1)
if(reagent_name in our_reagents)
reagent_name = lowertext(REAGENT_MILK)
gen_amount = 1
gen_cost = 5
reagentid = REAGENT_ID_MILK_BELLY
reagentid = REAGENT_ID_MILK
reagentcolor = "#DFDFDF"
if(REAGENT_CREAM)
generated_reagents = list(REAGENT_ID_CREAM_BELLY = 1)
generated_reagents = list(REAGENT_ID_CREAM = 1)
if(reagent_name in our_reagents)
reagent_name = lowertext(REAGENT_CREAM)
gen_amount = 1
gen_cost = 5
reagentid = REAGENT_ID_CREAM_BELLY
reagentid = REAGENT_ID_CREAM
reagentcolor = "#DFD7AF"
if(REAGENT_HONEY)
generated_reagents = list(REAGENT_ID_HONEY_BELLY = 1)
generated_reagents = list(REAGENT_ID_HONEY = 1)
if(reagent_name in our_reagents)
reagent_name = lowertext(REAGENT_HONEY)
gen_amount = 1
gen_cost = 10
reagentid = REAGENT_ID_HONEY_BELLY
reagentid = REAGENT_ID_HONEY
reagentcolor = "#FFFF00"
if(REAGENT_CHERRYJELLY) //Kinda WIP, allows slime like folks something to stuff others with, should make a generic jelly in future
generated_reagents = list(REAGENT_ID_CHERRYJELLY_BELLY = 1)
generated_reagents = list(REAGENT_ID_CHERRYJELLY = 1)
if(reagent_name in our_reagents)
reagent_name = lowertext(REAGENT_CHERRYJELLY)
gen_amount = 1
gen_cost = 10
reagentid = REAGENT_ID_CHERRYJELLY_BELLY
reagentid = REAGENT_ID_CHERRYJELLY
reagentcolor = "#801E28"
if(REAGENT_STOMACID)
generated_reagents = list(REAGENT_ID_STOMACID_BELLY = 1)
generated_reagents = list(REAGENT_ID_STOMACID = 1)
if(reagent_name in our_reagents)
reagent_name = lowertext(REAGENT_STOMACID)
gen_amount = 1
gen_cost = 1
reagentid = REAGENT_ID_STOMACID_BELLY
reagentid = REAGENT_ID_STOMACID
reagentcolor = "#664330"
if(REAGENT_DIETSTOMACID)
generated_reagents = list(REAGENT_ID_DIETSTOMACID_BELLY = 1)
generated_reagents = list(REAGENT_ID_DIETSTOMACID = 1)
if(reagent_name in our_reagents)
reagent_name = lowertext(REAGENT_DIETSTOMACID)
gen_amount = 1
gen_cost = 1
reagentid = REAGENT_ID_DIETSTOMACID_BELLY
reagentid = REAGENT_ID_DIETSTOMACID
reagentcolor = "#664330"
if(REAGENT_CLEANER)
generated_reagents = list(REAGENT_ID_CLEANER_BELLY = 1)
generated_reagents = list(REAGENT_ID_CLEANER = 1)
if(reagent_name in our_reagents)
reagent_name = lowertext(REAGENT_CLEANER)
gen_amount = 1
gen_cost = 10
reagentid = REAGENT_ID_CLEANER_BELLY
reagentid = REAGENT_ID_CLEANER
reagentcolor = "#A5F0EE"
if(REAGENT_LUBE)
generated_reagents = list(REAGENT_ID_LUBE_BELLY = 1)
generated_reagents = list(REAGENT_ID_LUBE = 1)
if(reagent_name in our_reagents)
reagent_name = lowertext(REAGENT_LUBE)
gen_amount = 1
gen_cost = 10
reagentid = REAGENT_ID_LUBE_BELLY
reagentid = REAGENT_ID_LUBE
reagentcolor = "#009CA8"
if(REAGENT_BIOMASS)
generated_reagents = list(REAGENT_ID_BIOMASS_BELLY = 1)
generated_reagents = list(REAGENT_ID_BIOMASS = 1)
if(reagent_name in our_reagents)
reagent_name = lowertext(REAGENT_BIOMASS)
gen_amount = 1
gen_cost = 10
reagentid = REAGENT_ID_BIOMASS_BELLY
reagentid = REAGENT_ID_BIOMASS
reagentcolor = "#DF9FBF"
if(REAGENT_CONCENTRATEDRADIUM)
generated_reagents = list(REAGENT_ID_CONCENTRATEDRADIUM_BELLY = 1)
generated_reagents = list(REAGENT_ID_CONCENTRATEDRADIUM = 1)
if(reagent_name in our_reagents)
reagent_name = lowertext(REAGENT_CONCENTRATEDRADIUM)
gen_amount = 1
gen_cost = 1
reagentid = REAGENT_ID_CONCENTRATEDRADIUM_BELLY
reagentid = REAGENT_ID_CONCENTRATEDRADIUM
reagentcolor = "#C7C7C7"
if(REAGENT_TRICORDRAZINE)
generated_reagents = list(REAGENT_ID_TRICORDRAZINE_BELLY = 1)
generated_reagents = list(REAGENT_ID_TRICORDRAZINE = 1)
if(reagent_name in our_reagents)
reagent_name = lowertext(REAGENT_TRICORDRAZINE)
gen_amount = 1
gen_cost = 10
reagentid = REAGENT_ID_TRICORDRAZINE_BELLY
reagentid = REAGENT_ID_TRICORDRAZINE
reagentcolor = "#8040FF"
is_beneficial = TRUE