From 02be2c77a0fee6295b02a05f2d7cbad3faca25b3 Mon Sep 17 00:00:00 2001 From: Aronai Sieyes Date: Fri, 6 Aug 2021 16:15:45 -0400 Subject: [PATCH] Allows sipping proteans/prometheans --- code/modules/food/drinkingglass/extras.dm | 45 +++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/code/modules/food/drinkingglass/extras.dm b/code/modules/food/drinkingglass/extras.dm index eb139a92b7..6605bb937f 100644 --- a/code/modules/food/drinkingglass/extras.dm +++ b/code/modules/food/drinkingglass/extras.dm @@ -69,4 +69,49 @@ glass_desc = "There is a straw in the glass." icon_state = "straw" +// This isn't great code, so if you're doing something that happens many times or isn't user-initiated +// like this is, where it'll likely happen 0-4 times a shift, then don't copy this pattern. +/obj/item/weapon/glass_extra/straw/afterattack(atom/target, mob/user, proximity_flag, click_parameters) + if(ismob(target) && proximity_flag) + // Clicked protean blob + if(istype(target, /mob/living/simple_mob/protean_blob)) + sipp_mob(target, user, "liquid_protean") + return + // Clicked humanoid + else if(ishuman(target)) + var/mob/living/carbon/human/H = target + var/speciesname = H.species?.name + switch(speciesname) + if(SPECIES_PROTEAN) + sipp_mob(target, user, "liquid_protean") + return + if(SPECIES_PROMETHEAN) + sipp_mob(target, user, "nutriment") + return + return ..() + +/obj/item/weapon/glass_extra/straw/proc/sipp_mob(mob/living/victim, mob/user, reagent_type = "nutriment") + if(victim.health <= 0) + to_chat(user, "There's not enough of [victim] left to sip on!") + return + + user.visible_message("[user] starts sipping on [victim] with [src]!", "You start sipping on [victim] with [src].") + if(!do_after(user, 3 SECONDS, victim, exclusive = TASK_ALL_EXCLUSIVE)) + return + + user.visible_message("[user] sips some of [victim] with [src]!", "You take a sip of [victim] with [src]. Yum!") + if(victim.vore_taste) + to_chat(user, "[victim] tastes like... [victim.vore_taste]!") + + victim.apply_damage(5, used_weapon = "straw") + + // If you're human you get the reagent + if(ishuman(user)) + var/mob/living/carbon/human/H = user + H.ingested.add_reagent(reagent_type, 2) + // Anything else just gets some nutrition + else if(isliving(user)) + var/mob/living/L = user + L.adjust_nutrition(30) + #undef DRINK_ICON_FILE