mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 20:16:55 +01:00
Adds a taste system!
This commit is contained in:
@@ -67,6 +67,12 @@
|
||||
// Factor of how fast mob nutrition decreases
|
||||
#define HUNGER_FACTOR 0.1
|
||||
|
||||
// Taste sensitivity - the more the more reagents you'll taste
|
||||
#define TASTE_SENSITIVITY_NORMAL 1
|
||||
#define TASTE_SENSITIVITY_SHARP 3
|
||||
#define TASTE_SENSITIVITY_DULL 0.75
|
||||
#define TASTE_SENSITIVITY_NO_TASTE 0
|
||||
|
||||
// Reagent type flags, defines the types of mobs this reagent will affect
|
||||
#define ORGANIC 1
|
||||
#define SYNTHETIC 2
|
||||
|
||||
@@ -1015,6 +1015,7 @@ 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)
|
||||
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)
|
||||
|
||||
@@ -2160,3 +2160,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 //factor of how much of a reagent is needed for a human to taste it
|
||||
|
||||
var/siemens_coeff = 1 //base electrocution coefficient
|
||||
|
||||
|
||||
@@ -851,3 +851,39 @@
|
||||
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
|
||||
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>")
|
||||
|
||||
@@ -59,3 +59,5 @@
|
||||
var/tesla_ignore = FALSE
|
||||
|
||||
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()
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
var/drink_icon = null
|
||||
var/drink_name = "Glass of ..what?"
|
||||
var/drink_desc = "You can't really tell what this is."
|
||||
var/taste_strength = 1 //how easy it is to taste - the more the easier
|
||||
var/taste_message = "bitterness" //life's bitter by default. Cool points for using a span class for when you're tasting <span class='userdanger'>LIQUID FUCKING DEATH</span>
|
||||
|
||||
/datum/reagent/Destroy()
|
||||
. = ..()
|
||||
@@ -148,4 +150,4 @@
|
||||
if(prob(5))
|
||||
to_chat(M, "<span class='warning'>You feel like you can't live without [name]!</span>")
|
||||
if(prob(5))
|
||||
to_chat(M, "<span class='warning'>You would DIE for some [name] right now!</span>")
|
||||
to_chat(M, "<span class='warning'>You would DIE for some [name] right now!</span>")
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
process_flags = ORGANIC | SYNTHETIC //Adminbuse knows no bounds!
|
||||
admin_only = 1
|
||||
can_synth = 0
|
||||
taste_message = "admin abuse"
|
||||
|
||||
/datum/reagent/medicine/adminordrazine/on_mob_life(mob/living/carbon/M)
|
||||
M.setCloneLoss(0)
|
||||
@@ -58,4 +59,5 @@
|
||||
/datum/reagent/medicine/adminordrazine/nanites
|
||||
name = "Nanites"
|
||||
id = "nanites"
|
||||
description = "Nanomachines that aid in rapid cellular regeneration."
|
||||
description = "Nanomachines that aid in rapid cellular regeneration."
|
||||
taste_message = "nanomachines, son"
|
||||
|
||||
Reference in New Issue
Block a user