You can shove all small mobs in the glass jar now (#10484)

This commit is contained in:
Wowzewow (Wezzy)
2020-11-16 21:59:03 +01:00
committed by GitHub
parent 04ffd064a3
commit cbc835a2db
4 changed files with 96 additions and 46 deletions
+1 -1
View File
@@ -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("<b>[user]</b> holds up [icon2html(src, viewers(get_turf(src)))] [src]. <a HREF=?src=\ref[M];lookitem=\ref[src]>Take a closer look.</a>",1)
M.show_message("<b>[user]</b> holds up [icon2html(src, viewers(get_turf(src)))] [src]. <a HREF=?src=\ref[M];lookitem=\ref[src]>Take a closer look.</a>",1)
/mob/living/carbon/verb/showoff()
set name = "Show Held Item"
+49 -42
View File
@@ -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("<span class='notice'>[user] scoops [L] into \the [src].</span>", "<span class='notice'>You scoop [L] into \the [src].</span>")
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("<span class='notice'>[user] scoops [S] into \the [src].</span>", "<span class='notice'>You scoop [S] into \the [src].</span>")
user.visible_message(SPAN_NOTICE("<b>\The [user]</b> 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("<b>\The [user]</b> 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, "<span class='notice'>You take money out of \the [src].</span>")
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("<span class='notice'>[user] releases [M] from \the [src].</span>", "<span class='notice'>You release [M] from \the [src].</span>")
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("<span class='notice'>[user] releases [S] from \the [src].</span>", "<span class='notice'>You release [S] from \the [src].</span>")
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, "<span class='notice'>You remove the lid from \the [src].</span>")
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("<span class='notice'>[user] puts [S.worth] [S.worth > 1 ? "credits" : "credit"] into \the [src].</span>")
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
@@ -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("<b>[capitalize_first_letters(src.name)]</b> [speak_emote.len ? pick(speak_emote) : "rumbles"].") //purring
return
if(istype(O, /obj/item/glass_jar))
return FALSE
if(!O.force)
visible_message("<b>\The [user]</b> gently taps \the [src] with \the [O].")
visible_message(SPAN_NOTICE("<b>\The [user]</b> 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
#undef BLOOD_HEAVY
+41
View File
@@ -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."