Migrate deliveries to the new attack chain. (#32277)

* Migrate deliveries to the new attack chain.

* Add destination labels to descriptions.

* Call parent in activate_self() in shipping_package.

* Call update_desc only indirectly.

* Modify attack chain test.

* Apply suggestions from CRUNCH review.

Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com>
Signed-off-by: Alan <alfalfascout@users.noreply.github.com>

* Fix GitHub's grievous error.

---------

Signed-off-by: Alan <alfalfascout@users.noreply.github.com>
Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com>
This commit is contained in:
Alan
2026-07-24 19:29:42 +00:00
committed by GitHub
co-authored by CRUNCH
parent 4bfc230a72
commit a177bdbe87
5 changed files with 162 additions and 109 deletions
+1 -1
View File
@@ -400,7 +400,7 @@ GLOBAL_LIST_EMPTY(allRequestConsoles)
/obj/machinery/requests_console/proc/print_label(tag_name, tag_index)
var/obj/item/shipping_package/sp = new /obj/item/shipping_package(get_turf(src))
sp.sortTag = tag_index
sp.sort_tag = tag_index
sp.update_appearance(UPDATE_DESC)
print_cooldown = world.time + 600 //1 minute cooldown before you can print another label, but you can still configure the next one during this time
+23 -21
View File
@@ -548,21 +548,21 @@
flushing = 1
flick("[icon_state]-flush", src)
var/wrapcheck = 0
var/wrapcheck = FALSE
var/obj/structure/disposalholder/H = new(src) // virtual holder object which actually
// travels through the pipes.
// travels through the pipes.
//Hacky test to get drones to mail themselves through disposals.
for(var/mob/living/silicon/robot/drone/D in src)
wrapcheck = 1
wrapcheck = TRUE
for(var/mob/living/silicon/robot/syndicate/saboteur/R in src)
wrapcheck = 1
wrapcheck = TRUE
for(var/obj/item/small_delivery/O in src)
wrapcheck = 1
wrapcheck = TRUE
if(wrapcheck == 1)
H.tomail = 1
if(wrapcheck)
H.tomail = TRUE
sleep(10)
if(last_sound + DISPOSAL_SOUND_COOLDOWN < world.time)
@@ -676,9 +676,11 @@
var/count = 1000 //*** can travel 1000 steps before going inactive (in case of loops)
var/has_fat_guy = FALSE // true if contains a fat person
/// Destination the holder is set to, defaulting to disposals and changes if the contents have a mail/sort tag.
var/destinationTag = 1
var/tomail = 0 //changes if contains wrapped package
var/hasmob = 0 //If it contains a mob
var/destination_tag = TAGGER_LOCATION_DISPOSALS
/// Do we contain a package?
var/tomail = FALSE
/// Do we contain a mob?
var/hasmob = FALSE
/obj/structure/disposalholder/Destroy()
QDEL_NULL(gas)
@@ -714,21 +716,21 @@
has_fat_guy = TRUE // set flag on holder
if(istype(AM, /obj/structure/big_delivery) && !hasmob)
var/obj/structure/big_delivery/T = AM
destinationTag = T.sortTag
destination_tag = T.sort_tag
if(istype(AM, /obj/item/small_delivery) && !hasmob)
var/obj/item/small_delivery/T = AM
destinationTag = T.sortTag
destination_tag = T.sort_tag
//Drones can mail themselves through maint.
if(isdrone(AM))
var/mob/living/silicon/robot/drone/drone = AM
destinationTag = drone.mail_destination
destination_tag = drone.mail_destination
if(istype(AM, /mob/living/silicon/robot/syndicate/saboteur))
var/mob/living/silicon/robot/syndicate/saboteur/S = AM
destinationTag = S.mail_destination
destination_tag = S.mail_destination
if(istype(AM, /obj/item/shipping_package) && !hasmob)
var/obj/item/shipping_package/sp = AM
if(sp.sealed) //only sealed packages get delivered to their intended destination
destinationTag = sp.sortTag
destination_tag = sp.sort_tag
// start the movement process
@@ -1213,13 +1215,13 @@
if(istype(I, /obj/item/dest_tagger))
var/obj/item/dest_tagger/O = I
var/tag = uppertext(GLOB.TAGGERLOCATIONS[O.currTag])
var/tag = uppertext(GLOB.TAGGERLOCATIONS[O.current_tag])
playsound(loc, 'sound/machines/twobeep.ogg', 100, 1)
if(O.currTag == 1)
if(O.current_tag == 1)
sort_type = list(1)
to_chat(user, SPAN_NOTICE("Filter set to [tag] only."))
else if(O.currTag in sort_type)
sort_type.Remove(O.currTag)
else if(O.current_tag in sort_type)
sort_type.Remove(O.current_tag)
to_chat(user, SPAN_NOTICE("Removed [tag] from filter."))
if(!length(sort_type))
sort_type.Add(1) // Default to Disposals if everything is removed.
@@ -1227,7 +1229,7 @@
else
if(1 in sort_type) // Remove Disposals if a destination is added.
sort_type.Remove(1)
sort_type.Add(O.currTag)
sort_type.Add(O.current_tag)
to_chat(user, SPAN_NOTICE("Added [tag] to filter."))
update_appearance(UPDATE_NAME|UPDATE_DESC)
return ITEM_INTERACT_COMPLETE
@@ -1267,7 +1269,7 @@
return posdir
/obj/structure/disposalpipe/sortjunction/transfer(obj/structure/disposalholder/H)
var/nextdir = nextdir(H.dir, H.destinationTag)
var/nextdir = nextdir(H.dir, H.destination_tag)
H.dir = nextdir
var/turf/T = H.nextloc()
var/obj/structure/disposalpipe/P = H.findpipe(T)
+136 -85
View File
@@ -8,7 +8,13 @@
var/obj/wrapped = null
var/init_welded = FALSE
var/giftwrapped = FALSE
var/sortTag = 1
var/sort_tag = 1
/obj/structure/big_delivery/update_desc()
. = ..()
desc = initial(desc)
if(sort_tag)
desc += " The label says \"Deliver to [GLOB.TAGGERLOCATIONS[sort_tag]]\"."
/obj/structure/big_delivery/Destroy()
var/turf/T = get_turf(src)
@@ -52,24 +58,28 @@
if(istype(W, /obj/item/dest_tagger))
var/obj/item/dest_tagger/O = W
if(sortTag != O.currTag)
var/tag = uppertext(GLOB.TAGGERLOCATIONS[O.currTag])
if(sort_tag != O.current_tag)
var/tag = uppertext(GLOB.TAGGERLOCATIONS[O.current_tag])
to_chat(user, SPAN_NOTICE("*[tag]*"))
sortTag = O.currTag
sort_tag = O.current_tag
playsound(loc, 'sound/machines/twobeep.ogg', 100, 1)
update_appearance(UPDATE_DESC)
else if(istype(W, /obj/item/shipping_package))
var/obj/item/shipping_package/sp = W
if(sp.sealed)
return
else
sortTag = sp.sortTag
sort_tag = sp.sort_tag
to_chat(user, SPAN_NOTICE("You rip the label off the shipping package and affix it to [src]."))
qdel(sp)
playsound(loc, 'sound/items/poster_ripped.ogg', 50, 1)
update_appearance(UPDATE_DESC)
add_fingerprint(user)
else if(is_pen(W))
rename_interactive(user, W)
add_fingerprint(user)
else if(istype(W, /obj/item/stack/wrapping_paper) && !giftwrapped)
var/obj/item/stack/wrapping_paper/WP = W
@@ -94,7 +104,14 @@
icon_state = "deliverycrate2"
var/obj/item/wrapped = null
var/giftwrapped = FALSE
var/sortTag = 1
var/sort_tag = TAGGER_LOCATION_DISPOSALS
new_attack_chain = TRUE
/obj/item/small_delivery/update_desc()
. = ..()
desc = initial(desc)
if(sort_tag)
desc += SPAN_NOTICE("The label says \"Deliver to [GLOB.TAGGERLOCATIONS[sort_tag]]\".")
/obj/item/small_delivery/ex_act(severity)
for(var/atom/movable/AM in contents)
@@ -108,49 +125,62 @@
var/atom/A = i
A.emp_act(severity)
/obj/item/small_delivery/attack_self__legacy__attackchain(mob/user)
if(wrapped?.loc == src) //sometimes items can disappear. For example, bombs. --rastaf0
/obj/item/small_delivery/activate_self(mob/user)
if(..())
return ITEM_INTERACT_COMPLETE
if(wrapped?.loc == src) // Sometimes items can disappear. For example, bombs. --rastaf0
wrapped.forceMove(get_turf(src))
if(ishuman(user))
user.put_in_hands(wrapped)
playsound(src, 'sound/items/poster_ripped.ogg', 50, TRUE)
qdel(src)
/obj/item/small_delivery/attackby__legacy__attackchain(obj/item/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/dest_tagger))
var/obj/item/dest_tagger/O = W
/obj/item/small_delivery/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(istype(used, /obj/item/dest_tagger))
var/obj/item/dest_tagger/tagger = used
if(sortTag != O.currTag)
var/tag = uppertext(GLOB.TAGGERLOCATIONS[O.currTag])
to_chat(user, SPAN_NOTICE("*[tag]*"))
sortTag = O.currTag
playsound(loc, 'sound/machines/twobeep.ogg', 100, 1)
if(sort_tag == tagger.current_tag)
return ITEM_INTERACT_COMPLETE
var/tag = uppertext(GLOB.TAGGERLOCATIONS[tagger.current_tag])
to_chat(user, SPAN_NOTICE("*[tag]*"))
sort_tag = tagger.current_tag
playsound(loc, 'sound/machines/twobeep.ogg', 100, 1)
update_appearance(UPDATE_DESC)
return ITEM_INTERACT_COMPLETE
else if(istype(W, /obj/item/shipping_package))
var/obj/item/shipping_package/sp = W
if(sp.sealed)
return
else
sortTag = sp.sortTag
to_chat(user, SPAN_NOTICE("You rip the label off the shipping package and affix it to [src]."))
qdel(sp)
playsound(loc, 'sound/items/poster_ripped.ogg', 50, 1)
if(istype(used, /obj/item/shipping_package))
var/obj/item/shipping_package/package = used
if(package.sealed)
return ITEM_INTERACT_COMPLETE
else if(is_pen(W))
rename_interactive(user, W)
sort_tag = package.sort_tag
to_chat(user, SPAN_NOTICE("You rip the label off the shipping package and affix it to [src]."))
qdel(package)
playsound(loc, 'sound/items/poster_ripped.ogg', 50, 1)
update_appearance(UPDATE_DESC)
add_fingerprint(user)
return ITEM_INTERACT_COMPLETE
else if(istype(W, /obj/item/stack/wrapping_paper) && !giftwrapped)
var/obj/item/stack/wrapping_paper/WP = W
if(WP.use(1))
icon_state = "giftcrate[wrapped.w_class]"
giftwrapped = TRUE
user.visible_message(SPAN_NOTICE("[user] wraps the package in festive paper!"))
if(WP.amount <= 0 && !WP.loc) //if we used our last wrapping paper, drop a cardboard tube
new /obj/item/c_tube( get_turf(user) )
else
to_chat(user, SPAN_NOTICE("You need more paper."))
else
return ..()
if(is_pen(used))
rename_interactive(user, used)
add_fingerprint(user)
return ITEM_INTERACT_COMPLETE
if(istype(used, /obj/item/stack/wrapping_paper) && !giftwrapped)
var/obj/item/stack/wrapping_paper/paper_roll = used
if(!paper_roll.use(1))
to_chat(user, SPAN_WARNING("You need more paper to wrap this!"))
return ITEM_INTERACT_COMPLETE
icon_state = "giftcrate[wrapped.w_class]"
giftwrapped = TRUE
user.visible_message(SPAN_NOTICE("[user] wraps the package in festive paper!"))
if(paper_roll.amount <= 0 && !paper_roll.loc) // If we used our last wrapping paper, drop a cardboard tube.
new /obj/item/c_tube(get_turf(user))
add_fingerprint(user)
return ITEM_INTERACT_COMPLETE
return ..()
/obj/item/stack/package_wrap
name = "package wrapper"
@@ -274,10 +304,11 @@
slot_flags = ITEM_SLOT_BELT
materials = list(MAT_METAL = 250, MAT_GLASS = 150)
///Value of the tag
var/currTag = 1
var/current_tag = 1
//The whole system for the sort_type 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 sort_type = list(1) --Superxpdude
var/datum/ui_module/destination_tagger/destination_tagger
new_attack_chain = TRUE
/obj/item/dest_tagger/Initialize(mapload)
. = ..()
@@ -287,9 +318,13 @@
QDEL_NULL(destination_tagger)
return ..()
/obj/item/dest_tagger/attack_self__legacy__attackchain(mob/user)
/obj/item/dest_tagger/activate_self(mob/user)
if(..())
return ITEM_INTERACT_COMPLETE
add_fingerprint(user)
ui_interact(user)
return ITEM_INTERACT_COMPLETE
/obj/item/dest_tagger/ui_state(mob/user)
return GLOB.default_state
@@ -363,19 +398,19 @@
/obj/machinery/disposal/delivery_chute/flush()
flushing = 1
flick("intake-closing", src)
var/deliveryCheck = 0
var/delivery_check = FALSE
var/obj/structure/disposalholder/H = new(src) // virtual holder object which actually
// travels through the pipes.
for(var/obj/structure/big_delivery/O in src)
deliveryCheck = 1
delivery_check = TRUE
for(var/obj/item/small_delivery/O in src)
deliveryCheck = 1
delivery_check = TRUE
for(var/obj/item/shipping_package/O in src)
deliveryCheck = 1
delivery_check = TRUE
if(!O.sealed) //unsealed shipping packages will default to disposals
O.sortTag = 1
if(deliveryCheck == 0)
H.destinationTag = 1
O.sort_tag = 1
if(!delivery_check)
H.destination_tag = TAGGER_LOCATION_DISPOSALS
sleep(10)
if(last_sound + DISPOSAL_SOUND_COOLDOWN < world.time)
@@ -425,70 +460,86 @@
desc = "A pre-labeled package for shipping an item to coworkers."
icon = 'icons/obj/boxes.dmi'
icon_state = "shippack"
var/obj/item/wrapped = null
var/sortTag = 1
var/obj/item/object_inside = null
var/sort_tag = 1
var/sealed = 0
new_attack_chain = TRUE
/obj/item/shipping_package/attackby__legacy__attackchain(obj/item/O, mob/user, params)
/obj/item/shipping_package/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(sealed)
if(is_pen(O))
if(is_pen(used))
var/str = tgui_input_text(user, "Intended recipient?", "Address", max_length = MAX_NAME_LEN)
if(!str || !length(str))
to_chat(user, SPAN_NOTICE("Invalid text."))
return
to_chat(user, SPAN_WARNING("Invalid text!"))
return ITEM_INTERACT_COMPLETE
user.visible_message(SPAN_NOTICE("[user] addresses [src] to [str]."))
name = "Shipping package (RE: [str])"
return
if(wrapped)
to_chat(user, SPAN_NOTICE("[src] already contains \a [wrapped]."))
return
if(isitem(O) && !isstorage(O) && !istype(O, /obj/item/shipping_package))
if(!user.canUnEquip(O))
to_chat(user, SPAN_WARNING("[O] is stuck to your hand, you cannot put it in [src]!"))
return
if(O.w_class > 3)
to_chat(user, SPAN_NOTICE("[O] is too large to fit in [src]."))
else
wrapped = O
user.transfer_item_to(O, src)
O.add_fingerprint(usr)
add_fingerprint(usr)
to_chat(user, SPAN_NOTICE("You put [O] in [src]."))
return ITEM_INTERACT_COMPLETE
if(object_inside)
to_chat(user, SPAN_WARNING("[src] already contains [object_inside]!"))
return ITEM_INTERACT_COMPLETE
if(!(isitem(used) && !isstorage(used) && !istype(used, /obj/item/shipping_package)))
return ..()
if(!user.canUnEquip(used))
to_chat(user, SPAN_WARNING("[used] is stuck to your hand, you cannot put it in [src]!"))
return ITEM_INTERACT_COMPLETE
if(used.w_class > 3)
to_chat(user, SPAN_NOTICE("[used] is too large to fit in [src]!"))
return ITEM_INTERACT_COMPLETE
object_inside = used
user.transfer_item_to(used, src)
used.add_fingerprint(usr)
add_fingerprint(usr)
to_chat(user, SPAN_NOTICE("You put [used] in [src]."))
return ITEM_INTERACT_COMPLETE
/obj/item/shipping_package/activate_self(mob/user)
if(..())
return ITEM_INTERACT_COMPLETE
/obj/item/shipping_package/attack_self__legacy__attackchain(mob/user)
if(sealed)
to_chat(user, SPAN_NOTICE("You tear open [src], dropping the contents onto the floor."))
playsound(loc, 'sound/items/poster_ripped.ogg', 50, 1)
user.unequip(src)
wrapped.forceMove(get_turf(user))
wrapped = null
object_inside.forceMove(get_turf(user))
object_inside = null
qdel(src)
else if(wrapped)
return ITEM_INTERACT_COMPLETE
if(object_inside)
switch(tgui_alert(user, "Select an action:", "Shipping", list("Remove Object", "Seal Package", "Cancel")))
if("Remove Object")
to_chat(user, SPAN_NOTICE("You shake out [src]'s contents onto the floor."))
wrapped.forceMove(get_turf(user))
wrapped = null
object_inside.forceMove(get_turf(user))
object_inside = null
if("Seal Package")
to_chat(user, SPAN_NOTICE("You seal [src], preparing it for delivery."))
icon_state = "shippack_sealed"
sealed = 1
update_appearance(UPDATE_DESC)
else
if(tgui_alert(user, "Do you want to tear up the package?", "Shipping", list("Yes", "No")) == "Yes")
to_chat(user, SPAN_NOTICE("You shred [src]."))
playsound(loc, 'sound/items/poster_ripped.ogg', 50, 1)
user.drop_item_to_ground(src)
qdel(src)
return ITEM_INTERACT_COMPLETE
if(tgui_alert(user, "Do you want to tear up the package?", "Shipping", list("Yes", "No")) != "Yes")
return ITEM_INTERACT_COMPLETE
to_chat(user, SPAN_NOTICE("You shred [src]."))
playsound(loc, 'sound/items/poster_ripped.ogg', 50, 1)
user.drop_item_to_ground(src)
qdel(src)
return ITEM_INTERACT_COMPLETE
/obj/item/shipping_package/update_desc()
. = ..()
desc = "A pre-labeled package for shipping an item to coworkers."
if(sortTag)
desc += " The label says \"Deliver to [GLOB.TAGGERLOCATIONS[sortTag]]\"."
if(sort_tag)
desc += " The label says \"Deliver to [GLOB.TAGGERLOCATIONS[sort_tag]]\"."
if(!sealed)
desc += " The package is not sealed."
/obj/item/shipping_package/Destroy()
QDEL_NULL(wrapped)
QDEL_NULL(object_inside)
return ..()
@@ -43,7 +43,7 @@
// Handle setting tags (and flushing for drones)
if(istype(host, /obj/item/dest_tagger))
var/obj/item/dest_tagger/O = host
O.currTag = my_tag
O.current_tag = my_tag
else if(isrobot(host))
var/mob/living/silicon/robot/R = host
R.mail_destination = my_tag
@@ -263,7 +263,7 @@
var/obj/structure/big_delivery/delivery = teleport_to_first(player, /obj/structure/big_delivery)
var/obj/item/dest_tagger/tagger = player.spawn_obj_in_hand(/obj/item/dest_tagger)
tagger.currTag = 2
tagger.current_tag = 2
player.click_on(delivery)
TEST_ASSERT_LAST_CHATLOG(player, "*CARGO BAY*")
player.drop_held_item()