Adds chugging, knocking on a table and slamming your hand on a table. (#15501)

This commit is contained in:
Matt Atlas
2023-01-10 20:44:44 +01:00
committed by GitHub
parent 576a609483
commit 9e54d75b03
8 changed files with 132 additions and 13 deletions

View File

@@ -94,6 +94,7 @@
/singleton/emote/visible/shiver,
/singleton/emote/visible/collapse,
/singleton/emote/audible/gasp,
/singleton/emote/audible/choke,
/singleton/emote/audible/sneeze,
/singleton/emote/audible/sniff,
/singleton/emote/audible/snore,

View File

@@ -1756,15 +1756,24 @@
return 1
return 0
/mob/living/carbon/human/proc/can_drink(var/obj/item/I)
if(!check_has_mouth())
to_chat(src, SPAN_NOTICE("Where do you intend to put \the [I]? You don't have a mouth!"))
return FALSE
var/obj/item/blocked = check_mouth_coverage()
if(blocked)
to_chat(src, SPAN_WARNING("\The [blocked] is in the way!"))
return FALSE
return TRUE
/mob/living/carbon/human/MouseDrop(var/atom/over_object)
var/mob/living/carbon/human/H = over_object
if(holder_type && istype(H) && H.a_intent == I_HELP && !H.lying && !issmall(H) && Adjacent(H))
get_scooped(H, (usr == src))
return
if(ishuman(over_object))
var/mob/living/carbon/human/H = over_object
if(holder_type && istype(H) && H.a_intent == I_HELP && !H.lying && !issmall(H) && Adjacent(H))
get_scooped(H, (usr == src))
return
return ..()
/mob/living/carbon/human/AltClickOn(var/atom/A)
var/doClickAction = 1
if (istype(get_active_hand(), /obj/item))

View File

@@ -237,19 +237,14 @@
if(target == user)
if(istype(user, /mob/living/carbon/human))
H = user
if(!H.check_has_mouth())
to_chat(user, "Where do you intend to put \the [src]? You don't have a mouth!")
return 1
var/obj/item/blocked = H.check_mouth_coverage()
if(blocked)
to_chat(user, "<span class='warning'>\The [blocked] is in the way!</span>")
if(!H.can_drink(src))
return
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) //puts a limit on how fast people can eat/drink things
self_feed_message(user)
reagents.trans_to_mob(user, min(10,amount_per_transfer_from_this), CHEM_INGEST) //A sane limiter. So you don't go drinking 300u all at once.
feed_sound(user)
return 1
return TRUE
else
if(istype(target, /mob/living/carbon/human))
H = target
@@ -283,6 +278,46 @@
feed_sound(user)
return 1
/obj/item/reagent_containers/MouseDrop(atom/over, src_location, over_location, src_control, over_control, params)
. = ..()
if(ishuman(over))
var/mob/living/carbon/human/H = over
if(usr != H)
return
if(!H.can_drink())
return
if(!(H.l_hand == src) && !(H.r_hand == src))
return
if(!reagents.total_volume)
to_chat(H, SPAN_NOTICE("\The [src] is empty."))
return
if(H.isSynthetic() && !isipc(H))
return
visible_message(SPAN_NOTICE("[H] starts chugging from \the [src]!"))
var/chugs = 0
while(reagents.total_volume)
if(do_after(H, 1.5 SECONDS))
chugs++
reagents.trans_to_mob(H, min(10, amount_per_transfer_from_this), CHEM_INGEST)
if(!(H.species.flags & NO_BREATHE))
if(chugs > 3)
if(H.losebreath < 6)
H.losebreath += 1
H.adjustOxyLoss(1)
feed_sound(H)
else
break
if(chugs > 3)
if(!(H.species.flags & NO_BREATHE))
H.visible_message(SPAN_NOTICE("[src] finishes chugging, exhausted..."), SPAN_NOTICE("You finish chugging, exhausted..."))
H.emote("gasp")
return
/obj/item/reagent_containers/proc/standard_pour_into(var/mob/user, var/atom/target) // This goes into afterattack and yes, it's atom-level
if(!target.reagents)
return 0

View File

@@ -3,6 +3,7 @@
/obj/item/reagent_containers/food/drinks/drinkingglass
name = "glass"
desc = "Your standard drinking glass."
desc_info = "To toast with someone, aim for the right or left hand and click them on help intent with the glass in hand. They must be holding a glass in the targeted hand."
icon_state = "glass_empty"
item_icons = list(
slot_l_hand_str = 'icons/mob/items/lefthand_food.dmi',

View File

@@ -151,6 +151,36 @@
return ..()
/obj/structure/table/attack_hand(mob/user)
. = ..()
if(ishuman(user))
if(!use_check_and_message(user))
var/mob/living/carbon/human/H = user
if((H.zone_sel.selecting in list(BP_R_HAND, BP_L_HAND)))
if(H.last_special + 1 SECOND < world.time)
H.last_special = world.time
switch(H.a_intent)
if(I_GRAB)
H.visible_message(SPAN_NOTICE("[H] knocks on the table!"))
playsound(src, 'sound/effects/table_knock.ogg')
if(I_HURT)
H.do_attack_animation(src)
H.visible_message(SPAN_WARNING("[H] slams [H.get_pronoun("his")] hand on the table!"))
playsound(src, 'sound/effects/table_slam.ogg')
if(material.hardness > 15) //15 wood, 60 steel
var/obj/item/organ/external/hand/hand = H.zone_sel.selecting
if(!BP_IS_ROBOTIC(hand))
H.apply_damage(5, BRUTE, H.zone_sel.selecting, armor_pen = 10)
to_chat(H, SPAN_WARNING("Ow! That hurt..."))
else
for(var/obj/item/O in get_turf(src))
if(!O.anchored && O.w_class < ITEMSIZE_HUGE)
animate(O, pixel_y = 3, time = 2, loop = 1, easing = BOUNCE_EASING)
addtimer(CALLBACK(O, /obj/item/.proc/reset_table_position), 2)
/obj/item/proc/reset_table_position()
animate(src, pixel_y = 0, time = 2, loop = 1, easing = BOUNCE_EASING)
/obj/structure/table/attackby(obj/item/W, mob/user, var/click_parameters)
if (!W)
return