Fixes some chugging-related bugs (#16475)

* Chugging-related fixes

The word "chug" doesn't sound real anymore

* Drinks can fix

#16500
This commit is contained in:
SabreML
2021-09-18 03:03:08 +01:00
committed by GitHub
parent dfbba739c6
commit 597d667dfa
2 changed files with 19 additions and 11 deletions
+16 -5
View File
@@ -12,6 +12,7 @@
volume = 50
resistance_flags = NONE
antable = FALSE
var/chugging = FALSE
/obj/item/reagent_containers/food/drinks/New()
..()
@@ -40,22 +41,32 @@
return FALSE
/obj/item/reagent_containers/food/drinks/MouseDrop(atom/over_object) //CHUG! CHUG! CHUG!
if(!iscarbon(over_object))
return
var/mob/living/carbon/chugger = over_object
if (!(container_type & DRAINABLE))
if(!(container_type & DRAINABLE))
to_chat(chugger, "<span class='notice'>You need to open [src] first!</span>")
return
if(istype(chugger) && loc == chugger && src == chugger.get_active_hand() && reagents.total_volume)
chugger.visible_message("<span class='notice'>[chugger] raises [src] to [chugger.p_their()] mouth and starts [pick("chugging","gulping")] it down like [pick("a savage","a mad beast","it's going out of style","there's no tomorrow")]!</span>", "<span class='notice'>You start chugging [src].</span>", "<span class='notice'>You hear what sounds like gulping.</span>")
while(do_mob(chugger, chugger, 40)) //Between the default time for do_mob and the time it takes for a vampire to suck blood.
if(reagents.total_volume && loc == chugger && src == chugger.get_active_hand())
chugger.visible_message("<span class='notice'>[chugger] raises [src] to [chugger.p_their()] mouth and starts [pick("chugging","gulping")] it down like [pick("a savage","a mad beast","it's going out of style","there's no tomorrow")]!</span>",
"<span class='notice'>You start chugging [src].</span>",
"<span class='notice'>You hear what sounds like gulping.</span>")
chugging = TRUE
while(do_after_once(chugger, 4 SECONDS, TRUE, chugger, null, "You stop chugging [src]."))
chugger.eat(src, chugger, 25) //Half of a glass, quarter of a bottle.
if(!reagents.total_volume) //Finish in style.
chugger.emote("gasp")
chugger.visible_message("<span class='notice'>[chugger] [pick("finishes","downs","polishes off","slams")] the entire [src], what a [pick("savage","monster","champ","beast")]!</span>", "<span class='notice'>You finish off [src]![prob(50) ? " Maybe that wasn't such a good idea..." : ""]</span>", "<span class='notice'>You hear a gasp and a clink.</span>")
chugger.visible_message("<span class='notice'>[chugger] [pick("finishes","downs","polishes off","slams")] the entire [src], what a [pick("savage","monster","champ","beast")]!</span>",
"<span class='notice'>You finish off [src]![prob(50) ? " Maybe that wasn't such a good idea..." : ""]</span>",
"<span class='notice'>You hear a gasp and a clink.</span>")
break
chugging = FALSE
/obj/item/reagent_containers/food/drinks/afterattack(obj/target, mob/user, proximity)
if(!proximity)
return
if(chugging)
return
if(target.is_refillable() && is_drainable()) //Something like a glass. Player probably wants to transfer TO it.
if(!reagents.total_volume)
@@ -1,4 +1,5 @@
/obj/item/reagent_containers/food/drinks/cans
container_type = NONE
var/canopened = FALSE
var/is_glass = 0
var/is_plastic = 0
@@ -7,10 +8,6 @@
var/can_burst = FALSE
var/burst_chance = 0
/obj/item/reagent_containers/food/drinks/cans/New()
..()
flags &= ~OPENCONTAINER
/obj/item/reagent_containers/food/drinks/cans/examine(mob/user)
. = ..()
if(canopened)
@@ -26,7 +23,7 @@
return ..()
playsound(loc, 'sound/effects/canopen.ogg', rand(10, 50), 1)
canopened = TRUE
flags |= OPENCONTAINER
container_type |= OPENCONTAINER
to_chat(user, "<span class='notice'>You open the drink with an audible pop!</span>")
return ..()
@@ -111,7 +108,7 @@
/obj/item/reagent_containers/food/drinks/cans/proc/fizzy_open(mob/user, burstopen = FALSE)
playsound(loc, 'sound/effects/canopenfizz.ogg', rand(10, 50), 1)
canopened = TRUE
flags |= OPENCONTAINER
container_type |= OPENCONTAINER
if(!burstopen && user)
to_chat(user, "<span class='notice'>You open the drink with an audible pop!</span>")