Files
siliconsandGitHub 0c8dd521c2 refactors attack hand proc header (#6720)
needed for #5677 

this is to make that PR slightly easier to review.
2024-09-06 13:36:10 -06:00

119 lines
3.7 KiB
Plaintext

// todo: /obj/structure/large_parcel
/obj/structure/bigDelivery
desc = "A big wrapped package."
name = "large parcel"
icon = 'icons/obj/storage.dmi'
icon_state = "deliverycloset"
var/obj/wrapped = null
density = 1
var/sortTag = null
mouse_drag_pointer = MOUSE_ACTIVE_POINTER
var/examtext = null
var/nameset = 0
var/label_y
var/label_x
var/tag_x
/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/structure/bigDelivery/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
unwrap()
/obj/structure/bigDelivery/proc/unwrap()
// 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 class='notice'>You have labeled the destination as [O.currTag].</span>")
if(!src.sortTag)
src.sortTag = O.currTag
update_icon()
else
src.sortTag = O.currTag
playsound(src.loc, 'sound/machines/twobeep.ogg', 50, 1)
else
to_chat(user, "<span class='warning'>The package is already labeled for [O.currTag].</span>")
else
to_chat(user, "<span class='warning'>You need to set a destination first!</span>")
else if(istype(W, /obj/item/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))
to_chat(user, "<span class='warning'> Invalid text.</span>")
return
user.visible_message("\The [user] titles \the [src] with \a [W], marking down: \"[str]\"",\
"<span class='notice'>You title \the [src]: \"[str]\"</span>",\
"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))
to_chat(user, "<font color='red'>Invalid text.</font>")
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 class='notice'>You label \the [src]: \"[examtext]\"</span>",\
"You hear someone scribbling a note.")
return
/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(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, dist)
. = ..()
if(sortTag)
. += "<span class='notice'>It is labeled \"[sortTag]\"</span>"
if(examtext)
. += "<span class='notice'>It has a note attached which reads, \"[examtext]\"</span>"