大佬,來抽煙 (Yakuza Smoking Mechanics) (#17067)

* 大佬,來抽煙 (Yakuza Smoking Mechanics)

  - rscadd: "You can now offer someone a smoke directly from the packet. Just target the mouth area with an open cigarette packet, like you would yourself."
  - rscadd: "You can also offer to light someone else's cigarettes."

* Update code/game/objects/items/weapons/storage/fancy.dm

Co-authored-by: Matt Atlas <mattiathebest2000@hotmail.it>

* fixes

* use_check

* oops

---------

Co-authored-by: Matt Atlas <mattiathebest2000@hotmail.it>
This commit is contained in:
Wowzewow (Wezzy)
2023-09-07 23:44:14 +08:00
committed by GitHub
parent 342efb0e7f
commit c0135c8df5
3 changed files with 80 additions and 12 deletions

View File

@@ -935,10 +935,20 @@ CIGARETTE PACKETS ARE IN FANCY.DM
if(M == user)
cig.attackby(src, user)
else
var/response = ""
user.visible_message(SPAN_NOTICE("\The <b>[user]</b> holds up \the [src] to \the [M]'s mouth."), SPAN_NOTICE("You hold up \the [src] to \the [M]'s mouth, waiting for them to accept."))
response = alert(M, "\The [user] offers to light your [cig.name]. Do you accept?", "Lighter offer", "Accept", "Decline")
if(response != "Accept")
M.visible_message(SPAN_NOTICE("<b>[M]</b> pushes [user]'s [src] away."))
return
if(!M.Adjacent(user))
to_chat(user, SPAN_WARNING("You need to stay in reaching distance to do that."))
to_chat(M, SPAN_WARNING("\The [user] moved too far away."))
return
if(istype(src, /obj/item/flame/lighter/zippo))
cig.light(SPAN_NOTICE("[user] whips the [name] out and holds it for [M]."))
cig.light(SPAN_NOTICE("In one smooth motion, \the <b>[user]</b> whips \the [name] out and lights \the [M]'s [cig.name]."))
else
cig.light(SPAN_NOTICE("[user] holds the [name] out for [M], and lights the [cig.name]."))
cig.light(SPAN_NOTICE("\The <b>[user]</b> holds \the [name] out for [M], and lights the [cig.name]."))
else
..()

View File

@@ -322,17 +322,32 @@
..()
/obj/item/storage/box/fancy/cigarettes/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob, target_zone)
if(!istype(M, /mob))
if(!ismob(M))
return
if(!opened)
to_chat(user, SPAN_NOTICE("The [src] is closed."))
to_chat(user, SPAN_NOTICE("\The [src] is closed."))
return
if(M == user && target_zone == BP_MOUTH && contents.len > 0 && !user.wear_mask)
var/obj/item/clothing/mask/smokable/cigarette/W = new cigarette_to_spawn(user)
if(!istype(W))
to_chat(user, SPAN_NOTICE("The [W] is in the way."))
if(use_check(M))
to_chat(usr, SPAN_WARNING("[M.name] is in no condition to handle items!"))
return
if(target_zone == BP_MOUTH && contents.len > 0)
var/obj/item/clothing/mask/smokable/cigarette/W = new cigarette_to_spawn(src)
if(!istype(W) || M.wear_mask)
to_chat(user, SPAN_NOTICE("\The [M.wear_mask] is in the way."))
if(M != user)
to_chat(M, SPAN_NOTICE("\The [M.wear_mask] is in the way."))
return
if(M != user)
var/response = ""
user.visible_message(SPAN_NOTICE("\The <b>[user]</b> holds up \the [src] to \the [M]'s mouth."), SPAN_NOTICE("You hold up \the [src] to \the [M]'s mouth, waiting for them to accept."))
response = alert(M, "\The [user] offers you \a [W.name]. Do you accept?", "Smokable offer", "Accept", "Decline")
if(response != "Accept")
M.visible_message(SPAN_NOTICE("<b>[M]</b> pushes [user]'s [src] away."))
return
if(!M.Adjacent(user))
to_chat(user, SPAN_WARNING("You need to stay in reaching distance while giving an object."))
to_chat(M, SPAN_WARNING("\The [user] moved too far away."))
return
//Checking contents of packet so lighters won't be cigarettes.
for (var/i = contents.len; i > 0; i--)
W = contents[i]
@@ -343,12 +358,13 @@
if (!W)
return
reagents.trans_to_obj(W, (reagents.total_volume/contents.len))
user.equip_to_slot_if_possible(W, slot_wear_mask)
M.equip_to_slot_if_possible(W, slot_wear_mask)
reagents.maximum_volume = 15 * contents.len
user.visible_message(SPAN_NOTICE("<b>[user]</b> casually pulls out a [icon_type] from \the [src] with their mouth."), SPAN_NOTICE("You casually pull out a [icon_type] from \the [src] with your mouth."), range = 3)
M.visible_message(SPAN_NOTICE("<b>[M]</b> casually pulls out a [icon_type] from \the [src] with [M.get_pronoun("his")] mouth."), SPAN_NOTICE("You casually pull out a [icon_type] from \the [src] with your mouth."), range = 3)
update_icon()
return
if(M == user && target_zone == BP_R_HAND || target_zone == BP_L_HAND) // Cig packing. Because obsessive smokers do it.
user.visible_message(SPAN_NOTICE("<b>[user]</b> taps \the [src] against their palm."), SPAN_NOTICE("You tap \the [src] against your palm."))
user.visible_message(SPAN_NOTICE("<b>[user]</b> taps \the [src] against [user.get_pronoun("his")] palm."), SPAN_NOTICE("You tap \the [src] against your palm."))
else
..()