Disposals - Sort junctions can now hold a list of destinations they filter for (#19892)

* you can sort more than one thing

* cleanup

* Update code/modules/recycling/disposal.dm

Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>

* fr

* Update code/modules/recycling/disposal.dm

Co-authored-by: Sirryan2002 <80364400+Sirryan2002@users.noreply.github.com>

Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
Co-authored-by: Sirryan2002 <80364400+Sirryan2002@users.noreply.github.com>
This commit is contained in:
Vi3trice
2023-01-04 17:08:04 -05:00
committed by GitHub
parent c52b05206e
commit fb134965ef
6 changed files with 13820 additions and 13799 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -31,9 +31,9 @@ GLOBAL_LIST_INIT(scarySounds, list('sound/weapons/thudswoosh.ogg','sound/weapons
'sound/voice/hiss3.ogg','sound/voice/hiss4.ogg','sound/voice/hiss5.ogg','sound/voice/hiss6.ogg','sound/effects/glassbr1.ogg','sound/effects/glassbr2.ogg','sound/effects/glassbr3.ogg', \
'sound/items/welder.ogg','sound/items/welder2.ogg','sound/machines/airlock_open.ogg','sound/effects/clownstep1.ogg','sound/effects/clownstep2.ogg'))
// Reference list for disposal sort junctions. Set the sortType variable on disposal sort junctions to
// the index of the sort department that you want. For example, sortType set to 2 will reroute all packages
// tagged for the Cargo Bay.
// Reference list for disposal sort junctions. Set the sort_type_txt variable on disposal sort junctions to
// the index of the sort department that you want. For example, adding "2" to sort_type_txt will reroute all packages
// tagged for the Cargo Bay. Multiple destinations can be added by separating them with ;, like "2;8" for Cargo Bay and Security.
//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
+37 -16
View File
@@ -1014,8 +1014,10 @@
//a three-way junction that sorts objects
/obj/structure/disposalpipe/sortjunction
name = "disposal sort junction"
icon_state = "pipe-j1s"
var/sortType = 0 //Look at the list called TAGGERLOCATIONS in /code/_globalvars/lists/flavor_misc.dm and cry
var/sort_type = list()
var/sort_type_txt //Look at the list called TAGGERLOCATIONS in /code/_globalvars/lists/flavor_misc.dm and cry
var/posdir = 0
var/negdir = 0
var/sortdir = 0
@@ -1023,12 +1025,6 @@
/obj/structure/disposalpipe/sortjunction/reversed
icon_state = "pipe-j2s"
/obj/structure/disposalpipe/sortjunction/proc/updatedesc()
desc = "An underfloor disposal pipe with a package sorting mechanism."
if(sortType>0)
var/tag = uppertext(GLOB.TAGGERLOCATIONS[sortType])
desc += "\nIt's tagged with [tag]"
/obj/structure/disposalpipe/sortjunction/proc/updatedir()
posdir = dir
negdir = turn(posdir, 180)
@@ -1044,7 +1040,13 @@
/obj/structure/disposalpipe/sortjunction/Initialize(mapload)
. = ..()
updatedir()
updatedesc()
if(sort_type_txt)
var/list/sort_type_str = splittext(sort_type_txt, ";")
for(var/x in sort_type_str)
var/n = text2num(x)
if(n)
sort_type += n
update_appearance(UPDATE_DESC)
update()
return
@@ -1054,15 +1056,34 @@
if(istype(I, /obj/item/destTagger))
var/obj/item/destTagger/O = I
var/tag = uppertext(GLOB.TAGGERLOCATIONS[O.currTag])
playsound(loc, 'sound/machines/twobeep.ogg', 100, 1)
if(O.currTag in sort_type)
sort_type -= O.currTag
to_chat(user, "<span class='notice'>Removed [tag] from filter.</span>")
else
sort_type |= O.currTag
to_chat(user, "<span class='notice'>Added [tag] to filter.</span>")
update_appearance(UPDATE_NAME|UPDATE_DESC)
if(O.currTag > 0)// Tag set
sortType = O.currTag
name = GLOB.TAGGERLOCATIONS[O.currTag]
playsound(src.loc, 'sound/machines/twobeep.ogg', 100, 1)
var/tag = uppertext(GLOB.TAGGERLOCATIONS[O.currTag])
to_chat(user, "<span class='notice'>Changed filter to [tag]</span>")
updatedesc()
/obj/structure/disposalpipe/sortjunction/update_name()
. = ..()
name = initial(name)
if(!length(sort_type))
return
if(length(sort_type) == 1)
name += " - [GLOB.TAGGERLOCATIONS[sort_type[1]]]"
return
name = "multi disposal sort junction"
/obj/structure/disposalpipe/sortjunction/update_desc()
. = ..()
desc = "An underfloor disposal pipe with a package sorting mechanism."
if(length(sort_type))
var/tags = list()
for(var/destinations in sort_type)
tags += GLOB.TAGGERLOCATIONS[destinations]
desc += "\nIt's tagged with [english_list(tags)]."
// next direction to move
// if coming in from negdir, then next is primary dir or sortdir
@@ -1073,7 +1094,7 @@
//var/flipdir = turn(fromdir, 180)
if(fromdir != sortdir) // probably came from the negdir
if(src.sortType == sortTag) //if destination matches filtered type...
if(sortTag in sort_type) //if destination matches filtered types...
return sortdir // exit through sortdirection
else
return posdir
+2 -2
View File
@@ -237,8 +237,8 @@
slot_flags = SLOT_BELT
///Value of the tag
var/currTag = 1
//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
//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
/obj/item/destTagger/Initialize(mapload)