diff --git a/code/modules/recycling/disposal-construction.dm b/code/modules/recycling/disposal-construction.dm index e472b1bb659..21cb505e3df 100644 --- a/code/modules/recycling/disposal-construction.dm +++ b/code/modules/recycling/disposal-construction.dm @@ -19,245 +19,245 @@ 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) +/obj/structure/disposalconstruct/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 - // disposal bin has only one dir, thus we don't need to care about setting it - if(6) - if(anchored) - base_state = "disposal" - else - base_state = "condisposal" + 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 + // disposal bin has only one dir, thus we don't need to care about setting it + if(6) + if(anchored) + base_state = "disposal" + else + base_state = "condisposal" - if(7) - base_state = "outlet" - dpdir = dir + if(7) + base_state = "outlet" + dpdir = dir - if(8) - base_state = "intake" - dpdir = dir + if(8) + base_state = "intake" + dpdir = dir - if(9) - base_state = "pipe-j1s" - dpdir = dir | right | flip + if(9) + base_state = "pipe-j1s" + dpdir = dir | right | flip - if(10) - base_state = "pipe-j2s" - dpdir = dir | left | flip + if(10) + base_state = "pipe-j2s" + dpdir = dir | left | flip - if(ptype<6 || ptype>8) - icon_state = "con[base_state]" - else - icon_state = base_state + if(ptype<6 || ptype>8) + icon_state = "con[base_state]" + else + icon_state = base_state - // if invisible, fade icon - alpha = (invisibility ? 0 : 255) + // if invisible, fade icon + alpha = (invisibility ? 0 : 255) - // 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() +// hide called by levelupdate if turf intact status changes +// change visibility status and force update of icon +/obj/structure/disposalconstruct/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 category = "Object" - set src in view(1) +// flip and rotate verbs +/obj/structure/disposalconstruct/verb/rotate() + set name = "Rotate Pipe" + set category = "Object" + set src in view(1) - if(usr.stat) - return - - if(anchored) - usr << "You must unfasten the pipe before rotating it." - return - - dir = turn(dir, -90) - update() - - verb/flip() - set name = "Flip Pipe" - set category = "Object" - set src in view(1) - if(usr.stat) - return - - if(anchored) - usr << "You must unfasten the pipe before flipping it." - return - - dir = turn(dir, 180) - switch(ptype) - if(2) - ptype = 3 - if(3) - ptype = 2 - if(9) - ptype = 10 - if(10) - ptype = 9 - - 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 - if(6) - return /obj/machinery/disposal - if(7) - return /obj/structure/disposaloutlet - if(8) - return /obj/machinery/disposal/deliveryChute - if(9,10) - return /obj/structure/disposalpipe/sortjunction + if(usr.stat) return + if(anchored) + usr << "You must unfasten the pipe before rotating it." + return + + dir = turn(dir, -90) + update() + +/obj/structure/disposalconstruct/verb/flip() + set name = "Flip Pipe" + set category = "Object" + set src in view(1) + if(usr.stat) + return + + if(anchored) + usr << "You must unfasten the pipe before flipping it." + return + + dir = turn(dir, 180) + switch(ptype) + if(2) + ptype = 3 + if(3) + ptype = 2 + if(9) + ptype = 10 + if(10) + ptype = 9 + + update() + +// returns the type path of disposalpipe corresponding to this item dtype +/obj/structure/disposalconstruct/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 + if(6) + return /obj/machinery/disposal + if(7) + return /obj/structure/disposaloutlet + if(8) + return /obj/machinery/disposal/deliveryChute + if(9,10) + return /obj/structure/disposalpipe/sortjunction + return - // attackby item - // wrench: (un)anchor - // weldingtool: convert to real pipe - attackby(var/obj/item/I, var/mob/user) - var/nicetype = "pipe" - var/ispipe = 0 // Indicates if we should change the level of this pipe - src.add_fingerprint(user) - switch(ptype) - if(6) - nicetype = "disposal bin" - if(7) - nicetype = "disposal outlet" - if(8) - nicetype = "delivery chute" - if(9, 10) - nicetype = "sorting pipe" - ispipe = 1 +// attackby item +// wrench: (un)anchor +// weldingtool: convert to real pipe + +/obj/structure/disposalconstruct/attackby(var/obj/item/I, var/mob/user) + var/nicetype = "pipe" + var/ispipe = 0 // Indicates if we should change the level of this pipe + src.add_fingerprint(user) + switch(ptype) + if(6) + nicetype = "disposal bin" + if(7) + nicetype = "disposal outlet" + if(8) + nicetype = "delivery chute" + if(9, 10) + nicetype = "sorting pipe" + ispipe = 1 + else + nicetype = "pipe" + ispipe = 1 + + var/turf/T = src.loc + if(T.intact) + user << "You can only attach the [nicetype] if the floor plating is removed." + return + + var/obj/structure/disposalpipe/CP = locate() in T + + if(istype(I, /obj/item/weapon/wrench)) + if(anchored) + anchored = 0 + if(ispipe) + level = 2 + density = 0 else - nicetype = "pipe" - ispipe = 1 - - var/turf/T = src.loc - if(T.intact) - user << "You can only attach the [nicetype] if the floor plating is removed." - return - - var/obj/structure/disposalpipe/CP = locate() in T - - if(istype(I, /obj/item/weapon/wrench)) - if(anchored) - anchored = 0 - if(ispipe) - level = 2 - density = 0 - else - density = 1 - user << "You detach the [nicetype] from the underfloor." - else - if(ptype>=6 && ptype <= 8) // Disposal or outlet - if(CP) // There's something there - if(!istype(CP,/obj/structure/disposalpipe/trunk)) - user << "The [nicetype] requires a trunk underneath it in order to work." - return - else // Nothing under, fuck. + density = 1 + user << "You detach the [nicetype] from the underfloor." + else + if(ptype>=6 && ptype <= 8) // Disposal or outlet + if(CP) // There's something there + if(!istype(CP,/obj/structure/disposalpipe/trunk)) user << "The [nicetype] requires a trunk underneath it in order to work." return - else - 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 [nicetype] at that location." - return - anchored = 1 - if(ispipe) - level = 1 // We don't want disposal bins to disappear under the floors - density = 0 - else - density = 1 // We don't want disposal bins or outlets to go density 0 - user << "You attach the [nicetype] to the underfloor." - playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1) - update() - - else if(istype(I, /obj/item/weapon/weldingtool)) - if(anchored) - var/obj/item/weapon/weldingtool/W = I - if(W.remove_fuel(0,user)) - playsound(src.loc, 'sound/items/Welder2.ogg', 100, 1) - user << "Welding the [nicetype] in place." - if(do_after(user, 20)) - if(!src || !W.isOn()) return - user << "The [nicetype] has been welded in place!" - update() // TODO: Make this neat - if(ispipe) // Pipe - - var/pipetype = dpipetype() - var/obj/structure/disposalpipe/P = new pipetype(src.loc) - src.transfer_fingerprints_to(P) - P.base_icon_state = base_state - P.dir = dir - P.dpdir = dpdir - P.updateicon() - - //Needs some special treatment ;) - if(ptype==9 || ptype==10) - var/obj/structure/disposalpipe/sortjunction/SortP = P - SortP.updatedir() - - else if(ptype==6) // Disposal bin - var/obj/machinery/disposal/P = new /obj/machinery/disposal(src.loc) - src.transfer_fingerprints_to(P) - P.mode = 0 // start with pump off - - else if(ptype==7) // Disposal outlet - - var/obj/structure/disposaloutlet/P = new /obj/structure/disposaloutlet(src.loc) - src.transfer_fingerprints_to(P) - P.dir = dir - var/obj/structure/disposalpipe/trunk/Trunk = CP - Trunk.linked = P - - else if(ptype==8) // Disposal outlet - - var/obj/machinery/disposal/deliveryChute/P = new /obj/machinery/disposal/deliveryChute(src.loc) - src.transfer_fingerprints_to(P) - P.dir = dir - - qdel(src) - return - else - user << "You need more welding fuel to complete this task." + else // Nothing under, fuck. + user << "The [nicetype] requires a trunk underneath it in order to work." return else - user << "You need to attach it to the plating first!" + 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 [nicetype] at that location." + return + anchored = 1 + if(ispipe) + level = 1 // We don't want disposal bins to disappear under the floors + density = 0 + else + density = 1 // We don't want disposal bins or outlets to go density 0 + user << "You attach the [nicetype] to the underfloor." + playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1) + update() + + else if(istype(I, /obj/item/weapon/weldingtool)) + if(anchored) + var/obj/item/weapon/weldingtool/W = I + if(W.remove_fuel(0,user)) + playsound(src.loc, 'sound/items/Welder2.ogg', 100, 1) + user << "Welding the [nicetype] in place." + if(do_after(user, 20)) + if(!src || !W.isOn()) return + user << "The [nicetype] has been welded in place!" + update() // TODO: Make this neat + if(ispipe) // Pipe + + var/pipetype = dpipetype() + var/obj/structure/disposalpipe/P = new pipetype(src.loc) + src.transfer_fingerprints_to(P) + P.base_icon_state = base_state + P.dir = dir + P.dpdir = dpdir + P.updateicon() + + //Needs some special treatment ;) + if(ptype==9 || ptype==10) + var/obj/structure/disposalpipe/sortjunction/SortP = P + SortP.updatedir() + + else if(ptype==6) // Disposal bin + var/obj/machinery/disposal/P = new /obj/machinery/disposal(src.loc) + src.transfer_fingerprints_to(P) + P.mode = 0 // start with pump off + + else if(ptype==7) // Disposal outlet + + var/obj/structure/disposaloutlet/P = new /obj/structure/disposaloutlet(src.loc) + src.transfer_fingerprints_to(P) + P.dir = dir + var/obj/structure/disposalpipe/trunk/Trunk = CP + Trunk.linked = P + + else if(ptype==8) // Disposal outlet + + var/obj/machinery/disposal/deliveryChute/P = new /obj/machinery/disposal/deliveryChute(src.loc) + src.transfer_fingerprints_to(P) + P.dir = dir + + qdel(src) + return + else + user << "You need more welding fuel to complete this task." return + else + user << "You need to attach it to the plating first!" + return diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm index 88e88dc3e6d..bc1586e2733 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -479,120 +479,119 @@ active = 0 ..() -/obj/structure/disposalholder // initialize a holder from the contents of a disposal unit - proc/init(var/obj/machinery/disposal/D) - gas = D.air_contents// transfer gas resv. into holder object +/obj/structure/disposalholder/proc/init(var/obj/machinery/disposal/D) + gas = D.air_contents// transfer gas resv. into holder object - //Check for any living mobs trigger hasmob. - //hasmob effects whether the package goes to cargo or its tagged destination. - for(var/mob/living/M in D) - if(M && M.stat != 2) - hasmob = 1 + //Check for any living mobs trigger hasmob. + //hasmob effects whether the package goes to cargo or its tagged destination. + for(var/mob/living/M in D) + if(M && M.stat != 2) + hasmob = 1 - //Checks 1 contents level deep. This means that players can be sent through disposals... - //...but it should require a second person to open the package. (i.e. person inside a wrapped locker) - for(var/obj/O in D) - if(O.contents) - for(var/mob/living/M in O.contents) - if(M && M.stat != 2) - hasmob = 1 + //Checks 1 contents level deep. This means that players can be sent through disposals... + //...but it should require a second person to open the package. (i.e. person inside a wrapped locker) + for(var/obj/O in D) + if(O.contents) + for(var/mob/living/M in O.contents) + if(M && M.stat != 2) + hasmob = 1 - // 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(FAT in H.mutations) // is a human and fat? - has_fat_guy = 1 // set flag on holder - if(istype(AM, /obj/structure/bigDelivery) && !hasmob) - var/obj/structure/bigDelivery/T = AM - src.destinationTag = T.sortTag - if(istype(AM, /obj/item/smallDelivery) && !hasmob) - var/obj/item/smallDelivery/T = AM - src.destinationTag = T.sortTag + // 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(FAT in H.mutations) // is a human and fat? + has_fat_guy = 1 // set flag on holder + if(istype(AM, /obj/structure/bigDelivery) && !hasmob) + var/obj/structure/bigDelivery/T = AM + src.destinationTag = T.sortTag + if(istype(AM, /obj/item/smallDelivery) && !hasmob) + 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) - move() // spawn off the movement process - +// start the movement process +// argument is the disposal unit the holder started in +/obj/structure/disposalholder/proc/start(var/obj/machinery/disposal/D) + if(!D.trunk) + D.expel(src) // no trunk connected, so expel immediately return - // movement process, persists while holder is moving through pipes - proc/move() - var/obj/structure/disposalpipe/last - while(active) - var/obj/structure/disposalpipe/curr = loc - last = curr - curr = curr.transfer(src) - if(!curr && active) - last.expel(src, loc, dir) + loc = D.trunk + active = 1 + dir = DOWN + spawn(1) + move() // spawn off the movement process - sleep(1) - if(!(count--)) - active = 0 - return + return + +// movement process, persists while holder is moving through pipes +/obj/structure/disposalholder/proc/move() + var/obj/structure/disposalpipe/last + while(active) + var/obj/structure/disposalpipe/curr = loc + last = curr + curr = curr.transfer(src) + if(!curr && active) + last.expel(src, loc, dir) + + sleep(1) + if(!(count--)) + active = 0 + return - // find the turf which should contain the next pipe - proc/nextloc() - return get_step(loc,dir) +// find the turf which should contain the next pipe +/obj/structure/disposalholder/proc/nextloc() + return get_step(loc,dir) - // find a matching pipe on a turf - proc/findpipe(var/turf/T) +// find a matching pipe on a turf +/obj/structure/disposalholder/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 + if(!T) 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 + 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 - if(other.has_fat_guy) - has_fat_guy = 1 - qdel(other) +// merge two holder objects +// used when a a holder meets a stuck holder +/obj/structure/disposalholder/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 + qdel(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, 'sound/effects/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 - air_update_turf() +// called when player tries to move while in a pipe +/obj/structure/disposalholder/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, 'sound/effects/clang.ogg', 50, 0, 0) + +// called to vent all gas in holder to a location +/obj/structure/disposalholder/proc/vent_gas(var/atom/location) + location.assume_air(gas) // vent all gas to turf + air_update_turf() + return // Disposal pipes @@ -611,252 +610,252 @@ 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 +/obj/structure/disposalpipe/New() + ..() + base_icon_state = icon_state + return // pipe is deleted // ensure if holder is present, it is expelled - Destroy() - 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) - qdel(H) - ..() - return - - // otherwise, do normal expel from turf - if(H) - 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() +/obj/structure/disposalpipe/Destroy() + var/obj/structure/disposalholder/H = locate() in src + if(H) + // holder was present + H.active = 0 var/turf/T = src.loc - hide(T.intact && !istype(T,/turf/space)) // space never hides pipes + if(T.density) + // deleting pipe is inside a dense turf (wall) + // this is unlikely, but just dump out everything into the turf in case - // 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() + for(var/atom/movable/AM in H) + AM.loc = T + AM.pipe_eject(0) + qdel(H) + ..() + return - // 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(istype(T, /turf/simulated/floor)) //intact floor, pop the tile - var/turf/simulated/floor/F = T - if(F.floor_tile) - F.floor_tile.loc = H //It took me a day to figure out this was the right way to do it. - F.floor_tile = null //So it doesn't get deleted in make_plating() - F.make_plating() - - 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, 'sound/machines/hiss.ogg', 50, 0, 0) - if(H) - for(var/atom/movable/AM in H) - AM.loc = T - AM.pipe_eject(direction) - spawn(1) - if(AM) - AM.throw_at(target, 100, 1) - - else // no specified direction, so throw in random direction - - playsound(src, 'sound/machines/hiss.ogg', 50, 0, 0) - if(H) - 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) - qdel(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 + // otherwise, do normal expel from turf 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 + expel(H, T, 0) + ..() - for(var/atom/movable/AM in H) - AM.loc = T - AM.pipe_eject(0) - qdel(H) - return +// returns the direction of the next pipe object, given the entrance dir +// by default, returns the bitmask of remaining directions +/obj/structure/disposalpipe/proc/nextdir(var/fromdir) + return dpdir & (~turn(fromdir, 180)) - // otherwise, do normal expel from turf - if(H) - expel(H, T, 0) +// transfer the holder through this pipe segment +// overriden for special behaviour +// +/obj/structure/disposalpipe/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) - spawn(2) // delete pipe after 2 ticks to ensure expel proc finished - qdel(src) + 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 - // pipe affected by explosion - ex_act(severity) +// update the icon_state to reflect hidden status +/obj/structure/disposalpipe/proc/update() + var/turf/T = src.loc + hide(T.intact && !istype(T,/turf/space)) // space never hides pipes - //pass on ex_act to our contents before calling it on ourself - var/obj/structure/disposalholder/H = locate() in src +// hide called by levelupdate if turf intact status changes +// change visibility status and force update of icon +/obj/structure/disposalpipe/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 +/obj/structure/disposalpipe/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 +// + +/obj/structure/disposalpipe/proc/expel(var/obj/structure/disposalholder/H, var/turf/T, var/direction) + + var/turf/target + + if(istype(T, /turf/simulated/floor)) //intact floor, pop the tile + var/turf/simulated/floor/F = T + if(F.floor_tile) + F.floor_tile.loc = H //It took me a day to figure out this was the right way to do it. + F.floor_tile = null //So it doesn't get deleted in make_plating() + F.make_plating() + + 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, 'sound/machines/hiss.ogg', 50, 0, 0) if(H) for(var/atom/movable/AM in H) - AM.ex_act(severity) + AM.loc = T + AM.pipe_eject(direction) + spawn(1) + if(AM) + AM.throw_at(target, 100, 1) - 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 + else // no specified direction, so throw in random direction + playsound(src, 'sound/machines/hiss.ogg', 50, 0, 0) + if(H) + for(var/atom/movable/AM in H) + target = get_offset_target_turf(T, rand(5)-rand(5), rand(5)-rand(5)) - // test health for brokenness - proc/healthcheck() - if(health < -2) - broken(0) - else if(health<1) - broken(1) - return + AM.loc = T + AM.pipe_eject(0) + spawn(1) + if(AM) + AM.throw_at(target, 5, 1) + H.vent_gas(T) + qdel(H) + return - //attack by item - //weldingtool: unfasten and convert to obj/disposalconstruct - - attackby(var/obj/item/I, var/mob/user) +// 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 +/obj/structure/disposalpipe/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.intact) - return // prevent interaction with T-scanner revealed pipes - src.add_fingerprint(user) - if(istype(I, /obj/item/weapon/weldingtool)) - var/obj/item/weapon/weldingtool/W = I + if(T.density) + // broken pipe is inside a dense turf (wall) + // this is unlikely, but just dump out everything into the turf in case - if(W.remove_fuel(0,user)) - playsound(src.loc, 'sound/items/Welder2.ogg', 100, 1) - user << "You start slicing the disposal pipe." - // check if anything changed over 2 seconds - if(do_after(user,30)) - if(!src || !W.isOn()) return - welded() - user << "You've sliced the disposal pipe." - else - user << "You need more welding fuel to cut the pipe." - return + for(var/atom/movable/AM in H) + AM.loc = T + AM.pipe_eject(0) + qdel(H) + 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 - if("pipe-j1s") - C.ptype = 9 - if("pipe-j2s") - C.ptype = 10 - src.transfer_fingerprints_to(C) - C.dir = dir - C.density = 0 - C.anchored = 1 - C.update() + // otherwise, do normal expel from turf + if(H) + expel(H, T, 0) + spawn(2) // delete pipe after 2 ticks to ensure expel proc finished qdel(src) + +// pipe affected by explosion +/obj/structure/disposalpipe/ex_act(severity) + + //pass on ex_act to our contents before calling it on ourself + var/obj/structure/disposalholder/H = locate() in src + if(H) + for(var/atom/movable/AM in H) + AM.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 +/obj/structure/disposalpipe/proc/healthcheck() + if(health < -2) + broken(0) + else if(health<1) + broken(1) + return + +//attack by item +//weldingtool: unfasten and convert to obj/disposalconstruct + +/obj/structure/disposalpipe/attackby(var/obj/item/I, var/mob/user) + + var/turf/T = src.loc + if(T.intact) + return // prevent interaction with T-scanner revealed pipes + src.add_fingerprint(user) + if(istype(I, /obj/item/weapon/weldingtool)) + var/obj/item/weapon/weldingtool/W = I + + if(W.remove_fuel(0,user)) + playsound(src.loc, 'sound/items/Welder2.ogg', 100, 1) + user << "You start slicing the disposal pipe." + // check if anything changed over 2 seconds + if(do_after(user,30)) + if(!src || !W.isOn()) return + welded() + user << "You've sliced the disposal pipe." + else + user << "You need more welding fuel to cut the pipe." + return + +// called when pipe is cut with welder +/obj/structure/disposalpipe/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 + if("pipe-j1s") + C.ptype = 9 + if("pipe-j2s") + C.ptype = 10 + src.transfer_fingerprints_to(C) + C.dir = dir + C.density = 0 + C.anchored = 1 + C.update() + + qdel(src) + // *** TEST verb //client/verb/dispstop() // for(var/obj/structure/disposalholder/H in world) @@ -866,15 +865,15 @@ /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) +/obj/structure/disposalpipe/segment/New() + ..() + if(icon_state == "pipe-s") + dpdir = dir | turn(dir, 180) + else + dpdir = dir | turn(dir, -90) - update() - return + update() + return @@ -883,45 +882,45 @@ /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 +/obj/structure/disposalpipe/junction/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 +// 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) +/obj/structure/disposalpipe/junction/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 + // 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) + 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 @@ -932,81 +931,81 @@ var/negdir = 0 var/sortdir = 0 - proc/updatedesc() - desc = "An underfloor disposal pipe with a package sorting mechanism." - if(sortType>0) - var/tag = uppertext(TAGGERLOCATIONS[sortType]) - desc += "\nIt's tagged with [tag]" +/obj/structure/disposalpipe/sortjunction/proc/updatedesc() + desc = "An underfloor disposal pipe with a package sorting mechanism." + if(sortType>0) + var/tag = uppertext(TAGGERLOCATIONS[sortType]) + desc += "\nIt's tagged with [tag]" - proc/updatedir() - posdir = dir - negdir = turn(posdir, 180) +/obj/structure/disposalpipe/sortjunction/proc/updatedir() + posdir = dir + negdir = turn(posdir, 180) - if(icon_state == "pipe-j1s") - sortdir = turn(posdir, -90) - else - icon_state = "pipe-j2s" - sortdir = turn(posdir, 90) + if(icon_state == "pipe-j1s") + sortdir = turn(posdir, -90) + else + icon_state = "pipe-j2s" + sortdir = turn(posdir, 90) - dpdir = sortdir | posdir | negdir + dpdir = sortdir | posdir | negdir - New() - ..() - updatedir() - updatedesc() - update() +/obj/structure/disposalpipe/sortjunction/New() + ..() + updatedir() + updatedesc() + update() + return + +/obj/structure/disposalpipe/sortjunction/attackby(var/obj/item/I, var/mob/user) + if(..()) return - attackby(var/obj/item/I, var/mob/user) - if(..()) - return + if(istype(I, /obj/item/device/destTagger)) + var/obj/item/device/destTagger/O = I - if(istype(I, /obj/item/device/destTagger)) - var/obj/item/device/destTagger/O = I - - if(O.currTag > 0)// Tag set - sortType = O.currTag - playsound(src.loc, 'sound/machines/twobeep.ogg', 100, 1) - var/tag = uppertext(TAGGERLOCATIONS[O.currTag]) - user << " Changed filter to [tag]." - updatedesc() + if(O.currTag > 0)// Tag set + sortType = O.currTag + playsound(src.loc, 'sound/machines/twobeep.ogg', 100, 1) + var/tag = uppertext(TAGGERLOCATIONS[O.currTag]) + user << " Changed filter to [tag]." + updatedesc() - // 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 +// 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 +/obj/structure/disposalpipe/sortjunction/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 + 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) +/obj/structure/disposalpipe/sortjunction/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) + 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 + H.loc = P + else // if wasn't a pipe, then set loc to turf + H.loc = T + return null - return P + return P //a three-way junction that sorts objects destined for the mail office mail table (tomail = 1) @@ -1018,56 +1017,56 @@ var/negdir = 0 var/sortdir = 0 - New() - ..() - posdir = dir - if(icon_state == "pipe-j1s") - sortdir = turn(posdir, -90) - negdir = turn(posdir, 180) +/obj/structure/disposalpipe/wrapsortjunction/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 + +/obj/structure/disposalpipe/wrapsortjunction/nextdir(var/fromdir, var/istomail) + //var/flipdir = turn(fromdir, 180) + if(fromdir != sortdir) // probably came from the negdir + + if(istomail) //if destination matches filtered type... + return sortdir // exit through sortdirection 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/istomail) - //var/flipdir = turn(fromdir, 180) - if(fromdir != sortdir) // probably came from the negdir - - if(istomail) //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 + 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.tomail) - H.dir = nextdir - var/turf/T = H.nextloc() - var/obj/structure/disposalpipe/P = H.findpipe(T) +/obj/structure/disposalpipe/wrapsortjunction/transfer(var/obj/structure/disposalholder/H) + var/nextdir = nextdir(H.dir, H.tomail) + 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) + 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 + H.loc = P + else // if wasn't a pipe, then set loc to turf + H.loc = T + return null - return P + return P @@ -1183,18 +1182,18 @@ // i.e. will be treated as an empty turf desc = "A broken piece of disposal pipe." - New() - ..() - update() - return +/obj/structure/disposalpipe/broken/New() + ..() + update() + return - // called when welded - // for broken pipe, remove and turn into scrap +// 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) - qdel(src) +/obj/structure/disposalpipe/broken/welded() +// var/obj/item/scrap/S = new(src.loc) +// S.set_components(200,0,0) + qdel(src) // the disposal outlet machine @@ -1211,74 +1210,74 @@ var/start_eject = 0 var/eject_range = 2 - New() - ..() +/obj/structure/disposaloutlet/New() + ..() - spawn(1) - target = get_ranged_target_turf(src, dir, 10) + spawn(1) + target = get_ranged_target_turf(src, dir, 10) - var/obj/structure/disposalpipe/trunk/trunk = locate() in src.loc - if(trunk) - trunk.linked = src // link the pipe trunk to self + var/obj/structure/disposalpipe/trunk/trunk = locate() in src.loc + if(trunk) + trunk.linked = src // link the pipe trunk to self - // expel the contents of the holder object, then delete it - // called when the holder exits the outlet - proc/expel(var/obj/structure/disposalholder/H) +// expel the contents of the holder object, then delete it +// called when the holder exits the outlet +/obj/structure/disposaloutlet/proc/expel(var/obj/structure/disposalholder/H) - flick("outlet-open", src) - if((start_eject + 30) < world.time) - start_eject = world.time - playsound(src, 'sound/machines/warning-buzzer.ogg', 50, 0, 0) - sleep(20) - playsound(src, 'sound/machines/hiss.ogg', 50, 0, 0) - else - sleep(20) - if(H) - for(var/atom/movable/AM in H) - AM.loc = src.loc - AM.pipe_eject(dir) - spawn(5) - if(AM) - AM.throw_at(target, eject_range, 1) - H.vent_gas(src.loc) - qdel(H) + flick("outlet-open", src) + if((start_eject + 30) < world.time) + start_eject = world.time + playsound(src, 'sound/machines/warning-buzzer.ogg', 50, 0, 0) + sleep(20) + playsound(src, 'sound/machines/hiss.ogg', 50, 0, 0) + else + sleep(20) + if(H) + for(var/atom/movable/AM in H) + AM.loc = src.loc + AM.pipe_eject(dir) + spawn(5) + if(AM) + AM.throw_at(target, eject_range, 1) + H.vent_gas(src.loc) + qdel(H) + return + +/obj/structure/disposaloutlet/attackby(var/obj/item/I, var/mob/user) + if(!I || !user) return - - attackby(var/obj/item/I, var/mob/user) - if(!I || !user) + src.add_fingerprint(user) + if(istype(I, /obj/item/weapon/screwdriver)) + if(mode==0) + mode=1 + playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) + user << "You remove the screws around the power connection." + return + else if(mode==1) + mode=0 + playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) + user << "You attach the screws around the power connection." + return + else if(istype(I,/obj/item/weapon/weldingtool) && mode==1) + var/obj/item/weapon/weldingtool/W = I + if(W.remove_fuel(0,user)) + playsound(src.loc, 'sound/items/Welder2.ogg', 100, 1) + user << "You start slicing the floorweld off \the [src]." + if(do_after(user,20)) + if(!src || !W.isOn()) return + user << "You've sliced the floorweld off \the [src]." + var/obj/structure/disposalconstruct/C = new (src.loc) + src.transfer_fingerprints_to(C) + C.ptype = 7 // 7 = outlet + C.update() + C.anchored = 1 + C.density = 1 + qdel(src) + return + else + user << "You need more welding fuel to complete this task." return - src.add_fingerprint(user) - if(istype(I, /obj/item/weapon/screwdriver)) - if(mode==0) - mode=1 - playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) - user << "You remove the screws around the power connection." - return - else if(mode==1) - mode=0 - playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) - user << "You attach the screws around the power connection." - return - else if(istype(I,/obj/item/weapon/weldingtool) && mode==1) - var/obj/item/weapon/weldingtool/W = I - if(W.remove_fuel(0,user)) - playsound(src.loc, 'sound/items/Welder2.ogg', 100, 1) - user << "You start slicing the floorweld off \the [src]." - if(do_after(user,20)) - if(!src || !W.isOn()) return - user << "You've sliced the floorweld off \the [src]." - var/obj/structure/disposalconstruct/C = new (src.loc) - src.transfer_fingerprints_to(C) - C.ptype = 7 // 7 = outlet - C.update() - C.anchored = 1 - C.density = 1 - qdel(src) - return - else - user << "You need more welding fuel to complete this task." - return diff --git a/code/modules/recycling/sortingmachinery.dm b/code/modules/recycling/sortingmachinery.dm index 043116087bf..9971ca56c4b 100644 --- a/code/modules/recycling/sortingmachinery.dm +++ b/code/modules/recycling/sortingmachinery.dm @@ -58,38 +58,38 @@ var/sortTag = 0 - attack_self(mob/user as mob) - if(wrapped) //sometimes items can disappear. For example, bombs. --rastaf0 - wrapped.loc = user.loc - if(ishuman(user)) - user.put_in_hands(wrapped) - else - wrapped.loc = get_turf(src) +/obj/item/smallDelivery/attack_self(mob/user as mob) + if(wrapped) //sometimes items can disappear. For example, bombs. --rastaf0 + wrapped.loc = user.loc + if(ishuman(user)) + user.put_in_hands(wrapped) + else + wrapped.loc = get_turf(src) - qdel(src) + qdel(src) - attackby(obj/item/W as obj, mob/user as mob) - if(istype(W, /obj/item/device/destTagger)) - var/obj/item/device/destTagger/O = W +/obj/item/smallDelivery/attackby(obj/item/W as obj, mob/user as mob) + if(istype(W, /obj/item/device/destTagger)) + var/obj/item/device/destTagger/O = W - if(sortTag != O.currTag) - var/tag = uppertext(TAGGERLOCATIONS[O.currTag]) - user << "\blue *[tag]*" - sortTag = O.currTag - playsound(loc, 'sound/machines/twobeep.ogg', 100, 1) + if(sortTag != O.currTag) + var/tag = uppertext(TAGGERLOCATIONS[O.currTag]) + user << "\blue *[tag]*" + sortTag = O.currTag + playsound(loc, 'sound/machines/twobeep.ogg', 100, 1) - else if(istype(W, /obj/item/weapon/pen)) - var/str = copytext(sanitize(input(user,"Label text?","Set label","")),1,MAX_NAME_LEN) - if(!str || !length(str)) - user << "Invalid text." - return - user.visible_message("[user] labels [src] as [str].") - name = "[name] ([str])" + else if(istype(W, /obj/item/weapon/pen)) + var/str = copytext(sanitize(input(user,"Label text?","Set label","")),1,MAX_NAME_LEN) + if(!str || !length(str)) + user << "Invalid text." + return + user.visible_message("[user] labels [src] as [str].") + name = "[name] ([str])" - else if(istype(W, /obj/item/weapon/wrapping_paper)) - icon_state = "giftcrate[wrapped.w_class]" - user.visible_message("[user] wraps the package in festive paper!") + else if(istype(W, /obj/item/weapon/wrapping_paper)) + icon_state = "giftcrate[wrapped.w_class]" + user.visible_message("[user] wraps the package in festive paper!") /obj/item/weapon/packageWrap @@ -101,71 +101,71 @@ var/amount = 25.0 - afterattack(var/obj/target as obj, mob/user as mob, proximity) - if(!proximity) return - if(!istype(target)) //this really shouldn't be necessary (but it is). -Pete - return - if(istype(target, /obj/item/smallDelivery) || istype(target,/obj/structure/bigDelivery) \ - || istype(target, /obj/item/weapon/evidencebag) || istype(target, /obj/structure/closet/body_bag)) - return - if(target.anchored) - return - if(target in user) - return - - user.attack_log += text("\[[time_stamp()]\] Has used [name] on \ref[target]") - - if(istype(target, /obj/item) && !(istype(target, /obj/item/weapon/storage) && !istype(target,/obj/item/weapon/storage/box))) - var/obj/item/O = target - if(amount > 1) - var/obj/item/smallDelivery/P = new /obj/item/smallDelivery(get_turf(O.loc)) //Aaannd wrap it up! - if(!istype(O.loc, /turf)) - if(user.client) - user.client.screen -= O - P.wrapped = O - O.loc = P - var/i = round(O.w_class) - if(i in list(1,2,3,4,5)) - P.icon_state = "deliverycrate[i]" - P.w_class = i - P.add_fingerprint(usr) - O.add_fingerprint(usr) - add_fingerprint(usr) - amount -= 1 - else if(istype(target, /obj/structure/closet/crate)) - var/obj/structure/closet/crate/O = target - if(amount > 3 && !O.opened) - var/obj/structure/bigDelivery/P = new /obj/structure/bigDelivery(get_turf(O.loc)) - P.icon_state = "deliverycrate" - P.wrapped = O - O.loc = P - amount -= 3 - else if(amount < 3) - user << "You need more paper." - else if(istype (target, /obj/structure/closet)) - var/obj/structure/closet/O = target - if(amount > 3 && !O.opened) - var/obj/structure/bigDelivery/P = new /obj/structure/bigDelivery(get_turf(O.loc)) - P.wrapped = O - O.welded = 1 - O.loc = P - amount -= 3 - else if(amount < 3) - user << "You need more paper." - else - user << "The object you are trying to wrap is unsuitable for the sorting machinery." - if(amount <= 0) - new /obj/item/weapon/c_tube( loc ) - qdel(src) - return +/obj/item/weapon/packageWrap/afterattack(var/obj/target as obj, mob/user as mob, proximity) + if(!proximity) return + if(!istype(target)) //this really shouldn't be necessary (but it is). -Pete + return + if(istype(target, /obj/item/smallDelivery) || istype(target,/obj/structure/bigDelivery) \ + || istype(target, /obj/item/weapon/evidencebag) || istype(target, /obj/structure/closet/body_bag)) + return + if(target.anchored) + return + if(target in user) return + user.attack_log += text("\[[time_stamp()]\] Has used [name] on \ref[target]") - examine() - if(src in usr) - usr << "There are [amount] units of package wrap left." - ..() + if(istype(target, /obj/item) && !(istype(target, /obj/item/weapon/storage) && !istype(target,/obj/item/weapon/storage/box))) + var/obj/item/O = target + if(amount > 1) + var/obj/item/smallDelivery/P = new /obj/item/smallDelivery(get_turf(O.loc)) //Aaannd wrap it up! + if(!istype(O.loc, /turf)) + if(user.client) + user.client.screen -= O + P.wrapped = O + O.loc = P + var/i = round(O.w_class) + if(i in list(1,2,3,4,5)) + P.icon_state = "deliverycrate[i]" + P.w_class = i + P.add_fingerprint(usr) + O.add_fingerprint(usr) + add_fingerprint(usr) + amount -= 1 + else if(istype(target, /obj/structure/closet/crate)) + var/obj/structure/closet/crate/O = target + if(amount > 3 && !O.opened) + var/obj/structure/bigDelivery/P = new /obj/structure/bigDelivery(get_turf(O.loc)) + P.icon_state = "deliverycrate" + P.wrapped = O + O.loc = P + amount -= 3 + else if(amount < 3) + user << "You need more paper." + else if(istype (target, /obj/structure/closet)) + var/obj/structure/closet/O = target + if(amount > 3 && !O.opened) + var/obj/structure/bigDelivery/P = new /obj/structure/bigDelivery(get_turf(O.loc)) + P.wrapped = O + O.welded = 1 + O.loc = P + amount -= 3 + else if(amount < 3) + user << "You need more paper." + else + user << "The object you are trying to wrap is unsuitable for the sorting machinery." + if(amount <= 0) + new /obj/item/weapon/c_tube( loc ) + qdel(src) return + return + + +/obj/item/weapon/packageWrap/examine() + if(src in usr) + usr << "There are [amount] units of package wrap left." + ..() + return /obj/item/device/destTagger @@ -184,31 +184,31 @@ flags = CONDUCT slot_flags = SLOT_BELT - proc/openwindow(mob/user as mob) - var/dat = "

TagMaster 2.2

" +/obj/item/device/destTagger/proc/openwindow(mob/user as mob) + var/dat = "

TagMaster 2.2

" - dat += "" - for (var/i = 1, i <= TAGGERLOCATIONS.len, i++) - dat += "" + dat += "
[TAGGERLOCATIONS[i]]
" + for (var/i = 1, i <= TAGGERLOCATIONS.len, i++) + dat += "" - if(i%4==0) - dat += "" + if(i%4==0) + dat += "" - dat += "
[TAGGERLOCATIONS[i]]

Current Selection: [currTag ? TAGGERLOCATIONS[currTag] : "None"]
" + dat += "
Current Selection: [currTag ? TAGGERLOCATIONS[currTag] : "None"]
" - user << browse(dat, "window=destTagScreen;size=450x350") - onclose(user, "destTagScreen") + user << browse(dat, "window=destTagScreen;size=450x350") + onclose(user, "destTagScreen") - attack_self(mob/user as mob) - openwindow(user) - return +/obj/item/device/destTagger/attack_self(mob/user as mob) + openwindow(user) + return - Topic(href, href_list) - add_fingerprint(usr) - if(href_list["nextTag"]) - var/n = text2num(href_list["nextTag"]) - currTag = n - openwindow(usr) +/obj/item/device/destTagger/Topic(href, href_list) + add_fingerprint(usr) + if(href_list["nextTag"]) + var/n = text2num(href_list["nextTag"]) + currTag = n + openwindow(usr) /obj/machinery/disposal/deliveryChute name = "delivery chute"