From cbc835a2db204d4db2d8fb68c2591342850f3114 Mon Sep 17 00:00:00 2001 From: "Wowzewow (Wezzy)" <42310821+alsoandanswer@users.noreply.github.com> Date: Tue, 17 Nov 2020 04:59:03 +0800 Subject: [PATCH] You can shove all small mobs in the glass jar now (#10484) --- code/game/objects/items.dm | 2 +- code/game/objects/items/glassjar.dm | 91 ++++++++++--------- .../mob/living/simple_animal/simple_animal.dm | 8 +- html/changelogs/wezzy_getinjar.yml | 41 +++++++++ 4 files changed, 96 insertions(+), 46 deletions(-) create mode 100644 html/changelogs/wezzy_getinjar.yml diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index aa3badf69cf..caf683ce6b2 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -670,7 +670,7 @@ var/list/global/slot_flags_enumeration = list( /obj/item/proc/showoff(mob/user) for (var/mob/M in view(user)) if(!user.is_invisible_to(M)) - M.show_message("[user] holds up [icon2html(src, viewers(get_turf(src)))] [src]. Take a closer look.",1) + M.show_message("[user] holds up [icon2html(src, viewers(get_turf(src)))] [src]. Take a closer look.",1) /mob/living/carbon/verb/showoff() set name = "Show Held Item" diff --git a/code/game/objects/items/glassjar.dm b/code/game/objects/items/glassjar.dm index efef7ad3b22..7b9290f7ac9 100644 --- a/code/game/objects/items/glassjar.dm +++ b/code/game/objects/items/glassjar.dm @@ -1,3 +1,8 @@ +#define JAR_NOTHING 0 +#define JAR_MONEY 1 +#define JAR_ANIMAL 2 +#define JAR_SPIDERLING 3 + /obj/item/glass_jar name = "glass jar" desc = "A glass jar. You can remove the lid and use it as a reagent container." @@ -7,8 +12,7 @@ matter = list(MATERIAL_GLASS = 200) recyclable = TRUE flags = NOBLUDGEON - var/list/accept_mobs = list(/mob/living/simple_animal/lizard, /mob/living/simple_animal/rat) - var/contains = 0 // 0 = nothing, 1 = money, 2 = animal, 3 = spiderling + var/contains = JAR_NOTHING // 0 = nothing, 1 = money, 2 = animal, 3 = spiderling drop_sound = 'sound/items/drop/glass.ogg' pickup_sound = 'sound/items/pickup/glass.ogg' @@ -19,68 +23,65 @@ /obj/item/glass_jar/afterattack(var/atom/A, var/mob/user, var/proximity) if(!proximity || contains) return - if(istype(A, /mob)) - var/accept = 0 - for(var/D in accept_mobs) - if(istype(A, D)) - accept = 1 - if(!accept) - to_chat(user, "[A] doesn't fit into \the [src].") - return - var/mob/L = A - user.visible_message("[user] scoops [L] into \the [src].", "You scoop [L] into \the [src].") - L.forceMove(src) - contains = 2 - update_icon() - return - else if(istype(A, /obj/effect/spider/spiderling)) + if(istype(A, /obj/effect/spider/spiderling)) var/obj/effect/spider/spiderling/S = A - user.visible_message("[user] scoops [S] into \the [src].", "You scoop [S] into \the [src].") + user.visible_message(SPAN_NOTICE("\The [user] scoops \the [S] into \the [src]."), SPAN_NOTICE("You scoop \the [S] into \the [src].")) S.forceMove(src) STOP_PROCESSING(SSprocessing, S) // No growing inside jars - contains = 3 + contains = JAR_SPIDERLING update_icon() return + if(ismob(A)) + var/mob/L = A + if(L.mob_size <= MOB_SMALL) + user.visible_message(SPAN_NOTICE("\The [user] scoops \the [L] into \the [src]."), SPAN_NOTICE("You scoop \the [L] into \the [src].")) + L.forceMove(src) + contains = JAR_ANIMAL + update_icon() + return + else + to_chat(user, SPAN_WARNING("\The [L] doesn't fit into \the [src]!")) + return /obj/item/glass_jar/attack_self(var/mob/user) switch(contains) - if(1) + if(JAR_MONEY) for(var/obj/O in src) O.forceMove(user.loc) - to_chat(user, "You take money out of \the [src].") - contains = 0 + to_chat(user, SPAN_NOTICE("You take money out of \the [src].")) + contains = JAR_NOTHING update_icon() return - if(2) + if(JAR_ANIMAL) for(var/mob/M in src) M.forceMove(user.loc) - user.visible_message("[user] releases [M] from \the [src].", "You release [M] from \the [src].") - contains = 0 + user.visible_message(SPAN_NOTICE("\The [user] releases \the [M] from \the [src]."), SPAN_NOTICE("You release \the [M] from \the [src].")) + contains = JAR_NOTHING update_icon() return - if(3) + if(JAR_SPIDERLING) for(var/obj/effect/spider/spiderling/S in src) S.forceMove(user.loc) - user.visible_message("[user] releases [S] from \the [src].", "You release [S] from \the [src].") + user.visible_message(SPAN_NOTICE("\The [user] releases \the [S] from \the [src]."), SPAN_NOTICE("You release \the [S] from \the [src].")) START_PROCESSING(SSprocessing, S) // They can grow after being let out though - contains = 0 + contains = JAR_NOTHING update_icon() return - if(0) - to_chat(user, "You remove the lid from \the [src].") + if(JAR_NOTHING) + to_chat(user, SPAN_NOTICE("You remove the lid from \the [src].")) user.drop_from_inventory(src) user.put_in_hands(new /obj/item/reagent_containers/glass/beaker/jar) //found in jar.dm qdel(src) return -/obj/item/glass_jar/attackby(var/obj/item/W, var/mob/user) - if(istype(W, /obj/item/spacecash)) - if(contains == 0) - contains = 1 - if(contains != 1) +/obj/item/glass_jar/attackby(var/atom/A, var/mob/user, var/proximity) + if(istype(A, /obj/item/spacecash)) + if(contains == JAR_NOTHING) + contains = JAR_MONEY + if(contains != JAR_MONEY) return - var/obj/item/spacecash/S = W - user.visible_message("[user] puts [S.worth] [S.worth > 1 ? "credits" : "credit"] into \the [src].") + var/obj/item/spacecash/S = A + user.visible_message(SPAN_NOTICE("\The [user] puts [S.worth] [S.worth > 1 ? "credits" : "credit"] into \the [src].")) user.drop_from_inventory(S,src) update_icon() @@ -88,10 +89,10 @@ underlays.Cut() cut_overlays() switch(contains) - if(0) + if(JAR_NOTHING) name = initial(name) desc = initial(desc) - if(1) + if(JAR_MONEY) name = "tip jar" desc = "A small jar with money inside." for(var/obj/item/spacecash/S in src) @@ -102,7 +103,7 @@ underlays += money for (var/A in S.overlays) underlays += A - if(2) + if(JAR_ANIMAL) for(var/mob/M in src) var/image/victim = new() victim.appearance = M @@ -113,7 +114,7 @@ underlays += victim name = "glass jar with [M]" desc = "A small jar with [M] inside." - if(3) + if(JAR_SPIDERLING) for(var/obj/effect/spider/spiderling/S in src) var/image/victim = image(S.icon, S.icon_state) underlays += victim @@ -123,12 +124,18 @@ /obj/item/glass_jar/peter/ name = "Peter's Jar" + /obj/item/glass_jar/peter/Initialize() . = ..() var/obj/effect/spider/spiderling/S = new S.name = "Peter" S.desc = "The journalist's pet spider, Peter. It has a miniature camera around its neck and seems to glow faintly." S.forceMove(src) - contains = 3 + contains = JAR_SPIDERLING STOP_PROCESSING(SSprocessing, S) update_icon() + +#undef JAR_NOTHING +#undef JAR_MONEY +#undef JAR_ANIMAL +#undef JAR_SPIDERLING diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index cce6bb30fe3..bfbae769379 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -496,7 +496,7 @@ mob/living/simple_animal/bullet_act(var/obj/item/projectile/Proj) attacked_with_item(O, user) //TODO: refactor mob attackby(), attacked_by(), and friends. -/mob/living/simple_animal/proc/attacked_with_item(obj/item/O, mob/user) +/mob/living/simple_animal/proc/attacked_with_item(obj/item/O, mob/user, var/proximity) if(istype(O, /obj/item/trap/animal) || istype(O, /obj/item/gun)) O.attack(src, user) return @@ -506,8 +506,10 @@ mob/living/simple_animal/bullet_act(var/obj/item/projectile/Proj) if(prob(15) && !istype(src, /mob/living/simple_animal/hostile)) //Aggressive animals don't purr before biting your face off. visible_message("[capitalize_first_letters(src.name)] [speak_emote.len ? pick(speak_emote) : "rumbles"].") //purring return + if(istype(O, /obj/item/glass_jar)) + return FALSE if(!O.force) - visible_message("\The [user] gently taps \the [src] with \the [O].") + visible_message(SPAN_NOTICE("\The [user] gently taps \the [src] with \the [O].")) poke() return FALSE @@ -813,4 +815,4 @@ mob/living/simple_animal/bullet_act(var/obj/item/projectile/Proj) #undef BLOOD_NONE #undef BLOOD_LIGHT #undef BLOOD_MEDIUM -#undef BLOOD_HEAVY \ No newline at end of file +#undef BLOOD_HEAVY diff --git a/html/changelogs/wezzy_getinjar.yml b/html/changelogs/wezzy_getinjar.yml new file mode 100644 index 00000000000..5d5e9ab5c2f --- /dev/null +++ b/html/changelogs/wezzy_getinjar.yml @@ -0,0 +1,41 @@ +################################ +# 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: "All small mobs fit in the glass jar now."