From ee79020cb885ec45fd00f30c0c58c3447a94b947 Mon Sep 17 00:00:00 2001 From: Karolis2011 Date: Mon, 23 Nov 2015 11:53:28 +0200 Subject: [PATCH 1/4] Added option to enter custom destination to tagger and Made code to look closer to today's code standarts --- code/modules/recycling/sortingmachinery.dm | 716 +++++++++++---------- 1 file changed, 361 insertions(+), 355 deletions(-) diff --git a/code/modules/recycling/sortingmachinery.dm b/code/modules/recycling/sortingmachinery.dm index eb763258326..54c30bdcd30 100755 --- a/code/modules/recycling/sortingmachinery.dm +++ b/code/modules/recycling/sortingmachinery.dm @@ -14,101 +14,101 @@ var/label_x var/tag_x - attack_hand(mob/user as mob) - unwrap() +/obj/structure/bigDelivery/attack_hand(mob/user as mob) + unwrap() - proc/unwrap() - if(wrapped) //sometimes items can disappear. For example, bombs. --rastaf0 - wrapped.loc = (get_turf(src.loc)) - if(istype(wrapped, /obj/structure/closet)) - var/obj/structure/closet/O = wrapped - O.welded = 0 - qdel(src) +/obj/structure/bigDelivery/proc/unwrap() + if(wrapped) //sometimes items can disappear. For example, bombs. --rastaf0 + wrapped.loc = (get_turf(src.loc)) + if(istype(wrapped, /obj/structure/closet)) + var/obj/structure/closet/O = wrapped + O.welded = 0 + 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 - if(O.currTag) - if(src.sortTag != O.currTag) - user << "You have labeled the destination as [O.currTag]." - if(!src.sortTag) - src.sortTag = O.currTag - update_icon() - else - src.sortTag = O.currTag - playsound(src.loc, 'sound/machines/twobeep.ogg', 50, 1) +/obj/structure/bigDelivery/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(O.currTag) + if(src.sortTag != O.currTag) + user << "You have labeled the destination as [O.currTag]." + if(!src.sortTag) + src.sortTag = O.currTag + update_icon() else - user << "The package is already labeled for [O.currTag]." + src.sortTag = O.currTag + playsound(src.loc, 'sound/machines/twobeep.ogg', 50, 1) else - user << "You need to set a destination first!" + user << "The package is already labeled for [O.currTag]." + else + user << "You need to set a destination first!" - else if(istype(W, /obj/item/weapon/pen)) - switch(alert("What would you like to alter?",,"Title","Description", "Cancel")) - if("Title") - var/str = sanitizeSafe(input(usr,"Label text?","Set label",""), MAX_NAME_LEN) - if(!str || !length(str)) - usr << " Invalid text." - return - user.visible_message("\The [user] titles \the [src] with \a [W], marking down: \"[str]\"",\ - "You title \the [src]: \"[str]\"",\ - "You hear someone scribbling a note.") - name = "[name] ([str])" - if(!examtext && !nameset) - nameset = 1 - update_icon() - else - nameset = 1 - if("Description") - var/str = sanitize(input(usr,"Label text?","Set label","")) - if(!str || !length(str)) - usr << "\red Invalid text." - return - if(!examtext && !nameset) - examtext = str - update_icon() - else - examtext = str - user.visible_message("\The [user] labels \the [src] with \a [W], scribbling down: \"[examtext]\"",\ - "You label \the [src]: \"[examtext]\"",\ - "You hear someone scribbling a note.") - return + else if(istype(W, /obj/item/weapon/pen)) + switch(alert("What would you like to alter?",,"Title","Description", "Cancel")) + if("Title") + var/str = sanitizeSafe(input(usr,"Label text?","Set label",""), MAX_NAME_LEN) + if(!str || !length(str)) + usr << " Invalid text." + return + user.visible_message("\The [user] titles \the [src] with \a [W], marking down: \"[str]\"",\ + "You title \the [src]: \"[str]\"",\ + "You hear someone scribbling a note.") + name = "[name] ([str])" + if(!examtext && !nameset) + nameset = 1 + update_icon() + else + nameset = 1 + if("Description") + var/str = sanitize(input(usr,"Label text?","Set label","")) + if(!str || !length(str)) + usr << "\red Invalid text." + return + if(!examtext && !nameset) + examtext = str + update_icon() + else + examtext = str + user.visible_message("\The [user] labels \the [src] with \a [W], scribbling down: \"[examtext]\"",\ + "You label \the [src]: \"[examtext]\"",\ + "You hear someone scribbling a note.") + return - update_icon() - overlays = new() - if(nameset || examtext) - var/image/I = new/image('icons/obj/storage.dmi',"delivery_label") - if(icon_state == "deliverycloset") - I.pixel_x = 2 - if(label_y == null) - label_y = rand(-6, 11) - I.pixel_y = label_y - else if(icon_state == "deliverycrate") - if(label_x == null) - label_x = rand(-8, 6) - I.pixel_x = label_x - I.pixel_y = -3 - overlays += I - if(src.sortTag) - var/image/I = new/image('icons/obj/storage.dmi',"delivery_tag") - if(icon_state == "deliverycloset") - if(tag_x == null) - tag_x = rand(-2, 3) - I.pixel_x = tag_x - I.pixel_y = 9 - else if(icon_state == "deliverycrate") - if(tag_x == null) - tag_x = rand(-8, 6) - I.pixel_x = tag_x - I.pixel_y = -3 - overlays += I +/obj/structure/bigDelivery/update_icon() + overlays = new() + if(nameset || examtext) + var/image/I = new/image('icons/obj/storage.dmi',"delivery_label") + if(icon_state == "deliverycloset") + I.pixel_x = 2 + if(label_y == null) + label_y = rand(-6, 11) + I.pixel_y = label_y + else if(icon_state == "deliverycrate") + if(label_x == null) + label_x = rand(-8, 6) + I.pixel_x = label_x + I.pixel_y = -3 + overlays += I + if(src.sortTag) + var/image/I = new/image('icons/obj/storage.dmi',"delivery_tag") + if(icon_state == "deliverycloset") + if(tag_x == null) + tag_x = rand(-2, 3) + I.pixel_x = tag_x + I.pixel_y = 9 + else if(icon_state == "deliverycrate") + if(tag_x == null) + tag_x = rand(-8, 6) + I.pixel_x = tag_x + I.pixel_y = -3 + overlays += I - examine(mob/user) - if(..(user, 4)) - if(sortTag) - user << "It is labeled \"[sortTag]\"" - if(examtext) - user << "It has a note attached which reads, \"[examtext]\"" - return +/obj/structure/bigDelivery/examine(mob/user) + if(..(user, 4)) + if(sortTag) + user << "It is labeled \"[sortTag]\"" + if(examtext) + user << "It has a note attached which reads, \"[examtext]\"" + return /obj/item/smallDelivery desc = "A small wrapped package." @@ -121,98 +121,98 @@ var/nameset = 0 var/tag_x - attack_self(mob/user as mob) - if (src.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 (src.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) - return + qdel(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 - if(O.currTag) - if(src.sortTag != O.currTag) - user << "You have labeled the destination as [O.currTag]." - if(!src.sortTag) - src.sortTag = O.currTag - update_icon() - else - src.sortTag = O.currTag - playsound(src.loc, 'sound/machines/twobeep.ogg', 50, 1) +/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(O.currTag) + if(src.sortTag != O.currTag) + user << "You have labeled the destination as [O.currTag]." + if(!src.sortTag) + src.sortTag = O.currTag + update_icon() else - user << "The package is already labeled for [O.currTag]." + src.sortTag = O.currTag + playsound(src.loc, 'sound/machines/twobeep.ogg', 50, 1) else - user << "You need to set a destination first!" + user << "The package is already labeled for [O.currTag]." + else + user << "You need to set a destination first!" - else if(istype(W, /obj/item/weapon/pen)) - switch(alert("What would you like to alter?",,"Title","Description", "Cancel")) - if("Title") - var/str = sanitizeSafe(input(usr,"Label text?","Set label",""), MAX_NAME_LEN) - if(!str || !length(str)) - usr << " Invalid text." - return - user.visible_message("\The [user] titles \the [src] with \a [W], marking down: \"[str]\"",\ - "You title \the [src]: \"[str]\"",\ - "You hear someone scribbling a note.") - name = "[name] ([str])" - if(!examtext && !nameset) - nameset = 1 - update_icon() - else - nameset = 1 + else if(istype(W, /obj/item/weapon/pen)) + switch(alert("What would you like to alter?",,"Title","Description", "Cancel")) + if("Title") + var/str = sanitizeSafe(input(usr,"Label text?","Set label",""), MAX_NAME_LEN) + if(!str || !length(str)) + usr << " Invalid text." + return + user.visible_message("\The [user] titles \the [src] with \a [W], marking down: \"[str]\"",\ + "You title \the [src]: \"[str]\"",\ + "You hear someone scribbling a note.") + name = "[name] ([str])" + if(!examtext && !nameset) + nameset = 1 + update_icon() + else + nameset = 1 - if("Description") - var/str = sanitize(input(usr,"Label text?","Set label","")) - if(!str || !length(str)) - usr << "\red Invalid text." - return - if(!examtext && !nameset) - examtext = str - update_icon() - else - examtext = str - user.visible_message("\The [user] labels \the [src] with \a [W], scribbling down: \"[examtext]\"",\ - "You label \the [src]: \"[examtext]\"",\ - "You hear someone scribbling a note.") - return + if("Description") + var/str = sanitize(input(usr,"Label text?","Set label","")) + if(!str || !length(str)) + usr << "\red Invalid text." + return + if(!examtext && !nameset) + examtext = str + update_icon() + else + examtext = str + user.visible_message("\The [user] labels \the [src] with \a [W], scribbling down: \"[examtext]\"",\ + "You label \the [src]: \"[examtext]\"",\ + "You hear someone scribbling a note.") + return - update_icon() - overlays = new() - if((nameset || examtext) && icon_state != "deliverycrate1") - var/image/I = new/image('icons/obj/storage.dmi',"delivery_label") - if(icon_state == "deliverycrate5") - I.pixel_y = -1 - overlays += I - if(src.sortTag) - var/image/I = new/image('icons/obj/storage.dmi',"delivery_tag") - switch(icon_state) - if("deliverycrate1") - I.pixel_y = -5 - if("deliverycrate2") - I.pixel_y = -2 - if("deliverycrate3") - I.pixel_y = 0 - if("deliverycrate4") - if(tag_x == null) - tag_x = rand(0,5) - I.pixel_x = tag_x - I.pixel_y = 3 - if("deliverycrate5") - I.pixel_y = -3 - overlays += I +/obj/item/smallDelivery/update_icon() + overlays = new() + if((nameset || examtext) && icon_state != "deliverycrate1") + var/image/I = new/image('icons/obj/storage.dmi',"delivery_label") + if(icon_state == "deliverycrate5") + I.pixel_y = -1 + overlays += I + if(src.sortTag) + var/image/I = new/image('icons/obj/storage.dmi',"delivery_tag") + switch(icon_state) + if("deliverycrate1") + I.pixel_y = -5 + if("deliverycrate2") + I.pixel_y = -2 + if("deliverycrate3") + I.pixel_y = 0 + if("deliverycrate4") + if(tag_x == null) + tag_x = rand(0,5) + I.pixel_x = tag_x + I.pixel_y = 3 + if("deliverycrate5") + I.pixel_y = -3 + overlays += I - examine(mob/user) - if(..(user, 4)) - if(sortTag) - user << "It is labeled \"[sortTag]\"" - if(examtext) - user << "It has a note attached which reads, \"[examtext]\"" - return +/obj/item/smallDelivery/examine(mob/user) + if(..(user, 4)) + if(sortTag) + user << "It is labeled \"[sortTag]\"" + if(examtext) + user << "It has a note attached which reads, \"[examtext]\"" + return /obj/item/weapon/packageWrap name = "package wrapper" @@ -222,92 +222,92 @@ 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/gift) || istype(target, /obj/item/weapon/evidencebag)) - return - if(target.anchored) - return - if(target in user) - return - if(user in target) //no wrapping closets that you are inside - it's not physically possible - return - - user.attack_log += text("\[[time_stamp()]\] Has used [src.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 (src.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]" - switch(i) - if(1) P.name = "tiny parcel" - if(3) P.name = "normal-sized parcel" - if(4) P.name = "large parcel" - if(5) P.name = "huge parcel" - if(i < 1) - P.icon_state = "deliverycrate1" - P.name = "tiny parcel" - if(i > 5) - P.icon_state = "deliverycrate5" - P.name = "huge parcel" - P.add_fingerprint(usr) - O.add_fingerprint(usr) - src.add_fingerprint(usr) - src.amount -= 1 - user.visible_message("\The [user] wraps \a [target] with \a [src].",\ - "You wrap \the [target], leaving [amount] units of paper on \the [src].",\ - "You hear someone taping paper around a small object.") - else if (istype(target, /obj/structure/closet/crate)) - var/obj/structure/closet/crate/O = target - if (src.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 - src.amount -= 3 - user.visible_message("\The [user] wraps \a [target] with \a [src].",\ - "You wrap \the [target], leaving [amount] units of paper on \the [src].",\ - "You hear someone taping paper around a large object.") - else if(src.amount < 3) - user << "You need more paper." - else if (istype (target, /obj/structure/closet)) - var/obj/structure/closet/O = target - if (src.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 - src.amount -= 3 - user.visible_message("\The [user] wraps \a [target] with \a [src].",\ - "You wrap \the [target], leaving [amount] units of paper on \the [src].",\ - "You hear someone taping paper around a large object.") - else if(src.amount < 3) - user << "You need more paper." - 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 ) - 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/gift) || istype(target, /obj/item/weapon/evidencebag)) + return + if(target.anchored) + return + if(target in user) + return + if(user in target) //no wrapping closets that you are inside - it's not physically possible return - examine(mob/user) - if(..(user, 0)) - user << "\blue There are [amount] units of package wrap left!" + user.attack_log += text("\[[time_stamp()]\] Has used [src.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 (src.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]" + switch(i) + if(1) P.name = "tiny parcel" + if(3) P.name = "normal-sized parcel" + if(4) P.name = "large parcel" + if(5) P.name = "huge parcel" + if(i < 1) + P.icon_state = "deliverycrate1" + P.name = "tiny parcel" + if(i > 5) + P.icon_state = "deliverycrate5" + P.name = "huge parcel" + P.add_fingerprint(usr) + O.add_fingerprint(usr) + src.add_fingerprint(usr) + src.amount -= 1 + user.visible_message("\The [user] wraps \a [target] with \a [src].",\ + "You wrap \the [target], leaving [amount] units of paper on \the [src].",\ + "You hear someone taping paper around a small object.") + else if (istype(target, /obj/structure/closet/crate)) + var/obj/structure/closet/crate/O = target + if (src.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 + src.amount -= 3 + user.visible_message("\The [user] wraps \a [target] with \a [src].",\ + "You wrap \the [target], leaving [amount] units of paper on \the [src].",\ + "You hear someone taping paper around a large object.") + else if(src.amount < 3) + user << "You need more paper." + else if (istype (target, /obj/structure/closet)) + var/obj/structure/closet/O = target + if (src.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 + src.amount -= 3 + user.visible_message("\The [user] wraps \a [target] with \a [src].",\ + "You wrap \the [target], leaving [amount] units of paper on \the [src].",\ + "You hear someone taping paper around a large object.") + else if(src.amount < 3) + user << "You need more paper." + 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 ) + qdel(src) return + return + +/obj/item/weapon/packageWrap/examine(mob/user) + if(..(user, 0)) + user << "\blue There are [amount] units of package wrap left!" + + return /obj/structure/bigDelivery/Destroy() if(wrapped) //sometimes items can disappear. For example, bombs. --rastaf0 @@ -331,30 +331,36 @@ flags = CONDUCT slot_flags = SLOT_BELT - proc/openwindow(mob/user as mob) - var/dat = "

TagMaster 2.3

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

TagMaster 2.3

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

Current Selection: [currTag ? currTag : "None"]
" + dat += "
Current Selection: [currTag ? currTag : "None"]
" + dat += "
Enter custom location." + user << browse(dat, "window=destTagScreen;size=450x365") + onclose(user, "destTagScreen") - user << browse(dat, "window=destTagScreen;size=450x350") - onclose(user, "destTagScreen") +/obj/item/device/destTagger/attack_self(mob/user as mob) + openwindow(user) + return - attack_self(mob/user as mob) - openwindow(user) - return - - Topic(href, href_list) - src.add_fingerprint(usr) - if(href_list["nextTag"] && href_list["nextTag"] in tagger_locations) - src.currTag = href_list["nextTag"] - openwindow(usr) +/obj/item/device/destTagger/Topic(href, href_list) + src.add_fingerprint(usr) + if(href_list["nextTag"] && href_list["nextTag"] in tagger_locations) + src.currTag = href_list["nextTag"] + if(href_list["nextTag"] == "CUSTOM") + var/dest = input("Please enter custom location.", "Location", src.currTag ? src.currTag : "None") + if(dest != "None") + src.currTag = dest + else + src.currTag = 0 + openwindow(usr) /obj/machinery/disposal/deliveryChute name = "Delivery chute" @@ -364,94 +370,94 @@ var/c_mode = 0 - New() - ..() - spawn(5) - trunk = locate() in src.loc - if(trunk) - trunk.linked = src // link the pipe trunk to self +/obj/machinery/disposal/deliveryChute/New() + ..() + spawn(5) + trunk = locate() in src.loc + if(trunk) + trunk.linked = src // link the pipe trunk to self - interact() - return +/obj/machinery/disposal/deliveryChute/interact() + return +/obj/machinery/disposal/deliveryChute/update() + return + +/obj/machinery/disposal/deliveryChute/Bumped(var/atom/movable/AM) //Go straight into the chute + if(istype(AM, /obj/item/projectile) || istype(AM, /obj/effect)) return + switch(dir) + if(NORTH) + if(AM.loc.y != src.loc.y+1) return + if(EAST) + if(AM.loc.x != src.loc.x+1) return + if(SOUTH) + if(AM.loc.y != src.loc.y-1) return + if(WEST) + if(AM.loc.x != src.loc.x-1) return + + 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() + +/obj/machinery/disposal/deliveryChute/flush() + flushing = 1 + flick("intake-closing", src) + var/obj/structure/disposalholder/H = new() // virtual holder object which actually + // travels through the pipes. + air_contents = new() // new empty gas resv. + + sleep(10) + playsound(src, 'sound/machines/disposalflush.ogg', 50, 0, 0) + sleep(5) // wait for animation to finish + + H.init(src) // copy the contents of disposer to holder + + 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 + +/obj/machinery/disposal/deliveryChute/attackby(var/obj/item/I, var/mob/user) + if(!I || !user) return - Bumped(var/atom/movable/AM) //Go straight into the chute - if(istype(AM, /obj/item/projectile) || istype(AM, /obj/effect)) return - switch(dir) - if(NORTH) - if(AM.loc.y != src.loc.y+1) return - if(EAST) - if(AM.loc.x != src.loc.x+1) return - if(SOUTH) - if(AM.loc.y != src.loc.y-1) return - if(WEST) - if(AM.loc.x != src.loc.x-1) return - - 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/obj/structure/disposalholder/H = new() // virtual holder object which actually - // travels through the pipes. - air_contents = new() // new empty gas resv. - - sleep(10) - playsound(src, 'sound/machines/disposalflush.ogg', 50, 0, 0) - sleep(5) // wait for animation to finish - - H.init(src) // copy the contents of disposer to holder - - 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 - - attackby(var/obj/item/I, var/mob/user) - if(!I || !user) + if(istype(I, /obj/item/weapon/screwdriver)) + if(c_mode==0) + c_mode=1 + playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) + user << "You remove the screws around the power connection." + return + else if(c_mode==1) + c_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) && c_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 delivery chute." + if(do_after(user,20)) + if(!src || !W.isOn()) return + user << "You sliced the floorweld off the delivery chute." + var/obj/structure/disposalconstruct/C = new (src.loc) + C.ptype = 8 // 8 = Delivery chute + C.update() + C.anchored = 1 + C.density = 1 + qdel(src) + return + else + user << "You need more welding fuel to complete this task." return - - if(istype(I, /obj/item/weapon/screwdriver)) - if(c_mode==0) - c_mode=1 - playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) - user << "You remove the screws around the power connection." - return - else if(c_mode==1) - c_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) && c_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 delivery chute." - if(do_after(user,20)) - if(!src || !W.isOn()) return - user << "You sliced the floorweld off the delivery chute." - var/obj/structure/disposalconstruct/C = new (src.loc) - C.ptype = 8 // 8 = Delivery chute - C.update() - C.anchored = 1 - C.density = 1 - qdel(src) - return - else - user << "You need more welding fuel to complete this task." - return /obj/machinery/disposal/deliveryChute/Destroy() if(trunk) From 70245abe20903f04dbfca85f10d54e58d612d4b1 Mon Sep 17 00:00:00 2001 From: Karolis2011 Date: Mon, 23 Nov 2015 11:55:08 +0200 Subject: [PATCH 2/4] Made conveyors constructable and linkable with switches, but currently there is no way to obtain new conveyors or switches --- code/modules/recycling/conveyor2.dm | 89 ++++++++++++++++++++++++++++- 1 file changed, 87 insertions(+), 2 deletions(-) diff --git a/code/modules/recycling/conveyor2.dm b/code/modules/recycling/conveyor2.dm index 957c3b574dc..d3112837566 100644 --- a/code/modules/recycling/conveyor2.dm +++ b/code/modules/recycling/conveyor2.dm @@ -37,6 +37,8 @@ operating = 1 setmove() + + /obj/machinery/conveyor/proc/setmove() if(operating == 1) movedir = forwards @@ -78,6 +80,14 @@ // attack with item, place item on conveyor /obj/machinery/conveyor/attackby(var/obj/item/I, mob/user) + if(istype(I, /obj/item/weapon/crowbar)) + if(!(stat & BROKEN)) + var/obj/item/conveyor_construct/C = new/obj/item/conveyor_construct(src.loc) + C.id = id + transfer_fingerprints_to(C) + user << "You remove the conveyor belt." + qdel(src) + return if(isrobot(user)) return //Carn: fix for borgs dropping their modules on conveyor belts if(I.loc != user) return // This should stop mounted modules ending up outside the module. @@ -162,8 +172,10 @@ -/obj/machinery/conveyor_switch/New() - ..() +/obj/machinery/conveyor_switch/New(loc, newid) + ..(loc) + if(!id) + id = newid update() spawn(5) // allow map load @@ -221,6 +233,15 @@ S.position = position S.update() + +/obj/machinery/conveyor_switch/attackby(obj/item/I, mob/user, params) + if(istype(I, /obj/item/weapon/crowbar)) + var/obj/item/conveyor_switch_construct/C = new/obj/item/conveyor_switch_construct(src.loc) + C.id = id + transfer_fingerprints_to(C) + user << "You deattach the conveyor switch." + qdel(src) + /obj/machinery/conveyor_switch/oneway var/convdir = 1 //Set to 1 or -1 depending on which way you want the convayor to go. (In other words keep at 1 and set the proper dir on the belts.) desc = "A conveyor control switch. It appears to only go in one direction." @@ -240,3 +261,67 @@ if(S.id == src.id) S.position = position S.update() + + + +// +// CONVEYOR CONSTRUCTION STARTS HERE +// + +/obj/item/conveyor_construct + icon = 'icons/obj/recycling.dmi' + icon_state = "conveyor0" + name = "conveyor belt assembly" + desc = "A conveyor belt assembly." + w_class = 4 + var/id = "" //inherited by the belt + +/obj/item/conveyor_construct/attackby(obj/item/I, mob/user, params) + ..() + if(istype(I, /obj/item/conveyor_switch_construct)) + user << "You link the switch to the conveyor belt assembly." + var/obj/item/conveyor_switch_construct/C = I + id = C.id + +/obj/item/conveyor_construct/afterattack(atom/A, mob/user, proximity) + if(!proximity || user.stat || !istype(A, /turf/simulated/floor) || istype(A, /area/shuttle)) + return + var/cdir = get_dir(A, user) + if(!(cdir in cardinal) || A == user.loc) + return + for(var/obj/machinery/conveyor/CB in A) + if(CB.dir == cdir || CB.dir == turn(cdir,180)) + return + cdir |= CB.dir + qdel(CB) + var/obj/machinery/conveyor/C = new/obj/machinery/conveyor(A,cdir) + C.id = id + transfer_fingerprints_to(C) + qdel(src) + +/obj/item/conveyor_switch_construct + name = "conveyor switch assembly" + desc = "A conveyor control switch assembly." + icon = 'icons/obj/recycling.dmi' + icon_state = "switch-off" + w_class = 4 + var/id = "" //inherited by the switch + +/obj/item/conveyor_switch_construct/New() + ..() + id = rand() //this couldn't possibly go wrong + +/obj/item/conveyor_switch_construct/afterattack(atom/A, mob/user, proximity) + if(!proximity || user.stat || !istype(A, /turf/simulated/floor) || istype(A, /area/shuttle)) + return + var/found = 0 + for(var/obj/machinery/conveyor/C in view()) + if(C.id == src.id) + found = 1 + break + if(!found) + user << "\icon[src]The conveyor switch did not detect any linked conveyor belts in range." + return + var/obj/machinery/conveyor_switch/NC = new/obj/machinery/conveyor_switch(A, id) + transfer_fingerprints_to(NC) + qdel(src) From 551df1bb9704fbc36839d933a21befc7b9229e45 Mon Sep 17 00:00:00 2001 From: Karolis2011 Date: Tue, 24 Nov 2015 11:50:25 +0200 Subject: [PATCH 3/4] Few Fixes Made destination tagger window bigger. Added user checks. --- code/modules/recycling/conveyor2.dm | 4 ++-- code/modules/recycling/sortingmachinery.dm | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/modules/recycling/conveyor2.dm b/code/modules/recycling/conveyor2.dm index d3112837566..2f49b7b0842 100644 --- a/code/modules/recycling/conveyor2.dm +++ b/code/modules/recycling/conveyor2.dm @@ -284,7 +284,7 @@ id = C.id /obj/item/conveyor_construct/afterattack(atom/A, mob/user, proximity) - if(!proximity || user.stat || !istype(A, /turf/simulated/floor) || istype(A, /area/shuttle)) + if(!proximity || !istype(A, /turf/simulated/floor) || istype(A, /area/shuttle) || user.incapacitated()) return var/cdir = get_dir(A, user) if(!(cdir in cardinal) || A == user.loc) @@ -312,7 +312,7 @@ id = rand() //this couldn't possibly go wrong /obj/item/conveyor_switch_construct/afterattack(atom/A, mob/user, proximity) - if(!proximity || user.stat || !istype(A, /turf/simulated/floor) || istype(A, /area/shuttle)) + if(!proximity || !istype(A, /turf/simulated/floor) || istype(A, /area/shuttle) || user.incapacitated()) return var/found = 0 for(var/obj/machinery/conveyor/C in view()) diff --git a/code/modules/recycling/sortingmachinery.dm b/code/modules/recycling/sortingmachinery.dm index 54c30bdcd30..ce0c27ad958 100755 --- a/code/modules/recycling/sortingmachinery.dm +++ b/code/modules/recycling/sortingmachinery.dm @@ -343,7 +343,7 @@ dat += "
Current Selection: [currTag ? currTag : "None"]" dat += "
Enter custom location." - user << browse(dat, "window=destTagScreen;size=450x365") + user << browse(dat, "window=destTagScreen;size=450x375") onclose(user, "destTagScreen") /obj/item/device/destTagger/attack_self(mob/user as mob) From 1774743f24803013a88211e730598fdc6b148086 Mon Sep 17 00:00:00 2001 From: Karolis2011 Date: Thu, 10 Dec 2015 19:53:42 +0200 Subject: [PATCH 4/4] Made part of recycling code to use atom.forceMove() and fixed minor bugs: Delivery chute deconstruction use no fuel. --- code/modules/recycling/sortingmachinery.dm | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/code/modules/recycling/sortingmachinery.dm b/code/modules/recycling/sortingmachinery.dm index ce0c27ad958..c729c53bb4b 100755 --- a/code/modules/recycling/sortingmachinery.dm +++ b/code/modules/recycling/sortingmachinery.dm @@ -19,7 +19,7 @@ /obj/structure/bigDelivery/proc/unwrap() if(wrapped) //sometimes items can disappear. For example, bombs. --rastaf0 - wrapped.loc = (get_turf(src.loc)) + wrapped.forceMove(get_turf(src.loc)) if(istype(wrapped, /obj/structure/closet)) var/obj/structure/closet/O = wrapped O.welded = 0 @@ -123,11 +123,11 @@ /obj/item/smallDelivery/attack_self(mob/user as mob) if (src.wrapped) //sometimes items can disappear. For example, bombs. --rastaf0 - wrapped.loc = user.loc + wrapped.forceMove(user.loc) if(ishuman(user)) user.put_in_hands(wrapped) else - wrapped.loc = get_turf(src) + wrapped.forceMove(get_turf(src)) qdel(src) return @@ -247,7 +247,7 @@ if(user.client) user.client.screen -= O P.wrapped = O - O.loc = P + O.forceMove(P) var/i = round(O.w_class) if(i in list(1,2,3,4,5)) P.icon_state = "deliverycrate[i]" @@ -275,7 +275,7 @@ var/obj/structure/bigDelivery/P = new /obj/structure/bigDelivery(get_turf(O.loc)) P.icon_state = "deliverycrate" P.wrapped = O - O.loc = P + O.forceMove(P) src.amount -= 3 user.visible_message("\The [user] wraps \a [target] with \a [src].",\ "You wrap \the [target], leaving [amount] units of paper on \the [src].",\ @@ -288,7 +288,7 @@ var/obj/structure/bigDelivery/P = new /obj/structure/bigDelivery(get_turf(O.loc)) P.wrapped = O O.welded = 1 - O.loc = P + O.forceMove(P) src.amount -= 3 user.visible_message("\The [user] wraps \a [target] with \a [src].",\ "You wrap \the [target], leaving [amount] units of paper on \the [src].",\ @@ -397,10 +397,10 @@ if(istype(AM, /obj)) var/obj/O = AM - O.loc = src + O.forceMove(src) else if(istype(AM, /mob)) var/mob/M = AM - M.loc = src + M.forceMove(src) src.flush() /obj/machinery/disposal/deliveryChute/flush() @@ -442,10 +442,10 @@ return else if(istype(I,/obj/item/weapon/weldingtool) && c_mode==1) var/obj/item/weapon/weldingtool/W = I - if(W.remove_fuel(0,user)) - playsound(src.loc, 'sound/items/Welder2.ogg', 100, 1) + if(W.remove_fuel(1,user)) user << "You start slicing the floorweld off the delivery chute." if(do_after(user,20)) + playsound(src.loc, 'sound/items/Welder2.ogg', 100, 1) if(!src || !W.isOn()) return user << "You sliced the floorweld off the delivery chute." var/obj/structure/disposalconstruct/C = new (src.loc)