diff --git a/code/modules/fish/fishtank.dm b/code/modules/fish/fishtank.dm index 73b029c5972..412c5407ddc 100644 --- a/code/modules/fish/fishtank.dm +++ b/code/modules/fish/fishtank.dm @@ -1,6 +1,6 @@ ////////////////////////////// -// Fish Tanks! // +// Fish Tanks // ////////////////////////////// @@ -9,44 +9,41 @@ desc = "So generic, it might as well have no description at all." icon = 'icons/obj/fish_items.dmi' icon_state = "tank1" - density = 0 - anchored = 0 + density = FALSE + anchored = FALSE pass_flags = 0 var/tank_type = "" // Type of aquarium, used for icon updating var/water_capacity = 0 // Number of units the tank holds (varies with tank type) var/water_level = 0 // Number of units currently in the tank (new tanks start empty) var/light_switch = 0 // 0 = off, 1 = on (off by default) - var/filth_level = 0.0 // How dirty the tank is (max 10) + var/filth_level = 0 // How dirty the tank is (max 10) var/lid_switch = 0 // 0 = open, 1 = closed (open by default) var/max_fish = 0 // How many fish the tank can support (varies with tank type, 1 fish per 50 units sounds reasonable) var/food_level = 0 // Amount of fishfood floating in the tank (max 10) var/fish_count = 0 // Number of fish in the tank - var/list/fish_list = null // Tracks the current types of fish in the tank + var/list/fish_list = list() // Tracks the current types of fish in the tank var/egg_count = 0 // How many fish eggs can be harvested from the tank (capped at the max_fish value) - var/list/egg_list = null // Tracks the current types of harvestable eggs in the tank + var/list/egg_list = list() // Tracks the current types of harvestable eggs in the tank - var/has_lid = 0 // 0 if the tank doesn't have a lid/light, 1 if it does - var/max_health = 0 // Can handle a couple hits - var/cur_health = 0 // Current health, starts at max_health - var/leaking = 0 // 0 if not leaking, 1 if minor leak, 2 if major leak (not leaking by default) + var/has_lid = FALSE // 0 if the tank doesn't have a lid/light, 1 if it does + var/leaking = FALSE // 0 if not leaking, 1 if minor leak, 2 if major leak (not leaking by default) var/shard_count = 0 // Number of glass shards to salvage when broken (1 less than the number of sheets to build the tank) /obj/machinery/fishtank/bowl name = "fish bowl" desc = "A small bowl capable of housing a single fish, commonly found on desks. This one has a tiny treasure chest in it!" icon_state = "bowl1" - density = 0 // Small enough to not block stuff - anchored = 0 // Small enough to move even when filled + density = FALSE // Small enough to not block stuff + anchored = FALSE // Small enough to move even when filled pass_flags = PASSTABLE | LETPASSTHROW // Just like at the county fair, you can't seem to throw the ball in to win the goldfish, and it's small enough to pull onto a table tank_type = "bowl" water_capacity = 50 // Not very big, therefore it can't hold much max_fish = 1 // What a lonely fish - has_lid = 0 - max_health = 15 // Not very sturdy - cur_health = 15 + has_lid = FALSE + max_integrity = 15 // Not very sturdy shard_count = 0 // No salvageable shards /obj/machinery/fishtank/tank @@ -54,17 +51,16 @@ desc = "A large glass tank designed to house aquatic creatures. Contains an integrated water circulation system." icon = 'icons/obj/fish_items.dmi' icon_state = "tank1" - density = 1 - anchored = 1 + density = TRUE + anchored = TRUE pass_flags = LETPASSTHROW tank_type = "tank" water_capacity = 200 // Decent sized, holds almost 2 full buckets max_fish = 4 // Room for a few fish - has_lid = 1 - max_health = 50 // Average strength, will take a couple hits from a toolbox. - cur_health = 50 + has_lid = TRUE + max_integrity = 50 // Average strength, will take a couple hits from a toolbox. shard_count = 2 @@ -72,17 +68,16 @@ name = "wall aquarium" desc = "This aquarium is massive! It completely occupies the same space as a wall, and looks very sturdy too!" icon_state = "wall1" - density = 1 - anchored = 1 + density = TRUE + anchored = TRUE pass_flags = 0 // This thing is the size of a wall, you can't throw past it. tank_type = "wall" water_capacity = 500 // This thing fills an entire tile, it holds a lot. max_fish = 10 // Plenty of room for a lot of fish - has_lid = 1 - max_health = 100 // This thing is a freaking wall, it can handle abuse. - cur_health = 100 + has_lid = TRUE + max_integrity = 100 // This thing is a freaking wall, it can handle abuse. shard_count = 3 @@ -94,9 +89,10 @@ set name = "Toggle Tank Lid" set category = "Object" set src in view(1) - toggle_lid(usr) -/obj/machinery/fishtank/proc/toggle_lid(var/mob/living/user) + toggle_lid() + +/obj/machinery/fishtank/proc/toggle_lid() lid_switch = !lid_switch update_icon() @@ -104,12 +100,13 @@ set name = "Toggle Tank Light" set category = "Object" set src in view(1) - toggle_light(usr) -/obj/machinery/fishtank/proc/toggle_light(var/mob/living/user) + toggle_light() + +/obj/machinery/fishtank/proc/toggle_light() light_switch = !light_switch if(light_switch) - set_light(2,2,"#a0a080") + set_light(2, 2, "#a0a080") else adjust_tank_light() @@ -119,8 +116,6 @@ /obj/machinery/fishtank/New() ..() - fish_list = new/list() - egg_list = new/list() if(!has_lid) //Tank doesn't have a lid/light, remove the verbs for then verbs -= /obj/machinery/fishtank/verb/toggle_lid_verb verbs -= /obj/machinery/fishtank/verb/toggle_light_verb @@ -154,7 +149,8 @@ overlays += "over_leak_[leaking]" //Green if we aren't leaking, light blue and slow blink if minor link, dark blue and rapid flashing for major leak //Update water overlay - if(water_level == 0) return //Skip the rest of this if there is no water in the aquarium + if(!water_level) + return //Skip the rest of this if there is no water in the aquarium var/water_type = "_clean" //Default to clean water if(filth_level > 5) water_type = "_dirty" //Show dirty water above filth_level 5 (breeding threshold) if(water_level > (water_capacity * 0.85)) //Show full if the water_level is over 85% of water_capacity @@ -162,15 +158,13 @@ else if(water_level > (water_capacity * 0.35)) //Show half-full if the water_level is over 35% of water_capacity overlays += "over_[tank_type]_half[water_type]" - return - ////////////////////////////// // PROCESS PROC // ////////////////////////////// //Stops atmos from passing wall tanks, since they are effectively full-windows. -/obj/machinery/fishtank/wall/CanAtmosPass(var/turf/T) - return 0 +/obj/machinery/fishtank/wall/CanAtmosPass(turf/T) + return FALSE /obj/machinery/fishtank/process() //Start by counting fish in the tank @@ -238,9 +232,7 @@ adjust_tank_light() /obj/machinery/fishtank/proc/adjust_tank_light() - if(light_switch) //tank light overrides fish lights - return - else + if(!light_switch) //tank light overrides fish lights var/glo_light = 0 for(var/datum/fish/fish in fish_list) if(istype(fish, /datum/fish/glofish)) @@ -261,19 +253,13 @@ food_level = min(10, max(0, food_level + amount)) /obj/machinery/fishtank/proc/check_health() - //Max value check - if(cur_health > max_health) //Cur_health cannot exceed max_health, set it to max_health if it does - cur_health = max_health //Leaking status check - if(cur_health <= (max_health * 0.25)) //Major leak at or below 25% health (-10 water/cycle) + if(obj_integrity <= (max_integrity * 0.25)) //Major leak at or below 25% health (-10 water/cycle) leaking = 2 - else if(cur_health <= (max_health * 0.5)) //Minor leak at or below 50% health (-1 water/cycle) + else if(obj_integrity <= (max_integrity * 0.5)) //Minor leak at or below 50% health (-1 water/cycle) leaking = 1 else //Not leaking above 50% health leaking = 0 - //Destruction check - if(cur_health <= 0) //The tank is broken, destroy it - destroy() /obj/machinery/fishtank/proc/kill_fish(datum/fish/fish_type = null) //Check if we were passed a fish to kill, otherwise kill a random one @@ -292,12 +278,12 @@ fish_list.Add(fish_type) //Add a fish of the specified type fish_count++ //Increase fish_count to reflect the introduction of a fish, so the everything else works fine //Announce the new fish - visible_message("A new [fish_type.fish_name] has hatched in \the [src]!") + visible_message("A new [fish_type.fish_name] has hatched in [src]!") //Null type fish are dud eggs, give a message to inform the player else to_chat(usr, "The eggs disolve in the water. They were duds!") -/obj/machinery/fishtank/proc/harvest_eggs(var/mob/user) +/obj/machinery/fishtank/proc/harvest_eggs(mob/user) if(!egg_count) //Can't harvest non-existant eggs return @@ -312,62 +298,39 @@ egg_list.Cut() //Destroy any excess eggs, clearing the egg_list -/obj/machinery/fishtank/proc/harvest_fish(var/mob/user) +/obj/machinery/fishtank/proc/harvest_fish(mob/user) if(fish_count <= 0) //Can't catch non-existant fish! - to_chat(usr, "There are no fish in \the [src] to catch!") + to_chat(user, "There are no fish in [src] to catch!") return var/list/fish_names_list = list() for(var/datum/fish/fish_type in fish_list) fish_names_list += list("[fish_type.fish_name]" = fish_type) var/caught_fish = input("Select a fish to catch.", "Fishing") as null|anything in fish_names_list //Select a fish from the tank if(fish_count <= 0) - to_chat(usr, "There are no fish in \the [src] to catch!") + to_chat(user, "There are no fish in [src] to catch!") return else if(caught_fish) - user.visible_message("[user.name] harvests \a [caught_fish] from \the [src].", "You scoop \a [caught_fish] out of \the [src].") + user.visible_message("[user.name] harvests \a [caught_fish] from [src].", "You scoop \a [caught_fish] out of [src].") var/datum/fish/fish_type = fish_names_list[caught_fish] var/fish_item = fish_type.fish_item if(fish_item) new fish_item(get_turf(user)) //Spawn the appropriate fish_item at the user's feet. kill_fish(fish_type) //Kill the caught fish from the tank - -/obj/machinery/fishtank/proc/destroy(var/deconstruct = 0) - var/turf/T = get_turf(src) //Store the tank's turf for atmos updating after deletion of tank - if(!deconstruct) //Check if we are deconstructing or breaking the tank - var/shards_left = shard_count - while(shards_left > 0) //Produce the appropriate number of glass shards - new /obj/item/shard(get_turf(src)) - shards_left -- - if(water_level) //Spill any water that was left in the tank when it broke - spill_water() - else //We are deconstructing, make glass sheets instead of shards - var/sheets = shard_count + 1 //Deconstructing it salvages all the glass used to build the tank - new /obj/item/stack/sheet/glass(get_turf(src), sheets) //Produce the appropriate number of glass sheets, in a single stack - qdel(src) //qdel the tank and it's contents - T.air_update_turf(1) //Update the air for the turf, to avoid permanent atmos sealing with wall tanks - + //Update the air for the turf, to avoid permanent atmos sealing with wall tanks /obj/machinery/fishtank/proc/spill_water() + var/turf/simulated/T = get_turf(src) switch(tank_type) if("bowl") //Fishbowl: Wets it's own tile - var/turf/T = get_turf(src) - if(!istype(T, /turf/simulated)) return - var/turf/simulated/S = T - S.MakeSlippery() + if(istype(T)) + T.MakeSlippery() if("tank") //Fishtank: Wets it's own tile and the 4 adjacent tiles (cardinal directions) - var/turf/ST = get_turf(src) - if(istype(ST, /turf/simulated)) - var/turf/simulated/ST2 = ST - ST2.MakeSlippery() - var/list/L = ST.CardinalTurfs() - for(var/turf/T in L) - if(!istype(T, /turf/simulated)) continue - var/turf/simulated/S = T - S.MakeSlippery() + if(istype(T)) + T.MakeSlippery() + for(var/turf/simulated/ST in T.CardinalTurfs()) + ST.MakeSlippery() if("wall") //Wall-tank: Wets it's own tile and the surrounding 8 tiles (3x3 square) - for(var/turf/T in spiral_range_turfs(1, src.loc)) - if(!istype(T, /turf/simulated)) continue - var/turf/simulated/S = T - S.MakeSlippery() + for(var/turf/simulated/ST in spiral_range_turfs(1, loc)) + ST.MakeSlippery() /obj/machinery/fishtank/proc/breed_fish() var/list/breed_candidates = fish_list.Copy() @@ -412,20 +375,20 @@ examine_message += "Water level: " - if(water_level == 0) - examine_message += "\The [src] is empty! " + if(!water_level) + examine_message += "[src] is empty! " else if(water_level < water_capacity * 0.1) - examine_message += "\The [src] is nearly empty! " + examine_message += "[src] is nearly empty! " else if(water_level <= water_capacity * 0.25) - examine_message += "\The [src] is about one-quarter filled. " + examine_message += "[src] is about one-quarter filled. " else if(water_level <= water_capacity * 0.5) - examine_message += "\The [src] is about half filled. " + examine_message += "[src] is about half filled. " else if(water_level <= water_capacity * 0.75) - examine_message += "\The [src] is about three-quarters filled. " + examine_message += "[src] is about three-quarters filled. " else if(water_level < water_capacity) - examine_message += "\The [src] is nearly full! " + examine_message += "[src] is nearly full! " else if(water_level == water_capacity) - examine_message += "\The [src] is full! " + examine_message += "[src] is full! " examine_message += "
Cleanliness level: " @@ -467,7 +430,7 @@ //Report the number and types of live fish if there is water in the tank if(fish_count == 0) - examine_message += "\The [src] doesn't contain any live fish. " + examine_message += "[src] doesn't contain any live fish. " else //Build a message reporting the types of fish var/fish_num = fish_count @@ -483,7 +446,7 @@ message +=", " message +="." //No more fish, end the message with a period //Display the number of fish and previously constructed message - examine_message += "\The [src] contains [fish_count] live fish. [message] " + examine_message += "[src] contains [fish_count] live fish. [message] " examine_message += "
" @@ -498,12 +461,16 @@ examine_message += "
" //Report if the tank is leaking/cracked - if(water_level > 0) //Tank has water, so it's actually leaking - if(leaking == 1) examine_message += "\The [src] is leaking." - if(leaking == 2) examine_message += "\The [src] is leaking profusely!" + if(water_level) //Tank has water, so it's actually leaking + if(leaking == 1) + examine_message += "[src] is leaking." + if(leaking == 2) + examine_message += "[src] is leaking profusely!" else //No water, report the cracks instead - if(leaking == 1) examine_message += "\The [src] is cracked." - if(leaking == 2) examine_message += "\The [src] is nearly shattered!" + if(leaking == 1) + examine_message += "[src] is cracked." + if(leaking == 2) + examine_message += "[src] is nearly shattered!" //Finally, report the full examine_message constructed from the above reports @@ -514,122 +481,113 @@ // ATACK PROCS // ////////////////////////////// -/obj/machinery/fishtank/attack_animal(mob/living/simple_animal/M as mob) +/obj/machinery/fishtank/attack_animal(mob/living/simple_animal/M) if(istype(M, /mob/living/simple_animal/pet/cat)) if(M.a_intent == INTENT_HELP) //Cats can try to fish in open tanks on help intent if(lid_switch) //Can't fish in a closed tank. Fishbowls are ALWAYS open. - M.visible_message("[M.name] stares at into \the [src] while sitting perfectly still.", "The lid is closed, so you stare into \the [src] intently.") + M.visible_message("[M.name] stares at into [src] while sitting perfectly still.", "The lid is closed, so you stare into [src] intently.") else if(fish_count) //Tank must actually have fish to try catching one - M.visible_message("[M.name] leaps up onto \the[src] and attempts to fish through the opening!", "You jump up onto \the [src] and begin fishing through the opening!") - spawn(10) - if(water_level && prob(45)) //If there is water, there is a chance the cat will slip, Syndicat will spark like E-N when this happens - M.visible_message("[M.name] slipped and got soaked!", "You slipped and got soaked!") - if(istype(M, /mob/living/simple_animal/pet/cat/Syndi)) - var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread - s.set_up(3, 1, src) - s.start() - else //No water or didn't slip, get that fish! - M.visible_message("[M.name] catches and devours a live fish!", "You catch and devour a live fish, yum!") - kill_fish() //Kill a random fish - M.health = M.maxHealth //Eating fish heals the predator + M.visible_message("[M.name] leaps up onto [src] and attempts to fish through the opening!", "You jump up onto [src] and begin fishing through the opening!") + if(water_level && prob(45)) //If there is water, there is a chance the cat will slip, Syndicat will spark like E-N when this happens + M.visible_message("[M.name] slipped and got soaked!", "You slipped and got soaked!") + if(istype(M, /mob/living/simple_animal/pet/cat/Syndi)) + var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread + s.set_up(3, 1, src) + s.start() + else //No water or didn't slip, get that fish! + M.visible_message("[M.name] catches and devours a live fish!", "You catch and devour a live fish, yum!") + kill_fish() //Kill a random fish + M.health = M.maxHealth //Eating fish heals the predator else - to_chat(usr, "There are no fish in [src]!") + to_chat(M, "There are no fish in [src]!") else - attack_generic(M, M.harm_intent_damage) + return ..() else if(istype(M, /mob/living/simple_animal/hostile/bear)) if(M.a_intent == INTENT_HELP) //Bears can try to fish in open tanks on help intent if(lid_switch) //Can't fish in a closed tank. Fishbowls are ALWAYS open. - M.visible_message("[M.name] scrapes it's claws along \the [src]'s lid.", "The lid is closed, so you scrape your claws against \the [src]'s lid.") + M.visible_message("[M.name] scrapes it's claws along [src]'s lid.", "The lid is closed, so you scrape your claws against [src]'s lid.") else if(fish_count) //Tank must actually have fish to try catching one - M.visible_message("[M.name] reaches into \the[src] and attempts to fish through the opening!", "You reach into \the [src] and begin fishing through the opening!") - spawn(5) - if(water_level && prob(5)) //Bears are good at catching fish, only a 5% chance to fail - M.visible_message("[M.name] swipes at the water!", "You just barely missed that fish!") - else //No water or didn't slip, get that fish! - M.visible_message("[M.name] catches and devours a live fish!", "You catch and devour a live fish, yum!") - kill_fish() //Kill a random fish - M.health = M.maxHealth //Eating fish heals the predator + M.visible_message("[M.name] reaches into [src] and attempts to fish through the opening!", "You reach into [src] and begin fishing through the opening!") + if(water_level && prob(5)) //Bears are good at catching fish, only a 5% chance to fail + M.visible_message("[M.name] swipes at the water!", "You just barely missed that fish!") + else //No water or didn't slip, get that fish! + M.visible_message("[M.name] catches and devours a live fish!", "You catch and devour a live fish, yum!") + kill_fish() //Kill a random fish + M.health = M.maxHealth //Eating fish heals the predator else - to_chat(usr, "There are no fish in [src]!") + to_chat(M, "There are no fish in [src]!") else - attack_generic(M, M.harm_intent_damage) + return ..() else - if(M.melee_damage_upper > 0) //If the simple_animal has a melee_damage_upper defined, use that for the damage - attack_generic(M, M.melee_damage_upper) - else if(M.a_intent == INTENT_HARM) //Let any simple_animal try to break tanks when on harm intent - if(M.harm_intent_damage <= 0) return //If it doesn't do damage, don't bother with the attack - attack_generic(M, M.harm_intent_damage) - check_health() + return ..() -/obj/machinery/fishtank/attack_alien(mob/living/user as mob) - if(islarva(user)) return - attack_generic(user, 15) - -/obj/machinery/fishtank/attack_slime(mob/living/user as mob) - var/mob/living/carbon/slime/S = user - if(!S.is_adult) - return - attack_generic(user, rand(10, 15)) - -/obj/machinery/fishtank/attack_hand(mob/user as mob) - if(usr.a_intent == INTENT_HARM) - user.changeNext_move(CLICK_CD_MELEE) +/obj/machinery/fishtank/attack_hand(mob/user) + user.changeNext_move(CLICK_CD_MELEE) + if(user.a_intent == INTENT_HARM) playsound(get_turf(src), 'sound/effects/glassknock.ogg', 80, 1) - usr.visible_message("[usr.name] bangs against the [src.name]!", \ - "You bang against the [src.name]!", \ + user.visible_message("[user.name] bangs against the [name]!", \ + "You bang against the [name]!", \ "You hear a banging sound.") else - user.changeNext_move(CLICK_CD_MELEE) - playsound(src.loc, 'sound/effects/glassknock.ogg', 80, 1) - usr.visible_message("[usr.name] taps on the [src.name].", \ - "You tap on the [src.name].", \ + playsound(loc, 'sound/effects/glassknock.ogg', 80, 1) + user.visible_message("[user.name] taps on the [name].", \ + "You tap on the [name].", \ "You hear a knocking sound.") -/obj/machinery/fishtank/proc/hit(var/damage, var/sound_effect = 1) - cur_health = max(0, cur_health - damage) - if(sound_effect) - playsound(loc, 'sound/effects/Glasshit.ogg', 75, 1) - check_health() - -/obj/machinery/fishtank/attack_generic(mob/living/user, damage = 0) //used by attack_alien, attack_animal, and attack_slime - user.changeNext_move(CLICK_CD_MELEE) - user.do_attack_animation(src) - cur_health -= damage - if(cur_health <= 0) - user.visible_message("[user] smashes through \the [src]!") - destroy() - else //for nicer text~ - user.visible_message("[user] smashes into \the [src]!") - playsound(loc, 'sound/effects/Glasshit.ogg', 100, 1) +/obj/machinery/fishtank/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1) + . = ..() + if(.) //received damage check_health() -/obj/machinery/fishtank/attackby(var/obj/item/O, var/mob/user as mob) +/obj/machinery/fishtank/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0) + switch(damage_type) + if(BRUTE) + if(damage_amount) + playsound(src, 'sound/effects/Glasshit.ogg', 75, 1) + else + playsound(src, 'sound/weapons/tap.ogg', 50, 1) + if(BURN) + playsound(src, 'sound/items/Welder.ogg', 100, 1) + +/obj/machinery/fishtank/deconstruct(disassembled = TRUE) + if(QDELETED(src)) + return + if(!disassembled) + playsound(src, "shatter", 70, 1) + for(var/i in 1 to shard_count) //Produce the appropriate number of glass shards + var/obj/item/shard/S = new /obj/item/shard(get_turf(src)) + transfer_fingerprints_to(S) + if(water_level) //Spill any water that was left in the tank when it broke + spill_water() + else //We are deconstructing, make glass sheets instead of shards + new /obj/item/stack/sheet/glass(get_turf(src), shard_count + 1) //Produce the appropriate number of glass sheets, in a single stack + qdel(src) + +/obj/machinery/fishtank/attackby(obj/item/O, mob/user) //Welders repair damaged tanks on help intent, damage on all others - if(istype(O, /obj/item/weldingtool)) + if(iswelder(O)) var/obj/item/weldingtool/W = O if(user.a_intent == INTENT_HELP) if(W.isOn()) - if(cur_health < max_health) + if(obj_integrity < max_integrity) playsound(loc, W.usesound, 50, 1) - to_chat(usr, "You repair some of the cracks on \the [src].") - cur_health += 20 + to_chat(user, "You repair some of the cracks on [src].") + obj_integrity = min(obj_integrity + 20, max_integrity) check_health() else - to_chat(usr, "There is no damage to fix!") + to_chat(user, "There is no damage to fix!") else - if(cur_health < max_health) - to_chat(usr, "[W.name] must be on to repair this damage.") + if(obj_integrity < max_integrity) + to_chat(user, "[W] must be on to repair this damage.") else - user.changeNext_move(CLICK_CD_MELEE) - hit(W.force) - return + return ..() //Open reagent containers add and remove water - if(O.is_open_container()) + else if(O.is_open_container()) if(istype(O, /obj/item/reagent_containers/glass)) if(lid_switch) - to_chat(usr, "Open the lid on \the [src] first!") + to_chat(user, "Open the lid on [src] first!") return var/obj/item/reagent_containers/glass/C = O //Containers with any reagents will get dumped in @@ -647,57 +605,52 @@ C.reagents.clear_reagents() else if(water_level == water_capacity) - to_chat(usr, "[src] is already full!") - return + to_chat(user, "[src] is already full!") else message = "The filtration process purifies the water, raising the water level." if((water_level + water_value) == water_capacity) - message += " You filled \the [src] to the brim!" + message += " You filled [src] to the brim!" if((water_level + water_value) > water_capacity) - message += " You overfilled \the [src] and some water runs down the side, wasted." + message += " You overfilled [src] and some water runs down the side, wasted." C.reagents.clear_reagents() adjust_water_level(water_value) - user.visible_message("[user.name] pours the contents of [C.name] into \the [src].", "[message]") - return + user.visible_message("[user.name] pours the contents of [C.name] into [src].", "[message]") //Empty containers will scoop out water, filling the container as much as possible from the water_level else - if(water_level == 0) - to_chat(usr, "[src] is empty!") + if(!water_level) + to_chat(user, "[src] is empty!") else if(water_level >= C.volume) //Enough to fill the container completely C.reagents.add_reagent("fishwater", C.volume) adjust_water_level(-C.volume) - user.visible_message("[user.name] scoops out some water from \the [src].", "You completely fill [C.name] from \the [src].") + user.visible_message("[user.name] scoops out some water from [src].", "You completely fill [C.name] from [src].") else //Fill the container as much as possible with the water_level C.reagents.add_reagent("fishwater", water_level) adjust_water_level(-water_level) - user.visible_message("[user.name] scoops out some water from \the [src].", "You fill [C.name] with the last of the water in \the [src].") - return + user.visible_message("[user.name] scoops out some water from [src].", "You fill [C.name] with the last of the water in [src].") //Wrenches can deconstruct empty tanks, but not tanks with any water. Kills any fish left inside and destroys any unharvested eggs in the process - if(istype(O, /obj/item/wrench)) - if(water_level == 0) - to_chat(usr, "Now disassembling [src].") - playsound(src.loc, O.usesound, 50, 1) + else if(iswrench(O)) + if(!water_level) + to_chat(user, "Now disassembling [src].") + playsound(loc, O.usesound, 50, 1) if(do_after(user, 50 * O.toolspeed, target = src)) - destroy(1) + deconstruct(TRUE) else - to_chat(usr, "[src] must be empty before you disassemble it!") - return + to_chat(user, "[src] must be empty before you disassemble it!") //Fish eggs else if(istype(O, /obj/item/fish_eggs)) var/obj/item/fish_eggs/egg = O //Don't add eggs if there is no water (they kinda need that to live) - if(water_level == 0) - to_chat(usr, "[src] has no water; [egg.name] won't hatch without water!") + if(!water_level) + to_chat(user, "[src] has no water; [egg.name] won't hatch without water!") else //Don't add eggs if the tank already has the max number of fish if(fish_count >= max_fish) - to_chat(usr, "[src] can't hold any more fish.") + to_chat(user, "[src] can't hold any more fish.") else add_fish(egg.fish_type) qdel(egg) - return //Fish food else if(istype(O, /obj/item/fishfood)) //Only add food if there is water and it isn't already full of food @@ -706,33 +659,28 @@ if(fish_count == 0) user.visible_message("[user.name] shakes some fish food into the empty [src]... How sad.", "You shake some fish food into the empty [src]... If only it had fish.") else - user.visible_message("[user.name] feeds the fish in \the [src]. The fish look excited!", "You feed the fish in \the [src]. They look excited!") + user.visible_message("[user.name] feeds the fish in [src]. The fish look excited!", "You feed the fish in [src]. They look excited!") adjust_food_level(10) else - to_chat(usr, "[src] already has plenty of food in it. You decide to not add more.") + to_chat(user, "[src] already has plenty of food in it. You decide to not add more.") else - to_chat(usr, "[src] doesn't have any water in it. You should fill it with water first.") - return + to_chat(user, "[src] doesn't have any water in it. You should fill it with water first.") //Fish egg scoop else if(istype(O, /obj/item/egg_scoop)) if(egg_count) - user.visible_message("[user.name] harvests some fish eggs from \the [src].", "You scoop the fish eggs out of \the [src].") + user.visible_message("[user.name] harvests some fish eggs from [src].", "You scoop the fish eggs out of [src].") harvest_eggs(user) else - user.visible_message("[user.name] fails to harvest any fish eggs from \the [src].", "There are no fish eggs in \the [src] to scoop out.") - return + user.visible_message("[user.name] fails to harvest any fish eggs from [src].", "There are no fish eggs in [src] to scoop out.") //Fish net - if(istype(O, /obj/item/fish_net)) + else if(istype(O, /obj/item/fish_net)) harvest_fish(user) - return //Tank brush - if(istype(O, /obj/item/tank_brush)) + else if(istype(O, /obj/item/tank_brush)) if(filth_level == 0) - to_chat(usr, "[src] is already spotless!") + to_chat(user, "[src] is already spotless!") else adjust_filth_level(-filth_level) - user.visible_message("[user.name] scrubs the inside of \the [src], cleaning the filth.", "You scrub the inside of \the [src], cleaning the filth.") - else if(O && O.force) - user.visible_message("\The [src] has been attacked by [user.name] with \the [O]!") - hit(O.force) - return + user.visible_message("[user.name] scrubs the inside of [src], cleaning the filth.", "You scrub the inside of [src], cleaning the filth.") + else + return ..() \ No newline at end of file diff --git a/code/modules/reagents/reagent_containers/glass_containers.dm b/code/modules/reagents/reagent_containers/glass_containers.dm index 39d3babf4bc..6b0dc98dd37 100644 --- a/code/modules/reagents/reagent_containers/glass_containers.dm +++ b/code/modules/reagents/reagent_containers/glass_containers.dm @@ -42,7 +42,8 @@ /obj/machinery/constructable_frame, /obj/machinery/icemachine, /obj/item/bombcore/chemical, - /obj/machinery/vending) + /obj/machinery/vending, + /obj/machinery/fishtank) /obj/item/reagent_containers/glass/New() ..()