mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-29 11:31:51 +00:00
refactors some disposals filtering code and remaps some disposals pipes
New things! /obj/structure/disposalpipe/tagger - retags a holder when it passes through /obj/structure/disposalpipe/tagger/partial - retags a holder when it passes through two times; good for loop detection /obj/structure/disposalpipe/sortjunction/wildcard - filters out all holders that are tagged /obj/structure/disposalpipe/sortjunction/untagged - filters out untagged holders Tagging doesn't use an icky list index system any more, tags are put into a global list and directly checked against. Changed the map around a bit, disposals is now a proper loop but anything that's not tagged, is tagged with "Disposals" or anything that passes the tagger twice will be filtered out. Not a feature, just a fix for drones being sad about weird disposals. <3
This commit is contained in:
@@ -250,3 +250,6 @@ var/custom_event_msg = null
|
||||
//A connection is established on world creation. Ideally, the connection dies when the server restarts (After feedback logging.).
|
||||
var/DBConnection/dbcon = new() //Feedback database (New database)
|
||||
var/DBConnection/dbcon_old = new() //Tgstation database (Old database) - See the files in the SQL folder for information what goes where.
|
||||
|
||||
// Reference list for disposal sort junctions. Filled up by sorting junction's New()
|
||||
/var/list/tagger_locations = list()
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
var/obj/item/weapon/matter_decompiler/decompiler = null
|
||||
|
||||
//Used for self-mailing.
|
||||
var/mail_destination = 0
|
||||
var/mail_destination = ""
|
||||
|
||||
/mob/living/silicon/robot/drone/New()
|
||||
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
set desc = "Tag yourself for delivery through the disposals system."
|
||||
set category = "Drone"
|
||||
|
||||
var/tag = input("Select the desired destination.", "Set Mail Tag", null) as null|anything in TAGGERLOCATIONS
|
||||
var/new_tag = input("Select the desired destination.", "Set Mail Tag", null) as null|anything in tagger_locations
|
||||
|
||||
if(!tag || TAGGERLOCATIONS[tag])
|
||||
mail_destination = 0
|
||||
if(!new_tag)
|
||||
mail_destination = ""
|
||||
return
|
||||
|
||||
src << "\blue You configure your internal beacon, tagging yourself for delivery to '[tag]'."
|
||||
mail_destination = TAGGERLOCATIONS.Find(tag)
|
||||
src << "\blue You configure your internal beacon, tagging yourself for delivery to '[new_tag]'."
|
||||
mail_destination = new_tag
|
||||
|
||||
//Auto flush if we use this verb inside a disposal chute.
|
||||
var/obj/machinery/disposal/D = src.loc
|
||||
|
||||
@@ -60,9 +60,9 @@
|
||||
if (href_list["setarea"])
|
||||
|
||||
//Probably should consider using another list, but this one will do.
|
||||
var/t_area = input("Select the area to ping.", "Set Target Area", null) as null|anything in TAGGERLOCATIONS
|
||||
var/t_area = input("Select the area to ping.", "Set Target Area", null) as null|anything in tagger_locations
|
||||
|
||||
if(!t_area || TAGGERLOCATIONS[t_area])
|
||||
if(!t_area)
|
||||
return
|
||||
|
||||
drone_call_area = t_area
|
||||
|
||||
@@ -73,6 +73,12 @@
|
||||
base_state = "pipe-d"
|
||||
dpdir = dir
|
||||
///// Z-Level stuff
|
||||
if(13)
|
||||
base_state = "pipe-tagger"
|
||||
dpdir = dir | flip
|
||||
if(14)
|
||||
base_state = "pipe-tagger-partial"
|
||||
dpdir = dir | flip
|
||||
|
||||
|
||||
///// Z-Level stuff
|
||||
@@ -83,7 +89,7 @@
|
||||
icon_state = base_state
|
||||
|
||||
if(invisibility) // if invisible, fade icon
|
||||
icon -= rgb(0,0,0,128)
|
||||
alpha = 128
|
||||
|
||||
// hide called by levelupdate if turf intact status changes
|
||||
// change visibility status and force update of icon
|
||||
@@ -147,14 +153,20 @@
|
||||
return /obj/structure/disposaloutlet
|
||||
if(8)
|
||||
return /obj/machinery/disposal/deliveryChute
|
||||
if(9,10)
|
||||
if(9)
|
||||
return /obj/structure/disposalpipe/sortjunction
|
||||
if(10)
|
||||
return /obj/structure/disposalpipe/sortjunction/flipped
|
||||
///// Z-Level stuff
|
||||
if(11)
|
||||
return /obj/structure/disposalpipe/up
|
||||
if(12)
|
||||
return /obj/structure/disposalpipe/down
|
||||
///// Z-Level stuff
|
||||
if(13)
|
||||
return /obj/structure/disposalpipe/tagger
|
||||
if(14)
|
||||
return /obj/structure/disposalpipe/tagger/partial
|
||||
return
|
||||
|
||||
|
||||
@@ -177,6 +189,12 @@
|
||||
if(9, 10)
|
||||
nicetype = "sorting pipe"
|
||||
ispipe = 1
|
||||
if(13)
|
||||
nicetype = "tagging pipe"
|
||||
ispipe = 1
|
||||
if(14)
|
||||
nicetype = "partial tagging pipe"
|
||||
ispipe = 1
|
||||
else
|
||||
nicetype = "pipe"
|
||||
ispipe = 1
|
||||
|
||||
@@ -487,12 +487,14 @@
|
||||
var/datum/gas_mixture/gas = null // gas used to flush, will appear at exit point
|
||||
var/active = 0 // true if the holder is moving, otherwise inactive
|
||||
dir = 0
|
||||
var/count = 1000 //*** can travel 1000 steps before going inactive (in case of loops)
|
||||
var/count = 2048 //*** can travel 2048 steps before going inactive (in case of loops)
|
||||
var/has_fat_guy = 0 // true if contains a fat person
|
||||
var/destinationTag = 0 // changes if contains a delivery container
|
||||
var/destinationTag = "" // changes if contains a delivery container
|
||||
var/tomail = 0 //changes if contains wrapped package
|
||||
var/hasmob = 0 //If it contains a mob
|
||||
|
||||
var/partialTag = "" //set by a partial tagger the first time round, then put in destinationTag if it goes through again.
|
||||
|
||||
|
||||
// initialize a holder from the contents of a disposal unit
|
||||
proc/init(var/obj/machinery/disposal/D)
|
||||
@@ -608,6 +610,17 @@
|
||||
del(other)
|
||||
|
||||
|
||||
proc/settag(var/new_tag)
|
||||
destinationTag = new_tag
|
||||
|
||||
proc/setpartialtag(var/new_tag)
|
||||
if(partialTag == new_tag)
|
||||
destinationTag = new_tag
|
||||
partialTag = ""
|
||||
else
|
||||
partialTag = new_tag
|
||||
|
||||
|
||||
// called when player tries to move while in a pipe
|
||||
relaymove(mob/user as mob)
|
||||
|
||||
@@ -901,6 +914,10 @@
|
||||
if("pipe-d")
|
||||
C.ptype = 12
|
||||
///// Z-Level stuff
|
||||
if("pipe-tagger")
|
||||
C.ptype = 13
|
||||
if("pipe-tagger-partial")
|
||||
C.ptype = 14
|
||||
src.transfer_fingerprints_to(C)
|
||||
C.dir = dir
|
||||
C.density = 0
|
||||
@@ -1080,39 +1097,31 @@
|
||||
else
|
||||
return mask & (~setbit)
|
||||
|
||||
//a three-way junction that sorts objects
|
||||
/obj/structure/disposalpipe/sortjunction
|
||||
|
||||
icon_state = "pipe-j1s"
|
||||
var/sortType = 0 //Look at the list called TAGGERLOCATIONS in setup.dm
|
||||
var/posdir = 0
|
||||
var/negdir = 0
|
||||
var/sortdir = 0
|
||||
/obj/structure/disposalpipe/tagger
|
||||
name = "package tagger"
|
||||
icon_state = "pipe-tagger"
|
||||
var/sort_tag = ""
|
||||
var/partial = 0
|
||||
|
||||
proc/updatedesc()
|
||||
desc = "An underfloor disposal pipe with a package sorting mechanism."
|
||||
if(sortType>0)
|
||||
var/tag = uppertext(TAGGERLOCATIONS[sortType])
|
||||
desc += "\nIt's tagged with [tag]"
|
||||
desc = initial(desc)
|
||||
if(sort_tag)
|
||||
desc += "\nIt's tagging objects with the '[sort_tag]' tag."
|
||||
|
||||
proc/updatedir()
|
||||
posdir = dir
|
||||
negdir = turn(posdir, 180)
|
||||
|
||||
if(icon_state == "pipe-j1s")
|
||||
sortdir = turn(posdir, -90)
|
||||
proc/updatename()
|
||||
if(sort_tag)
|
||||
name = "[initial(name)] ([sort_tag])"
|
||||
else
|
||||
icon_state = "pipe-j2s"
|
||||
sortdir = turn(posdir, 90)
|
||||
|
||||
dpdir = sortdir | posdir | negdir
|
||||
name = initial(name)
|
||||
|
||||
New()
|
||||
..()
|
||||
updatedir()
|
||||
. = ..()
|
||||
dpdir = dir | turn(dir, 180)
|
||||
if(sort_tag) tagger_locations |= sort_tag
|
||||
updatename()
|
||||
updatedesc()
|
||||
update()
|
||||
return
|
||||
|
||||
attackby(var/obj/item/I, var/mob/user)
|
||||
if(..())
|
||||
@@ -1121,13 +1130,84 @@
|
||||
if(istype(I, /obj/item/device/destTagger))
|
||||
var/obj/item/device/destTagger/O = I
|
||||
|
||||
if(O.currTag > 0)// Tag set
|
||||
sortType = O.currTag
|
||||
if(O.currTag)// Tag set
|
||||
sort_tag = O.currTag
|
||||
playsound(src.loc, 'sound/machines/twobeep.ogg', 100, 1)
|
||||
var/tag = uppertext(TAGGERLOCATIONS[O.currTag])
|
||||
user << "\blue Changed filter to [tag]"
|
||||
user << "\blue Changed tag to '[sort_tag]'."
|
||||
updatename()
|
||||
updatedesc()
|
||||
|
||||
transfer(var/obj/structure/disposalholder/H)
|
||||
if(sort_tag)
|
||||
if(partial)
|
||||
H.setpartialtag(sort_tag)
|
||||
else
|
||||
H.settag(sort_tag)
|
||||
return ..()
|
||||
|
||||
/obj/structure/disposalpipe/tagger/partial //needs two passes to tag
|
||||
name = "partial package tagger"
|
||||
icon_state = "pipe-tagger-partial"
|
||||
partial = 1
|
||||
|
||||
//a three-way junction that sorts objects
|
||||
/obj/structure/disposalpipe/sortjunction
|
||||
name = "sorting junction"
|
||||
icon_state = "pipe-j1s"
|
||||
desc = "An underfloor disposal pipe with a package sorting mechanism."
|
||||
|
||||
var/sortType = ""
|
||||
var/posdir = 0
|
||||
var/negdir = 0
|
||||
var/sortdir = 0
|
||||
|
||||
proc/updatedesc()
|
||||
desc = initial(desc)
|
||||
if(sortType)
|
||||
desc += "\nIt's filtering objects with the '[sortType]' tag."
|
||||
|
||||
proc/updatename()
|
||||
if(sortType)
|
||||
name = "[initial(name)] ([sortType])"
|
||||
else
|
||||
name = initial(name)
|
||||
|
||||
proc/updatedir()
|
||||
posdir = dir
|
||||
negdir = turn(posdir, 180)
|
||||
|
||||
if(icon_state == "pipe-j1s")
|
||||
sortdir = turn(posdir, -90)
|
||||
else if(icon_state == "pipe-j2s")
|
||||
sortdir = turn(posdir, 90)
|
||||
|
||||
dpdir = sortdir | posdir | negdir
|
||||
|
||||
New()
|
||||
. = ..()
|
||||
if(sortType) tagger_locations |= sortType
|
||||
|
||||
updatedir()
|
||||
updatename()
|
||||
updatedesc()
|
||||
update()
|
||||
|
||||
attackby(var/obj/item/I, var/mob/user)
|
||||
if(..())
|
||||
return
|
||||
|
||||
if(istype(I, /obj/item/device/destTagger))
|
||||
var/obj/item/device/destTagger/O = I
|
||||
|
||||
if(O.currTag)// Tag set
|
||||
sortType = O.currTag
|
||||
playsound(src.loc, 'sound/machines/twobeep.ogg', 100, 1)
|
||||
user << "\blue Changed filter to '[sortType]'."
|
||||
updatename()
|
||||
updatedesc()
|
||||
|
||||
proc/divert_check(var/checkTag)
|
||||
return sortType == checkTag
|
||||
|
||||
// next direction to move
|
||||
// if coming in from negdir, then next is primary dir or sortdir
|
||||
@@ -1135,11 +1215,9 @@
|
||||
// if coming in from sortdir, go to posdir
|
||||
|
||||
nextdir(var/fromdir, var/sortTag)
|
||||
//var/flipdir = turn(fromdir, 180)
|
||||
if(fromdir != sortdir) // probably came from the negdir
|
||||
|
||||
if(src.sortType == sortTag) //if destination matches filtered type...
|
||||
return sortdir // exit through sortdirection
|
||||
if(divert_check(sortTag))
|
||||
return sortdir
|
||||
else
|
||||
return posdir
|
||||
else // came from sortdir
|
||||
@@ -1165,71 +1243,30 @@
|
||||
|
||||
return P
|
||||
|
||||
//a three-way junction that filters all wrapped and tagged items
|
||||
/obj/structure/disposalpipe/sortjunction/wildcard
|
||||
name = "wildcard sorting junction"
|
||||
desc = "An underfloor disposal pipe which filters all wrapped and tagged items."
|
||||
|
||||
//a three-way junction that sorts objects destined for the mail office mail table (tomail = 1)
|
||||
/obj/structure/disposalpipe/wrapsortjunction
|
||||
divert_check(var/checkTag)
|
||||
return checkTag != ""
|
||||
|
||||
desc = "An underfloor disposal pipe which sorts wrapped and unwrapped objects."
|
||||
icon_state = "pipe-j1s"
|
||||
var/posdir = 0
|
||||
var/negdir = 0
|
||||
var/sortdir = 0
|
||||
|
||||
New()
|
||||
..()
|
||||
posdir = dir
|
||||
if(icon_state == "pipe-j1s")
|
||||
sortdir = turn(posdir, -90)
|
||||
negdir = turn(posdir, 180)
|
||||
else
|
||||
icon_state = "pipe-j2s"
|
||||
sortdir = turn(posdir, 90)
|
||||
negdir = turn(posdir, 180)
|
||||
dpdir = sortdir | posdir | negdir
|
||||
|
||||
update()
|
||||
return
|
||||
|
||||
|
||||
// next direction to move
|
||||
// if coming in from negdir, then next is primary dir or sortdir
|
||||
// if coming in from posdir, then flip around and go back to posdir
|
||||
// if coming in from sortdir, go to posdir
|
||||
|
||||
nextdir(var/fromdir, var/istomail)
|
||||
//var/flipdir = turn(fromdir, 180)
|
||||
if(fromdir != sortdir) // probably came from the negdir
|
||||
|
||||
if(istomail) //if destination matches filtered type...
|
||||
return sortdir // exit through sortdirection
|
||||
else
|
||||
return posdir
|
||||
else // came from sortdir
|
||||
// so go with the flow to positive direction
|
||||
return posdir
|
||||
|
||||
transfer(var/obj/structure/disposalholder/H)
|
||||
var/nextdir = nextdir(H.dir, H.tomail)
|
||||
H.dir = nextdir
|
||||
var/turf/T = H.nextloc()
|
||||
var/obj/structure/disposalpipe/P = H.findpipe(T)
|
||||
|
||||
if(P)
|
||||
// find other holder in next loc, if inactive merge it with current
|
||||
var/obj/structure/disposalholder/H2 = locate() in P
|
||||
if(H2 && !H2.active)
|
||||
H.merge(H2)
|
||||
|
||||
H.loc = P
|
||||
else // if wasn't a pipe, then set loc to turf
|
||||
H.loc = T
|
||||
return null
|
||||
|
||||
return P
|
||||
//junction that filters all untagged items
|
||||
/obj/structure/disposalpipe/sortjunction/untagged
|
||||
name = "untagged sorting junction"
|
||||
desc = "An underfloor disposal pipe which filters all untagged items."
|
||||
|
||||
divert_check(var/checkTag)
|
||||
return checkTag == ""
|
||||
|
||||
/obj/structure/disposalpipe/sortjunction/flipped //for easier and cleaner mapping
|
||||
icon_state = "pipe-j2s"
|
||||
|
||||
/obj/structure/disposalpipe/sortjunction/wildcard/flipped
|
||||
icon_state = "pipe-j2s"
|
||||
|
||||
/obj/structure/disposalpipe/sortjunction/untagged/flipped
|
||||
icon_state = "pipe-j2s"
|
||||
|
||||
//a trunk joining to a disposal bin or outlet on the same turf
|
||||
/obj/structure/disposalpipe/trunk
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
icon_state = "deliverycloset"
|
||||
var/obj/wrapped = null
|
||||
density = 1
|
||||
var/sortTag = 0
|
||||
var/sortTag = ""
|
||||
flags = FPRINT | NOBLUDGEON
|
||||
mouse_drag_pointer = MOUSE_ACTIVE_POINTER
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
var/obj/item/device/destTagger/O = W
|
||||
|
||||
if(src.sortTag != O.currTag)
|
||||
var/tag = uppertext(TAGGERLOCATIONS[O.currTag])
|
||||
user << "\blue *[tag]*"
|
||||
user << "\blue *[O.currTag]*"
|
||||
src.sortTag = O.currTag
|
||||
playsound(src.loc, 'sound/machines/twobeep.ogg', 100, 1)
|
||||
|
||||
@@ -44,7 +43,7 @@
|
||||
icon = 'icons/obj/storage.dmi'
|
||||
icon_state = "deliverycrateSmall"
|
||||
var/obj/item/wrapped = null
|
||||
var/sortTag = 0
|
||||
var/sortTag = ""
|
||||
flags = FPRINT
|
||||
|
||||
|
||||
@@ -64,8 +63,7 @@
|
||||
var/obj/item/device/destTagger/O = W
|
||||
|
||||
if(src.sortTag != O.currTag)
|
||||
var/tag = uppertext(TAGGERLOCATIONS[O.currTag])
|
||||
user << "\blue *[tag]*"
|
||||
user << "\blue *[O.currTag]*"
|
||||
src.sortTag = O.currTag
|
||||
playsound(src.loc, 'sound/machines/twobeep.ogg', 100, 1)
|
||||
|
||||
@@ -161,11 +159,6 @@
|
||||
desc = "Used to set the destination of properly wrapped packages."
|
||||
icon_state = "dest_tagger"
|
||||
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 = 2
|
||||
item_state = "electronic"
|
||||
@@ -173,16 +166,16 @@
|
||||
slot_flags = SLOT_BELT
|
||||
|
||||
proc/openwindow(mob/user as mob)
|
||||
var/dat = "<tt><center><h1><b>TagMaster 2.2</b></h1></center>"
|
||||
var/dat = "<tt><center><h1><b>TagMaster 2.3</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>"
|
||||
for(var/i = 1, i <= tagger_locations.len, i++)
|
||||
dat += "<td><a href='?src=\ref[src];nextTag=[tagger_locations[i]]'>[tagger_locations[i]]</a></td>"
|
||||
|
||||
if (i%4==0)
|
||||
dat += "</tr><tr>"
|
||||
|
||||
dat += "</tr></table><br>Current Selection: [currTag ? TAGGERLOCATIONS[currTag] : "None"]</tt>"
|
||||
dat += "</tr></table><br>Current Selection: [currTag ? currTag : "None"]</tt>"
|
||||
|
||||
user << browse(dat, "window=destTagScreen;size=450x350")
|
||||
onclose(user, "destTagScreen")
|
||||
@@ -193,9 +186,8 @@
|
||||
|
||||
Topic(href, href_list)
|
||||
src.add_fingerprint(usr)
|
||||
if(href_list["nextTag"])
|
||||
var/n = text2num(href_list["nextTag"])
|
||||
src.currTag = n
|
||||
if(href_list["nextTag"] && href_list["nextTag"] in tagger_locations)
|
||||
src.currTag = href_list["nextTag"]
|
||||
openwindow(usr)
|
||||
|
||||
/obj/machinery/disposal/deliveryChute
|
||||
|
||||
@@ -552,15 +552,6 @@ var/list/liftable_structures = list(\
|
||||
//some arbitrary defines to be used by self-pruning global lists. (see master_controller)
|
||||
#define PROCESS_KILL 26 //Used to trigger removal from a processing list
|
||||
|
||||
// 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.
|
||||
var/list/TAGGERLOCATIONS = list("Disposals",
|
||||
"Cargo Bay", "QM Office", "Engineering", "CE Office",
|
||||
"Atmospherics", "Security", "HoS Office", "Medbay",
|
||||
"CMO Office", "Chemistry", "Research", "RD Office",
|
||||
"Robotics", "HoP Office", "Library", "Chapel", "Theatre",
|
||||
"Bar", "Kitchen", "Hydroponics", "Janitor Closet","Genetics","Drone Fabrication")
|
||||
|
||||
#define HOSTILE_STANCE_IDLE 1
|
||||
#define HOSTILE_STANCE_ALERT 2
|
||||
|
||||
Reference in New Issue
Block a user