Merge pull request #6178 from FalseIncarnate/NTPS

NTPS: Requests Console Based Shipping
This commit is contained in:
Fox McCloud
2017-01-31 01:26:21 -05:00
committed by GitHub
5 changed files with 272 additions and 96 deletions
+10 -5
View File
@@ -138,7 +138,8 @@
msg_admin_attack("[key_name_admin(user)] placed [key_name_admin(GM)] in a disposals unit. (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)")
return
if(!I) return
if(!I)
return
if(!user.drop_item())
return
@@ -530,14 +531,18 @@
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
destinationTag = T.sortTag
if(istype(AM, /obj/item/smallDelivery) && !hasmob)
var/obj/item/smallDelivery/T = AM
src.destinationTag = T.sortTag
destinationTag = T.sortTag
//Drones can mail themselves through maint.
if(istype(AM, /mob/living/silicon/robot/drone))
var/mob/living/silicon/robot/drone/drone = AM
src.destinationTag = drone.mail_destination
destinationTag = drone.mail_destination
if(istype(AM, /obj/item/shippingPackage) && !hasmob)
var/obj/item/shippingPackage/sp = AM
if(sp.sealed) //only sealed packages get delivered to their intended destination
destinationTag = sp.sortTag
// start the movement process
@@ -987,7 +992,7 @@
/obj/structure/disposalpipe/sortjunction
icon_state = "pipe-j1s"
var/sortType = 0 //Look at the list called TAGGERLOCATIONS in setup.dm
var/sortType = 0 //Look at the list called TAGGERLOCATIONS in /code/_globalvars/lists/flavor_misc.dm
var/posdir = 0
var/negdir = 0
var/sortdir = 0
+186 -86
View File
@@ -35,6 +35,16 @@
sortTag = O.currTag
playsound(loc, 'sound/machines/twobeep.ogg', 100, 1)
else if(istype(W, /obj/item/shippingPackage))
var/obj/item/shippingPackage/sp = W
if(sp.sealed)
return
else
sortTag = sp.sortTag
to_chat(user, "<span class='notice'>You rip the label off the shipping package and affix it to [src].</span>")
qdel(sp)
playsound(loc, 'sound/items/poster_ripped.ogg', 50, 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))
@@ -89,6 +99,16 @@
sortTag = O.currTag
playsound(loc, 'sound/machines/twobeep.ogg', 100, 1)
else if(istype(W, /obj/item/shippingPackage))
var/obj/item/shippingPackage/sp = W
if(sp.sealed)
return
else
sortTag = sp.sortTag
to_chat(user, "<span class='notice'>You rip the label off the shipping package and affix it to [src].</span>")
qdel(sp)
playsound(loc, 'sound/items/poster_ripped.ogg', 50, 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))
@@ -134,7 +154,7 @@
if(istype(target, /obj/item) && !(istype(target, /obj/item/weapon/storage) && !istype(target,/obj/item/weapon/storage/box)))
if(istype(target, /obj/item) && !(istype(target, /obj/item/weapon/storage) && !istype(target,/obj/item/weapon/storage/box) && !istype(target, /obj/item/shippingPackage)))
var/obj/item/O = target
if(use(1))
var/obj/item/smallDelivery/P = new /obj/item/smallDelivery(get_turf(O.loc)) //Aaannd wrap it up!
@@ -235,101 +255,181 @@
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
update()
return
/obj/machinery/disposal/deliveryChute/update()
return
Bumped(var/atom/movable/AM) //Go straight into the chute
if(istype(AM, /obj/item/projectile)) 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
/obj/machinery/disposal/deliveryChute/Bumped(atom/movable/AM) //Go straight into the chute
if(istype(AM, /obj/item/projectile)) 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()
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
/obj/machinery/disposal/deliveryChute/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/structure/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
for(var/obj/structure/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
for(var/obj/item/shippingPackage/O in src)
deliveryCheck = 1
if(!O.sealed || O.sortTag == 0) //unsealed or untagged shipping packages will default to disposals
O.sortTag = 1
if(deliveryCheck == 0)
H.destinationTag = 1
sleep(10)
playsound(src, 'sound/machines/disposalflush.ogg', 50, 0, 0)
sleep(5) // wait for animation to finish
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
air_contents = new() // The holder just took our gas; replace it
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()
H.init(src) // copy the contents of disposer to holder
air_contents = new() // The holder just took our gas; replace it
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(obj/item/I, mob/user, params)
if(!I || !user)
return
attackby(var/obj/item/I, var/mob/user, params)
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)
to_chat(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)
to_chat(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)
to_chat(user, "You start slicing the floorweld off the delivery chute.")
if(do_after(user,20, target = src))
if(!src || !W.isOn()) return
to_chat(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
to_chat(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)
to_chat(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)
to_chat(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)
to_chat(user, "You start slicing the floorweld off the delivery chute.")
if(do_after(user,20, target = src))
if(!src || !W.isOn()) return
to_chat(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
to_chat(user, "You need more welding fuel to complete this task.")
/obj/item/shippingPackage
name = "Shipping package"
desc = "A pre-labeled package for shipping an item to coworkers."
icon = 'icons/obj/storage.dmi'
icon_state = "shippack"
var/obj/item/wrapped = null
var/sortTag = 0
var/sealed = 0
/obj/item/shippingPackage/attackby(obj/item/O, mob/user, params)
if(sealed)
if(istype(O, /obj/item/weapon/pen))
var/str = copytext(sanitize(input(user,"Intended recipient?","Address","")),1,MAX_NAME_LEN)
if(!str || !length(str))
to_chat(user, "<span class='notice'>Invalid text.</span>")
return
user.visible_message("<span class='notice'>[user] addresses [src] to [str].</span>")
name = "Shipping package (RE: [str])"
return
if(wrapped)
to_chat(user, "<span class='notice'>[src] already contains \a [wrapped].</span>")
return
if(istype(O, /obj/item) && !istype(O, /obj/item/weapon/storage) && !istype(O, /obj/item/shippingPackage))
if(!user.canUnEquip(O))
to_chat(user, "<span class='warning'>[O] is stuck to your hand, you cannot put it in [src]!</span>")
return
if(O.w_class > 3)
to_chat(user, "<span class='notice'>[O] is too large to fit in [src].</span>")
else
wrapped = O
user.unEquip(O)
O.forceMove(src)
O.add_fingerprint(usr)
add_fingerprint(usr)
to_chat(user, "<span class='notice'>You put [O] in [src].</span>")
/obj/item/shippingPackage/attack_self(mob/user)
if(sealed)
to_chat(user, "<span class='notice'>You tear open [src], dropping the contents onto the floor.</span>")
playsound(loc, 'sound/items/poster_ripped.ogg', 50, 1)
user.unEquip(src)
wrapped.forceMove(get_turf(user))
wrapped = null
qdel(src)
else if(wrapped)
switch(alert("Select an action:",, "Remove Object", "Seal Package", "Cancel"))
if("Remove Object")
to_chat(user, "<span class='notice'>You shake out [src]'s contents onto the floor.</span>")
wrapped.forceMove(get_turf(user))
wrapped = null
if("Seal Package")
to_chat(user, "<span class='notice'>You seal [src], preparing it for delivery.</span>")
icon_state = "shippack_sealed"
sealed = 1
update_desc()
else
if(alert("Do you want to tear up the package?",, "Yes", "No") == "Yes")
to_chat(user, "<span class='notice'>You shred [src].</span>")
playsound(loc, 'sound/items/poster_ripped.ogg', 50, 1)
user.unEquip(src)
qdel(src)
/obj/item/shippingPackage/proc/update_desc()
desc = "A pre-labeled package for shipping an item to coworkers."
if(sortTag)
desc += " The label says \"Deliver to [TAGGERLOCATIONS[sortTag]]\"."
if(!sealed)
desc += " The package is not sealed."
/obj/item/shippingPackage/Destroy()
if(wrapped)
qdel(wrapped)
wrapped = null
return ..()