From 78b51c58b40a1606912a85b4522eae25edf28062 Mon Sep 17 00:00:00 2001 From: Mechoid Date: Sat, 1 Aug 2020 20:44:18 -0700 Subject: [PATCH] Fish tank --- code/datums/autolathe/general.dm | 4 + code/game/machinery/vending_machines.dm | 2 + code/game/objects/items/glassjar.dm | 137 ++++++++++++++++-- code/modules/materials/material_recipes.dm | 1 + .../subtypes/animal/passive/fish.dm | 23 ++- html/changelogs/mechoid - fishtank.yml | 36 +++++ 6 files changed, 184 insertions(+), 19 deletions(-) create mode 100644 html/changelogs/mechoid - fishtank.yml diff --git a/code/datums/autolathe/general.dm b/code/datums/autolathe/general.dm index 6ec648d388..891e73fb6b 100644 --- a/code/datums/autolathe/general.dm +++ b/code/datums/autolathe/general.dm @@ -54,6 +54,10 @@ name = "jar" path =/obj/item/glass_jar +/datum/category_item/autolathe/general/fishtank + name = "fish tank" + path =/obj/item/glass_jar + /datum/category_item/autolathe/general/radio_headset name = "radio headset" path =/obj/item/device/radio/headset diff --git a/code/game/machinery/vending_machines.dm b/code/game/machinery/vending_machines.dm index 59524f869a..b631ee807e 100644 --- a/code/game/machinery/vending_machines.dm +++ b/code/game/machinery/vending_machines.dm @@ -558,11 +558,13 @@ /obj/item/weapon/storage/box/wormcan = 4, /obj/item/weapon/storage/box/wormcan/sickly = 10, /obj/item/weapon/material/fishing_net = 2, + /obj/item/glass_jar/fish = 4, /obj/item/stack/cable_coil/random = 6) prices = list(/obj/item/weapon/material/fishing_rod/modern/cheap = 50, /obj/item/weapon/storage/box/wormcan = 12, /obj/item/weapon/storage/box/wormcan/sickly = 6, /obj/item/weapon/material/fishing_net = 40, + /obj/item/glass_jar/fish = 10, /obj/item/stack/cable_coil/random = 4) premium = list(/obj/item/weapon/storage/box/wormcan/deluxe = 1) contraband = list(/obj/item/weapon/storage/box/wormcan/deluxe = 1) diff --git a/code/game/objects/items/glassjar.dm b/code/game/objects/items/glassjar.dm index 60fd8b19eb..e55285e9da 100644 --- a/code/game/objects/items/glassjar.dm +++ b/code/game/objects/items/glassjar.dm @@ -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("[user] scoops [L] into \the [src].", "You scoop [L] into \the [src].") 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("[user] scoops [S] into \the [src].", "You scoop [S] into \the [src].") 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, "You take money out of \the [src].") - 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("[user] releases [M] from \the [src].", "You release [M] from \the [src].") - 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("[user] releases [S] from \the [src].", "You release [S] from \the [src].") 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("[user] puts [S.worth] [S.worth > 1 ? "thalers" : "thaler"] into \the [src].") @@ -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 \ No newline at end of file + 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, "That probably isn't the best idea.") + return + + to_chat(user, "You fill \the [src] with water!") + 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, "Maybe you shouldn't empty the water...") + return + + else + filled = FALSE + user.visible_message("[user] dumps out \the [src]'s water!") + update_icon() + return + + else + user.visible_message("[user] dumps \the [src]'s water.") + filled = FALSE + update_icon() + return + + return ..() + +#undef JAR_NOTHING +#undef JAR_MONEY +#undef JAR_ANIMAL +#undef JAR_SPIDER diff --git a/code/modules/materials/material_recipes.dm b/code/modules/materials/material_recipes.dm index a5079be720..2efef5783f 100644 --- a/code/modules/materials/material_recipes.dm +++ b/code/modules/materials/material_recipes.dm @@ -138,6 +138,7 @@ recipes += new/datum/stack_recipe("water-cooler", /obj/structure/reagent_dispensers/water_cooler, 4, time = 10, one_per_turf = 1, on_floor = 1, pass_stack_color = TRUE) recipes += new/datum/stack_recipe("lampshade", /obj/item/weapon/lampshade, 1, time = 1, pass_stack_color = TRUE) recipes += new/datum/stack_recipe("plastic net", /obj/item/weapon/material/fishing_net, 25, time = 1 MINUTE, pass_stack_color = TRUE) + recipes += new/datum/stack_recipe("plastic fishtank", /obj/item/glass_jar/fish/plastic, 2, time = 30 SECONDS) /material/wood/generate_recipes() ..() diff --git a/code/modules/mob/living/simple_mob/subtypes/animal/passive/fish.dm b/code/modules/mob/living/simple_mob/subtypes/animal/passive/fish.dm index 198f99a3f4..b5c811b81c 100644 --- a/code/modules/mob/living/simple_mob/subtypes/animal/passive/fish.dm +++ b/code/modules/mob/living/simple_mob/subtypes/animal/passive/fish.dm @@ -31,6 +31,17 @@ /turf/simulated/floor/water ) + var/randomize_location = TRUE + +/mob/living/simple_mob/animal/passive/fish/Initialize() + ..() + + if(!default_pixel_x && randomize_location) + default_pixel_x = rand(-12, 12) + + if(!default_pixel_y && randomize_location) + default_pixel_y = rand(-6, 10) + // Makes the AI unable to willingly go on land. /mob/living/simple_mob/animal/passive/fish/IMove(newloc) if(is_type_in_list(newloc, suitable_turf_types)) @@ -39,6 +50,11 @@ // Take damage if we are not in water /mob/living/simple_mob/animal/passive/fish/handle_breathing() + if(istype(loc, /obj/item/glass_jar/fish)) + var/obj/item/glass_jar/fish/F = loc + if(F.filled) + return + var/turf/T = get_turf(src) if(T && !is_type_in_list(T, suitable_turf_types)) if(prob(50)) @@ -178,8 +194,8 @@ dorsal_image.color = dorsal_color belly_image.color = belly_color - overlays += dorsal_image - overlays += belly_image + add_overlay(dorsal_image) + add_overlay(belly_image) /datum/category_item/catalogue/fauna/rockfish name = "Sivian Fauna - Rock Puffer" @@ -234,6 +250,7 @@ /mob/living/simple_mob/animal/passive/fish/rockfish/Initialize() ..() head_color = rgb(rand(min_red,max_red), rand(min_green,max_green), rand(min_blue,max_blue)) + update_icon() /mob/living/simple_mob/animal/passive/fish/rockfish/update_icon() overlays.Cut() @@ -245,7 +262,7 @@ head_image.color = head_color - overlays += head_image + add_overlay(head_image) /datum/category_item/catalogue/fauna/solarfish name = "Sivian Fauna - Solar Fin" diff --git a/html/changelogs/mechoid - fishtank.yml b/html/changelogs/mechoid - fishtank.yml new file mode 100644 index 0000000000..b30268dacd --- /dev/null +++ b/html/changelogs/mechoid - fishtank.yml @@ -0,0 +1,36 @@ +################################ +# 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 +################################# + +# Your name. +author: Mechoid + +# 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: "Adds a glass jar subtype, the glass tank, that can be used to hold live fish. Remember water!"