mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-20 19:44:09 +01:00
Migrate ashtrays to the new attack chain and tweak. (#32232)
* Migrate ashtrays to the new attack chain and tweak. * Add fisher's fingerprint to ashtray too. * Apply suggestions from CRUNCH review Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com> Signed-off-by: Alan <alfalfascout@users.noreply.github.com> * Add ashtray-fishing hint. --------- Signed-off-by: Alan <alfalfascout@users.noreply.github.com> Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com>
This commit is contained in:
@@ -4,31 +4,53 @@
|
||||
var/icon_half = ""
|
||||
var/icon_full = ""
|
||||
var/material = /obj/item/stack/sheet/metal
|
||||
new_attack_chain = TRUE
|
||||
|
||||
/obj/item/ashtray/attackby__legacy__attackchain(obj/item/I, mob/user, params)
|
||||
if(istype(I, /obj/item/cigbutt) || istype(I, /obj/item/clothing/mask/cigarette) || istype(I, /obj/item/match))
|
||||
if(length(contents) >= max_butts)
|
||||
to_chat(user, "This ashtray is full.")
|
||||
return
|
||||
if(!user.unequip(I))
|
||||
return
|
||||
I.forceMove(src)
|
||||
/obj/item/ashtray/item_interaction(mob/living/user, obj/item/used, list/modifiers)
|
||||
if(!(istype(used, /obj/item/cigbutt) || istype(used, /obj/item/clothing/mask/cigarette) || istype(used, /obj/item/match)))
|
||||
return ..()
|
||||
|
||||
if(istype(I, /obj/item/clothing/mask/cigarette))
|
||||
var/obj/item/clothing/mask/cigarette/cig = I
|
||||
if(cig.lit)
|
||||
visible_message("[user] crushes [cig] in [src], putting it out.")
|
||||
var/obj/item/butt = new cig.butt_type(src)
|
||||
cig.transfer_fingerprints_to(butt)
|
||||
qdel(cig)
|
||||
else
|
||||
to_chat(user, "You place [cig] in [src] without even smoking it. Why would you do that?")
|
||||
if(length(contents) >= max_butts)
|
||||
to_chat(user, SPAN_WARNING("[src] is full!"))
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
visible_message("[user] places [I] in [src].")
|
||||
if(!user.unequip(used))
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
if(istype(used, /obj/item/cigbutt) || istype(used, /obj/item/match))
|
||||
user.visible_message(
|
||||
SPAN_NOTICE("[user] places [used] in [src]."),
|
||||
SPAN_NOTICE("You put [used] in [src]."),
|
||||
SPAN_HEAR("You hear a soft tap.")
|
||||
)
|
||||
used.forceMove(src)
|
||||
add_fingerprint(user)
|
||||
update_appearance(UPDATE_DESC|UPDATE_ICON_STATE)
|
||||
else
|
||||
return ..()
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
var/obj/item/clothing/mask/cigarette/cig = used
|
||||
if(cig.lit)
|
||||
user.visible_message(
|
||||
SPAN_NOTICE("[user] crushes [cig] in [src], putting it out."),
|
||||
SPAN_NOTICE("You crush [cig] in [src], putting it out."),
|
||||
SPAN_HEAR("You hear the crumpling of a snuffed cigarette.")
|
||||
)
|
||||
var/obj/item/butt = new cig.butt_type(src)
|
||||
cig.transfer_fingerprints_to(butt)
|
||||
qdel(cig)
|
||||
add_fingerprint(user)
|
||||
update_appearance(UPDATE_DESC|UPDATE_ICON_STATE)
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
used.forceMove(src)
|
||||
user.visible_message(
|
||||
SPAN_NOTICE("[user] places an entire unlit [cig] in [src]."),
|
||||
SPAN_NOTICE("You place [cig] in [src] without even smoking it. Why would you do that?"),
|
||||
SPAN_HEAR("You hear a soft tap.")
|
||||
)
|
||||
add_fingerprint(user)
|
||||
update_appearance(UPDATE_DESC|UPDATE_ICON_STATE)
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
/obj/item/ashtray/update_icon_state()
|
||||
if(length(contents) == max_butts)
|
||||
@@ -40,12 +62,13 @@
|
||||
|
||||
/obj/item/ashtray/update_desc()
|
||||
. = ..()
|
||||
desc = initial(desc)
|
||||
if(length(contents) == max_butts)
|
||||
desc = initial(desc) + " It's stuffed full."
|
||||
desc += " It's stuffed full."
|
||||
else if(length(contents) > max_butts * 0.5)
|
||||
desc = initial(desc) + " It's half-filled."
|
||||
else
|
||||
desc = initial(desc)
|
||||
desc += " It's half-filled."
|
||||
if(length(contents))
|
||||
desc += " You can use <b>Alt-Click</b> to fish through the contents."
|
||||
|
||||
/obj/item/ashtray/proc/empty_tray()
|
||||
for(var/obj/item/I in contents)
|
||||
@@ -58,14 +81,41 @@
|
||||
empty_tray()
|
||||
return ..()
|
||||
|
||||
/obj/item/ashtray/wrench_act(mob/user, obj/item/I)
|
||||
/obj/item/ashtray/wrench_act(mob/user, obj/item/used)
|
||||
. = TRUE
|
||||
if(!I.use_tool(src, user, volume = I.tool_volume))
|
||||
if(!used.use_tool(src, user, volume = used.tool_volume))
|
||||
return
|
||||
empty_tray()
|
||||
new material(drop_location(), 1)
|
||||
deconstruct()
|
||||
|
||||
// Do you want to get your entire unlit cigarette back out without dumping the whole tray? Well now you can.
|
||||
/obj/item/ashtray/AltClick()
|
||||
if(!length(contents))
|
||||
return ..()
|
||||
if(!Adjacent(usr))
|
||||
return ..()
|
||||
if(!isliving(usr))
|
||||
return ..()
|
||||
var/atom/movable/choice = tgui_input_list(usr, "Choose a butt to remove.", "Ashtray fishing", contents)
|
||||
if(!choice)
|
||||
return
|
||||
if(!Adjacent(usr))
|
||||
to_chat(usr, SPAN_WARNING("You can't reach that far!"))
|
||||
return
|
||||
|
||||
usr.visible_message(
|
||||
SPAN_NOTICE("[usr] fishes [choice] out of [src]."),
|
||||
SPAN_NOTICE("You [length(contents) > max_butts * 0.5 ? "get ash on yourself, but you fish" : "pick"] [choice] out of [src]."),
|
||||
SPAN_HEAR("You hear soot rustling.")
|
||||
)
|
||||
choice.forceMove(get_turf(src))
|
||||
choice.add_fingerprint(usr)
|
||||
add_fingerprint(usr)
|
||||
if(ishuman(usr))
|
||||
var/mob/living/carbon/human/user = usr
|
||||
user.equip_to_slot_if_possible(choice, (user.hand ? ITEM_SLOT_LEFT_HAND : ITEM_SLOT_RIGHT_HAND), disable_warning = TRUE)
|
||||
|
||||
/obj/item/ashtray/plastic
|
||||
name = "plastic ashtray"
|
||||
desc = "Cheap plastic ashtray."
|
||||
|
||||
Reference in New Issue
Block a user