/* * Fluid Drains * Fluid Channels * Fluid Spawners */ /////////////////// //////Drainage///// /////////////////// /obj/machinery/drainage anchored = 1 density = 0 icon = 'icons/obj/fluid.dmi' var/base_icon = "drain" icon_state = "drain" plane = PLANE_FLOOR //They're supposed to be embedded in the floor. name = "drain" desc = "A drainage pipe embedded in the floor to prevent flooding. Where does the drain go? Nobody knows." var/turf/my_turf var/clogged = 0 //temporary block var/welded = 0 //permanent block var/drain_min = 2 var/drain_max = 7 mats = 8 deconstruct_flags = DECON_SCREWDRIVER | DECON_WRENCH | DECON_CROWBAR | DECON_WELDER big base_icon = "bigdrain" icon_state = "bigdrain" mats = 12 drain_min = 6 drain_max = 14 New() my_turf = get_turf(src) ..() process() if (!my_turf) my_turf = get_turf(src) if (!my_turf) return if (my_turf.active_liquid) if (clogged) clogged-- return if (welded) return var/obj/fluid/F = my_turf.active_liquid if (F.group) F.group.queued_drains += rand(drain_min,drain_max) F.group.last_drain = my_turf if (!F.group.draining) F.group.add_drain_process() playsound(src.loc, "sound/misc/drain_glug.ogg", 50, 1) //moved to fluid process //F.group.reagents.skip_next_update = 1 //F.group.drain(F,rand(drain_min,drain_max)) //420 drain it attackby(obj/item/I as obj, mob/user as mob) if (istype(I, /obj/item/weldingtool)) var/obj/item/weldingtool/W = I if(W.welding) if (W.get_fuel() > 2) W.use_fuel(2) W.eyecheck(user) else boutput(user, "Need more welding fuel!") return playsound(get_turf(src), "sound/items/Welder.ogg", 50, 1) if (!src.welded) src.welded = 1 logTheThing("station", user, null, "welded [name] shut at [log_loc(user)].") user.show_text("You weld the drain shut.") else logTheThing("station", user, null, "un-welded [name] at [log_loc(user)].") src.welded = 0 user.show_text("You unseal the drain with your welder.") if (src.clogged) src.clogged = 0 user.show_text("The drain clog melts away.") src.update_icon() return if (istype(I,/obj/item/material_piece/cloth)) var/obj/item/material_piece/cloth/C = I src.clogged += (20 * C.amount) //One piece of cloth clogs for about 1 minute. (cause the machine loop updates ~3 second interval) user.show_text("You stuff [I] into the drain.") logTheThing("station", user, null, "clogs [name] shut temporarily at [log_loc(user)].") pool(I) src.update_icon() return return ..() proc/update_icon() if (clogged) icon_state = "[base_icon]_clogged" else if (welded) icon_state = "[base_icon]_welded" else icon_state = "[base_icon]" /////////////////// //////Channel////// /////////////////// /obj/channel anchored = 1 density = 0 icon = 'icons/obj/fluid.dmi' icon_state = "channel" name = "channel" desc = "A channel that can restrict liquid flow in one direction." flags = ALWAYS_SOLID_FLUID var/required_to_pass = 150 //fluid on the side that my Dir points to will need this amount to be able to cross New() ..() src.invisibility = 100 /////////////////// //////spawner////// /////////////////// //use these to have fluids be built into areas of a map on load //spawn fluid, then delete self /obj/fluid_spawner var/reagent_id = "water" var/amount = 10 var/delay = 600 var/datum/reagents/R event_handler_flags = IMMUNE_MANTA_PUSH New() ..() SPAWN_DBG(delay) R = new /datum/reagents(amount) R.add_reagent(reagent_id, amount) var/turf/T = get_turf(src) if (istype(T)) T.fluid_react(R,amount) R.clear_reagents() qdel(src) shortdelay amount = 50 delay = 10 shortdelaybig amount = 5000 delay = 10 polluted_filth delay = 35 amount = 1250 reagent_id = "sewage" madness amount = 166 reagent_id = "madness_toxin" blood amount = 175 reagent_id = "blood" black_goop amount = 148 reagent_id = "black_goop" green_goop amount = 143 reagent_id = "green_goop" yuck amount = 150 reagent_id = "yuck" salmonella amount = 135 reagent_id = "salmonella" bathsalts amount = 130 reagent_id = "bathsalts" ecoli amount = 136 reagent_id = "e.coli" crank amount = 145 reagent_id = "crank" /////////////////// //////canister////// /////////////////// /obj/machinery/fluid_canister anchored = 0 density = 1 icon = 'icons/obj/fluid.dmi' var/base_icon = "blue" icon_state = "blue0" name = "fluid canister" desc = "A canister that can drink large amounts of fluid and spit it out somewhere else. Gross." var/bladder = 20000 //how much I can hold var/slurp = 10 //tiles of fluid to drain per tick var/piss = 500 //amt of reagents to piss out per tick mats = 20 deconstruct_flags = DECON_CROWBAR | DECON_WELDER var/slurping = 0 var/pissing = 0 var/static/image/overlay_image = image('icons/obj/fluid.dmi') New() ..() src.reagents = new /datum/reagents(bladder) src.reagents.my_atom = src update_icon() ex_act(severity) var/turf/T = get_turf(src) T.fluid_react(src.reagents, src.reagents.total_volume) src.reagents.clear_reagents() ..(severity) qdel(src) is_open_container() .= -1 disposing() if (src.reagents.total_volume > 0) var/turf/T = get_turf(src) if (T.active_liquid) var/obj/fluid/F = T.active_liquid if (F.group) src.reagents.trans_to_direct(F.group.reagents,src.reagents.total_volume) else T.fluid_react(src.reagents,src.reagents.total_volume) ..() process() if (slurping) if (src.reagents.total_volume < bladder) var/turf/T = get_turf(src) if (T.active_liquid && T.active_liquid.group && T.active_liquid.group.reagents) T.active_liquid.group.drain(T.active_liquid,slurp,src) if (prob(80)) playsound(src.loc, "sound/impact_sounds/Liquid_Slosh_1.ogg", 50, 0.1, 0.7) update_icon() else if (pissing) if (src.reagents.total_volume > 0) var/turf/T = get_turf(src) if (T.active_liquid) var/obj/fluid/F = T.active_liquid if (F.group) src.reagents.trans_to_direct(F.group.reagents,min(piss,src.reagents.total_volume)) else if (istype(T, /turf/space/fluid)) src.reagents.clear_reagents() else T.fluid_react(src.reagents,min(piss,src.reagents.total_volume)) update_icon() proc/update_icon() var/amt = round((src.reagents.total_volume / bladder) * 12,1) icon_state = "[base_icon][amt]" if (slurping) overlay_image.icon_state = "w_2" else if (pissing) overlay_image.icon_state = "w_1" else overlay_image.icon_state = "w_off" UpdateOverlays(overlay_image, "working") Topic(href, href_list) if (usr.stat || usr.restrained()) return if (get_dist(src, usr) <= 1) usr.machine = src if (href_list["slurp"]) slurping = 1 pissing = 0 update_icon() if (href_list["piss"]) slurping = 0 pissing = 1 update_icon() if (href_list["off"]) slurping = 0 pissing = 0 update_icon() src.updateUsrDialog() src.add_fingerprint(usr) else usr.Browse(null, "window=fluid_canister") return return attack_hand(var/mob/user as mob) user.machine = src var/offtext var/intext var/outtext var/activetext var/width = 400 var/height = 200 offtext = "OFF" intext = "IN" outtext = "OUT" activetext = "OFF" if (slurping) activetext = "IN" if (pissing) activetext = "OUT" var/output_text = {"