Fish tank

This commit is contained in:
Mechoid
2020-08-01 20:44:18 -07:00
committed by VirgoBot
parent f03b38636d
commit 78b51c58b4
6 changed files with 184 additions and 19 deletions

View File

@@ -1,3 +1,9 @@
#define JAR_NOTHING 0
#define JAR_MONEY 1
#define JAR_ANIMAL 2
#define JAR_SPIDER 3
/obj/item/glass_jar
name = "glass jar"
desc = "A small empty jar."
@@ -27,7 +33,7 @@
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.loc = src
contains = 2
contains = JAR_ANIMAL
update_icon()
return
else if(istype(A, /obj/effect/spider/spiderling))
@@ -35,40 +41,40 @@
user.visible_message("<span class='notice'>[user] scoops [S] into \the [src].</span>", "<span class='notice'>You scoop [S] into \the [src].</span>")
S.loc = src
STOP_PROCESSING(SSobj, S) // No growing inside jars
contains = 3
contains = JAR_SPIDER
update_icon()
return
/obj/item/glass_jar/attack_self(var/mob/user)
switch(contains)
if(1)
if(JAR_MONEY)
for(var/obj/O in src)
O.loc = user.loc
to_chat(user, "<span class='notice'>You take money out of \the [src].</span>")
contains = 0
contains = JAR_NOTHING
update_icon()
return
if(2)
if(JAR_ANIMAL)
for(var/mob/M in src)
M.loc = 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
contains = JAR_NOTHING
update_icon()
return
if(3)
if(JAR_SPIDER)
for(var/obj/effect/spider/spiderling/S in src)
S.loc = 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>")
START_PROCESSING(SSobj, S) // They can grow after being let out though
contains = 0
contains = JAR_NOTHING
update_icon()
return
/obj/item/glass_jar/attackby(var/obj/item/W, var/mob/user)
if(istype(W, /obj/item/weapon/spacecash))
if(contains == 0)
contains = 1
if(contains != 1)
if(contains == JAR_NOTHING)
contains = JAR_MONEY
if(contains != JAR_MONEY)
return
var/obj/item/weapon/spacecash/S = W
user.visible_message("<span class='notice'>[user] puts [S.worth] [S.worth > 1 ? "thalers" : "thaler"] into \the [src].</span>")
@@ -80,10 +86,10 @@
underlays.Cut()
overlays.Cut()
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/weapon/spacecash/S in src)
@@ -92,7 +98,7 @@
money.pixel_y = rand(-6, 6)
money.transform *= 0.6
underlays += money
if(2)
if(JAR_ANIMAL)
for(var/mob/M in src)
var/image/victim = image(M.icon, M.icon_state)
victim.pixel_y = 6
@@ -105,10 +111,109 @@
underlays += victim
name = "glass jar with [M]"
desc = "A small jar with [M] inside."
if(3)
if(JAR_SPIDER)
for(var/obj/effect/spider/spiderling/S in src)
var/image/victim = image(S.icon, S.icon_state)
underlays += victim
name = "glass jar with [S]"
desc = "A small jar with [S] inside."
return
return
/obj/item/glass_jar/fish
name = "glass tank"
desc = "A large glass tank."
var/filled = FALSE
w_class = ITEMSIZE_NORMAL
accept_mobs = list(/mob/living/simple_mob/animal/passive/lizard, /mob/living/simple_mob/animal/passive/mouse, /mob/living/simple_mob/animal/sif/leech, /mob/living/simple_mob/animal/sif/frostfly, /mob/living/simple_mob/animal/sif/glitterfly, /mob/living/simple_mob/animal/passive/fish)
/obj/item/glass_jar/fish/plastic
name = "plastic tank"
desc = "A large plastic tank."
matter = list("plastic" = 4000)
/obj/item/glass_jar/fish/update_icon() // Also updates name and desc
underlays.Cut()
overlays.Cut()
if(filled)
underlays += image(icon, "[icon_state]_water")
switch(contains)
if(JAR_NOTHING)
name = initial(name)
desc = initial(desc)
if(JAR_MONEY)
name = "tip tank"
desc = "A large [name] with money inside."
for(var/obj/item/weapon/spacecash/S in src)
var/image/money = image(S.icon, S.icon_state)
money.pixel_x = rand(-2, 3)
money.pixel_y = rand(-6, 6)
money.transform *= 0.6
underlays += money
if(JAR_ANIMAL)
for(var/mob/M in src)
var/image/victim = image(M.icon, M.icon_state)
var/initial_x_scale = M.icon_scale_x
var/initial_y_scale = M.icon_scale_y
M.adjust_scale(0.7)
victim.appearance = M.appearance
M.adjust_scale(initial_x_scale, initial_y_scale)
victim.pixel_y = 4
underlays += victim
name = "[name] with [M]"
desc = "A large [name] with [M] inside."
if(JAR_SPIDER)
for(var/obj/effect/spider/spiderling/S in src)
var/image/victim = image(S.icon, S.icon_state)
underlays += victim
name = "[name] with [S]"
desc = "A large tank with [S] inside."
if(filled)
desc = "[desc] It contains water."
return
/obj/item/glass_jar/fish/afterattack(var/atom/A, var/mob/user, var/proximity)
if(!filled)
if(istype(A, /obj/structure/sink) || istype(A, /turf/simulated/floor/water))
if(contains && user.a_intent == "help")
to_chat(user, "<span class='warning'>That probably isn't the best idea.</span>")
return
to_chat(user, "<span class='notice'>You fill \the [src] with water!</span>")
filled = TRUE
update_icon()
return
return ..()
/obj/item/glass_jar/fish/attack_self(var/mob/user)
if(filled)
if(contains == JAR_ANIMAL)
if(user.a_intent == "help")
to_chat(user, "<span class='notice'>Maybe you shouldn't empty the water...</span>")
return
else
filled = FALSE
user.visible_message("<span class='warning'>[user] dumps out \the [src]'s water!</span>")
update_icon()
return
else
user.visible_message("<span class='notice'>[user] dumps \the [src]'s water.</span>")
filled = FALSE
update_icon()
return
return ..()
#undef JAR_NOTHING
#undef JAR_MONEY
#undef JAR_ANIMAL
#undef JAR_SPIDER