Merge pull request #11962 from variableundefined/TasteOfVictory

TG Taste System Port continued
This commit is contained in:
Fox McCloud
2019-08-31 20:28:36 -04:00
committed by GitHub
74 changed files with 930 additions and 439 deletions
+4 -4
View File
@@ -1000,7 +1000,7 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump,
else
if(!forceFed(toEat, user, fullness))
return 0
consume(toEat, bitesize_override, taste = toEat.taste)
consume(toEat, bitesize_override, can_taste_container = toEat.can_taste)
score_foodeaten++
return 1
@@ -1051,7 +1051,7 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump,
/*TO DO - If/when stomach organs are introduced, override this at the human level sending the item to the stomach
so that different stomachs can handle things in different ways VB*/
/mob/living/carbon/proc/consume(var/obj/item/reagent_containers/food/toEat, var/bitesize_override, var/taste = TRUE)
/mob/living/carbon/proc/consume(var/obj/item/reagent_containers/food/toEat, var/bitesize_override, var/can_taste_container = TRUE)
var/this_bite = bitesize_override ? bitesize_override : toEat.bitesize
if(!toEat.reagents)
return
@@ -1060,8 +1060,8 @@ so that different stomachs can handle things in different ways VB*/
if(toEat.consume_sound)
playsound(loc, toEat.consume_sound, rand(10,50), 1)
if(toEat.reagents.total_volume)
if(taste)
taste_reagents(toEat.reagents)
if(can_taste_container)
taste(toEat.reagents)
var/fraction = min(this_bite/toEat.reagents.total_volume, 1)
toEat.reagents.reaction(src, toEat.apply_type, fraction)
toEat.reagents.trans_to(src, this_bite*toEat.transfer_efficiency)
@@ -1898,12 +1898,6 @@ Eyes need to have significantly high darksight to shine unless the mob has the X
.["Make superhero"] = "?_src_=vars;makesuper=[UID()]"
. += "---"
/mob/living/carbon/human/get_taste_sensitivity()
if(dna.species)
return dna.species.taste_sensitivity
else
return 1
/mob/living/carbon/human/proc/special_post_clone_handling()
if(mind && mind.assigned_role == "Cluwne") //HUNKE your suffering never stops
makeCluwne()
-38
View File
@@ -916,44 +916,6 @@
if(pulling && !(pulling in orange(1)))
stop_pulling()
/mob/living/proc/get_taste_sensitivity()
return 1
/mob/living/proc/taste_reagents(datum/reagents/tastes)
if(!get_taste_sensitivity())//this also works for IPCs and stuff that returns 0 here
return
var/do_not_taste_at_all = 1//so we don't spam with recent tastes
var/taste_sum = 0
var/list/taste_list = list()//associative list so we can stack stuff that tastes the same
var/list/final_taste_list = list()//final list of taste strings
for(var/datum/reagent/R in tastes.reagent_list)
taste_sum += R.volume * R.taste_strength
if(!R.taste_message)//set to null; no taste, like water
continue
taste_list[R.taste_message] += R.volume * R.taste_strength
for(var/R in taste_list)
if(recent_tastes[R] && (world.time - recent_tastes[R] < 12 SECONDS))
continue
do_not_taste_at_all = 0//something was fresh enough to taste; could still be bland enough to be unrecognizable
if(taste_list[R] / taste_sum >= 0.15 / get_taste_sensitivity())//we return earlier if the proc returns a 0; won't break the universe
final_taste_list += R
recent_tastes[R] = world.time
if(do_not_taste_at_all)
return //no message spam
if(final_taste_list.len == 0)//too many reagents - none meet their thresholds
to_chat(src, "<span class='notice'>You can't really make out what you're tasting...</span>")
return
to_chat(src, "<span class='notice'>You can taste [english_list(final_taste_list)].</span>")
/mob/living/proc/update_z(new_z) // 1+ to register, null to unregister
if(registered_z != new_z)
if(registered_z)
+30
View File
@@ -0,0 +1,30 @@
/mob/living
var/last_taste_time
var/last_taste_text
/mob/living/proc/get_taste_sensitivity()
return TASTE_SENSITIVITY_NORMAL
/mob/living/carbon/human/get_taste_sensitivity()
if(dna.species)
return dna.species.taste_sensitivity
else
return TASTE_SENSITIVITY_NORMAL
// non destructively tastes a reagent container
/mob/living/proc/taste(datum/reagents/from)
if(last_taste_time + 50 < world.time)
var/taste_sensitivity = get_taste_sensitivity()
var/text_output = from.generate_taste_message(taste_sensitivity)
// We dont want to spam the same message over and over again at the
// person. Give it a bit of a buffer.
if(hallucination > 50 && prob(25))
text_output = pick("spiders","dreams","nightmares","the future","the past","victory",\
"defeat","pain","bliss","revenge","poison","time","space","death","life","truth","lies","justice","memory",\
"regrets","your soul","suffering","music","noise","blood","hunger","the american way")
if(text_output != last_taste_text || last_taste_time + 100 < world.time)
to_chat(src, "<span class='notice'>You can taste [text_output].</span>")
// "something indescribable" -> too many tastes, not enough flavor.
last_taste_time = world.time
last_taste_text = text_output