mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-05-17 12:20:09 +01:00
244 lines
7.5 KiB
Plaintext
244 lines
7.5 KiB
Plaintext
/obj/structure/bigDelivery
|
|
desc = "A big wrapped package."
|
|
name = "large parcel"
|
|
icon = 'icons/obj/storage_vr.dmi' //VOREStation Edit
|
|
icon_state = "deliverycloset"
|
|
var/obj/wrapped = null
|
|
density = TRUE
|
|
var/sortTag = null
|
|
flags = NOBLUDGEON
|
|
mouse_drag_pointer = MOUSE_ACTIVE_POINTER
|
|
var/examtext = null
|
|
var/nameset = 0
|
|
var/label_y
|
|
var/label_x
|
|
var/tag_x
|
|
|
|
/obj/structure/bigDelivery/attack_hand(mob/user as mob)
|
|
unwrap()
|
|
|
|
/obj/structure/bigDelivery/proc/unwrap()
|
|
playsound(src, 'sound/items/package_unwrap.ogg', 50, 1)
|
|
// Destroy will drop our wrapped object on the turf, so let it.
|
|
qdel(src)
|
|
|
|
/obj/structure/bigDelivery/attackby(obj/item/W as obj, mob/user as mob)
|
|
if(istype(W, /obj/item/destTagger))
|
|
var/obj/item/destTagger/O = W
|
|
if(O.currTag)
|
|
if(src.sortTag != O.currTag)
|
|
to_chat(user, span_notice("You have labeled the destination as [O.currTag]."))
|
|
if(!src.sortTag)
|
|
src.sortTag = O.currTag
|
|
update_icon()
|
|
else
|
|
src.sortTag = O.currTag
|
|
playsound(src, 'sound/machines/twobeep.ogg', 50, 1)
|
|
else
|
|
to_chat(user, span_warning("The package is already labeled for [O.currTag]."))
|
|
else
|
|
to_chat(user, span_warning("You need to set a destination first!"))
|
|
|
|
else if(istype(W, /obj/item/pen))
|
|
switch(tgui_alert(user, "What would you like to alter?","Select Alteration",list("Title","Description","Cancel")))
|
|
if("Title")
|
|
var/str = sanitizeSafe(tgui_input_text(user,"Label text?","Set label","", MAX_NAME_LEN, encode = FALSE), MAX_NAME_LEN)
|
|
if(!str || !length(str))
|
|
to_chat(user, span_warning(" Invalid text."))
|
|
return
|
|
user.visible_message("\The [user] titles \the [src] with \a [W], marking down: \"[str]\"",\
|
|
span_notice("You title \the [src]: \"[str]\""),\
|
|
"You hear someone scribbling a note.")
|
|
playsound(src, pick('sound/bureaucracy/pen1.ogg','sound/bureaucracy/pen2.ogg'), 20)
|
|
name = "[name] ([str])"
|
|
if(!examtext && !nameset)
|
|
nameset = 1
|
|
update_icon()
|
|
else
|
|
nameset = 1
|
|
if("Description")
|
|
var/str = tgui_input_text(user,"Label text?","Set label","", MAX_MESSAGE_LEN)
|
|
if(!str || !length(str))
|
|
to_chat(user, span_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]\"",\
|
|
span_notice("You label \the [src]: \"[examtext]\""),\
|
|
"You hear someone scribbling a note.")
|
|
playsound(src, pick('sound/bureaucracy/pen1.ogg','sound/bureaucracy/pen2.ogg'), 20)
|
|
return
|
|
|
|
/obj/structure/bigDelivery/attack_robot(mob/living/user)
|
|
if(user.stat || !Adjacent(user))
|
|
return
|
|
unwrap()
|
|
|
|
/obj/structure/bigDelivery/update_icon()
|
|
cut_overlays()
|
|
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
|
|
add_overlay(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
|
|
add_overlay(I)
|
|
|
|
/obj/structure/bigDelivery/examine(mob/user)
|
|
. = ..()
|
|
if(get_dist(user, src) <= 4)
|
|
if(sortTag)
|
|
. += span_notice("It is labeled \"[sortTag]\"")
|
|
if(examtext)
|
|
. += span_notice("It has a note attached which reads, \"[examtext]\"")
|
|
|
|
/obj/structure/bigDelivery/Destroy()
|
|
if(wrapped) //sometimes items can disappear. For example, bombs. --rastaf0
|
|
wrapped.forceMove(get_turf(src))
|
|
if(istype(wrapped, /obj/structure/closet))
|
|
var/obj/structure/closet/O = wrapped
|
|
O.sealed = 0
|
|
wrapped = null
|
|
var/turf/T = get_turf(src)
|
|
for(var/atom/movable/AM in contents)
|
|
AM.forceMove(T)
|
|
return ..()
|
|
|
|
/obj/item/smallDelivery
|
|
desc = "A small wrapped package."
|
|
name = "small parcel"
|
|
icon = 'icons/obj/storage_vr.dmi' //VOREStation Edit
|
|
icon_state = "deliverycrate3"
|
|
drop_sound = 'sound/items/drop/cardboardbox.ogg'
|
|
pickup_sound = 'sound/items/pickup/cardboardbox.ogg'
|
|
var/obj/item/wrapped = null
|
|
var/sortTag = null
|
|
var/examtext = null
|
|
var/nameset = 0
|
|
var/tag_x
|
|
|
|
/obj/item/smallDelivery/attack_self(mob/user)
|
|
. = ..(user)
|
|
if(.)
|
|
return TRUE
|
|
if (wrapped) //sometimes items can disappear. For example, bombs. --rastaf0
|
|
wrapped.forceMove(user.loc)
|
|
if(ishuman(user))
|
|
user.put_in_hands(wrapped)
|
|
else
|
|
wrapped.loc = get_turf(src)
|
|
|
|
qdel(src)
|
|
return
|
|
|
|
/obj/item/smallDelivery/attackby(obj/item/W as obj, mob/user as mob)
|
|
if(istype(W, /obj/item/destTagger))
|
|
var/obj/item/destTagger/O = W
|
|
if(O.currTag)
|
|
if(src.sortTag != O.currTag)
|
|
to_chat(user, span_notice("You have labeled the destination as [O.currTag]."))
|
|
if(!src.sortTag)
|
|
src.sortTag = O.currTag
|
|
update_icon()
|
|
else
|
|
src.sortTag = O.currTag
|
|
playsound(src, 'sound/machines/twobeep.ogg', 50, 1)
|
|
else
|
|
to_chat(user, span_warning("The package is already labeled for [O.currTag]."))
|
|
else
|
|
to_chat(user, span_warning("You need to set a destination first!"))
|
|
|
|
else if(istype(W, /obj/item/pen))
|
|
switch(tgui_alert(user, "What would you like to alter?","Select Alteration",list("Title","Description","Cancel")))
|
|
if("Title")
|
|
var/str = sanitizeSafe(tgui_input_text(user,"Label text?","Set label","", MAX_NAME_LEN, encode = FALSE), MAX_NAME_LEN)
|
|
if(!str || !length(str))
|
|
to_chat(user, span_warning(" Invalid text."))
|
|
return
|
|
user.visible_message("\The [user] titles \the [src] with \a [W], marking down: \"[str]\"",\
|
|
span_notice("You title \the [src]: \"[str]\""),\
|
|
"You hear someone scribbling a note.")
|
|
playsound(src, pick('sound/bureaucracy/pen1.ogg','sound/bureaucracy/pen2.ogg'), 20)
|
|
name = "[name] ([str])"
|
|
if(!examtext && !nameset)
|
|
nameset = 1
|
|
update_icon()
|
|
else
|
|
nameset = 1
|
|
|
|
if("Description")
|
|
var/str = tgui_input_text(user,"Label text?","Set label","", MAX_MESSAGE_LEN)
|
|
if(!str || !length(str))
|
|
to_chat(user, span_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]\"",\
|
|
span_notice("You label \the [src]: \"[examtext]\""),\
|
|
"You hear someone scribbling a note.")
|
|
playsound(src, pick('sound/bureaucracy/pen1.ogg','sound/bureaucracy/pen2.ogg'), 20)
|
|
return
|
|
|
|
/obj/item/smallDelivery/attack_robot(mob/living/user)
|
|
if(user.stat || !Adjacent(user))
|
|
return
|
|
attack_self(user)
|
|
|
|
/obj/item/smallDelivery/update_icon()
|
|
cut_overlays()
|
|
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
|
|
add_overlay(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
|
|
add_overlay(I)
|
|
|
|
/obj/item/smallDelivery/examine(mob/user)
|
|
. = ..()
|
|
if(get_dist(user, src) <= 4)
|
|
if(sortTag)
|
|
. += span_notice("It is labeled \"[sortTag]\"")
|
|
if(examtext)
|
|
. += span_notice("It has a note attached which reads, \"[examtext]\"")
|