Skip to content

Commit

Permalink
Extends the bartender's alcohol intuition (goonstation#20856)
Browse files Browse the repository at this point in the history
  • Loading branch information
MintyPhresh authored Sep 27, 2024
1 parent 0729c1a commit 0fdbaf6
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 29 deletions.
2 changes: 1 addition & 1 deletion code/datums/jobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ ABSTRACT_TYPE(/datum/job/civilian)
alias_names = list("Barman")
limit = 1
wages = PAY_UNTRAINED
trait_list = list("training_drinker")
trait_list = list("training_drinker", "training_bartender")
access_string = "Bartender"
slot_belt = list(/obj/item/device/pda2/bartender)
slot_jump = list(/obj/item/clothing/under/rank/bartender)
Expand Down
5 changes: 5 additions & 0 deletions code/datums/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,11 @@ ABSTRACT_TYPE(/datum/trait/job)
desc = "Subject is experienced in foodstuffs and their effects."
id = "training_chef"

/datum/trait/job/bartender
name = "Bartender Training"
desc = "Subject has a keen mind for all things alcoholic."
id = "training_bartender"

// bartender, detective, HoS
/datum/trait/job/drinker
name = "Professional Drinker"
Expand Down
21 changes: 21 additions & 0 deletions code/mob/living/carbon/human/procs/get_desc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,27 @@
items = copytext(items, 3)
. += "<br>[SPAN_NOTICE("[src] is juggling [items]!")]"

if (src.reagents.has_reagent("ethanol"))
var/et_amt = src.reagents.get_reagent_amount("ethanol")
var/drunk_assess = ""
if (!isalcoholresistant(src) || src.reagents.has_reagent("moonshine"))
switch (et_amt)
if (0 to 10)
drunk_assess = "[capitalize("[he_or_she(src)]")] seem[blank_or_s(src)] <b>buzzed.</b>"
if (10 to 20)
drunk_assess = "[capitalize("[he_or_she(src)]")] look[blank_or_s(src)] a little <b>tipsy.</b>"
if (20 to 40)
drunk_assess = "[capitalize("[hes_or_shes(src)]")] pretty <b>[prob(10)? "stewed" : "drunk"].</b>"
if (40 to 70)
drunk_assess = "[capitalize("[hes_or_shes(src)]")] totally <b>smashed.</b>"
if (70 to 100)
drunk_assess = SPAN_ALERT("[capitalize("[hes_or_shes(src)]")] <b>[prob(3)? " zonked</b> off [his_or_her(src)] <b>rocker" : "badly inebriated"].</b>")
if (100 to INFINITY)
drunk_assess = SPAN_ALERT("[capitalize("[hes_or_shes(src)]")] <b>dying of drink.</b>")
else
drunk_assess = "[capitalize("[his_or_her(src)]")] inebriaton is almost <b>imperceptible</b> to you."
. += "<br> [drunk_assess]"

. += "<br>[SPAN_NOTICE("*---------*")]"

if (GET_DIST(usr, src) < 4)
Expand Down
49 changes: 28 additions & 21 deletions code/modules/chemistry/Chemistry-Holder.dm
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,11 @@ proc/chem_helmet_check(mob/living/carbon/human/H, var/what_liquid="hot")
for(var/current_id in reagent_list)
var/datum/reagent/current_reagent = reagent_list[current_id]
. += "<br>[SPAN_ALERT("[current_reagent.volume] units of [current_reagent.name]")]"

if (user.traitHolder.hasTrait("training_bartender"))
var/eth_eq = get_ethanol_equivalent(user, src)
if (eth_eq)
. += "<br> [SPAN_REGULAR("You estimate there's the equivalent of <b>[eth_eq] units of ethanol</b> here.")]"
return

proc/get_reagents_fullness()
Expand Down Expand Up @@ -1098,27 +1103,29 @@ proc/chem_helmet_check(mob/living/carbon/human/H, var/what_liquid="hot")

/// Gets a string of what something tastes like (as shown to the drinker/eater/whatever)
proc/get_taste_string(mob/taster)
if (iscarbon(taster) || ismobcritter(taster))
if (taster.mind && taster.mind.assigned_role == "Bartender")
var/reag_list = ""
for (var/current_id in src.reagent_list)
var/datum/reagent/current_reagent = src.reagent_list[current_id]
if (length(src.reagent_list) > 1 && src.reagent_list[src.reagent_list.len] == current_id)
reag_list += " and [current_reagent.name]"
continue
reag_list += ", [current_reagent.name]"
reag_list = copytext(reag_list, 3)
. = "Tastes like there might be some [reag_list] in this. "
var/tastes = src.get_prevalent_tastes(3)
switch (length(tastes))
if (0)
. += "Tastes pretty bland."
if (1)
. += "Tastes kind of [tastes[1]]."
if (2)
. += "Tastes kind of [tastes[1]] and [tastes[2]]."
else
. += "Tastes kind of [tastes[1]], [tastes[2]], and a little bit [tastes[3]]."
if (taster.traitHolder.hasTrait("training_bartender"))
var/reag_list = ""
var/eth_eq = get_ethanol_equivalent(taster, src)
for (var/current_id in src.reagent_list)
var/datum/reagent/current_reagent = src.reagent_list[current_id]
if (length(src.reagent_list) > 1 && src.reagent_list[src.reagent_list.len] == current_id)
reag_list += " and [current_reagent.name]"
continue
reag_list += ", [current_reagent.name]"
reag_list = copytext(reag_list, 3)
. = "Tastes like there might be some [reag_list] in this. "
if (eth_eq)
. += "[SPAN_REGULAR("This should be about <b>[eth_eq / src.total_volume * 100]% ethanol by volume.</b> <br>")]"
var/tastes = src.get_prevalent_tastes(3)
switch (length(tastes))
if (0)
. += "Tastes pretty bland."
if (1)
. += "Tastes kind of [tastes[1]]."
if (2)
. += "Tastes kind of [tastes[1]] and [tastes[2]]."
else
. += "Tastes kind of [tastes[1]], [tastes[2]], and a little bit [tastes[3]]."

/// returns whether reagents are solid, liquid, gas, or mixture
proc/get_state_description()
Expand Down
8 changes: 4 additions & 4 deletions code/modules/chemistry/tools/food_and_drink.dm
Original file line number Diff line number Diff line change
Expand Up @@ -623,9 +623,9 @@ ABSTRACT_TYPE(/obj/item/reagent_containers/food/snacks)
return
if(src.is_sealed)
return
if(user.mind.assigned_role == "Bartender")
if(user.traitHolder.hasTrait("training_bartender"))
. = ("You deftly [pick("spin", "twirl")] [src] managing to keep all the contents inside.")
if(!ON_COOLDOWN(user, "bartender spinning xp", 180 SECONDS)) //only for real cups
if(user.mind.assigned_role == "Bartender" && !ON_COOLDOWN(user, "bartender spinning xp", 180 SECONDS)) //only for real cups
JOB_XP(user, "Bartender", 1)
else
user.visible_message(SPAN_ALERT("<b>[user] spills the contents of [src] all over [him_or_her(user)]self!</b>"))
Expand Down Expand Up @@ -1101,11 +1101,11 @@ ABSTRACT_TYPE(/obj/item/reagent_containers/food/snacks)
var/success_prob = 25
var/hurt_prob = 50

if (user.reagents && user.reagents.has_reagent("ethanol") && user.mind && user.mind.assigned_role == "Bartender")
if (user.reagents && user.reagents.has_reagent("ethanol") && user.traitHolder.hasTrait("training_bartender"))
success_prob = 75
hurt_prob = 25

else if (user.mind && user.mind.assigned_role == "Bartender")
else if (user.traitHolder.hasTrait("training_bartender"))
success_prob = 50
hurt_prob = 10

Expand Down
5 changes: 5 additions & 0 deletions code/obj/item/device/pda2/scanners.dm
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,14 @@
size = 6

scan_atom(atom/A)
var/mob/user = usr
if (..())
return
. = scan_reagents(A, visible = TRUE)
if (user.traitHolder.hasTrait("training_bartender"))
var/eth_eq = get_ethanol_equivalent(user, A.reagents)
if (eth_eq)
. += "<br> [SPAN_REGULAR("You estimate there's the equivalent of <b>[eth_eq] units of ethanol</b> here.")]"

//Plant scanner
plant_scan
Expand Down
11 changes: 8 additions & 3 deletions code/obj/item/device/scanners.dm
Original file line number Diff line number Diff line change
Expand Up @@ -530,9 +530,14 @@ TYPEINFO(/obj/item/device/reagentscanner)
if (isnull(src.scan_results))
boutput(user, SPAN_ALERT("\The [src] encounters an error and crashes!"))
else
boutput(user, "[src.scan_results]")

attack_self(mob/user as mob)
var/scan_output = "[src.scan_results]"
if (user.traitHolder.hasTrait("training_bartender"))
var/eth_eq = get_ethanol_equivalent(user, A.reagents)
if (eth_eq)
scan_output += "<br> [SPAN_REGULAR("You estimate there's the equivalent of <b>[eth_eq] units of ethanol</b> here.")]"
boutput(user, scan_output)

attack_self(mob/user as mob) // no eth_eq here cuz then we'd have to save how the reagent container used to be
if (isnull(src.scan_results))
boutput(user, SPAN_NOTICE("No previous scan results located."))
return
Expand Down
15 changes: 15 additions & 0 deletions code/procs/scanprocs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,21 @@

return data

/proc/get_ethanol_equivalent(mob/user, datum/reagents/R)
var/eth_eq = 0
var/should_we_output = FALSE //looks bad if we output this when it's just ethanol in there
for (var/current_id in R.reagent_list)
var/datum/reagent/current_reagent = R.reagent_list[current_id]
if (istype(current_reagent, /datum/reagent/fooddrink/alcoholic))
var/datum/reagent/fooddrink/alcoholic/alch_reagent = current_reagent
eth_eq += alch_reagent.alch_strength * alch_reagent.volume
should_we_output = TRUE
if (current_reagent.id == "ethanol")
eth_eq += current_reagent.volume
if (should_we_output == FALSE)
eth_eq = 0
return eth_eq

// Should make it easier to maintain the detective's scanner and PDA program (Convair880).
/proc/scan_forensic(var/atom/A as turf|obj|mob, visible = 0)
if (istype(A, /obj/ability_button)) // STOP THAT
Expand Down

0 comments on commit 0fdbaf6

Please sign in to comment.