Files
kiwistation/code/modules/recycling/sortingmachinery.dm
T
phil235 44eb9607e0 Some adjustments to wrapping code. I removed my possibility to wrap non-box storage item (that was at the expense of seeing a warning message that the packagewrap doesn't fit in the storage item every time you wrap one). So we're back to only wrapping boxes.
You can now wrap an item that is in your hand, and wrapping an item puts the created package in you hand.
Also, opening a package puts the item in your hand instead of being dropped on the ground.
2016-03-04 17:24:36 +01:00

154 lines
5.2 KiB
Plaintext

/obj/structure/bigDelivery
name = "large parcel"
desc = "A big wrapped package."
icon = 'icons/obj/storage.dmi'
icon_state = "deliverycloset"
density = 1
mouse_drag_pointer = MOUSE_ACTIVE_POINTER
var/giftwrapped = 0
var/sortTag = 0
/obj/structure/bigDelivery/attack_hand(mob/user)
playsound(src.loc, 'sound/items/poster_ripped.ogg', 50, 1)
qdel(src)
/obj/structure/bigDelivery/Destroy()
var/turf/T = get_turf(src)
for(var/atom/movable/AM in contents)
AM.loc = T
return ..()
/obj/structure/bigDelivery/attackby(obj/item/W, mob/user, params)
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 << "<span class='notice'>*[tag]*</span>"
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 << "<span class='warning'>Invalid text!</span>"
return
user.visible_message("[user] labels [src] as [str].")
name = "[name] ([str])"
else if(istype(W, /obj/item/stack/wrapping_paper) && !giftwrapped)
var/obj/item/stack/wrapping_paper/WP = W
if(WP.use(3))
user.visible_message("[user] wraps the package in festive paper!")
giftwrapped = 1
icon_state = "gift[icon_state]"
else
user << "<span class='warning'>You need more paper!</span>"
/obj/structure/bigDelivery/relay_container_resist(mob/living/user, obj/O)
if(istype(loc, /atom/movable))
var/atom/movable/AM = loc //can't unwrap the wrapped container if it's inside something.
AM.relay_container_resist(user, O)
return
user << "<span class='notice'>You lean on the back of [O] and start pushing to rip the wrapping around it.</span>"
if(do_after(user, 50, target = O))
if(!user || user.stat != CONSCIOUS || user.loc != src || O.loc != src )
return
user << "<span class='notice'>You successfully removed [O]'s wrapping !</span>"
O.loc = loc
playsound(src.loc, 'sound/items/poster_ripped.ogg', 50, 1)
qdel(src)
else
if(user.loc == src) //so we don't get the message if we resisted multiple times and succeeded.
user << "<span class='warning'>You fail to remove [O]'s wrapping!</span>"
/obj/item/smallDelivery
name = "small parcel"
desc = "A small wrapped package."
icon = 'icons/obj/storage.dmi'
icon_state = "deliverypackage3"
var/giftwrapped = 0
var/sortTag = 0
/obj/item/smallDelivery/attack_self(mob/user)
user.unEquip(src)
for(var/X in contents)
var/atom/movable/AM = X
user.put_in_hands(AM)
playsound(src.loc, 'sound/items/poster_ripped.ogg', 50, 1)
qdel(src)
/obj/item/smallDelivery/attackby(obj/item/W, mob/user, params)
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 << "<span class='notice'>*[tag]*</span>"
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 << "<span class='warning'>Invalid text!</span>"
return
user.visible_message("[user] labels [src] as [str].")
name = "[name] ([str])"
else if(istype(W, /obj/item/stack/wrapping_paper) && !giftwrapped)
var/obj/item/stack/wrapping_paper/WP = W
if(WP.use(1))
icon_state = "gift[icon_state]"
giftwrapped = 1
user.visible_message("[user] wraps the package in festive paper!")
else
user << "<span class='warning'>You need more paper!</span>"
/obj/item/device/destTagger
name = "destination tagger"
desc = "Used to set the destination of properly wrapped packages."
icon_state = "cargotagger"
var/currTag = 0
//The whole system for the sorttype var is determined based on the order of this list,
//disposals must always be 1, since anything that's untagged will automatically go to disposals, or sorttype = 1 --Superxpdude
//If you don't want to fuck up disposals, add to this list, and don't change the order.
//If you insist on changing the order, you'll have to change every sort junction to reflect the new order. --Pete
w_class = 1
item_state = "electronic"
flags = CONDUCT
slot_flags = SLOT_BELT
/obj/item/device/destTagger/proc/openwindow(mob/user)
var/dat = "<tt><center><h1><b>TagMaster 2.2</b></h1></center>"
dat += "<table style='width:100%; padding:4px;'><tr>"
for (var/i = 1, i <= TAGGERLOCATIONS.len, i++)
dat += "<td><a href='?src=\ref[src];nextTag=[i]'>[TAGGERLOCATIONS[i]]</a></td>"
if(i%4==0)
dat += "</tr><tr>"
dat += "</tr></table><br>Current Selection: [currTag ? TAGGERLOCATIONS[currTag] : "None"]</tt>"
user << browse(dat, "window=destTagScreen;size=450x350")
onclose(user, "destTagScreen")
/obj/item/device/destTagger/attack_self(mob/user)
openwindow(user)
return
/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)