Files
Yogstation/code/modules/food_and_drinks/drinks/drinks.dm
Ashe Higgs ab9e2e8902 Adds minor roundstart traits! (ala CDDA, etc.) (#35440)
* Roundstart traits

* Unspaghettifies night vision

* Fuck everything

* Issues patch
2018-03-02 13:39:44 +13:00

498 lines
17 KiB
Plaintext

////////////////////////////////////////////////////////////////////////////////
/// Drinks.
////////////////////////////////////////////////////////////////////////////////
/obj/item/reagent_containers/food/drinks
name = "drink"
desc = "yummy"
icon = 'icons/obj/drinks.dmi'
icon_state = null
lefthand_file = 'icons/mob/inhands/misc/food_lefthand.dmi'
righthand_file = 'icons/mob/inhands/misc/food_righthand.dmi'
container_type = OPENCONTAINER
var/gulp_size = 5 //This is now officially broken ... need to think of a nice way to fix it.
possible_transfer_amounts = list(5,10,15,20,25,30,50)
volume = 50
resistance_flags = NONE
var/isGlass = TRUE //Whether the 'bottle' is made of glass or not so that milk cartons dont shatter when someone gets hit by it
/obj/item/reagent_containers/food/drinks/on_reagent_change(changetype)
if (gulp_size < 5)
gulp_size = 5
else
gulp_size = max(round(reagents.total_volume / 5), 5)
/obj/item/reagent_containers/food/drinks/attack(mob/living/M, mob/user, def_zone)
if(!reagents || !reagents.total_volume)
to_chat(user, "<span class='warning'>[src] is empty!</span>")
return 0
if(!canconsume(M, user))
return 0
if (!is_drainable())
to_chat(user, "<span class='warning'>[src]'s lid hasn't been opened!</span>")
return 0
if(M == user)
to_chat(M, "<span class='notice'>You swallow a gulp of [src].</span>")
if(M.has_trait(TRAIT_VORACIOUS))
M.changeNext_move(CLICK_CD_MELEE * 0.5) //chug! chug! chug!
else
M.visible_message("<span class='danger'>[user] attempts to feed the contents of [src] to [M].</span>", "<span class='userdanger'>[user] attempts to feed the contents of [src] to [M].</span>")
if(!do_mob(user, M))
return
if(!reagents || !reagents.total_volume)
return // The drink might be empty after the delay, such as by spam-feeding
M.visible_message("<span class='danger'>[user] feeds the contents of [src] to [M].</span>", "<span class='userdanger'>[user] feeds the contents of [src] to [M].</span>")
add_logs(user, M, "fed", reagents.log_list())
var/fraction = min(gulp_size/reagents.total_volume, 1)
checkLiked(fraction, M)
reagents.reaction(M, INGEST, fraction)
reagents.trans_to(M, gulp_size)
playsound(M.loc,'sound/items/drink.ogg', rand(10,50), 1)
return 1
/obj/item/reagent_containers/food/drinks/afterattack(obj/target, mob/user , proximity)
if(!proximity)
return
if(target.is_refillable()) //Something like a glass. Player probably wants to transfer TO it.
if(!reagents.total_volume)
to_chat(user, "<span class='warning'>[src] is empty.</span>")
return
if(target.reagents.holder_full())
to_chat(user, "<span class='warning'>[target] is full.</span>")
return
var/refill = reagents.get_master_reagent_id()
var/trans = src.reagents.trans_to(target, amount_per_transfer_from_this)
to_chat(user, "<span class='notice'>You transfer [trans] units of the solution to [target].</span>")
if(iscyborg(user)) //Cyborg modules that include drinks automatically refill themselves, but drain the borg's cell
var/mob/living/silicon/robot/bro = user
bro.cell.use(30)
addtimer(CALLBACK(reagents, /datum/reagents.proc/add_reagent, refill, trans), 600)
else if(target.is_drainable()) //A dispenser. Transfer FROM it TO us.
if (!is_refillable())
to_chat(user, "<span class='warning'>[src]'s tab isn't open!</span>")
return
if(!target.reagents.total_volume)
to_chat(user, "<span class='warning'>[target] is empty.</span>")
return
if(reagents.holder_full())
to_chat(user, "<span class='warning'>[src] is full.</span>")
return
var/trans = target.reagents.trans_to(src, amount_per_transfer_from_this)
to_chat(user, "<span class='notice'>You fill [src] with [trans] units of the contents of [target].</span>")
else
/obj/item/reagent_containers/food/drinks/attackby(obj/item/I, mob/user, params)
var/hotness = I.is_hot()
if(hotness && reagents)
reagents.expose_temperature(hotness)
to_chat(user, "<span class='notice'>You heat [name] with [I]!</span>")
..()
/obj/item/reagent_containers/food/drinks/throw_impact(atom/target, datum/thrownthing/throwinfo)
. = ..()
if(!.) //if the bottle wasn't caught
smash(target, throwinfo.thrower, TRUE)
/obj/item/reagent_containers/food/drinks/proc/smash(atom/target, mob/thrower, ranged = FALSE)
if(!isGlass)
return
if(bartender_check(target) && ranged)
return
var/obj/item/broken_bottle/B = new (loc)
B.icon_state = icon_state
var/icon/I = new('icons/obj/drinks.dmi', src.icon_state)
I.Blend(B.broken_outline, ICON_OVERLAY, rand(5), 1)
I.SwapColor(rgb(255, 0, 220, 255), rgb(0, 0, 0, 0))
B.icon = I
B.name = "broken [name]"
if(prob(33))
new/obj/item/shard(drop_location())
playsound(src, "shatter", 70, 1)
transfer_fingerprints_to(B)
qdel(src)
////////////////////////////////////////////////////////////////////////////////
/// Drinks. END
////////////////////////////////////////////////////////////////////////////////
/obj/item/reagent_containers/food/drinks/trophy
name = "pewter cup"
desc = "Everyone gets a trophy."
icon_state = "pewter_cup"
w_class = WEIGHT_CLASS_TINY
force = 1
throwforce = 1
amount_per_transfer_from_this = 5
materials = list(MAT_METAL=100)
possible_transfer_amounts = list()
volume = 5
flags_1 = CONDUCT_1
container_type = OPENCONTAINER
spillable = TRUE
resistance_flags = FIRE_PROOF
isGlass = FALSE
/obj/item/reagent_containers/food/drinks/trophy/gold_cup
name = "gold cup"
desc = "You're winner!"
icon_state = "golden_cup"
w_class = WEIGHT_CLASS_BULKY
force = 14
throwforce = 10
amount_per_transfer_from_this = 20
materials = list(MAT_GOLD=1000)
volume = 150
/obj/item/reagent_containers/food/drinks/trophy/silver_cup
name = "silver cup"
desc = "Best loser!"
icon_state = "silver_cup"
w_class = WEIGHT_CLASS_NORMAL
force = 10
throwforce = 8
amount_per_transfer_from_this = 15
materials = list(MAT_SILVER=800)
volume = 100
/obj/item/reagent_containers/food/drinks/trophy/bronze_cup
name = "bronze cup"
desc = "At least you ranked!"
icon_state = "bronze_cup"
w_class = WEIGHT_CLASS_SMALL
force = 5
throwforce = 4
amount_per_transfer_from_this = 10
materials = list(MAT_METAL=400)
volume = 25
///////////////////////////////////////////////Drinks
//Notes by Darem: Drinks are simply containers that start preloaded. Unlike condiments, the contents can be ingested directly
// rather then having to add it to something else first. They should only contain liquids. They have a default container size of 50.
// Formatting is the same as food.
/obj/item/reagent_containers/food/drinks/coffee
name = "robust coffee"
desc = "Careful, the beverage you're about to enjoy is extremely hot."
icon_state = "coffee"
list_reagents = list("coffee" = 30)
spillable = TRUE
resistance_flags = FREEZE_PROOF
isGlass = FALSE
/obj/item/reagent_containers/food/drinks/ice
name = "ice cup"
desc = "Careful, cold ice, do not chew."
icon_state = "coffee"
list_reagents = list("ice" = 30)
spillable = TRUE
isGlass = FALSE
/obj/item/reagent_containers/food/drinks/mug/ // parent type is literally just so empty mug sprites are a thing
name = "mug"
desc = "A drink served in a classy mug."
icon_state = "tea"
item_state = "coffee"
spillable = TRUE
/obj/item/reagent_containers/food/drinks/mug/on_reagent_change(changetype)
if(reagents.total_volume)
icon_state = "tea"
else
icon_state = "tea_empty"
/obj/item/reagent_containers/food/drinks/mug/tea
name = "Duke Purple tea"
desc = "An insult to Duke Purple is an insult to the Space Queen! Any proper gentleman will fight you, if you sully this tea."
list_reagents = list("tea" = 30)
/obj/item/reagent_containers/food/drinks/mug/coco
name = "Dutch hot coco"
desc = "Made in Space South America."
list_reagents = list("hot_coco" = 30, "sugar" = 5)
foodtype = SUGAR
resistance_flags = FREEZE_PROOF
/obj/item/reagent_containers/food/drinks/dry_ramen
name = "cup ramen"
desc = "Just add 10ml of water, self heats! A taste that reminds you of your school years."
icon_state = "ramen"
list_reagents = list("dry_ramen" = 30)
foodtype = GRAIN
isGlass = FALSE
/obj/item/reagent_containers/food/drinks/beer
name = "space beer"
desc = "Beer. In space."
icon_state = "beer"
list_reagents = list("beer" = 30)
foodtype = GRAIN | ALCOHOL
/obj/item/reagent_containers/food/drinks/ale
name = "Magm-Ale"
desc = "A true dorf's drink of choice."
icon_state = "alebottle"
item_state = "beer"
list_reagents = list("ale" = 30)
foodtype = GRAIN | ALCOHOL
/obj/item/reagent_containers/food/drinks/sillycup
name = "paper cup"
desc = "A paper water cup."
icon_state = "water_cup_e"
possible_transfer_amounts = list()
volume = 10
spillable = TRUE
isGlass = FALSE
/obj/item/reagent_containers/food/drinks/sillycup/on_reagent_change(changetype)
if(reagents.total_volume)
icon_state = "water_cup"
else
icon_state = "water_cup_e"
/obj/item/reagent_containers/food/drinks/sillycup/smallcarton
name = "small carton"
desc = "A small carton, intended for holding drinks."
icon_state = "juicebox"
volume = 15 //I figure if you have to craft these it should at least be slightly better than something you can get for free from a watercooler
/obj/item/reagent_containers/food/drinks/sillycup/smallcarton/smash(atom/target, mob/thrower, ranged = FALSE)
if(bartender_check(target) && ranged)
return
var/obj/item/broken_bottle/B = new (loc)
B.icon_state = icon_state
var/icon/I = new('icons/obj/drinks.dmi', src.icon_state)
I.Blend(B.broken_outline, ICON_OVERLAY, rand(5), 1)
I.SwapColor(rgb(255, 0, 220, 255), rgb(0, 0, 0, 0))
B.icon = I
B.name = "broken [name]"
B.force = 0
B.throwforce = 0
B.desc = "A carton with the bottom half burst open. Might give you a papercut."
transfer_fingerprints_to(B)
qdel(src)
/obj/item/reagent_containers/food/drinks/sillycup/smallcarton/on_reagent_change(changetype)
if (reagents.reagent_list.len)
switch(reagents.get_master_reagent_id())
if("orangejuice")
icon_state = "orangebox"
name = "orange juice box"
desc = "A great source of vitamins. Stay healthy!"
foodtype = FRUIT
if("milk")
icon_state = "milkbox"
name = "carton of milk"
desc = "An excellent source of calcium for growing space explorers."
foodtype = DAIRY
if("applejuice")
icon_state = "juicebox"
name = "apple juice box"
desc = "Sweet apple juice. Don't be late for school!"
foodtype = FRUIT
if("grapejuice")
icon_state = "grapebox"
name = "grape juice box"
desc = "Tasty grape juice in a fun little container. Non-alcoholic!"
foodtype = FRUIT
if("chocolate_milk")
icon_state = "chocolatebox"
name = "carton of chocolate milk"
desc = "Milk for cool kids!"
foodtype = SUGAR
if("eggnog")
icon_state = "nog2"
name = "carton of eggnog"
desc = "For enjoying the most wonderful time of the year."
foodtype = MEAT
else
icon_state = "juicebox"
name = "small carton"
desc = "A small carton, intended for holding drinks."
//////////////////////////drinkingglass and shaker//
//Note by Darem: This code handles the mixing of drinks. New drinks go in three places: In Chemistry-Reagents.dm (for the drink
// itself), in Chemistry-Recipes.dm (for the reaction that changes the components into the drink), and here (for the drinking glass
// icon states.
/obj/item/reagent_containers/food/drinks/shaker
name = "shaker"
desc = "A metal shaker to mix drinks in."
icon_state = "shaker"
materials = list(MAT_METAL=1500)
amount_per_transfer_from_this = 10
volume = 100
isGlass = FALSE
/obj/item/reagent_containers/food/drinks/flask
name = "flask"
desc = "Every good spaceman knows it's a good idea to bring along a couple of pints of whiskey wherever they go."
icon_state = "flask"
materials = list(MAT_METAL=250)
volume = 60
isGlass = FALSE
/obj/item/reagent_containers/food/drinks/flask/gold
name = "captain's flask"
desc = "A gold flask belonging to the captain."
icon_state = "flask_gold"
materials = list(MAT_GOLD=500)
/obj/item/reagent_containers/food/drinks/flask/det
name = "detective's flask"
desc = "The detective's only true friend."
icon_state = "detflask"
list_reagents = list("whiskey" = 30)
/obj/item/reagent_containers/food/drinks/britcup
name = "cup"
desc = "A cup with the british flag emblazoned on it."
icon_state = "britcup"
volume = 30
spillable = TRUE
//////////////////////////soda_cans//
//These are in their own group to be used as IED's in /obj/item/grenade/ghettobomb.dm
/obj/item/reagent_containers/food/drinks/soda_cans
name = "soda can"
lefthand_file = 'icons/mob/inhands/misc/food_lefthand.dmi'
righthand_file = 'icons/mob/inhands/misc/food_righthand.dmi'
container_type = NONE
spillable = FALSE
isGlass = FALSE
/obj/item/reagent_containers/food/drinks/soda_cans/suicide_act(mob/living/carbon/user)
user.visible_message("<span class='suicide'>[user] is trying to eat \the [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
var/obj/item/trash/can/crushed_can = new /obj/item/trash/can(user.loc)
crushed_can.icon_state = icon_state
qdel(src)
return BRUTELOSS
/obj/item/reagent_containers/food/drinks/soda_cans/attack(mob/M, mob/user)
if(M == user && !src.reagents.total_volume && user.a_intent == INTENT_HARM && user.zone_selected == "head")
user.visible_message("<span class='warning'>[user] crushes the can of [src] on [user.p_their()] forehead!</span>", "<span class='notice'>You crush the can of [src] on your forehead.</span>")
playsound(user.loc,'sound/weapons/pierce.ogg', rand(10,50), 1)
var/obj/item/trash/can/crushed_can = new /obj/item/trash/can(user.loc)
crushed_can.icon_state = icon_state
qdel(src)
..()
/obj/item/reagent_containers/food/drinks/soda_cans/attack_self(mob/user)
if(!is_drainable())
to_chat(user, "You pull back the tab of \the [src] with a satisfying pop.") //Ahhhhhhhh
container_type = OPENCONTAINER
playsound(src, "can_open", 50, 1)
spillable = TRUE
return
return ..()
/obj/item/reagent_containers/food/drinks/soda_cans/cola
name = "Space Cola"
desc = "Cola. in space."
icon_state = "cola"
list_reagents = list("cola" = 30)
foodtype = SUGAR
/obj/item/reagent_containers/food/drinks/soda_cans/tonic
name = "T-Borg's tonic water"
desc = "Quinine tastes funny, but at least it'll keep that Space Malaria away."
icon_state = "tonic"
list_reagents = list("tonic" = 50)
foodtype = ALCOHOL
/obj/item/reagent_containers/food/drinks/soda_cans/sodawater
name = "soda water"
desc = "A can of soda water. Why not make a scotch and soda?"
icon_state = "sodawater"
list_reagents = list("sodawater" = 50)
/obj/item/reagent_containers/food/drinks/soda_cans/lemon_lime
name = "orange soda"
desc = "You wanted ORANGE. It gave you Lemon Lime."
icon_state = "lemon-lime"
list_reagents = list("lemon_lime" = 30)
foodtype = FRUIT
/obj/item/reagent_containers/food/drinks/soda_cans/lemon_lime/Initialize()
. = ..()
name = "lemon-lime soda"
/obj/item/reagent_containers/food/drinks/soda_cans/space_up
name = "Space-Up!"
desc = "Tastes like a hull breach in your mouth."
icon_state = "space-up"
list_reagents = list("space_up" = 30)
foodtype = SUGAR | JUNKFOOD
/obj/item/reagent_containers/food/drinks/soda_cans/starkist
name = "Star-kist"
desc = "The taste of a star in liquid form. And, a bit of tuna...?"
icon_state = "starkist"
list_reagents = list("cola" = 15, "orangejuice" = 15)
foodtype = SUGAR | FRUIT | JUNKFOOD
/obj/item/reagent_containers/food/drinks/soda_cans/space_mountain_wind
name = "Space Mountain Wind"
desc = "Blows right through you like a space wind."
icon_state = "space_mountain_wind"
list_reagents = list("spacemountainwind" = 30)
foodtype = SUGAR | JUNKFOOD
/obj/item/reagent_containers/food/drinks/soda_cans/thirteenloko
name = "Thirteen Loko"
desc = "The CMO has advised crew members that consumption of Thirteen Loko may result in seizures, blindness, drunkenness, or even death. Please Drink Responsibly."
icon_state = "thirteen_loko"
list_reagents = list("thirteenloko" = 30)
foodtype = SUGAR | JUNKFOOD
/obj/item/reagent_containers/food/drinks/soda_cans/dr_gibb
name = "Dr. Gibb"
desc = "A delicious mixture of 42 different flavors."
icon_state = "dr_gibb"
list_reagents = list("dr_gibb" = 30)
foodtype = SUGAR | JUNKFOOD
/obj/item/reagent_containers/food/drinks/soda_cans/pwr_game
name = "Pwr Game"
desc = "The only drink with the PWR that true gamers crave."
icon_state = "purple_can"
list_reagents = list("pwr_game" = 30)
/obj/item/reagent_containers/food/drinks/soda_cans/shamblers
name = "Shambler's juice"
desc = "~Shake me up some of that Shambler's Juice!~"
icon_state = "shamblers"
list_reagents = list("shamblers" = 30)
foodtype = SUGAR | JUNKFOOD
/obj/item/reagent_containers/food/drinks/soda_cans/air
name = "canned air"
desc = "There is no air shortage. Do not drink."
icon_state = "air"
list_reagents = list("nitrogen" = 24, "oxygen" = 6)