diff --git a/aurorastation.dme b/aurorastation.dme index ac5acf5e220..236f006c716 100644 --- a/aurorastation.dme +++ b/aurorastation.dme @@ -1107,7 +1107,7 @@ #include "code\game\objects\structures\banner.dm" #include "code\game\objects\structures\barsign.dm" #include "code\game\objects\structures\bedsheet_bin.dm" -#include "code\game\objects\structures\coathanger.dm" +#include "code\game\objects\structures\coatrack.dm" #include "code\game\objects\structures\crystals.dm" #include "code\game\objects\structures\curtains.dm" #include "code\game\objects\structures\displaycase.dm" diff --git a/code/game/objects/structures/coathanger.dm b/code/game/objects/structures/coathanger.dm deleted file mode 100644 index 0978deb50c9..00000000000 --- a/code/game/objects/structures/coathanger.dm +++ /dev/null @@ -1,74 +0,0 @@ -/obj/structure/coatrack - name = "coat rack" - desc = "Rack that holds coats." - icon = 'icons/obj/coatrack.dmi' - icon_state = "coatrack0" - var/obj/item/clothing/suit/coat - var/obj/item/clothing/head/hat - var/list/allowed_coats = list(/obj/item/clothing/suit/storage/toggle/labcoat, /obj/item/clothing/suit/storage/toggle/det_trench, - /obj/item/clothing/suit/storage/toggle/forensics, /obj/item/clothing/suit/storage/toggle/trench, - /obj/item/clothing/suit/storage/det_jacket, /obj/item/clothing/accessory/poncho/tajarancloak) - var/list/allowed_hats = list(/obj/item/clothing/head/det, /obj/item/clothing/head/beret/security, /obj/item/clothing/head/softcap/security) - -/obj/structure/coatrack/attack_hand(mob/user as mob) - if (!ishuman(user)) - return - if(user.incapacitated()) - return - if (!user.can_use_hand()) - return - if(coat) - user.visible_message("[user] takes [coat] off \the [src].", SPAN_NOTICE("You take [coat] off the \the [src].")) - user.put_in_hands(coat) - coat = null - update_icon() - else if(hat) - user.visible_message("[user] takes [hat] off \the [src].", SPAN_NOTICE("You take [hat] off the \the [src].")) - user.put_in_hands(hat) - hat = null - update_icon() - -/obj/structure/coatrack/attackby(obj/item/W as obj, mob/user as mob) - if (is_type_in_list(W, allowed_coats) && !coat) - user.visible_message("[user] hangs [W] on \the [src].", SPAN_NOTICE("You hang [W] on the \the [src].")) - coat = W - user.drop_from_inventory(coat, src) - update_icon() - else if (is_type_in_list(W, allowed_hats) && !hat) - user.visible_message("[user] hangs [W] on \the [src].", SPAN_NOTICE("You hang [W] on the \the [src].")) - hat = W - user.drop_from_inventory(hat, src) - update_icon() - else - to_chat(user, SPAN_NOTICE("You cannot hang [W] on [src].")) - return ..() - -/obj/structure/coatrack/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) - if (is_type_in_list(mover, allowed_coats) && !coat) - src.visible_message("[mover] lands on \the [src].") - coat = mover - coat.forceMove(src) - update_icon() - return 0 - if (is_type_in_list(mover, allowed_hats) && !hat) - src.visible_message("[mover] lands on \the [src].") - hat = mover - hat.forceMove(src) - update_icon() - return 0 - else - return 1 - -/obj/structure/coatrack/update_icon() - cut_overlays() - if (coat) - if(istype(coat, /obj/item/clothing/suit/storage/toggle)) - var/obj/item/clothing/suit/storage/toggle/T = coat - T.icon_state = initial(T.icon_state) - T.opened = FALSE - add_overlay("coat_[coat.icon_state]") - if (hat) - if(istype(hat, /obj/item/clothing/head/softcap/security/idris) || istype(hat, /obj/item/clothing/head/softcap/security/corp)) - add_overlay("hat_softcap_[hat.icon_state]") - else - add_overlay("hat_[hat.icon_state]") diff --git a/code/game/objects/structures/coatrack.dm b/code/game/objects/structures/coatrack.dm new file mode 100644 index 00000000000..23eaa028bd7 --- /dev/null +++ b/code/game/objects/structures/coatrack.dm @@ -0,0 +1,138 @@ +/obj/structure/coatrack + name = "coat rack" + desc = "Rack that holds coats, or hats, if you're so inclined." + icon = 'icons/obj/coatrack.dmi' + icon_state = "coatrack" + layer = ABOVE_MOB_LAYER //Hide behind coat racks. Because funny. + var/obj/item/clothing/coat + var/obj/item/clothing/head/hat + var/list/custom_sprites = list(/obj/item/clothing/head/beret/security, /obj/item/clothing/accessory/poncho/tajarancloak) // Custom manual sprite override. + +/obj/structure/coatrack/attack_hand(mob/user as mob) + if(use_check_and_message(user)) + return + if(coat && hat) + var/response = "" + response = alert(user, "Do you remove the coat, or the hat?", "Coat Rack Selection", "Coat", "Hat", "Cancel") + if(response == "Coat") + remove_coat(user) + if(response == "Hat") + remove_hat(user) + if(coat) + remove_coat(user) + if(hat) + remove_hat(user) + add_fingerprint(user) + return + +/obj/structure/coatrack/proc/remove_coat(mob/user as mob) + user.visible_message("[user] takes [coat] off \the [src].", SPAN_NOTICE("You take [coat] off the \the [src].")) + user.put_in_hands(coat) + coat = null + update_icon() + +/obj/structure/coatrack/proc/remove_hat(mob/user as mob) + user.visible_message("[user] takes [hat] off \the [src].", SPAN_NOTICE("You take [hat] off the \the [src].")) + user.put_in_hands(hat) + hat = null + update_icon() + +/obj/structure/coatrack/attackby(obj/item/W as obj, mob/user as mob) + if(use_check_and_message(user)) + return + if(!coat && (istype(W, /obj/item/clothing/suit/storage/toggle) || istype(W, /obj/item/clothing/accessory/poncho))) + user.visible_message("[user] hangs [W] on \the [src].", SPAN_NOTICE("You hang [W] on the \the [src].")) + coat = W + user.drop_from_inventory(coat, src) + playsound(src, W.drop_sound, DROP_SOUND_VOLUME) + update_icon() + else if(!hat && istype(W, /obj/item/clothing/head) && !istype(W, /obj/item/clothing/head/helmet)) + user.visible_message("[user] hangs [W] on \the [src].", SPAN_NOTICE("You hang [W] on the \the [src].")) + hat = W + user.drop_from_inventory(hat, src) + playsound(src, W.drop_sound, DROP_SOUND_VOLUME) + update_icon() + else if(istype(W, /obj/item/clothing)) + to_chat(user, SPAN_WARNING("You can't hang that up.")) + else + return ..() + +/obj/structure/coatrack/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) + if(!coat && (istype(mover, /obj/item/clothing/suit/storage/toggle) || istype(mover, /obj/item/clothing/accessory/poncho))) + src.visible_message("[mover] lands on \the [src].") + coat = mover + coat.forceMove(src) + update_icon() + return 0 + else if(!hat && istype(mover, /obj/item/clothing/head)) + src.visible_message("[mover] lands on \the [src].") + hat = mover + hat.forceMove(src) + update_icon() + return 0 + else + return 1 + +/obj/structure/coatrack/update_icon() + cut_overlays() + if(coat) + if(is_type_in_list(coat, custom_sprites)) + add_overlay(coat.icon_state) + else if(istype(coat, /obj/item/clothing/suit/storage/toggle)) // Using onmob sprites, because they're more consistent than object sprites. + var/obj/item/clothing/suit/storage/toggle/T = coat + if(!T.opened) + T.opened = TRUE // Makes coats open when hung up. Cause you know, you can't really hang up a closed coat. Well you can, but...code reasons. + T.icon_state = "[T.icon_state]_open" + handle_coat_image(T) + else if(istype(coat, /obj/item/clothing/accessory/poncho)) // Pain. + var/obj/item/clothing/accessory/poncho/T = coat + handle_coat_image(T) + if(hat) + if(is_type_in_list(hat, custom_sprites)) + add_overlay(hat.icon_state) + else if(istype(hat, /obj/item/clothing/head)) + var/obj/item/clothing/head/H = hat + var/matrix/M = matrix() + var/image/hat_image + if(H.contained_sprite) + var/hat_icon_state = "[H.icon_state][WORN_HEAD]" // Needed to bypass contained sprite phoney baloney. + hat_image = image(H.icon, hat_icon_state, src.layer, EAST) + if(H.build_from_parts) + hat_image.add_overlay(overlay_image(H.icon, "[H.icon_state]_[H.worn_overlay]", flags=RESET_COLOR)) + else + hat_image = image(INV_HEAD_DEF_ICON, H.icon_state, src.layer, EAST) + if(H.build_from_parts) + hat_image.add_overlay(overlay_image(icon, "[INV_HEAD_DEF_ICON]_[H.worn_overlay]", flags=RESET_COLOR)) + M.Turn(90) // Flip the hat over and stick it on the coatrack. + M.Translate(-6, 6) + hat_image.transform = M + add_overlay(hat_image) + +/obj/structure/coatrack/proc/handle_coat_image(var/obj/item/clothing/T) + var/icon/coat_outline = icon('icons/obj/coatrack.dmi', "outline") + var/matrix/M = matrix() + var/coat_icon_state = T.icon_state + var/coat_icon_file = INV_SUIT_DEF_ICON + if(T.contained_sprite) + coat_icon_state = "[T.icon_state][WORN_SUIT]" // Needed to bypass contained sprite phoney baloney. + coat_icon_file = T.icon + + var/icon/coat_icon = new(coat_icon_file, coat_icon_state) + + coat_icon.Blend(coat_outline, ICON_OVERLAY) + coat_icon.SwapColor(rgb(255, 0, 220, 255), rgb(0, 0, 0, 0)) //Slice the coat in half. + var/image/coat_image = image(coat_icon) + if(T.color) + coat_image.color = T.color + + if(T.build_from_parts) + var/icon/overlay_icon = new(coat_icon_file, "[coat_icon_state]_[T.worn_overlay]") + overlay_icon.Blend(coat_outline, ICON_OVERLAY) + overlay_icon.SwapColor(rgb(255, 0, 220, 255), rgb(0, 0, 0, 0)) // Slice the overlay in half and slap it on the coat. + var/image/overlay_image = image(overlay_icon) + overlay_image.appearance_flags = RESET_COLOR + coat_image.add_overlay(overlay_image) + + M.Translate(-1, 5) // Stick it on the coat rack. + coat_image.transform = M + add_overlay(coat_image) diff --git a/html/changelogs/wezzy_coatrack.yml b/html/changelogs/wezzy_coatrack.yml new file mode 100644 index 00000000000..b45d9d73f64 --- /dev/null +++ b/html/changelogs/wezzy_coatrack.yml @@ -0,0 +1,42 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: Wowzewow (Wezzy) + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "Coatracks are now able to support every concievable toggleable coat, poncho and hat. Except helmets, armor and rigsuits, obviously." + - imageadd: "Coatracks have a shiny new sprite." diff --git a/icons/obj/coatrack.dmi b/icons/obj/coatrack.dmi index 28dab25666c..b007a2f4bc6 100644 Binary files a/icons/obj/coatrack.dmi and b/icons/obj/coatrack.dmi differ