mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-21 11:07:12 +01:00
Merge pull request #7333 from FlattestGuitar/taste-test
Adds a taste system!
This commit is contained in:
@@ -977,7 +977,7 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump,
|
||||
else
|
||||
if(!forceFed(toEat, user, fullness))
|
||||
return 0
|
||||
consume(toEat, bitesize_override)
|
||||
consume(toEat, bitesize_override, taste = toEat.taste)
|
||||
score_foodeaten++
|
||||
return 1
|
||||
|
||||
@@ -1030,7 +1030,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/weapon/reagent_containers/food/toEat, var/bitesize_override)
|
||||
/mob/living/carbon/proc/consume(var/obj/item/weapon/reagent_containers/food/toEat, var/bitesize_override, var/taste = TRUE)
|
||||
var/this_bite = bitesize_override ? bitesize_override : toEat.bitesize
|
||||
if(!toEat.reagents)
|
||||
return
|
||||
@@ -1039,6 +1039,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)
|
||||
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)
|
||||
|
||||
@@ -2050,3 +2050,9 @@
|
||||
update_icons()
|
||||
|
||||
..()
|
||||
|
||||
mob/living/carbon/human/get_taste_sensitivity()
|
||||
if(species)
|
||||
return species.taste_sensitivity
|
||||
else
|
||||
return 1
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
var/reagent_tag //Used for metabolizing reagents.
|
||||
var/hunger_drain = HUNGER_FACTOR
|
||||
var/digestion_ratio = 1 //How quickly the species digests/absorbs reagents.
|
||||
var/taste_sensitivity = TASTE_SENSITIVITY_NORMAL //the most widely used factor; humans use a different one
|
||||
|
||||
var/siemens_coeff = 1 //base electrocution coefficient
|
||||
|
||||
|
||||
@@ -114,6 +114,7 @@
|
||||
clothing_flags = HAS_UNDERWEAR | HAS_UNDERSHIRT | HAS_SOCKS
|
||||
bodyflags = HAS_TAIL | HAS_HEAD_ACCESSORY | HAS_HEAD_MARKINGS | HAS_BODY_MARKINGS | HAS_SKIN_COLOR | TAIL_WAGGING
|
||||
dietflags = DIET_OMNI
|
||||
taste_sensitivity = TASTE_SENSITIVITY_SHARP
|
||||
reagent_tag = PROCESS_ORG
|
||||
flesh_color = "#AFA59E"
|
||||
base_color = "#424242"
|
||||
@@ -164,6 +165,7 @@
|
||||
clothing_flags = HAS_UNDERWEAR | HAS_UNDERSHIRT | HAS_SOCKS
|
||||
bodyflags = HAS_TAIL | TAIL_WAGGING | TAIL_OVERLAPPED | HAS_HEAD_ACCESSORY | HAS_MARKINGS | HAS_SKIN_COLOR
|
||||
dietflags = DIET_OMNI
|
||||
taste_sensitivity = TASTE_SENSITIVITY_SHARP
|
||||
reagent_tag = PROCESS_ORG
|
||||
flesh_color = "#966464"
|
||||
base_color = "#CF4D2F"
|
||||
@@ -215,6 +217,7 @@
|
||||
clothing_flags = HAS_UNDERWEAR | HAS_UNDERSHIRT | HAS_SOCKS
|
||||
bodyflags = HAS_SKIN_COLOR | HAS_BODY_MARKINGS
|
||||
dietflags = DIET_HERB
|
||||
taste_sensitivity = TASTE_SENSITIVITY_DULL
|
||||
flesh_color = "#8CD7A3"
|
||||
blood_color = "#1D2CBF"
|
||||
base_color = "#38b661" //RGB: 56, 182, 97.
|
||||
@@ -800,6 +803,7 @@
|
||||
species_traits = list(NO_BREATHE, RADIMMUNE, IS_PLANT, NO_BLOOD, NO_PAIN)
|
||||
clothing_flags = HAS_SOCKS
|
||||
dietflags = 0 //Diona regenerate nutrition in light, no diet necessary
|
||||
taste_sensitivity = TASTE_SENSITIVITY_NO_TASTE
|
||||
|
||||
oxy_mod = 0
|
||||
|
||||
@@ -907,6 +911,7 @@
|
||||
clothing_flags = HAS_UNDERWEAR | HAS_UNDERSHIRT | HAS_SOCKS
|
||||
bodyflags = HAS_SKIN_COLOR | HAS_HEAD_MARKINGS | HAS_HEAD_ACCESSORY | ALL_RPARTS
|
||||
dietflags = 0 //IPCs can't eat, so no diet
|
||||
taste_sensitivity = TASTE_SENSITIVITY_NO_TASTE
|
||||
blood_color = "#1F181F"
|
||||
flesh_color = "#AAAAAA"
|
||||
//Default styles for created mobs.
|
||||
|
||||
@@ -1002,3 +1002,41 @@
|
||||
to_chat(src, "<span class='warning'>You don't have the dexterity to do this!</span>")
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/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 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>")
|
||||
|
||||
@@ -60,4 +60,5 @@
|
||||
|
||||
var/list/say_log = list() //a log of what we've said, plain text, no spans or junk, essentially just each individual "message"
|
||||
|
||||
var/list/recent_tastes = list()
|
||||
var/blood_volume = 0 //how much blood the mob has
|
||||
|
||||
Reference in New Issue
Block a user