From 1d9eda6b65f4e6b5166c17f796afec63384cbca3 Mon Sep 17 00:00:00 2001 From: "petethegoat@gmail.com" Date: Mon, 28 Nov 2011 20:08:14 +0000 Subject: [PATCH] Removing recycling from WorkInProgress. (Please note that due to what seems to be an error with Tortoise SVN, I have to do this in two commits.) git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2571 316c924e-a436-60f5-8080-3fe189b3f50e --- code/WorkInProgress/recycling/conveyor.dm | 398 ------ .../recycling/disposal-construction.dm | 152 --- code/WorkInProgress/recycling/disposal.dm | 1114 ----------------- code/WorkInProgress/recycling/scrap.dm | 289 ----- .../recycling/sortingmachinery.dm | 216 ---- 5 files changed, 2169 deletions(-) delete mode 100644 code/WorkInProgress/recycling/conveyor.dm delete mode 100644 code/WorkInProgress/recycling/disposal-construction.dm delete mode 100644 code/WorkInProgress/recycling/disposal.dm delete mode 100644 code/WorkInProgress/recycling/scrap.dm delete mode 100644 code/WorkInProgress/recycling/sortingmachinery.dm diff --git a/code/WorkInProgress/recycling/conveyor.dm b/code/WorkInProgress/recycling/conveyor.dm deleted file mode 100644 index 1dfabc7b29..0000000000 --- a/code/WorkInProgress/recycling/conveyor.dm +++ /dev/null @@ -1,398 +0,0 @@ -// converyor belt - -// moves items/mobs/movables in set direction every ptick - - -/obj/machinery/conveyor - icon = 'recycling.dmi' - icon_state = "conveyor0" - name = "conveyor belt" - desc = "A conveyor belt." - anchored = 1 - var/operating = 0 // 1 if running forward, -1 if backwards, 0 if off - var/operable = 1 // true if can operate (no broken segments in this belt run) - var/basedir // this is the default (forward) direction, set by the map dir - // note dir var can vary when the direction changes - - var/list/affecting // the list of all items that will be moved this ptick - var/id = "" // the control ID - must match controller ID - // following two only used if a diverter is present - var/divert = 0 // if non-zero, direction to divert items - var/divdir = 0 // if diverting, will be conveyer dir needed to divert (otherwise dense) - - - - // create a conveyor - -/obj/machinery/conveyor/New() - ..() - basedir = dir - setdir() - - // set the dir and target turf depending on the operating direction - -/obj/machinery/conveyor/proc/setdir() - if(operating == -1) - dir = turn(basedir,180) - else - dir = basedir - update() - - - // update the icon depending on the operating condition - -/obj/machinery/conveyor/proc/update() - if(stat & BROKEN) - icon_state = "conveyor-b" - operating = 0 - return - if(!operable) - operating = 0 - icon_state = "conveyor[(operating != 0) && !(stat & NOPOWER)]" - - - // machine process - // move items to the target location -/obj/machinery/conveyor/process() - if(stat & (BROKEN | NOPOWER)) - return - if(!operating) - return - use_power(100) - - var/movedir = dir // base movement dir - if(divert && dir==divdir) // update if diverter present - movedir = divert - - - affecting = loc.contents - src // moved items will be all in loc - spawn(1) // slight delay to prevent infinite propagation due to map order - var/items_moved = 0 - for(var/atom/movable/A in affecting) - if(!A.anchored) - if(isturf(A.loc)) // this is to prevent an ugly bug that forces a player to drop what they're holding if they recently pick it up from the conveyer belt - if(ismob(A)) - var/mob/M = A - if(M.buckled == src) - var/obj/machinery/conveyor/C = locate() in get_step(src, dir) - M.buckled = null - step(M,dir) - if(C) - M.buckled = C - else - new/obj/item/weapon/cable_coil/cut(M.loc) - else - step(M,movedir) - else - step(A,movedir) - items_moved++ - if(items_moved >= 10) - break - -// attack with item, place item on conveyor - -/obj/machinery/conveyor/attackby(var/obj/item/I, mob/user) - if(istype(I, /obj/item/weapon/grab)) // special handling if grabbing a mob - var/obj/item/weapon/grab/G = I - G.affecting.Move(src.loc) - del(G) - return - else if(istype(I, /obj/item/weapon/cable_coil)) // if cable, see if a mob is present - var/mob/M = locate() in src.loc - if(M) - if (M == user) - src.visible_message("\blue [M] ties \himself to the conveyor.") - // note don't check for lying if self-tying - else - if(M.lying) - user.visible_message("\blue [M] has been tied to the conveyor by [user].", "\blue You tie [M] to the converyor!") - else - user << "\blue [M] must be lying down to be tied to the converyor!" - return - M.buckled = src - src.add_fingerprint(user) - I:use(1) - M.lying = 1 - return - - // else if no mob in loc, then allow coil to be placed - - else if(istype(I, /obj/item/weapon/wirecutters)) - var/mob/M = locate() in src.loc - if(M && M.buckled == src) - M.buckled = null - src.add_fingerprint(user) - if (M == user) - src.visible_message("\blue [M] cuts \himself free from the conveyor.") - else - src.visible_message("\blue [M] had been cut free from the conveyor by [user].") - return - - if(isrobot(user)) - return - - // otherwise drop and place on conveyor - user.drop_item() - if(I && I.loc) I.loc = src.loc - return - -// attack with hand, move pulled object onto conveyor - -/obj/machinery/conveyor/attack_hand(mob/user as mob) - if ((!( user.canmove ) || user.restrained() || !( user.pulling ))) - return - if (user.pulling.anchored) - return - if ((user.pulling.loc != user.loc && get_dist(user, user.pulling) > 1)) - return - if (ismob(user.pulling)) - var/mob/M = user.pulling - M.pulling = null - step(user.pulling, get_dir(user.pulling.loc, src)) - user.pulling = null - else - step(user.pulling, get_dir(user.pulling.loc, src)) - user.pulling = null - return - - -// make the conveyor broken -// also propagate inoperability to any connected conveyor with the same ID -/obj/machinery/conveyor/proc/broken() - stat |= BROKEN - update() - - var/obj/machinery/conveyor/C = locate() in get_step(src, basedir) - if(C) - C.set_operable(basedir, id, 0) - - C = locate() in get_step(src, turn(basedir,180)) - if(C) - C.set_operable(turn(basedir,180), id, 0) - - -//set the operable var if ID matches, propagating in the given direction - -/obj/machinery/conveyor/proc/set_operable(stepdir, match_id, op) - - if(id != match_id) - return - operable = op - - update() - var/obj/machinery/conveyor/C = locate() in get_step(src, stepdir) - if(C) - C.set_operable(stepdir, id, op) - -/* -/obj/machinery/conveyor/verb/destroy() - set src in view() - src.broken() -*/ - -/obj/machinery/conveyor/power_change() - ..() - update() - - -// converyor diverter -// extendable arm that can be switched so items on the conveyer are diverted sideways -// situate in same turf as conveyor -// only works if belts is running proper direction -// -// -/obj/machinery/diverter - icon = 'recycling.dmi' - icon_state = "diverter0" - name = "diverter" - desc = "A diverter arm for a conveyor belt." - anchored = 1 - layer = FLY_LAYER - var/obj/machinery/conveyor/conv // the conveyor this diverter works on - var/deployed = 0 // true if diverter arm is extended - var/operating = 0 // true if arm is extending/contracting - var/divert_to // the dir that diverted items will be moved - var/divert_from // the dir items must be moving to divert - - -// create a diverter -// set up divert_to and divert_from directions depending on dir state -/obj/machinery/diverter/New() - - ..() - - switch(dir) - if(NORTH) - divert_to = WEST // stuff will be moved to the west - divert_from = NORTH // if entering from the north - if(SOUTH) - divert_to = EAST - divert_from = NORTH - if(EAST) - divert_to = EAST - divert_from = SOUTH - if(WEST) - divert_to = WEST - divert_from = SOUTH - if(NORTHEAST) - divert_to = NORTH - divert_from = EAST - if(NORTHWEST) - divert_to = NORTH - divert_from = WEST - if(SOUTHEAST) - divert_to = SOUTH - divert_from = EAST - if(SOUTHWEST) - divert_to = SOUTH - divert_from = WEST - spawn(2) - // wait for map load then find the conveyor in this turf - conv = locate() in src.loc - if(conv) // divert_from dir must match possible conveyor movement - if(conv.basedir != divert_from && conv.basedir != turn(divert_from,180) ) - del(src) // if no dir match, then delete self - set_divert() - update() - -// update the icon state depending on whether the diverter is extended -/obj/machinery/diverter/proc/update() - icon_state = "diverter[deployed]" - -// call to set the diversion vars of underlying conveyor -/obj/machinery/diverter/proc/set_divert() - if(conv) - if(deployed) - conv.divert = divert_to - conv.divdir = divert_from - else - conv.divert= 0 - - -// *** TESTING click to toggle -/obj/machinery/diverter/Click() - toggle() - - -// toggle between arm deployed and not deployed, showing animation -// -/obj/machinery/diverter/proc/toggle() - if( stat & (NOPOWER|BROKEN)) - return - - if(operating) - return - - use_power(50) - operating = 1 - if(deployed) - flick("diverter10",src) - icon_state = "diverter0" - sleep(10) - deployed = 0 - else - flick("diverter01",src) - icon_state = "diverter1" - sleep(10) - deployed = 1 - operating = 0 - update() - set_divert() - -// don't allow movement into the 'backwards' direction if deployed -/obj/machinery/diverter/CanPass(atom/movable/O, var/turf/target) - var/direct = get_dir(O, target) - if(direct == divert_to) // prevent movement through body of diverter - return 0 - if(!deployed) - return 1 - return(direct != turn(divert_from,180)) - -// don't allow movement through the arm if deployed -/obj/machinery/diverter/CheckExit(atom/movable/O, var/turf/target) - var/direct = get_dir(O, target) - if(direct == turn(divert_to,180)) // prevent movement through body of diverter - return 0 - if(!deployed) - return 1 - return(direct != divert_from) - - - - - -// the conveyor control switch -// -// - -/obj/machinery/conveyor_switch - - name = "conveyor switch" - desc = "A conveyor control switch." - icon = 'recycling.dmi' - icon_state = "switch-off" - var/position = 0 // 0 off, -1 reverse, 1 forward - var/last_pos = -1 // last direction setting - var/operated = 1 // true if just operated - - var/id = "" // must match conveyor IDs to control them - - var/list/conveyors // the list of converyors that are controlled by this switch - anchored = 1 - - - -/obj/machinery/conveyor_switch/New() - ..() - update() - - spawn(5) // allow map load - conveyors = list() - for(var/obj/machinery/conveyor/C in world) - if(C.id == id) - conveyors += C - -// update the icon depending on the position - -/obj/machinery/conveyor_switch/proc/update() - if(position<0) - icon_state = "switch-rev" - else if(position>0) - icon_state = "switch-fwd" - else - icon_state = "switch-off" - - -// timed process -// if the switch changed, update the linked conveyors - -/obj/machinery/conveyor_switch/process() - if(!operated) - return - operated = 0 - - for(var/obj/machinery/conveyor/C in conveyors) - C.operating = position - C.setdir() - -// attack with hand, switch position -/obj/machinery/conveyor_switch/attack_hand(mob/user) - if(position == 0) - if(last_pos < 0) - position = 1 - last_pos = 0 - else - position = -1 - last_pos = 0 - else - last_pos = position - position = 0 - - operated = 1 - update() - - // find any switches with same id as this one, and set their positions to match us - for(var/obj/machinery/conveyor_switch/S in world) - if(S.id == src.id) - S.position = position - S.update() diff --git a/code/WorkInProgress/recycling/disposal-construction.dm b/code/WorkInProgress/recycling/disposal-construction.dm deleted file mode 100644 index 844a4b6091..0000000000 --- a/code/WorkInProgress/recycling/disposal-construction.dm +++ /dev/null @@ -1,152 +0,0 @@ -// Disposal pipe construction - -/obj/structure/disposalconstruct - - name = "disposal pipe segment" - desc = "A huge pipe segment used for constructing disposal systems." - icon = 'disposal.dmi' - icon_state = "conpipe-s" - anchored = 0 - density = 1 - pressure_resistance = 5*ONE_ATMOSPHERE - m_amt = 1850 - level = 2 - var/ptype = 0 - // 0=straight, 1=bent, 2=junction-j1, 3=junction-j2, 4=junction-y, 5=trunk - - var/dpdir = 0 // directions as disposalpipe - var/base_state = "pipe-s" - - // update iconstate and dpdir due to dir and type - proc/update() - var/flip = turn(dir, 180) - var/left = turn(dir, 90) - var/right = turn(dir, -90) - - switch(ptype) - if(0) - base_state = "pipe-s" - dpdir = dir | flip - if(1) - base_state = "pipe-c" - dpdir = dir | right - if(2) - base_state = "pipe-j1" - dpdir = dir | right | flip - if(3) - base_state = "pipe-j2" - dpdir = dir | left | flip - if(4) - base_state = "pipe-y" - dpdir = dir | left | right - if(5) - base_state = "pipe-t" - dpdir = dir - - - icon_state = "con[base_state]" - - if(invisibility) // if invisible, fade icon - icon -= rgb(0,0,0,128) - - // hide called by levelupdate if turf intact status changes - // change visibility status and force update of icon - hide(var/intact) - invisibility = (intact && level==1) ? 101: 0 // hide if floor is intact - update() - - - // flip and rotate verbs - verb/rotate() - set name = "Rotate Pipe" - set src in view(1) - - if(usr.stat) - return - if(anchored) - usr << "You must unfasten the pipe before rotating it." - dir = turn(dir, -90) - update() - - verb/flip() - set name = "Flip Pipe" - set src in view(1) - if(usr.stat) - return - - if(anchored) - usr << "You must unfasten the pipe before flipping it." - - dir = turn(dir, 180) - if(ptype == 2) - ptype = 3 - else if(ptype == 3) - ptype = 2 - update() - - // returns the type path of disposalpipe corresponding to this item dtype - proc/dpipetype() - switch(ptype) - if(0,1) - return /obj/structure/disposalpipe/segment - if(2,3,4) - return /obj/structure/disposalpipe/junction - if(5) - return /obj/structure/disposalpipe/trunk - return - - - - // attackby item - // wrench: (un)anchor - // weldingtool: convert to real pipe - - attackby(var/obj/item/I, var/mob/user) - var/turf/T = src.loc - if(T.intact) - user << "You can only attach the pipe if the floor plating is removed." - return - - var/obj/structure/disposalpipe/CP = locate() in T - if(CP) - update() - var/pdir = CP.dpdir - if(istype(CP, /obj/structure/disposalpipe/broken)) - pdir = CP.dir - if(pdir & dpdir) - user << "There is already a pipe at that location." - return - - if(istype(I, /obj/item/weapon/wrench)) - if(anchored) - anchored = 0 - level = 2 - density = 1 - user << "You detach the pipe from the underfloor." - else - anchored = 1 - level = 1 - density = 0 - user << "You attach the pipe to the underfloor." - playsound(src.loc, 'Ratchet.ogg', 100, 1) - - else if(istype(I, /obj/item/weapon/weldingtool)) - var/obj/item/weapon/weldingtool/W = I - if(W.remove_fuel(0,user)) - playsound(src.loc, 'Welder2.ogg', 100, 1) - user << "Welding the pipe in place." - W:welding = 2 - if(do_after(user, 20)) - update() - var/pipetype = dpipetype() - var/obj/structure/disposalpipe/P = new pipetype(src.loc) - P.base_icon_state = base_state - P.dir = dir - P.dpdir = dpdir - P.updateicon() - del(src) - return - W:welding = 1 - else - user << "You need more welding fuel to complete this task." - return diff --git a/code/WorkInProgress/recycling/disposal.dm b/code/WorkInProgress/recycling/disposal.dm deleted file mode 100644 index fd044259cf..0000000000 --- a/code/WorkInProgress/recycling/disposal.dm +++ /dev/null @@ -1,1114 +0,0 @@ -// Disposal bin -// Holds items for disposal into pipe system -// Draws air from turf, gradually charges internal reservoir -// Once full (~1 atm), uses air resv to flush items into the pipes -// Automatically recharges air (unless off), will flush when ready if pre-set -// Can hold items and human size things, no other draggables -// Toilets are a type of disposal bin for small objects only and work on magic. By magic, I mean torque rotation - -/obj/machinery/disposal - name = "disposal unit" - desc = "A pneumatic waste disposal unit." - icon = 'disposal.dmi' - icon_state = "disposal" - anchored = 1 - density = 1 - var/datum/gas_mixture/air_contents // internal reservoir - var/mode = 1 // item mode 0=off 1=charging 2=charged - var/flush = 0 // true if flush handle is pulled - var/obj/structure/disposalpipe/trunk/trunk = null // the attached pipe trunk - var/flushing = 0 // true if flushing in progress - - // create a new disposal - // find the attached trunk (if present) and init gas resvr. - New() - ..() - spawn(5) - trunk = locate() in src.loc - if(!trunk) - mode = 0 - flush = 0 - else - trunk.linked = src // link the pipe trunk to self - - air_contents = new/datum/gas_mixture() - //gas.volume = 1.05 * CELLSTANDARD - update() - - - // attack by item places it in to disposal - attackby(var/obj/item/I, var/mob/user) - if(stat & BROKEN) - return - - if(istype(I, /obj/item/weapon/melee/energy/blade)) - user << "You can't place that item inside the disposal unit." - return - - if(istype(I, /obj/item/weapon/trashbag)) - user << "\blue You empty the bag." - for(var/obj/item/O in I.contents) - I.contents -= O - O.loc = src - I.update_icon() - update() - return - - var/obj/item/weapon/grab/G = I - if(istype(G)) // handle grabbed mob - if(ismob(G.affecting)) - var/mob/GM = G.affecting - for (var/mob/V in viewers(usr)) - V.show_message("[usr] starts putting [GM.name] into the disposal.", 3) - if(do_after(usr, 20)) - if (GM.client) - GM.client.perspective = EYE_PERSPECTIVE - GM.client.eye = src - GM.loc = src - for (var/mob/C in viewers(src)) - C.show_message("\red [GM.name] has been placed in the [src] by [user].", 3) - del(G) - - if(isrobot(user)) - return - - else - user.drop_item() - - I.loc = src - user << "You place \the [I] into the [src]." - for(var/mob/M in viewers(src)) - if(M == user) - continue - M.show_message("[user.name] places \the [I] into the [src].", 3) - - update() - - // mouse drop another mob or self - // - MouseDrop_T(mob/target, mob/user) - if (!istype(target) || target.buckled || get_dist(user, src) > 1 || get_dist(user, target) > 1 || user.stat || istype(user, /mob/living/silicon/ai)) - return - - var/msg - for (var/mob/V in viewers(usr)) - if(target == user && !user.stat && !user.weakened && !user.stunned && !user.paralysis) - V.show_message("[usr] starts climbing into the disposal.", 3) - if(target != user && !user.restrained()) - if(target.anchored) return - V.show_message("[usr] starts stuffing [target.name] into the disposal.", 3) - if(!do_after(usr, 20)) - return - if(target == user && !user.stat && !user.weakened && !user.stunned && !user.paralysis) // if drop self, then climbed in - // must be awake, not stunned or whatever - msg = "[user.name] climbs into the [src]." - user << "You climb into the [src]." - else if(target != user && !user.restrained()) - msg = "[user.name] stuffs [target.name] into the [src]!" - user << "You stuff [target.name] into the [src]!" - else - return - if (target.client) - target.client.perspective = EYE_PERSPECTIVE - target.client.eye = src - target.loc = src - - for (var/mob/C in viewers(src)) - if(C == user) - continue - C.show_message(msg, 3) - - update() - return - - // can breath normally in the disposal - alter_health() - return get_turf(src) - - // attempt to move while inside - relaymove(mob/user as mob) - if(user.stat || src.flushing) - return - src.go_out(user) - return - - // leave the disposal - proc/go_out(mob/user) - - if (user.client) - user.client.eye = user.client.mob - user.client.perspective = MOB_PERSPECTIVE - user.loc = src.loc - update() - return - - - // monkeys can only pull the flush lever - attack_paw(mob/user as mob) - if(stat & BROKEN) - return - - flush = !flush - update() - return - - // ai as human but can't flush - attack_ai(mob/user as mob) - interact(user, 1) - - // human interact with machine - attack_hand(mob/user as mob) - interact(user, 0) - - // user interaction - proc/interact(mob/user, var/ai=0) - src.add_fingerprint(user) - if(stat & BROKEN) - user.machine = null - return - - var/dat = "Waste Disposal UnitWaste Disposal Unit
" - - if(!ai) // AI can't pull flush handle - if(flush) - dat += "Disposal handle: Disengage Engaged" - else - dat += "Disposal handle: Disengaged Engage" - - dat += "

Eject contents
" - - if(mode == 0) - dat += "Pump: Off On
" - else if(mode == 1) - dat += "Pump: Off On (pressurizing)
" - else - dat += "Pump: Off On (idle)
" - - var/per = 100* air_contents.return_pressure() / (2*ONE_ATMOSPHERE) - - dat += "Pressure: [round(per, 1)]%
" - - - user.machine = src - user << browse(dat, "window=disposal;size=360x170") - onclose(user, "disposal") - - // handle machine interaction - - Topic(href, href_list) - ..() - src.add_fingerprint(usr) - if(stat & BROKEN) - return - if(usr.stat || usr.restrained() || src.flushing) - return - - if (in_range(src, usr) && istype(src.loc, /turf)) - usr.machine = src - - if(href_list["close"]) - usr.machine = null - usr << browse(null, "window=disposal") - return - - if(href_list["pump"]) - if(text2num(href_list["pump"])) - mode = 1 - else - mode = 0 - update() - - if(href_list["handle"]) - flush = text2num(href_list["handle"]) - update() - - if(href_list["eject"]) - eject() - else - usr << browse(null, "window=disposal") - usr.machine = null - return - return - - // eject the contents of the disposal unit - proc/eject() - for(var/atom/movable/AM in src) - AM.loc = src.loc - AM.pipe_eject(0) - update() - - // update the icon & overlays to reflect mode & status - proc/update() - overlays = null - if(stat & BROKEN) - icon_state = "disposal-broken" - mode = 0 - flush = 0 - return - - // flush handle - if(flush) - overlays += image('disposal.dmi', "dispover-handle") - - // only handle is shown if no power - if(stat & NOPOWER) - return - - // check for items in disposal - occupied light - if(contents.len > 0) - overlays += image('disposal.dmi', "dispover-full") - - // charging and ready light - if(mode == 1) - overlays += image('disposal.dmi', "dispover-charge") - else if(mode == 2) - overlays += image('disposal.dmi', "dispover-ready") - - // timed process - // charge the gas reservoir and perform flush if ready - process() - if(stat & BROKEN) // nothing can happen if broken - return - - src.updateDialog() - - if(flush && air_contents.return_pressure() >= 2*ONE_ATMOSPHERE) // flush can happen even without power - flush() - - if(stat & NOPOWER) // won't charge if no power - return - - use_power(100) // base power usage - - if(mode != 1) // if off or ready, no need to charge - return - - // otherwise charge - use_power(500) // charging power usage - - var/atom/L = loc // recharging from loc turf - - var/datum/gas_mixture/env = L.return_air() - var/pressure_delta = (ONE_ATMOSPHERE*2.1) - air_contents.return_pressure() - - if(env.temperature > 0) - var/transfer_moles = 0.1 * pressure_delta*air_contents.volume/(env.temperature * R_IDEAL_GAS_EQUATION) - - //Actually transfer the gas - var/datum/gas_mixture/removed = env.remove(transfer_moles) - air_contents.merge(removed) - - - // if full enough, switch to ready mode - if(air_contents.return_pressure() >= 2*ONE_ATMOSPHERE) - mode = 2 - update() - return - - // perform a flush - proc/flush() - - flushing = 1 - flick("disposal-flush", src) - - var/obj/structure/disposalholder/H = new() // virtual holder object which actually - // travels through the pipes. - - - H.init(src) // copy the contents of disposer to holder - - air_contents = new() // new empty gas resv. - - sleep(10) - playsound(src, 'disposalflush.ogg', 50, 0, 0) - sleep(5) // wait for animation to finish - - - H.start(src) // start the holder processing movement - flushing = 0 - // now reset disposal state - flush = 0 - if(mode == 2) // if was ready, - mode = 1 // switch to charging - update() - return - - - // called when area power changes - power_change() - ..() // do default setting/reset of stat NOPOWER bit - update() // update icon - return - - - // called when holder is expelled from a disposal - // should usually only occur if the pipe network is modified - proc/expel(var/obj/structure/disposalholder/H) - - var/turf/target - playsound(src, 'hiss.ogg', 50, 0, 0) - for(var/atom/movable/AM in H) - target = get_offset_target_turf(src.loc, rand(5)-rand(5), rand(5)-rand(5)) - - AM.loc = src.loc - AM.pipe_eject(0) - spawn(1) - if(AM) - AM.throw_at(target, 5, 1) - - H.vent_gas(loc) - del(H) - -//The toilet does not need to pressurized but can only handle small items. -//You can also choke people by dunking them into the toilet. -/obj/machinery/disposal/toilet - name = "toilet" - desc = "A torque rotation-based, waste disposal unit for small matter." - icon_state = "toilet" - density = 0//So you can stand on it. - mode = 2 - - attackby(var/obj/item/I, var/mob/user) - if( !(stat & BROKEN) ) - if(istype(I, /obj/item/weapon/grab)) - var/obj/item/weapon/grab/G = I - if(istype(G)) // handle grabbed mob - if(ismob(G.affecting)) - var/mob/GM = G.affecting - for (var/mob/V in viewers(usr)) - V.show_message("[user] dunks [GM.name] into the toilet!", 3) - if(do_after(user, 30)) - if(G.state>1&&!GM.internal) - GM.oxyloss += 5 - - else if(I.w_class < 4) - user.drop_item() - I.loc = src - user << "You place \the [I] into the [src]." - for(var/mob/M in viewers(src)) - if(M == user) - continue - M.show_message("[user.name] places \the [I] into the [src].", 3) - else - user << "\red That item cannot be placed into the toilet." - return - - MouseDrop_T(mob/target, mob/user) - if (!istype(target) || target.buckled || get_dist(user, src) > 1 || get_dist(user, target) > 1 || user.stat || istype(user, /mob/living/silicon/ai)) - return//Damn that list is long - - for (var/mob/V in viewers(usr)) - if(target == user && !user.stat) - V.show_message("[user] sits on the toilet.", 3) - if(target != user && !user.restrained()) - V.show_message("[user] places [target.name] on the toilet.", 3) - target.loc = loc - return - - interact(mob/user) - add_fingerprint(user) - for (var/mob/V in viewers(user)) - V.show_message("[user] eagerly drinks the toilet water!", 3)//Yum yum yum - return - - update() - overlays = null - if( !(stat & BROKEN) ) - if(flush) - overlays += image('disposal.dmi',"toilet-handle",,dir) - if( !(stat & NOPOWER) ) - overlays += image('disposal.dmi',"toilet-ready",,dir) - else - icon_state = "toilet-broken" - mode = 0 - flush = 0 - return - - process() - if( !((stat & BROKEN)||(stat & NOPOWER)) )// nothing can happen if broken or not powered. - updateDialog() - if(!flush&&contents.len) - flush++ - flush() - use_power(100)// base power usage - update() - return - - flush() - flick("toilet-flush", src) - var/obj/structure/disposalholder/H = new() - H.init(src) - sleep(10) - playsound(src, 'disposalflush.ogg', 50, 0, 0) - sleep(30) // To prevent spam. - H.start(src) - flush-- - update() - return - -// virtual disposal object -// travels through pipes in lieu of actual items -// contents will be items flushed by the disposal -// this allows the gas flushed to be tracked - -/obj/structure/disposalholder - invisibility = 101 - var/datum/gas_mixture/gas = null // gas used to flush, will appear at exit point - var/active = 0 // true if the holder is moving, otherwise inactive - dir = 0 - var/count = 1000 //*** can travel 1000 steps before going inactive (in case of loops) - var/has_fat_guy = 0 // true if contains a fat person - var/destinationTag = 0 // changes if contains a delivery container - - - // initialize a holder from the contents of a disposal unit - proc/init(var/obj/machinery/disposal/D) - if(!istype(D, /obj/machinery/disposal/toilet))//So it does not drain gas from a toilet which does not function on it. - gas = D.air_contents// transfer gas resv. into holder object - - // now everything inside the disposal gets put into the holder - // note AM since can contain mobs or objs - for(var/atom/movable/AM in D) - AM.loc = src - if(istype(AM, /mob/living/carbon/human)) - var/mob/living/carbon/human/H = AM - if(H.mutations & FAT) // is a human and fat? - has_fat_guy = 1 // set flag on holder - if(istype(AM, /obj/effect/bigDelivery)) - var/obj/effect/bigDelivery/T = AM - src.destinationTag = T.sortTag - if(istype(AM, /obj/item/smallDelivery)) - var/obj/item/smallDelivery/T = AM - src.destinationTag = T.sortTag - - - // start the movement process - // argument is the disposal unit the holder started in - proc/start(var/obj/machinery/disposal/D) - if(!D.trunk) - D.expel(src) // no trunk connected, so expel immediately - return - - loc = D.trunk - active = 1 - dir = DOWN - spawn(1) - process() // spawn off the movement process - - return - - // movement process, persists while holder is moving through pipes - process() - var/obj/structure/disposalpipe/last - while(active) - if(has_fat_guy && prob(2)) // chance of becoming stuck per segment if contains a fat guy - active = 0 - // find the fat guys - for(var/mob/living/carbon/human/H in src) - - break - sleep(1) // was 1 - var/obj/structure/disposalpipe/curr = loc - last = curr - curr = curr.transfer(src) - if(!curr) - last.expel(src, loc, dir) - - // - if(!(count--)) - active = 0 - return - - - - // find the turf which should contain the next pipe - proc/nextloc() - return get_step(loc,dir) - - // find a matching pipe on a turf - proc/findpipe(var/turf/T) - - if(!T) - return null - - var/fdir = turn(dir, 180) // flip the movement direction - for(var/obj/structure/disposalpipe/P in T) - if(fdir & P.dpdir) // find pipe direction mask that matches flipped dir - return P - // if no matching pipe, return null - return null - - // merge two holder objects - // used when a a holder meets a stuck holder - proc/merge(var/obj/structure/disposalholder/other) - for(var/atom/movable/AM in other) - AM.loc = src // move everything in other holder to this one - if(ismob(AM)) - var/mob/M = AM - if(M.client) // if a client mob, update eye to follow this holder - M.client.eye = src - - if(other.has_fat_guy) - has_fat_guy = 1 - del(other) - - - // called when player tries to move while in a pipe - relaymove(mob/user as mob) - if (user.stat) - return - if (src.loc) - for (var/mob/M in hearers(src.loc.loc)) - M << "CLONG, clong!" - - playsound(src.loc, 'clang.ogg', 50, 0, 0) - - // called to vent all gas in holder to a location - proc/vent_gas(var/atom/location) - location.assume_air(gas) // vent all gas to turf - return - -// Disposal pipes - -/obj/structure/disposalpipe - icon = 'disposal.dmi' - name = "disposal pipe" - desc = "An underfloor disposal pipe." - anchored = 1 - density = 0 - - level = 1 // underfloor only - var/dpdir = 0 // bitmask of pipe directions - dir = 0 // dir will contain dominant direction for junction pipes - var/health = 10 // health points 0-10 - layer = 2.3 // slightly lower than wires and other pipes - var/base_icon_state // initial icon state on map - - // new pipe, set the icon_state as on map - New() - ..() - base_icon_state = icon_state - return - - - // pipe is deleted - // ensure if holder is present, it is expelled - Del() - var/obj/structure/disposalholder/H = locate() in src - if(H) - // holder was present - H.active = 0 - var/turf/T = src.loc - if(T.density) - // deleting pipe is inside a dense turf (wall) - // this is unlikely, but just dump out everything into the turf in case - - for(var/atom/movable/AM in H) - AM.loc = T - AM.pipe_eject(0) - del(H) - ..() - return - - // otherwise, do normal expel from turf - expel(H, T, 0) - ..() - - // returns the direction of the next pipe object, given the entrance dir - // by default, returns the bitmask of remaining directions - proc/nextdir(var/fromdir) - return dpdir & (~turn(fromdir, 180)) - - // transfer the holder through this pipe segment - // overriden for special behaviour - // - proc/transfer(var/obj/structure/disposalholder/H) - var/nextdir = nextdir(H.dir) - H.dir = nextdir - var/turf/T = H.nextloc() - var/obj/structure/disposalpipe/P = H.findpipe(T) - - if(P) - // find other holder in next loc, if inactive merge it with current - var/obj/structure/disposalholder/H2 = locate() in P - if(H2 && !H2.active) - H.merge(H2) - - H.loc = P - else // if wasn't a pipe, then set loc to turf - H.loc = T - return null - - return P - - - // update the icon_state to reflect hidden status - proc/update() - var/turf/T = src.loc - hide(T.intact && !istype(T,/turf/space)) // space never hides pipes - - // hide called by levelupdate if turf intact status changes - // change visibility status and force update of icon - hide(var/intact) - invisibility = intact ? 101: 0 // hide if floor is intact - updateicon() - - // update actual icon_state depending on visibility - // if invisible, append "f" to icon_state to show faded version - // this will be revealed if a T-scanner is used - // if visible, use regular icon_state - proc/updateicon() - if(invisibility) - icon_state = "[base_icon_state]f" - else - icon_state = base_icon_state - return - - - // expel the held objects into a turf - // called when there is a break in the pipe - // - - proc/expel(var/obj/structure/disposalholder/H, var/turf/T, var/direction) - - var/turf/target - - if(T.density) // dense ouput turf, so stop holder - H.active = 0 - H.loc = src - return - if(T.intact && istype(T,/turf/simulated/floor)) //intact floor, pop the tile - var/turf/simulated/floor/F = T - //F.health = 100 - F.burnt = 1 - F.intact = 0 - F.levelupdate() - new /obj/item/stack/tile(H) // add to holder so it will be thrown with other stuff - F.icon_state = "Floor[F.burnt ? "1" : ""]" - - if(direction) // direction is specified - if(istype(T, /turf/space)) // if ended in space, then range is unlimited - target = get_edge_target_turf(T, direction) - else // otherwise limit to 10 tiles - target = get_ranged_target_turf(T, direction, 10) - - playsound(src, 'hiss.ogg', 50, 0, 0) - for(var/atom/movable/AM in H) - AM.loc = T - AM.pipe_eject(direction) - spawn(1) - if(AM) - AM.throw_at(target, 100, 1) - H.vent_gas(T) - del(H) - - else // no specified direction, so throw in random direction - - playsound(src, 'hiss.ogg', 50, 0, 0) - for(var/atom/movable/AM in H) - target = get_offset_target_turf(T, rand(5)-rand(5), rand(5)-rand(5)) - - AM.loc = T - AM.pipe_eject(0) - spawn(1) - if(AM) - AM.throw_at(target, 5, 1) - - H.vent_gas(T) // all gas vent to turf - del(H) - - return - - // call to break the pipe - // will expel any holder inside at the time - // then delete the pipe - // remains : set to leave broken pipe pieces in place - proc/broken(var/remains = 0) - if(remains) - for(var/D in cardinal) - if(D & dpdir) - var/obj/structure/disposalpipe/broken/P = new(src.loc) - P.dir = D - - src.invisibility = 101 // make invisible (since we won't delete the pipe immediately) - var/obj/structure/disposalholder/H = locate() in src - if(H) - // holder was present - H.active = 0 - var/turf/T = src.loc - if(T.density) - // broken pipe is inside a dense turf (wall) - // this is unlikely, but just dump out everything into the turf in case - - for(var/atom/movable/AM in H) - AM.loc = T - AM.pipe_eject(0) - del(H) - return - - // otherwise, do normal expel from turf - expel(H, T, 0) - - spawn(2) // delete pipe after 2 ticks to ensure expel proc finished - del(src) - - - // pipe affected by explosion - ex_act(severity) - - switch(severity) - if(1.0) - broken(0) - return - if(2.0) - health -= rand(5,15) - healthcheck() - return - if(3.0) - health -= rand(0,15) - healthcheck() - return - - - // test health for brokenness - proc/healthcheck() - if(health < -2) - broken(0) - else if(health<1) - broken(1) - return - - //attack by item - //weldingtool: unfasten and convert to obj/disposalconstruct - - attackby(var/obj/item/I, var/mob/user) - - var/turf/T = src.loc - if(T.intact) - return // prevent interaction with T-scanner revealed pipes - - if(istype(I, /obj/item/weapon/weldingtool)) - var/obj/item/weapon/weldingtool/W = I - - if(W.welding) - if(W.remove_fuel(0,user)) - W:welding = 2 - playsound(src.loc, 'Welder2.ogg', 100, 1) - // check if anything changed over 2 seconds - var/turf/uloc = user.loc - var/atom/wloc = W.loc - user << "Slicing the disposal pipe." - sleep(30) - if(user.loc == uloc && wloc == W.loc) - welded() - else - user << "You must stay still while welding the pipe." - W:welding = 1 - else - user << "You need more welding fuel to cut the pipe." - return - - // called when pipe is cut with welder - proc/welded() - - var/obj/structure/disposalconstruct/C = new (src.loc) - switch(base_icon_state) - if("pipe-s") - C.ptype = 0 - if("pipe-c") - C.ptype = 1 - if("pipe-j1") - C.ptype = 2 - if("pipe-j2") - C.ptype = 3 - if("pipe-y") - C.ptype = 4 - if("pipe-t") - C.ptype = 5 - - C.dir = dir - C.update() - - del(src) - -// *** TEST verb -//client/verb/dispstop() -// for(var/obj/structure/disposalholder/H in world) -// H.active = 0 - -// a straight or bent segment -/obj/structure/disposalpipe/segment - icon_state = "pipe-s" - - New() - ..() - if(icon_state == "pipe-s") - dpdir = dir | turn(dir, 180) - else - dpdir = dir | turn(dir, -90) - - update() - return - - - - -//a three-way junction with dir being the dominant direction -/obj/structure/disposalpipe/junction - icon_state = "pipe-j1" - - New() - ..() - if(icon_state == "pipe-j1") - dpdir = dir | turn(dir, -90) | turn(dir,180) - else if(icon_state == "pipe-j2") - dpdir = dir | turn(dir, 90) | turn(dir,180) - else // pipe-y - dpdir = dir | turn(dir,90) | turn(dir, -90) - update() - return - - - // next direction to move - // if coming in from secondary dirs, then next is primary dir - // if coming in from primary dir, then next is equal chance of other dirs - - nextdir(var/fromdir) - var/flipdir = turn(fromdir, 180) - if(flipdir != dir) // came from secondary dir - return dir // so exit through primary - else // came from primary - // so need to choose either secondary exit - var/mask = ..(fromdir) - - // find a bit which is set - var/setbit = 0 - if(mask & NORTH) - setbit = NORTH - else if(mask & SOUTH) - setbit = SOUTH - else if(mask & EAST) - setbit = EAST - else - setbit = WEST - - if(prob(50)) // 50% chance to choose the found bit or the other one - return setbit - else - return mask & (~setbit) - -//a three-way junction that sorts objects -/obj/structure/disposalpipe/sortjunction - - desc = "An underfloor disposal pipe with a package sorting mechanism." - icon_state = "pipe-j1s" - var/sortType = 0 - var/posdir = 0 - var/negdir = 0 - var/sortdir = 0 - - New() - ..() - posdir = dir - if(icon_state == "pipe-j1s") - sortdir = turn(posdir, -90) - negdir = turn(posdir, 180) - else - icon_state = "pipe-j2s" - sortdir = turn(posdir, 90) - negdir = turn(posdir, 180) - dpdir = sortdir | posdir | negdir - - update() - return - - - // next direction to move - // if coming in from negdir, then next is primary dir or sortdir - // if coming in from posdir, then flip around and go back to posdir - // if coming in from sortdir, go to posdir - - nextdir(var/fromdir, var/sortTag) - //var/flipdir = turn(fromdir, 180) - if(fromdir != sortdir) // probably came from the negdir - - if(src.sortType == sortTag) //if destination matches filtered type... - return sortdir // exit through sortdirection - else - return posdir - else // came from sortdir - // so go with the flow to positive direction - return posdir - - transfer(var/obj/structure/disposalholder/H) - var/nextdir = nextdir(H.dir, H.destinationTag) - H.dir = nextdir - var/turf/T = H.nextloc() - var/obj/structure/disposalpipe/P = H.findpipe(T) - - if(P) - // find other holder in next loc, if inactive merge it with current - var/obj/structure/disposalholder/H2 = locate() in P - if(H2 && !H2.active) - H.merge(H2) - - H.loc = P - else // if wasn't a pipe, then set loc to turf - H.loc = T - return null - - return P - - - - - -//a trunk joining to a disposal bin or outlet on the same turf -/obj/structure/disposalpipe/trunk - icon_state = "pipe-t" - var/obj/linked // the linked obj/machinery/disposal or obj/disposaloutlet - - New() - ..() - dpdir = dir - spawn(1) - getlinked() - - update() - return - - proc/getlinked() - linked = null - var/obj/machinery/disposal/D = locate() in src.loc - if(D) - linked = D - if (!D.trunk) - D.trunk = src - - var/obj/structure/disposaloutlet/O = locate() in src.loc - if(O) - linked = O - - update() - return - - // would transfer to next pipe segment, but we are in a trunk - // if not entering from disposal bin, - // transfer to linked object (outlet or bin) - - transfer(var/obj/structure/disposalholder/H) - - if(H.dir == DOWN) // we just entered from a disposer - return ..() // so do base transfer proc - // otherwise, go to the linked object - if(linked) - var/obj/structure/disposaloutlet/O = linked - if(istype(O)) - O.expel(H) // expel at outlet - else - var/obj/machinery/disposal/D = linked - D.expel(H) // expel at disposal - else - src.expel(H, src.loc, 0) // expel at turf - return null - - // nextdir - - nextdir(var/fromdir) - if(fromdir == DOWN) - return dir - else - return 0 - -// a broken pipe -/obj/structure/disposalpipe/broken - icon_state = "pipe-b" - dpdir = 0 // broken pipes have dpdir=0 so they're not found as 'real' pipes - // i.e. will be treated as an empty turf - desc = "A broken piece of disposal pipe." - - New() - ..() - update() - return - - // called when welded - // for broken pipe, remove and turn into scrap - - welded() -// var/obj/item/scrap/S = new(src.loc) -// S.set_components(200,0,0) - del(src) - -// the disposal outlet machine - -/obj/structure/disposaloutlet - name = "disposal outlet" - desc = "An outlet for the pneumatic disposal system." - icon = 'disposal.dmi' - icon_state = "outlet" - density = 1 - anchored = 1 - var/active = 0 - var/turf/target // this will be where the output objects are 'thrown' to. - - New() - ..() - - spawn(1) - target = get_ranged_target_turf(src, dir, 10) - - // expel the contents of the holder object, then delete it - // called when the holder exits the outlet - proc/expel(var/obj/structure/disposalholder/H) - - flick("outlet-open", src) - playsound(src, 'warning-buzzer.ogg', 50, 0, 0) - sleep(20) //wait until correct animation frame - playsound(src, 'hiss.ogg', 50, 0, 0) - - - for(var/atom/movable/AM in H) - AM.loc = src.loc - AM.pipe_eject(dir) - spawn(1) - AM.throw_at(target, 3, 1) - H.vent_gas(src.loc) - del(H) - - return - - - - -// called when movable is expelled from a disposal pipe or outlet -// by default does nothing, override for special behaviour - -/atom/movable/proc/pipe_eject(var/direction) - return - -// check if mob has client, if so restore client view on eject -/mob/pipe_eject(var/direction) - if (src.client) - src.client.perspective = MOB_PERSPECTIVE - src.client.eye = src - - return - -/obj/effect/decal/cleanable/blood/gibs/pipe_eject(var/direction) - var/list/dirs - if(direction) - dirs = list( direction, turn(direction, -45), turn(direction, 45)) - else - dirs = alldirs.Copy() - - src.streak(dirs) - -/obj/effect/decal/cleanable/robot_debris/gib/pipe_eject(var/direction) - var/list/dirs - if(direction) - dirs = list( direction, turn(direction, -45), turn(direction, 45)) - else - dirs = alldirs.Copy() - - src.streak(dirs) diff --git a/code/WorkInProgress/recycling/scrap.dm b/code/WorkInProgress/recycling/scrap.dm deleted file mode 100644 index e15d6780b2..0000000000 --- a/code/WorkInProgress/recycling/scrap.dm +++ /dev/null @@ -1,289 +0,0 @@ -// The scrap item -// a single object type represents all combinations of size and composition of scrap -// - - -/obj/item/scrap - name = "scrap" - icon = 'scrap.dmi' - icon_state = "1metal0" - item_state = "scrap-metal" - desc = "A piece of scrap" - var/classtext = "" - throwforce = 14.0 - m_amt = 0 - g_amt = 0 - w_amt = 0 - var/size = 1 // 1=piece, 2= few pieces, 3=small pile, 4=large pile - var/blood = 0 // 0=none, 1=blood-stained, 2=bloody - - throwforce = 8.0 - throw_speed = 1 - throw_range = 4 - w_class = 1 - flags = FPRINT | TABLEPASS | CONDUCT - -#define MAX_SCRAP 15000 // maximum content amount of a scrap pile - - -/obj/item/scrap/New() - src.verbs -= /atom/movable/verb/pull - ..() - update() - -// return a copy -/obj/item/scrap/proc/copy() - var/obj/item/scrap/ret = new() - ret.set_components(m_amt, g_amt, w_amt) - return ret - - -// set the metal, glass and waste content -/obj/item/scrap/proc/set_components(var/m, var/g, var/w) - m_amt = m - g_amt = g - w_amt = w - update() - -// returns the total amount of scrap in this pile -/obj/item/scrap/proc/total() - return m_amt + g_amt + w_amt - - -// sets the size, appearance, and description of the scrap depending on component amounts -/obj/item/scrap/proc/update() - var/total = total() - - - // determine size of pile - if(total<=400) - size = 1 - else if(total<=1600) - size = 2 - else - size = 3 - - w_class = size - - var/sizetext = "" - - switch(size) - if(1) - sizetext = "A piece of" - if(2) - sizetext = "A few pieces of" - if(3) - sizetext = "A pile of" - - // determine bloodiness - var/bloodtext = "" - switch(blood) - if(0) - bloodtext = "" - if(1) - bloodtext = "blood-stained " - if(2) - bloodtext = "bloody " - - - // find mixture and composition - var/class = 0 // 0 = mixed, 1=mostly. 2=pure - var/major = "waste" // the major component type - - var/max = 0 - - if(m_amt > max) - max = m_amt - else if(g_amt > max) - max = g_amt - else if(w_amt > max) - max = w_amt - - if(max == total) - class = 2 // pure - else if(max/total > 0.6) - class = 1 // mostly - else - class = 0 // mixed - - if(class>0) - var/remain = total - max - if(m_amt > remain) - major = "metal" - else if(g_amt > remain) - major = "glass" - else - major = "waste" - - - if(class == 1) - desc = "[sizetext] mostly [major] [bloodtext]scrap." - classtext = "mostly [major] [bloodtext]" - else - desc = "[sizetext] [bloodtext][major] scrap." - classtext = "[bloodtext][major] " - icon_state = "[size][major][blood]" - else - desc = "[sizetext] [bloodtext]mixed scrap." - classtext = "[bloodtext]mixed" - icon_state = "[size]mixed[blood]" - - if(size==0) - pixel_x = rand(-5,5) - pixel_y = rand(-5,5) - else - pixel_x = 0 - pixel_y = 0 - - // clear or set conduction flag depending on whether scrap is mostly metal - if(major=="metal") - flags |= CONDUCT - else - flags &= ~CONDUCT - - item_state = "scrap-[major]" - -// add a scrap item to this one -// if the resulting pile is too big, transfer only what will fit -// otherwise add them and deleted the added pile - -/obj/item/scrap/proc/add_scrap(var/obj/item/scrap/other, var/limit = MAX_SCRAP) - var/total = total() - var/other_total = other.total() - - if( (total + other_total) <= limit ) - m_amt += other.m_amt - g_amt += other.g_amt - w_amt += other.w_amt - - blood = (total*blood + other_total*other.blood) / (total + other_total) - del(other) - - else - var/space = limit - total - - var/m = round(other.m_amt/other_total*space, 1) - var/g = round(other.g_amt/other_total*space, 1) - var/w = round(other.w_amt/other_total*space, 1) - - m_amt += m - g_amt += g - w_amt += w - - other.m_amt -= m - other.g_amt -= g - other.w_amt -= w - - var/other_trans = m + g + w - other.update() - blood = (total*blood + other_trans*other.blood) / (total + other_trans) - - - blood = round(blood,1) - src.update() - -// limit this pile to maximum size -// return any remainder as a new scrap item (or null if none) -// note return item is not necessarily smaller than max size - -/obj/item/scrap/proc/remainder(var/limit = MAX_SCRAP) - var/total = total() - if(total > limit) - var/m = round( m_amt/total * limit, 1) - var/g = round( g_amt/total * limit, 1) - var/w = round( w_amt/total * limit, 1) - - var/obj/item/scrap/S = new() - S.set_components(m_amt - m,g_amt - g,w_amt - w) - src.set_components(m,g,w) - - return S - return null - -// if other pile of scrap tries to enter the same turf, then add that pile to this one - -/obj/item/scrap/CanPass(var/obj/item/scrap/O) - - if(istype(O)) - - src.add_scrap(O) - if(O) - return 0 // O still exists if not all could be transfered, so block it - return 1 - -/obj/item/scrap/proc/to_text() - return "[m_amt],[g_amt],[w_amt] ([total()])" - - -// attack with hand removes a single piece from a pile -/obj/item/scrap/attack_hand(mob/user) - add_fingerprint(user) - if(src.is_single_piece()) - return ..(user) - var/obj/item/scrap/S = src.get_single_piece() - S.attack_hand(user) - return - - -/obj/item/scrap/attackby(obj/item/I, mob/user) - ..() - if(istype(I, /obj/item/scrap)) - var/obj/item/scrap/S = I - if( (S.total()+src.total() ) > MAX_SCRAP ) - user << "The pile is full." - return - if(ismob(src.loc)) // can't combine scrap in hand - return - - src.add_scrap(S) - -// when dropped, try to make a pile if scrap is already there -/obj/item/scrap/dropped() - - spawn(2) // delay to allow drop postprocessing (since src may be destroyed) - for(var/obj/item/scrap/S in oview(0,src)) // excludes src itself - S.add_scrap(src) - -// return true if this is a single piece of scrap -// must be total<=400 and of single composition -/obj/item/scrap/proc/is_single_piece() - if(total() > 400) - return 0 - - var/empty = (m_amt == 0) + (g_amt == 0) + (w_amt == 0) - - return (empty==2) // must be 2 components with zero amount - - -// get a single piece of scrap from a pile -/obj/item/scrap/proc/get_single_piece() - - var/obj/item/scrap/S = new() - - var/cmp = pick(m_amt;1 , g_amt;2, w_amt;3) - - var/amount = 400 - switch(cmp) - if(1) - if(m_amt < amount) - amount = m_amt - - S.set_components(amount, 0, 0) - src.set_components(m_amt - amount, g_amt, w_amt) - - if(2) - if(g_amt < amount) - amount = g_amt - S.set_components(0, amount, 0) - src.set_components(m_amt, g_amt - amount, w_amt) - - if(3) - if(w_amt < amount) - amount = w_amt - S.set_components(0, 0, amount) - src.set_components(m_amt, g_amt, w_amt - amount) - - - return S - - diff --git a/code/WorkInProgress/recycling/sortingmachinery.dm b/code/WorkInProgress/recycling/sortingmachinery.dm deleted file mode 100644 index efb22911a8..0000000000 --- a/code/WorkInProgress/recycling/sortingmachinery.dm +++ /dev/null @@ -1,216 +0,0 @@ -/obj/effect/bigDelivery - desc = "A big wrapped package." - name = "large parcel" - icon = 'storage.dmi' - icon_state = "deliverycrate" - var/obj/wrapped = null - density = 1 - var/sortTag = 0 - flags = FPRINT - mouse_drag_pointer = MOUSE_ACTIVE_POINTER - - - attack_hand(mob/user as mob) - if (src.wrapped) //sometimes items can disappear. For example, bombs. --rastaf0 - src.wrapped.loc = (get_turf(src.loc)) - if (istype(src.wrapped,/obj/structure/closet)) - var/obj/structure/closet/O = src.wrapped - O.welded = 0 - del(src) - return - - attackby(obj/item/W as obj, mob/user as mob) - if(istype(W, /obj/item/device/destTagger)) - var/obj/item/device/destTagger/O = W - user << "\blue *TAGGED*" - src.sortTag = O.currTag - return - -/obj/item/smallDelivery - desc = "A small wrapped package." - name = "small parcel" - icon = 'storage.dmi' - icon_state = "deliverycrateSmall" - var/obj/item/wrapped = null - var/sortTag = 0 - flags = FPRINT - - - attack_hand(mob/user as mob) - if (src.wrapped) //sometimes items can disappear. For example, bombs. --rastaf0 - src.wrapped.loc = (get_turf(src.loc)) - - del(src) - return - - attackby(obj/item/W as obj, mob/user as mob) - if(istype(W, /obj/item/device/destTagger)) - var/obj/item/device/destTagger/O = W - user << "\blue *TAGGED*" - src.sortTag = O.currTag - return - - - -/obj/item/weapon/packageWrap - name = "package wrapper" - icon = 'items.dmi' - icon_state = "deliveryPaper" - var/amount = 25.0 - - - attack(target as obj, mob/user as mob) - - user.attack_log += text("\[[time_stamp()]\] Has used [src.name] on \ref[target]") - - if (istype(target, /obj/item)) - var/obj/item/O = target - if (src.amount > 1) - var/obj/item/smallDelivery/P = new /obj/item/smallDelivery(get_turf(O.loc)) - P.wrapped = O - O.loc = P - src.amount -= 1 - else if (istype(target, /obj/structure/crate)) - var/obj/structure/crate/O = target - if (src.amount > 3) - var/obj/effect/bigDelivery/P = new /obj/effect/bigDelivery(get_turf(O.loc)) - P.wrapped = O - O.loc = P - src.amount -= 3 - else - user << "\blue You need more paper." - else if (istype (target, /obj/structure/closet)) - var/obj/structure/closet/O = target - if (src.amount > 3) - var/obj/effect/bigDelivery/P = new /obj/effect/bigDelivery(get_turf(O.loc)) - P.wrapped = O - O.close() - O.welded = 1 - O.loc = P - src.amount -= 3 - - else - user << "\blue The object you are trying to wrap is unsuitable for the sorting machinery!" - if (src.amount <= 0) - new /obj/item/weapon/c_tube( src.loc ) - //SN src = null - del(src) - return - return - -/obj/item/device/destTagger - name = "destination tagger" - desc = "Used to set the destination of properly wrapped packages." - icon_state = "forensic0" - var/currTag = 0 - var/list/locationList = list( - "Disposals", "Bartender's Workspace", "Cafeteria", "Cargo Bay", "Chapel Office", - "Chemistry", "Chief Medical Officer's Office", "Crew Quarters Toilets", "Fitness", - "Head of Personnel's Office", "Head of Security's Office", "Hydroponics", - "Janitor's Closet", "Kitchen", "Library", "Locker Room", "Locker Toilets", "Medbay", - "Quartermaster's Office", "Research Director's Office", "Research Lab", "Robotics", - "Security", "Surgery", "Theatre", "Tool Storage") - //The whole system for the sorttype var is determined based on the order of this list, - //disposals must always be 1, since anything that's untagged will automatically go to disposals, or sorttype = 1 --Superxpdude - w_class = 1 - item_state = "electronic" - flags = FPRINT | TABLEPASS | ONBELT | CONDUCT - - attack_self(mob/user as mob) - var/dat = "TagMaster 2.2

" - if (src.currTag == 0) - dat += "
Current Selection: None
" - else - dat += "
Current Selection: [locationList[currTag]]

" - for (var/i = 1, i <= locationList.len, i++) - dat += "[locationList[i]]" - if (i%4==0) - dat += "
" - else - dat += " " - user << browse(dat, "window=destTagScreen") - onclose(user, "destTagScreen") - return - - Topic(href, href_list) - src.add_fingerprint(usr) - if(href_list["nextTag"]) - var/n = text2num(href_list["nextTag"]) - src.currTag = n - src.updateUsrDialog() - - -/* - attack(target as obj, mob/user as mob) - user << "/blue *TAGGED*" - target.sortTag = src.currTag - - attack(target as obj, mob/user as mob) - user << "/blue You can only tag properly wrapped delivery packages!" -*/ - attack(target as obj, mob/user as mob) - if (istype(target, /obj/effect/bigDelivery)) - user << "\blue *TAGGED*" - var/obj/effect/bigDelivery/O = target - O.sortTag = src.currTag - else if (istype(target, /obj/item/smallDelivery)) - user << "\blue *TAGGED*" - var/obj/item/smallDelivery/O = target - O.sortTag = src.currTag - else - user << "\blue You can only tag properly wrapped delivery packages!" - return - -/obj/machinery/disposal/deliveryChute - name = "Delivery chute" - desc = "A chute for big and small packages alike!" - density = 0 - icon_state = "intake" - - interact() - return - - HasEntered(AM as mob|obj) //Go straight into the chute - if (istype(AM, /obj)) - var/obj/O = AM - O.loc = src - else if (istype(AM, /mob)) - var/mob/M = AM - M.loc = src - src.flush() - - flush() - flushing = 1 - flick("intake-closing", src) - var/deliveryCheck = 0 - var/obj/structure/disposalholder/H = new() // virtual holder object which actually - // travels through the pipes. - for(var/obj/effect/bigDelivery/O in src) - deliveryCheck = 1 - if(O.sortTag == 0) - O.sortTag = 1 - for(var/obj/item/smallDelivery/O in src) - deliveryCheck = 1 - if (O.sortTag == 0) - O.sortTag = 1 - if(deliveryCheck == 0) - H.destinationTag = 1 - - - H.init(src) // copy the contents of disposer to holder - - air_contents = new() // new empty gas resv. - - sleep(10) - playsound(src, 'disposalflush.ogg', 50, 0, 0) - sleep(5) // wait for animation to finish - - - H.start(src) // start the holder processing movement - flushing = 0 - // now reset disposal state - flush = 0 - if(mode == 2) // if was ready, - mode = 1 // switch to charging - update() - return \ No newline at end of file