mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-22 04:22:39 +01:00
100 lines
3.8 KiB
Plaintext
100 lines
3.8 KiB
Plaintext
/mob/living/carbon/proc/ingest(var/datum/reagents/from, var/datum/reagents/target, var/amount = 1, var/multiplier = 1, var/copy = 0) //we kind of 'sneak' a proc in here for ingesting stuff so we can play with it.
|
|
if(last_taste_time + 50 < world.time)
|
|
var/datum/reagents/temp = new(amount) //temporary holder used to analyse what gets transferred.
|
|
from.trans_to_holder(temp, amount, multiplier, 1)
|
|
|
|
var/text_output = temp.generate_taste_message(src)
|
|
if(text_output != last_taste_text || last_taste_time + 100 < world.time) //We dont want to spam the same message over and over again at the person. Give it a bit of a buffer.
|
|
to_chat(src, SPAN_NOTICE("You can taste [text_output]"))//no taste means there are too many tastes and not enough flavor.
|
|
last_taste_time = world.time
|
|
last_taste_text = text_output
|
|
return from.trans_to_holder(target,amount,multiplier,copy) //complete transfer
|
|
|
|
/* what this does:
|
|
catalogue the 'taste strength' of each one
|
|
calculate text size per text.
|
|
*/
|
|
/datum/reagents/proc/generate_taste_message(mob/living/carbon/taster = null, var/force_taste_sensitivity)
|
|
var/minimum_percent = 15
|
|
if(force_taste_sensitivity)
|
|
minimum_percent = round(15 / force_taste_sensitivity)
|
|
else if(ishuman(taster))
|
|
var/mob/living/carbon/human/H = taster
|
|
var/total_taste_sensitivity
|
|
|
|
var/obj/item/organ/internal/augment/taste_booster/booster = H.internal_organs_by_name[BP_AUG_TASTE_BOOSTER]
|
|
if(booster && !booster.is_broken())
|
|
total_taste_sensitivity = booster.new_taste
|
|
else
|
|
total_taste_sensitivity = H.species.taste_sensitivity
|
|
|
|
minimum_percent = round(15 / (H.isSynthetic() ? TASTE_DULL : total_taste_sensitivity))
|
|
|
|
var/list/out = list()
|
|
var/list/tastes = list() //descriptor = strength
|
|
if(minimum_percent <= 100)
|
|
for(var/_R in reagent_volumes)
|
|
var/singleton/reagent/R = GET_SINGLETON(_R)
|
|
if(!R.taste_mult)
|
|
continue
|
|
if(istype(R, /singleton/reagent/nutriment) && (_R in reagent_data))
|
|
var/list/taste_data = REAGENT_DATA(src, _R)
|
|
for(var/taste in taste_data)
|
|
if(taste in tastes)
|
|
tastes[taste] += taste_data[taste]
|
|
else
|
|
tastes[taste] = taste_data[taste]
|
|
else
|
|
var/taste_desc = taster.species?.name && (taster.species?.name in R.species_taste_description) ? R.species_taste_description[taster.species.name] : R.taste_description
|
|
var/taste_amount = REAGENT_VOLUME(src, _R) * R.taste_mult
|
|
if(R.taste_description in tastes)
|
|
tastes[taste_desc] += taste_amount
|
|
else
|
|
tastes[taste_desc] = taste_amount
|
|
|
|
//deal with percentages
|
|
var/total_taste = 0
|
|
for(var/taste_desc in tastes)
|
|
total_taste += tastes[taste_desc]
|
|
for(var/taste_desc in tastes)
|
|
var/percent = tastes[taste_desc]/total_taste * 100
|
|
if(percent < minimum_percent)
|
|
continue
|
|
var/intensity_desc = "a hint of"
|
|
if(percent > minimum_percent * 2 || percent == 100)
|
|
intensity_desc = ""
|
|
else if(percent > minimum_percent * 3)
|
|
intensity_desc = "the strong flavor of"
|
|
if(intensity_desc == "")
|
|
out += "[taste_desc]"
|
|
else
|
|
out += "[intensity_desc] [taste_desc]"
|
|
|
|
var/temp_text = ""
|
|
switch(get_temperature())
|
|
if(-INFINITY to T0C - 50)
|
|
temp_text = "lethally freezing"
|
|
if(T0C - 50 to T0C - 25)
|
|
temp_text = "freezing"
|
|
if(T0C - 25 to T0C - 10)
|
|
temp_text = "very cold"
|
|
if(T0C - 10 to T0C)
|
|
temp_text = "cold"
|
|
if(T0C to T0C + 15)
|
|
temp_text = "cool"
|
|
if(T0C + 25 to T0C + 40)
|
|
temp_text = "warm"
|
|
if(T0C + 40 to T0C + 100)
|
|
temp_text = "hot"
|
|
if(T0C + 100 to T0C + 120)
|
|
temp_text = "scalding hot"
|
|
if(T0C + 120 to T0C + 200)
|
|
temp_text = "molten hot"
|
|
if(T0C + 200 to INFINITY)
|
|
temp_text = "lethally hot"
|
|
|
|
return "[temp_text][temp_text ? " " : ""][english_list(out, "something indescribable")]."
|
|
|
|
/mob/living/carbon/proc/get_fullness()
|
|
return nutrition + (REAGENT_VOLUME(reagents, /singleton/reagent/nutriment) * 25)
|