From eecbc99d87d25b2fa978023c14d3cc976d7ef447 Mon Sep 17 00:00:00 2001 From: Jared-Fogle <35135081+Jared-Fogle@users.noreply.github.com> Date: Sat, 4 Aug 2018 19:28:33 -0700 Subject: [PATCH] Moths can now eat clothes (#39350) * Moths can now eat clothes * Remove old call hacky fix * Fix damage sound, cleaned code --- code/__DEFINES/is_helpers.dm | 1 + code/modules/clothing/clothing.dm | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/code/__DEFINES/is_helpers.dm b/code/__DEFINES/is_helpers.dm index 15840210890..5394f40d883 100644 --- a/code/__DEFINES/is_helpers.dm +++ b/code/__DEFINES/is_helpers.dm @@ -56,6 +56,7 @@ #define isslimeperson(A) (is_species(A, /datum/species/jelly/slime)) #define isluminescent(A) (is_species(A, /datum/species/jelly/luminescent)) #define iszombie(A) (is_species(A, /datum/species/zombie)) +#define ismoth(A) (is_species(A, /datum/species/moth)) #define ishumanbasic(A) (is_species(A, /datum/species/human)) //why arent catpeople a subspecies diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 1dde03a8ed8..b9ce170dc5b 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -56,6 +56,22 @@ if(M.putItemFromInventoryInHandIfPossible(src, H.held_index)) add_fingerprint(usr) +/obj/item/reagent_containers/food/snacks/clothing + name = "oops" + desc = "If you're reading this it means I messed up. This is related to moths eating clothes and I didn't know a better way to do it than making a new food object." + list_reagents = list("nutriment" = 1) + tastes = list("dust" = 1, "lint" = 1) + +/obj/item/clothing/attack(mob/M, mob/user, def_zone) + if(user.a_intent != INTENT_HARM && ismoth(M)) + var/obj/item/reagent_containers/food/snacks/clothing/clothing_as_food = new + clothing_as_food.name = name + if(clothing_as_food.attack(M, user, def_zone)) + take_damage(15, sound_effect=FALSE) + qdel(clothing_as_food) + else + return ..() + /obj/item/clothing/attackby(obj/item/W, mob/user, params) if(damaged_clothes && istype(W, /obj/item/stack/sheet/cloth)) var/obj/item/stack/sheet/cloth/C = W